Sunday, November 30, 2014

Capture and expose system exception statistics in Mule using Coda Hale Metrics

This article describes how to use the Coda Hale metrics library to capture the counts and types of system exceptions thrown outside of Mule ESB flow processing.  Historical exception information is exposed via JMX or written to disk using CodaHale reporters as described on the CodaHale metrics web site. You can use this same technique in any Java application. 

We inject instrumentation at the system context level.  That component converts the wrapped exception stack to a counter name that is then created and incremented in the Coda Hale registry.  I use the simple running counter because I don't find the native Coda Hale histogram data useful for this type of metric. You can use other metric types if you want more complex statistics.


Components

We use 2 injection components 2 codahale components and a custom listener  to make this work:
  1. MetricsRegistry: A CodaHale singleton that maintains a reference to all statistics. It is injected into other components.
  2. MetricAgent: A Mule Agent that manages the lifecyle of the JMXReporter
  3. JMXReporter: A CodaHale reporter that exposes the MetricsRegistry via JMX. Instantiated by MetricAgent. Codahale supports other reporters in place of or in addition to the JMXReporter. 
  4. SystemExceptionMetricContextShim: A MuleContextAware class that injects the SystemExceptionMetricListener into the MuleContext
  5. SystemExceptionMetricListener: A custom class injected into the MuleContext as the ExceptionLister. This creates metric counters concatenating the Simple Names of each Exception in the stack. The failed class name is appended to the counter name if it is some type of Connection Exception

Initializing Coda Hale library

We use the same initialization configuration we used in the flow exception metrics example

Metrics Registry

Instantiate this component as a singleton Spring Bean so that it can be injected into all other objects that wish to record metrics. Note that we inject the app name so that we can add that to the JMX MBean domain name
...

JMX Reporter

Instantiate the JMXReporter using a custom Mule Agent that is injected with the MetricsRegistry spring bean.   
...

Injecting the Metric Listener into the MuleContext 

MuleContextAware / Mule Context

Create SystemExceptionMetricContextShim, a MuleContextAware component in spring that will get called by Mule when initializes the context.  This Shim injects the SystemExceptionMetricListener which actually counts all the exceptions. Create a exception listener spring bean as a singleton that we inject into the Shim.  This listener is set into the MuleContext by the shim.
...

The listener creates a metric name from the nested exception names and the Connection type if it is a connection exception:
...

Example Program

You can find an example program on github at  https://github.com/freemansoft/Mule-demo.  It is a Mule maven project originally built with Mule ESB 3.5.2.  This is the same demo used in the flow exception metrics example.

Th demo has a mis-configured HTTPS endpoint/connector that throws an System exception at deployment time.

Viewing the statistics

This sample exposes metrics via JMX.  You can use any MBean viewer to see the statistics including most Java friendly monitoring tools.  Ever Java JDK comes with jvisualvm that is capable of showing you JMX MBeans with the help of the MBean plugin. Run jvisuavm from the command line or your file viewer.  I run the following command prompt on my windows machine
C:\Program Files\Java\jdk1.7.0_55\bin>jvisualvm.exe
The following image displays the value for ConnectionExcepton raised in the HttpsConnector.  We get one exception for the endpoint on startup because of a configuration error.


 You could see higher numbers for connectors whose remote connections go up and down.

Conclusion

Teams can build production support, problem triage and troubleshooting aids into their applications by integrating Coda Hale metrics and Mule's exception handling strategies.  These metrics can be exposed via files , JMX beans or other tooling to make them visible in a variety of environments.

Created 11/30/2014
All code samples were created using Mule ESB 3.5.2

Capture and expose flow exception statistics in Mule using Coda Hale metrics

This article describes how to use the Coda Hale metrics library to capture the counts and types of exceptions thrown as part of Mule ESB flow processing.  Historical exception information is exposed via JMX or written to disk using CodaHale reporters as described on the CodaHale metrics web site. You can use this same technique in any Java application. 

We add an instrumentation component to each mule Exception Flow.  That component converts the wrapped exception stack to a counter name that is then created and incremented in the Coda Hale registry.  I use the simple running counter because I don't find the native Coda Hale histogram data useful for this type of metric. You can use other metric types if you want more complex statistics.


Components

We use 1 injection component, 2 codahale components and a custom flow component to make this work:
  1. MetricsRegistry: A CodaHale singleton that maintains a reference to all statistics. It is injected into other components.
  2. MetricAgent: A Mule Agent that manages the lifecyle of the JMXReporter
  3. JMXReporter: A CodaHale reporter that exposes the MetricsRegistry via JMX. You can initialize any Reporter in place of or in addition to the JMXReporter. 
  4. MetricRecordFlowException Component: A custom Mule component that is dropped into any Mule Flow exception block. This component creates a metric (counter) concatenating the Simple Name of each Exception in a wrapped exception block. 

Initializing Coda Hale library

Metrics Registry and Flow Component

Instantiate the metrics registry as a singleton Spring Bean so that it can be injected into all other objects that wish to record metrics. Instantiate a singleton MetricRecordFlowException component that can by inserted into exception flows, via spring bean ref, to record metrics.
...

Metrics Agent and JMX Reporter

Instantiate, MetricAgent, a custom Mule Agent that creates the JMX Reporter. This MuleAgent is called at application start up and instantiates the JMXReporter using the injected MetricsRegistry spring bean. Note that we inject the app name so that we can add that to the JMX MBean domain name
...

MetricsRecordFlowException Component

Create a spring bean using this component.  This lets us inject the Metrics registry Spring bean.  An alternative would be to modify the MetricsRecordFlowException component to find the MetricRegistry through the Mule registry. 
...

Operational Information

MetricRecordFlowException Flow Component

The component increments a codahale counter using the injected MetricRegistry.  It creates a metric name including the names of all the nested exceptions in the raised exception. 
  
...

Instrumenting Exception Flows

Metric component in flows

Drop a Java component into each Exception flow and refer to the spring bean using Mule's Spring bean reference syntax.




The XML that puts the component in the exception flow with the spring bean reference looks like:

...

Example Program

You can find an example program on github at  https://github.com/freemansoft/Mule-demo.  It is a Mule maven project originally built with Mule ESB 3.5.2.  This program implements an HTTP endpoint that can throw 4 different types of exceptions from 4 different languages that run inside Mule.

  • Java
  • Groovy
  • JRuby
  • Javascript
Each exception is caught by the Catch Exception Strategy.  The strategy updates the appropriate counter, logs the exception and returns HTML that describes the exception stack trace.  The base url returns a list of other test URLs.  Connect to the server with this URL after starting the application in Mule or Anypoint studio. This also works for deployed applications. 
http://localhost:8081/
Note: You can modify existing components or create new exception paths to generate other exception metrics. The program is also generally useful when wanting to learn how exceptions thrown by various languages are handled in mule.







Viewing the statistics

This sample exposes metrics via JMX.  You can use any MBean viewer to see the statistics including most Java friendly monitoring tools.  Ever Java JDK comes with jvisualvm that is capable of showing you JMX MBeans with the help of the MBean plugin. Run jvisuavm from the command line or your file viewer.  I run the following command prompt on my windows machine
C:\Program Files\Java\jdk1.7.0_55\bin>jvisualvm.exe
The following image displays the value for one of the counters. It shows that the exception originating with an IllegalAccessException has occured 13 times.



Conclusion

Teams can build production support, problem triage and troubleshooting aids into their applications by integrating Coda Hale metrics and Mule's exception handling strategies.  These metrics can be exposed via files , JMX beans or other tooling to make them visible in a variety of environments.

Created 11/30/2014
All code samples were created using Mule ESB 3.5.2

Sunday, November 16, 2014

Windows 8 tablet (battery) dies in 2 days because of Instant-On

I have a Windows 8 / 8.1 TW100 10" quad core tablet that leave at work as an inexpensive internet device.  The device is always dead with 0% battery when I arrive at work Monday morning. The thing has good battery life when I'm actively using it.  I have to charge the device and reset the clock every Monday. (The clock is dead because it relies on the main battery as the clock battery).  My IPad 2, by comparison, sits standby for days/weeks without draining the battery.

The TW100 uses Microsoft Windows 8 new Instant-On or Connected Standby to stay connected to the internet. This new SoC compatible standby mode uses a lot more energy than the standby on other tablet.  Note: This tablet has no applications installed.


You can use the "powercfg" command to analyze battery usage. It generates a nifty HTML file that describes battery usage across the last 3 days.
powercfg sleepstudy
 This chart shows the continual power drain on this tablet across the weekend.





The table after the chart shows that we were in the low power state 99% of the time.

powercfg creates a chart that shows the activity intervals on the tablet.  Windows 8 tablets wake up every 32 seconds.  Values other than 32 seconds mean some program is causing activity and using power. This chart shows that my tablet has no other activity.


The offender section shows which hardware causes the activity. The machine is 99% idle. We can see here that the I2C controller and SD card account for the < 1.5% active time.

powercfg also shows the programs that cause the activity. It finds no programs as the cause of my battery usage on this TW100 Windows 8 tablet.  This means all of this activity is related to the core functions of the Windows operating system, the SoC and this standby mode.

Conclusion

Windows 8.1 InstantOn (formerly InstantGo) provides a high level of connectivity for windows tablets when they are idle.  This is great when you are actually using your tablet or have it plugged in continually. InstantOn can completely eat the battery when the tablet is not actually in use, draining a full battery within a couple days.

The only way to guarantee a working tablet on Monday morning is to either leave it plugged in or power the machine off on Friday.  The TW100 cold boots in 5 seconds so a full powerdown isn't that big a deal.

Comment

I don't need for my tablet to communicate continually with the network when I'm not using it.  I wish Microsoft provided a way of adding additional power plans to tablets. They currently limit you to the InstantOn if it is installed by the OEM.

Sunday, November 2, 2014

Why does my Windows 8 (8.1) tablet have only one power plan?

I recently purchased a quad core Winbook TW100 Windows 8 tablet, similar to the TW801. The tablet gets OK active battery life running for 5 hours. It doesn't last as long on standby as I expected. It is often dead when I pull it out my backpack for a couple days.

Microsoft Windows uses "power plans" to manage the power consumption of windows based devices.  Power plan options that let the user trade off performance versus power consumption.

It turns out this is related to the way windows 8/8.1 manages power  for tablet and other always connected devices using a feature called instant on or InstantGo. These devices come with a single power plan and new sleep modes that are tightly integrated with the tablet/PC specific hardware.  The Windows Power Options panel shows only the Balanced power plan as seen in this image.

This feature, implemented by Tablet OEMs, lets Windows tablets / PCs wake up / receive notifications and other network traffic while the machine is ostensibly powered down.  Tablets and other lower power devices are highly integrated built with combined CPU / wireless and other functionality built into a single component called a System on Chip (SoC).

Microsoft provides information about this new sleep mode and how to study power usage on one of the windows blogs.

Monday, September 8, 2014

Communication Prep: Understanding the Motivations of Others


We communicate ideas and attempt to drive decisions with messages, meetings and conversation. We try to sell things, push ideas and get cooperation from others and “make things happen” by driving people to a common understanding. It is tempting to think that “our way” is obvious to people and that they “just don’t get it” when they don’t agree. We should instead put ourselves in the other person's position to see if we really understood the other party’s drivers and decision points.

There is only way … to get anybody to do anything. … Yes, just one way. And that is by making the other person want to do it. 
Dale Carnegie How to Win Friends and Influence People

I went to a meeting a long time a go with Max. Max created a sheet for every major player that we filled out from that person’s point of view. The sheet had two columns, What’s in it For Me (WiFM) and Does it Threaten Me (DiTM). You can use “Pros” and “Cons” if WiFM and DiTM make you uncomfortable even though they mean something different. I find that WiFM and DiTM more accurately describe how people subconsciously evaluate things as they are proposed or discussed. Max's table had two rows, Organization and Personal representing two levels of decision making that people operate on when considering options.

WFM and DTM

Prepare for your discussion by making a sheet for each participant, or at least each decision maker. Each cell is filled in from the point of view of the other person, the one you are meeting with.

What's in it For Me (WiFM)
Does it Threaten Me (DiTM)
Organizational










Personal










What's in it For Me / Organizational

List the advantages of this idea or proposal from the other person’s organizational viewpoint. Think how they believe it would help their organization, not how it helps you. This could be a team level advantage when meeting with another group, possibly in the same company. It could be at the corporate level for those at the VP / Cxx level.

Your idea might be a new way to make that group more productive or make it easier for them to meet their goals. The idea can increase morale or make folks excited about a project.

Example: Some new method may reduce the time taken for a process. This may make it possible to increase their internal satisfaction or let them work on other underserved processes.


What is in it For Me / Personal

List the reasons this would be good for them at a personal level. Does it increase their visibility, help them achieve something that would be difficult otherwise? Think of ways it may make their relationships easier with others. Personal interest or benefits vary by the type the field or area of the discussion.

Example: People in high tech may wish to be on current technologies to stay relevant in their fields. (This is not to be confused with “shiny object” syndrome.)

Example: Success might can increase a person’s stature.

Does it Threaten Me / Organizational

Change, ideas or action often involves organizational risk. Products or proposals may create more work for others or cause conflict with overlapping teams. Some ideas or programs may reduce the power of an organization or potentially cost it money. Action can cause liability or point out things that are currently broken.

Example: A team may not have budgeted for the additional work for a new idea. The idea potentially puts their previous commitments at risk.

Does it Threaten Me / Personal

This is the area people claim doesn’t happen. They would like to assume that people make rational decisions when in fact their wants and fears come into play. Think about how a change or an action can threaten someone personally. Does it change their importance? Would failure wound their standing more than success? I person might know how things work now but may not be comfortable that they would understand the new system.

Example: Someone created the previous system and is the focal point for questions and troubleshooting. The new system removes that level of expertise.

Preparation and Usage


Meet with your team or someone who understands the the other people, the charter/internals of the other group and understands the proposal/idea. Create a sheet for each major player, decision maker or influencer. Make sure you have enough people who would see enough WFM to outweigh DFM. Some participants may be “all threat” and you may have to talk around or through them to others. 

Sometimes I’ll do this in my head while walking through someone else’s meeting prep. I try and make sure they understand what is important to others instead of just pushing the thing they think is important.

Short Form

Meeting prep for internal meetings is important.  I often do one WFM/DTM group sheet for the other team if we're meeting about something big.  Usually this is just in my head or as a verbal walk-through with someone on my team.

Personal Relationships

We try and get people to do things or make decisions in a certain direction in our personal lives. A mental WFM/DFM worksheet with just the personal row can be a good pre-talk preparation. It isn’t manipulative. It is a way of taking the time to think about the other person’s needs or wants.

Conclusion 

I initially thought that this approach seemed manipulative. I’ve since come to appreciate it as a method of ensuring that I take time to understand other’s people's motivations.

People do things they want to do. I’ve worked with people who bullied or forced others into decisions. It worked tactically but often turned out badly in the long run.

Wednesday, August 20, 2014

Choose the right workspace type when using Team Foundation Server and Eclipse

Microsoft has a nice TFS Eclipse plugin that acts like any other Eclipse team provider.  It provides full TFS Source Control and Team view support inside of Eclipse. You can find information about the plugin on the the Microsoft MSDN site.

Team Foundation Server supports TFS version control (TFS) projects and GIT version control (TFS) projects.  TFS uses the concept of a workspace to track changes.  A TFS Project Workspace can be managed as either a "Server Workspace" or "Local Workspace".  There are several good articles that describe how this works phkelly's blog and MSDN documentation.

  • Server Workspace: These were the default for all workspaces created prior to TFS 2012. Server Workspace follows an older convention where all files on the local machine are marked as "Read Only" until checked out for modification.  This means you cannot edit files outside of TFS or Eclipse unless they have already been checked out for modification.
    • Server workspaces operate more like Clearcase or Visual Source Safe
  • Local Workspace: These are the default for all workspaces created in TFS 2012 or later. Local Workspace uses a workspace scanner to identify file changes and automatically adds them to the list of modified files. This means you can edit files outside of TFS or Eclipse with editors or scripts like maven.
    • Local workspaces operate more like CVS, SVN or Perforce.
Eclipse users that rely on Maven (mvn) or customized tooling that modify programs external to an IDE should use "Local Workspaces".  This includes customized eclipse versions like the Mule ESB IDE, Mulesoft Anypoint Studio, which integrates with the maven build process.

Setting the Workspace Type for Existing Workspaces

You can see and change the workspace type in TFS by editing the workspace settings in Visual Studio or using the TFS Eclipse plugin.

Finding the "Manage Workspace" Panel In Visual Studio


  1. Open your Team Explorer in Visual Studio
  2. Open the solutions drop down. It will be empty if you have never opened any solutions
  3. Select the drop down next to the workspace name.












  4. Select "Manage Workspaces..." to bring up the "Manage Workspaces" panel
  5. Select the workspace and "Edit..."









    Finding the "Manage Workspace" Panel in Eclipse

      1. Open the Package Explorer View
      2. Right click on your project
      3. Select Team --> Manage Project 
      4. Select the workspace for this machine and then "Edit..."




      Then in both VS and Eclipse

      1. Select the "Advance>>" button at the bottom
      2. Set the "Location" to "Local" if it is currently set to "Server"Click "OK"
      3. The TFS plugin will immediately start converting your workspace to "Local" if it was "Server" prior to this.






      You should be able to edit files at will both using the IDEs and external tools like Notepad++ or Maven.  The scanner will also pick up autogenerated files so you may have to update your .tfsignore file.









      Sunday, August 17, 2014

      Will you recognize change when you hear it?

      Technicians think they understand how rapid technological advances affect our lives.  After all, everyone can see the impact of cell phones and the internet.  There are subtle changes that occur when a younger generation embeds technology as a foundation of what they do instead of as an supplement. What happens when a new generation makes that technique a standard part of their toolbox?

      Tools available for everyone...
      Billy Joel and Jimmy Fallon recorded their own Doo Wop version of "The Lion Sleeps Tonight" using an iPad App on TV in 2014. The two of them performed all six parts. Joel and Fallon first looped 4 backing tracks live and then sang two part harmony. I was blown a way that they were willing go do this "on their own" in front of a live studio audience. It is doubly amazing when you consider how many folks will lip sync a performance.


      Their act was a super example of how technology makes the complex simple, enabling new types of creativity without getting in the way. A lot of the (technical) press talked about how this  performance counters the common statement that Tables and Phones are only used for content consumption. This ignores more interesting aspect how new technology is being used in the arts without much of the audience understanding the sophistication of the performance.

      We watched and Listened...
      My wife and I went to the Strathmore music hall the last night to see a "tribute show". Margo MacDonald, performed her version of "Private Life". She recorded at least 6 backing tracks 13 loops including vocals and percussion. She then switched on and off while singing. I believe that Ms. MacDonald also added additional tracks during the performance. You can see the type of thing she does on her you tube channel and in this video.



      Most of the audience had any idea what they just listened to. I was pretty much the only one who stood up at the end of the performance. Later I explained to a couple of the folks near me what just happened. They had no idea why what I was talking about or why it was exciting.

      Do people see the future when it's happening?
      It will be exciting to see what people will do when they start building using this new world as a base. I hope I'm attentive enough to recognize the magic when its in front of me.

      Sunday, June 8, 2014

      Combining Arduino Ethernet and Adafruit NeoPixel shield to create web controlled LED goodness

      Someone asked how hard it would be to swap the NeoPixel shield in place of the LED strip in an earlier Arduino based Web LED control project.  The Embedded web server  and LCD panel control chew up a lot of memory so I wasn't sure there was enough program space for the Adafruit NeoPixel library.  It turns out there is just enough space while still retaining some Bonjour functionality.   You can get the source code on GitHub


      Hardware and Software

      This project uses the following hardware

      1. Arduino Ethernet I picked mine up at  Microcenter.  They describe this unit as an Ethernet Shield but it is a full Arduino Ethernet for $49 (as of 2014/06). The Arduino IDE supports this board.  I used version 1.0.5.
      2. Adafruit  NeoPixel Shield a 5x8 matrix of individually controllable RGB LED.  The software library is available on github.  
      3. A simple protoshield with pass-through connectors.  The Ethernet connector is very large and the Neopixel Shield sits right on top of it. I used a prototyping shield to lift the NeoPixel board off the connector. You can see the cutout around the Ethernet connector in the right of the picture. It also gives me an easy place to connect the Nokia 5110 LCD display.
      4. Nokia 5110 LCD display.  Sparkfun makes one with a nice breakout board that is also available at Microcenter. I soldered a connector for it to the protoshield.  The LCD is not shown in the picture.
      5. FTDI USB adapter for programming the Arduino.


      This project uses the following libraries our source.  Close any open Arduino IDE windows before installing any libraries.  Install the first three libraries in your Arduino libraries directory in ~/Documents/Arduino/libraries. Restart the IDE. The libraries should now show up in the import list. (Ignore MSTimer2 in the picture)



      1. Adafruit NeoPixel Library on GitHub 
      2. Bonjour compatible zeroconf library on GitHub
      3. Arduino webserver capability, aka Webduino, available on GitHub
      4. Example 5110 sample code embedded in this project since it was not available as a library when I first pulled it in.

      My source code is available on GitHub. The NeoPixel shield uses pin 6 by default. I used pins 3,4,5,7,8 for the optional Nokia display  Pin assignments are as follows
      //      0 RX when programming/debugging
      //      1 TX when programming/debugging
      //      2 W5100 interrupt when bridged
      //      4 SD Card SS (if not using Nokia 5110)
      //      3 optional Nokia 5110 CLK
      //      4 optional Nokia 5110 DIn
      //      5 optional Nokia 5110 DC
      //      6 NeopPixel Sheild (default pin)
      //      7 optional Nokia 5110 Rst Reset (6 and 7 are twisted on LCD breakout board)
      //      8 optional Nokia 5110 CE Chip Enable (6 and 7 are twisted on LCD breakout board)
      //     10 SPI Wiznet SS
      //     11 SPI
      //     12 SPI
      //     13 SPI

      Communicating With the Board

      Finding the Board

      The board uses DHCP to acquire an IP address and registers itself with zeroconf Bonjour under the name http://arduino_neo.local/.  This means you can find the the device address using dns-sd on a windows machine.


      Verify Function with Web Interface

      The program provides a simple test web page to verify network connectivity and simple LED control.  It is located at http://arduino_neo.local/. The three RGB sliders set all the lights to the same color based on slider values.  They use r=, g= and b=

      POSTing Data

      You can change LED colors and brightness by POSTING form data.  The system will return 200 if the data appears to be basically correct. It will return 400 if any data is out of range, a non existent LED number for instance. The form parameters are as follows:

      //    r=<value>  set all RED LEDs to this value
      //    g=<value>  set all GREEN LEDs to this value
      //    b=<value>  set all BLUDELEDs to this value
      //    r#=<value> set RED LED number '#' to this value
      //    g#=<value> set GREEN LED number '#' to this value
      //    b#=<value> set BLUE LED number '#' to this value
      //    s#=<value> set Nokia 5100 LCD text on line # to this value
      //    c=<value>  clear Nokia 5100 LCD value is ignored
      The "#" signs represent the LED number.   "r#" lets you set the red value for a specific LED.  "r" by itself means set all the LEDs. You should be able to post several parameters as part of a single packet. I have have only tested forms with similar field types.  r=, g=, b= and r#=, g#=, b#= . 

      This shows Advanced REST Client posting valid updates to 3 LEDs.  Two of the fields point at the same LED.  The web server returned 200.

      This shows Advanced REST Client posting to an LED index (99) that does not exist. All of the valid form fields were processed correctly.  The invalid index was not processed and a 400 was returned.



      Finish

      Created 2014/06/08



      Friday, May 16, 2014

      Can I use an SD card for Virtual Machines?

      The answer is
      Yes you can use an SD card to host virtual machines.  The utility of that depends on the card you have and the speed of the card reader built into your machine.
      I've been using a Dell E7240 Ultrabook as my primary on-site machine. It only has a 128GB SSD so I've been debating on where I can put virtual machine disk images.  It has an internal MSATA and an SD card slot.  SD cards are easier to get around here so I purchased a couple 64GB SD cards to try out.  

      I get up to 17MB/s copying my VMDK files to the SD cards on the E7240 and up to 42MB/s copying VMDK files on the Macbook Pro 2011.

      I tested the following cards with CrystalDiskInfo and my MacBook running Windows 8.1 bootcamp. The Macbook Pro results imply that it may be a limit of the E7240s SD card slot interface, possibly some kind of USB.

      1. PNY StoreEdge 64GB.  This is a short card intended for Macbook and Macbook Air with short SD card slots.  There are no specs on the package.
      2. PNY Storage for Ultra thin Notebooks 64GB. This card is marketed as additional storage.  There are no specs on the package.
      3. San Disk Extreme Plus 64GB.  This card is rated 80MB/s Read and 50MB/s write and is targeted at high end photography.

      Here are the benchmark results.   Two of the cards had poorer than expected write speeds. I reformatted them using the SD card industry formatting tool available on their web site. This caused a big jump in the test Sequential write speed.  Both the PNY and Sandisk Extreme Plus went from ~23MB/sec to ~41MB/sec.  I'm not sure whether the formatting helped because of the formatter or because it erased any data on the cards.





      VMs run from an SD card OK on the E7240 for lightweight work but it was disappointing.   The E7240 requires an MSATA as a 2nd for any kind of performance. In the mean time the SD card will work for testing and for running VPN software to get into work.

      The StoreEdge, or any other fast card, on my Macbook, is pretty zippy for most things I do in a VM.  It needs more testing.

      Friday, May 2, 2014

      2014 USA Science and Engineering Festival USASEF in Washington DC - Wow

      You can read where scientists, engineers and technicians write about how we need to excite more kids about science and engineering. Engineering and science companies, government agencies, universities and primary education institutions all understand that we need to excite more people about the science and engineering disciplines.  Some of these groups worked together to create the USA Science and Engineering Festival in DC  and associated events in other places.  This was a big (big big) trade show like event with hundreds of companies probably 50-100 universities and dozens of government agencies.  Several of the universities had multiple booths in different sections for their various colleges, programs and labs.  The event filled two floors of the Washington DC convention center.  Six stages ran presentations and talks continuously during the event. The kids and older folks who are still kids at heart had a great time.
      The USA Science & Engineering Festival is a national grassroots effort to advance STEM education and inspire the next generation of scientists and engineers. Our exhibitors, performers, speakers, partners, sponsors and advisors are a who-is-who of science and engineering in the United States: from major academic centers and leading research institutes and government agencies to cutting-edge high tech companies, museums and community organizations. - See more at: http://www.usasciencefestival.org/about.html#sthash.Evk8VFmi.dpuf
      2014 is the 3rd year of this event.  My wife and I decided to go this year to see what it was like.  It was great.  I can't even remember all the disciplines that were there. The festival would be interesting to kids of all ages. It tended to trend a little younger but the High School kids could get something out of the university exhibits and from the career section. Next year we are renting some of the neighbor kids so I can spend more time in the hands on section.  I've lost the program to the event so I can't really show you how many hands on exhibits there were.

      Engineering companies, technical outfits, STEM and other technical educational companies , university graduate and undergraduate program and lab teams were spread out across this whole area and across the upper floor.

      This is the lower Convention floor coming down the escalator. This area was huge including engineering, health and medicine,communication, medical, career and other areas that I can't remember. 

      The area right at the bottom of the stairs included lathroscopic surgery exhibits where the kids could remotely control probes in a body while watching the probes on TVs.



      The section right at the bottom of the stairs also included a gas chromotography display/experiment area and some pig hearts the kids could stick their hands into to see how they worked.

      This is a slightly different angle.  The lower floor also included some vocational technical displays and learning institutions including things like HVAC The area to the right was the career area and some food vendors.


      The US Air  Force is off stage left from this picture. They had some quad copters in a netted cage that played musical instruments.  There were a lot of 3D printers, quadcoptors and electronic controls in the engineering section.

      There were also a couple hackerspaces, robot clubs and other groups in this section.

      This area was supposed to be where kids could rest. There were people floating around in here helping the kids build "air powered cars"  using straws and paper and such.

      Career information is behind us here.  3D printing, robots and engineering is to the right.


      This area was also near the ocean / (??) section where the kids could run remote control DSV in tanks.

      We were already 3 hours in by the time we got to this end of the lower floor. There was a bunch of cool stuff in here also. 

      You can see one of the stages in the background.  I really wish I still had my map to show you the size of this thing.

      Somewhere at this end were the "freeze a ballon and shatter it" , "torch a ceramic block and then touch it with your bare hands" kind of exhibits.



      This was one of several of the Boulder based companies that came with their educational tools.  These kids are building "robots" by snapping together components. A lot of the booths had construction or experimentation areas.

      Some companies did giveaways.  Kids in the Sparkfun booth were soldering together digital watches and electronic Simon games that they could take home. 



      This is the escalator going up. It was pretty much this busy the whole time we were there.


      We were so busy looking around that I forgot take pictures of huge sections of the lower floor.


      The upper floor was environmental, life  sciences, space, more trade science like welding and bunch of other stuff.  Folks wandered around playing people like Nicholas Tesla.  There were cool things like this buy with a giant spider that he would let crawl onto the kids hands.  They were loving it.


      This is a gratuitous space science picture. I've always been a space fan so the NASA and SpaceX exhibits were fun for me. They didn't have actual rockets but were talking about missions, spaceships and other cool stuff.











      Thoughts

      This event reminded of how broad an area the sciences cover and why science and engineering are cool. Science museums and discovery centers are great but this festival was croweded and made kids feel like it was exciting.

      School technical education has been dumbed down over last couple decades with the elimination of anything remotely dangerous or scary from the curriculum. Chemistry labs are dead, physics experiments have been gutted.   Zero tolerance programs can end teacher's careers for bringing simple things like household tools to class to describe how basic machines work. Maybe things like the USASEF can act as an alternative channel gets more kids interested in science and engineering.  I hope that they can have the same fun I had playing with and building things that sometimes fail but always teach.

      Tuesday, April 29, 2014

      IOIO Bluetooth and Windows 8 / 8.1

      Notes on using the IOIO with Windows 8 over Bluetooth

      This post describes the results of controlling various versions of the IOIO Firmware from Windows 8 over Bluetooth.  Initial content was extracted from http://joe.blog.freemansoft.com/2014/04/ioio-v1-dealing-with-firmware-versions.html and expanded with additional content.

      I used the HelloIOIOConsole.jar  sample program to test connectivity between Windows 8 and an IOIO V1 running different Application firmware.  I also tested Mac OS/X Mavericks.


      HelloIOIOConsole.jar results 4/2014
      Java Application V1 3.03/3.23 V1 3.26/4.0 V1 ?.00/5.00
      Windows 8.1
      3.30
      No Communication
      Constant reconnects
      Works Not Tested
      Windows 8.1
      4.00
      No Communication
      Constant reconnects
      Fails handshake without patch

      Works with patch described below

      Not Tested
      Windows 8.1
      5.03
      No Communication
      Constant reconnects
      Fails with Version Mismatch
      (as expected)
      Not Tested
      OS/X Mavericks
      3.30
      Works Works Not Tested
      OS/X Mavericks
      4.00
      - Works Not Tested
      OS/X Mavericks
      5.03
      - Fails with Version Mismatch
      (as expected)
      Not Tested

      Using HelloIOIOConsole.jar on a Mac running Mavericks

      My Macbook had no trouble pairing with the IOIO V1 with Bluetooth adapter. 4545 is the pairing code. The Bluetooth connection will go idle after some time and change from "Connected" to "Not Connected".  The IOIO serial device  ports on the Mac continue to exist even if the connection has gone to sleep. Bluetooth is re-connected when a program accesses the outbound serial device tied to the IOIO.  The Mac just worked.

      Determining my Application Firmware Version using a Mac

      I first tried HelloIOIOConsole, version 5, the latest, application java -jar HelloIOIOConsole.jar. That failed with the following output on my device.  Eureka!  It looks like I actually have Bootloader 303 and Firmware 323


      App-IOIO0500.zip HelloIOIOConsole.jar[I/IncomingState] IOIO Connection established. Hardware ID: SPRK0016 Bootloader ID: IOIO0303 Firmware ID: IOIO0323[V/IOIOImpl] Querying for required interface ID[E/IOIOImpl] Required interface ID is not supported[E/IOIOBaseApplicationHelper] Incompatible IOIO firmwareioio.lib.api.exception.IncompatibilityException: IOIO firmware does not support required firmware: IOIO0005


      Then I tried HelloIOIOConsole application version 4 java -jar HelloIOIOConsole.jar. Still no love with this combination.
      App-IOIO0400.zip HelloIOIOConsole.jar[I/IncomingState] IOIO Connection established. Hardware ID: SPRK0016 Bootloader ID: IOIO0303 Firmware ID: IOIO0323[V/IOIOImpl] Querying for required interface ID[E/IOIOImpl] Required interface ID is not supported[E/IOIOBaseApplicationHelper] Incompatible IOIO firmwareioio.lib.api.exception.IncompatibilityException: IOIO firmware does not support required firmware: IOIO0004


      Finally, I ran HelloIOIOConsole application version  java -jar HelloIOIOConsole.jar. The program ran fine and was able to manipulate the Bluetooth attached device..
      App-IOIO0330.zip HelloIOIOConsole.jar[I/IncomingState] IOIO Connection established. Hardware ID: SPRK0016 Bootloader ID: IOIO0303 Firmware ID: IOIO0323[V/IOIOImpl] Querying for required interface ID[V/IOIOImpl] Required interface ID is supported[I/IOIOImpl] IOIO connection established
      This means I am running version 3.x (!)


      Using HelloIOIOConsole with Windows 8 with Firmware 3.03/3.23

      I was unable to run any version of HelloIOIOConsole on Windows 8 with my IOIO V1 running firmware 3.23. None of them ever got far enough to verify a version match between the app and the firmware.

      The PC and IOIO pair over Bluetooth without any issues.  Virtual COM ports are created.

      The IOIO bluetooth connection status never changes from "Not Connected" to "Connected" even after letting HelloIOIO run for a while. Windows 8 told me that there was a driver failure every time a COM port was (re)opened.

      I tried several versions of HellloIOIOConsole. The image at right shows up every time the console app runs and connects to a serial port. This message pops up several times.  Tapping on it takes you to the Bluetooth management screen which then tells you:
      Adding your device didn't work. First remove it from your PC, and then try again.
      The windows event log shows the following.
      The mutual authentication between the local Bluetooth adapter and a device with Bluetooth adapter address (00:15:83:44:b9:e7) failed.
      It feels like some kind of driver / protocol problem I don't understand.  This is fixed with later versions of the Application Firmware


      Using HelloIOIOConsole with Windows 8 with Firmware 3.11/4.00

      The PC and IOIO pair over Bluetooth without any issues. Here is the success matrix for HelloIOIOConsole.jar:

      1. PC Application version 3.23 works great. It logs the IOIO hardware and firmware versions and accepts commands.
      2. PC Application version 4.00 hangs "waiting for handshake".
      3. PC Application version 5.03 connects and logs the IOIO hardware and firmware version and and correctly terminates because the app uses a later IOIOlib than allowed for the 4.00 firmware

      Fixing PC IOIOLib 4.00 to work with Windows 8


      SerialPortIOIOConnection.java in IOIOLibPC requres that three lines of code be commented out.  You can find the source file at:
      App-IOIO0400\IOIOLib\target\pc\src\ioio\lib\pc\SerialPortIOIOConnection.java
       Comment out lines 73-75

      ...
      ...

      to look like

      ...
      ...

      Conclusion

      OS/X and Linux are more forgiving when working with Bluetooth and IOIO

      Wednesday, April 23, 2014

      "What do you do for a living?" Pre-Sales Engineer

      My family told me that they don't know what I do for work.  This was kind of surprising since everyone tells me that I never shut up about what I'm working on.

      This post is an attempt to explain what I do/did as a "Pre-Sales Engineer".  I've played this part while working for software or hardware companies that sold "technical" products.  These ranged from Logic Analyzers and Embedded development tools to development and application platforms to Internet support products like web and mail servers.

      Note:  I'll probably use "Field Engineer", "Sales Engineer" and "Pre-sales Engineer" interchangeably throughout this document.


      You Got Mad Skills

      A Pre-Sales Engineer has the rare skill of being comfortable with technology and with people.   Pre-sales technical resources explain technology to techies, implement a solution, map the benefits of technology to business problems and interact with business users and managers..  Pre-sales Engineers are nerds who can talk to non-techies without killing them with jargon.  

      The Pre Sales Engineer (PSE)


      Sales representatives own the account.
      They are accountable for the team's success and carry most of the financial risk associated with account performance. Sales representatives handle the higher level customer relationships, track deals and handle first level technical discussions with mid to upper level management.

      The Pre-Sales Engineer is the technical half of a sales team in a partnership where the sales representative is in charge.  PSEs must be "sales ready" while also having good technical skills.  Pre-sales engineers tend to handle the technical relationships and 2nd level product discussions.

      Pre-sales technical resources exist to help the sales process. They exist to help close the deal and make the next deal possible.  Companies sometimes also use field technical resources to help cement technical partnerships with organizations that can help bring in future business.  A company may spend technical resources on a systems integrator or reseller to enable them to bring in business on some channel.  Ex: higher education, government, etc.

      Sales engineers can be inside or outside. Inside sales teams tend to work smaller accounts or external companies that aggregate other smaller accounts. Their customer interactions are all online/remote.  Inside teams may handle sub-parts of larger accounts. Outside sales teams are expensive and tend to focus on larger or strategic accounts.  Outside teams do digital meetings but also travel for in-person events.  EX: All of pre-sales technical resources for a large on line bookseller and cloud provider worked inside until a couple years ago.  It was only after they started getting true enterprise or government type deals that they spun up an team that was more outside oriented. I've always worked outside.

      Job Responsibilities

      Pre-sales engineers own the technical side of the sale. "Own" can mean a bunch of things depending on the complexity of the technology, the seniority of the engineer and the trust level and technical expertise of the sales rep. Essentially the engineers job is to understand the business problem , map that to the technical product to provide a business solution and to overcome technical objections.  They help package/re-package products and services to meet the customer needs by using previous solutions and customers as examples of how the solution comes together.



      Pre-Sales Activities

      Pre-sales activity involves initial calls, live meetings, webinars, discussions with the sales rep, customer presentations and product demonstrations. PSEs create customized presentations and demonstrations that target that customer's needs.  These can be minor customization or major amounts of work based on how far along this is in the sales cycle and how important the deal is.

      Sales representatives usually own pre-screening calls and relationship construction. First meetings are exploratory spent understanding customers true problems in contrast to their expressed problems. The sales rep and the PSE work together to map out the solution space for their products at each customer. You never know from call to call how deep the call will be or how on-target the customer.  Some prospects will bring the wrong people to a meeting, will have a totally different problem than described or may be unexpectedly interested in drilling down to understand how a product can be used.  This can happen in the same meeting as the conversation moves across a room. Meetings can be stressful while trying to understand true requirements, agendas, and bias towards your or other companies.  Pre-sales engineers deal with people who know nothing about the problems space.  They deal with people who understand the problem and solutions better than the PSE.  Existing customers often know the product better than the PSE because they live in some piece of it on a daily basis

      Good sales reps do a pre-meeting walk through for every meeting to make sure the team is on the same page as far as goals and to make sure everyone understands what is known about the customer.  There are also follow up conversations after each meeting/call to make sure everyone heard or saw the same thing.   Many PSEs work on multiple teams with different operating styles.  PSE resources are expensive so they may be pooled with multiple reps or assigned to specific reps.  A sales team may have dozens of calls per week with overlapping meetings and discussions. The PSE is responsible for keeping track of where each sales process is at and what tasks needs to be done.

      RFP responses often also fall on the PSE.   No product is an exact match for a proposal unless it was written explicitly for the product. In either case, it is up to the PSE to help craft a response that describes how the product meets the request as much as possible while mentioning advantages that may cause the request to be re-defined. This is hard for many technicians who tend to very direct and literal in their interpretation of requirements or specs.

      Sales reps like to retain control over activities because they are the ones rewarded for success and accountable for failure. PSEs can operate semi-independently handling customer calls , questions and presentations at the sales rep's direction.  The amount of power given to a PSE is directly proportional to the trust the sales team has that the PSE understands the product, won't say anything stupid, knows when to be quiet and understands the products the sales representative's style well enough to be and independent contributor.  

      Proof of Concept, Prototype and Pilot

      Many sales processes have a "bake off" or prototype phase where the customer wants to see the product in action in their environment or targeted at their business or problem space.  Prospects use these to verify the functionality or to try and eliminated companies to shrink down the amount of choices they have. These events tend to be on short time lines.  Product companies often try to get the customers to pay for part of these efforts to make sure they customers are serious and to make sure they have "skin in the game" with respect pushing to a completed state. 

      Pre sales engineers are one of the few resources totally controlled and "owned" by the sales group.  This means the sales group will often augment paid PoC efforts or completely fund them out of the sales team using the Pre-sales engineers. Pre-Sales Engineers must know their products well enough to scope and develop small implementations as part of these efforts.  This can be a very technical event depending on the complexity of the product being demonstrated.

      PoC efforts need to be done as quickly as possible in a "good enough" fashion that satisfies the customer's meaningful requirements.  They SE may have to figure out the most important areas based on feedback from the customer's various stakeholders.  The business may want to see one thing, technicians another and finance or operations a different area.  A PoC is not delivering a production ready environment. It is delivering enough that people can see the end state or that something will work.  These are high pressure events where the sales team may often also expect the PSE to continue handling other sales issues for this or other customers.  I've seen people working out of their hotel room at night while travelling to other customers or a trade shoe.  Expectation management with respect to time commitments and deliverables are keys to success in PoC efforts.

      Post Sale Support

      Primary customer support is usually handled by product technical support, post sales consulting teams or account managers.  The sales team often retains control of the account but only gets involved in post-sales issues as part of ongoing sales opportunities. PSEs sometimes help with planning for initial implementations or act as second tier or "on site" support if the primary technical resources can't resolve an issue. 

      Evangelism and Marketing

      There are many situations where a company or it's products must be positioned, demonstrated and described that are not tied to an individual sale.  Trade shows, marketing webinars, user groups, departmental technology demonstrations and partner events often require PSE support to give presentations, do demos, participate in panel discussions, answer questions or do basic training.  These types of events let the company get in front of more prospects without having to visit each one individually.  Some companies have technical marketing, developer evangelism or outbound technical publicity groups that handle the bulk of this work but they usually still rely on remote field resources for staffing.  PSEs may also be called upon to create the scripts or demonstrations and demonstration environments for these events.

      2nd Level or "SWAT" Engineering

      Many technical sales organizations have multiple levels of PSE.  There is often a step-up tier for more senior folks that are called in after the initial work is done. These may be Subject Matter Experts for particular products or vertical markets. A SME may be an expert in video or key cards for a security company.  A vertical market may be a specialty, like finance, medical, government or some other area that has special needs and standards.

      What the Day Looks Like


      The actual breakdown varies by product an industry.  My experience feels something like that to the right.  Some folks mostly do proposal respnses.  Their time breakdown is probably completely different.

      Sales: True sales activity including presentation prep, meeting prep, actual customer communication, and deal planning.  

      Self Training:  PSEs must become experts in their products which involves a lot of self motivated training.  They also self-train while building demonstrations and doing PoC.

      Post-Sale: Customer satisfaction leads to future business.  PSEs have direct customer involvement and advocate  for the customer themselves or for customer requested product changes. PSEs also maintain technical contact with the customer while the sales reps prospect for new deals.

      Dealing with Sales Representatives

      Sales representatives are different beasts.  They think differently and are motivated differently that most of their technical counterparts. They believe products are a good fit when the PSE doesn't quite see that (yet). They ignore or work around objections that may seem fatal to a technical person.  Sales reps can be compensation driven because they accept the risk / reward balance of commission based compensation. Good sales representatives understand how to drive a process and understand how people think.  I have found working with sales reps to be a generally rewarding experience.

      Sales representatives tend to come in two flavors, hunters and farmers:

      • Hunters:  These folks tend to be more aggressive tracking and bringing down the big deal. They are often great in a startup or when a company is trying to make a name for itself.  Hunters are not always great as account managers or annuity builders.  Sometimes you will run into a hunter that is a true barbarian whose first instinct is always to pick an aggressive sales posture.
      • Farmers:  These tend to work longer term deals, sometimes forgoing short term opportunities if they feel the product or customer isn't really ready.  Farmers can take a beating inside a company because they may not force close deal on short timelines. Companies tend to use these folks for relationship management and for customer satisfaction. 
      Sales representatives are usually commission or quota based. They will also occasionally bend a deal to better fit they way the company structured quota or bonuses. That's one of those things a technical person has to learn to live with.

      Difficulties for Technicians in non Technical Settings

      Customer visits have a dress code.  Technicians may not think appearance is important but first impressions and dress do matter when dealing with customers.

      Technical folks tend to take a question literally and answer it assuming there is a "right answer".  They need to understand the real purpose of the question.  Sometimes the question is more of a "how do we use your product to do it the way we used to" when the answer needs to be "this is how you solve a business problem a new way".  Sometimes folks ask hard questions as part of a "stump the chump" contest.  PSEs need to handle that too.  A lot of early technical questions exist to winnow down the number of vendors they need to talk to.  Technicians need to be aware of this and not say "no" until they have to.

      Technical folks tend to provide short answers when the answer is "yes".  They tend to provide a long winded response when the answer is "maybe" or "not exactly".  All answers have to be given within the context of the meeting and the place within the sales pipeline.  This is something people folks may need coaching and training to learn to handle.

      Technical folks also tend to be specific when they know the answers but very fuzzy when they don't.  This improves as the person learns more about the product, features and customer business processes.

      Sales representatives and their management often operate on a quota system.  This may drive the teams planning and thinking during certain times of a quarter or year.  A sales rep may view the likelihood of a deal based on size or product mix where the PSE may view it based on technological match.

      Customers sometimes are experts and sometimes don't even know the basics.  This may happen in the same meeting.  PSEs have to adjust to these disparate expertise levels.

      Training

      My experience tells me that corporations train their PSEs more aggressively than about almost any other technical position. PSEs need to understand products and techologies well enough to explain it to others, to demonstrate in high pressure situation and build small PoCs or deployments using the technology. Companies, like VMWare,  push PSEs through rigorous certification processes before letting people in front of customers. Training has to be done in a hurry so the PSE is useful but very deep so the PSE has credibility with the people they are in front of.  Some times this is like drinking from a firehose!

      Compensation

      Pre-sales engineers tend to make more than their developer counterparts.  Companies pay extra for people who both understand technology and can communicate with technical and non-technical humans in high pressure situations.  I'd guess that pre-sales engineers make about 20% more than their inside engineering counterparts.  They also normally get a performance bonus on top of that.  My experience has been that sales-engineers get about 80% base and 20% bonus.  Sales representatives can be the inverse of that. Many pre-sales engineers move to sales but many are more risk averse and stay more on the technical side.