Author: mfoster

  • Review: Adafruit ARDX Experimentation Kit for Arduino

    Review: Adafruit ARDX Experimentation Kit for Arduino

    My dad got me an ARDX Experimentation Kit for Arduino for my birthday. I just finished all the 13 experiments and I have to say it is a pretty awesome kit and a good introduction to the Arduino. The kit comes with a variety of input and output components/devices including:

    • 10x Red and 10x Green LEDs
    • 10mm Blue LED
    • 5mm RGB LED
    • Force Sensor
    • DC Motor
    • Hobby Servo
    • Shift Register
    • Piezo Element
    • Pushbuttons
    • Variable Resister/Potentiometer
    • Photo Resister
    • Temp Sensor
    • Relay

    Also included are some transistors, resistors, diodes, etc. After you finish going through the experiments this gives you a good head start once you decide to build your own project.

    Another bonus to the kit is that is comes with a custom cut piece of clear acrylic to mount the included Arduino and a bread board. There are wiring sheets you can cut out and overlay on the bread board but I didn’t find these necessary.

    Code for most of the projects can be found online at the URLs mentioned in the instructions with the exception of the last two experiments. For the RGB LED experiment I could not find the code online and I had trouble with the code printed in the manual. I had to make the color arrays regular variables instead of constants to get the code to work for me. I could not find the force sensor code online either but the code printed in the manual worked and was pretty trivial to enter.

    Overall I have to say this is a great kit for someone that would like to learn how to use Arduino to interface with real world devices.

  • TreeBot

    TreeBot

    For Christmas 2011 Pictometry had a holiday “Throwdown” challenge. Each department was given box of miscellaneous items that had to be incorporated into some sort of creation. The box was handed off from one engineer to the next. Everyone was too busy. Finally, with two days left before the judging, it was time to take action. With much help from my fellow engineers I built TreeBot, a remote control Christmas Tree with all the trimmings and wireless video for remote operation.

    It consists of my old Duratrax Evader RC car with a Christmas Tree mounted to it, Christmas lights on a power inverter, an iPod Shuffle playing Christmas tunes on an amplified speaker and a 2.4 Ghz video transmitter for remote operation. It is decorated with various items we had to use in our creation. We came in second place behind Finance who did a Christmas Carol play using the items as props but I feel it was a good entry representative of engineering given the time constraints.

    I took some pictures of TreeBot as I took it apart in case we decide to build something similar next year:

  • Funbat Scratch Build

    Funbat Scratch Build

    I just finished a scratch build of the Funbat, an RC plane design that uses Dollar Tree foam board designed by Bloody Micks. I posted build pictures here on RCGroups.com. Now I just need a nice calm day.

  • PHP/Apache running on Linux won’t connect to a PostgreSQL server

    PHP/Apache running on Linux won’t connect to a PostgreSQL server

    SELinux will block PHP/Apache from connecting to PostgreSQL (and probably any other DB) by default on some Linux distributions. If you are trying to get PHP to connect to a PostreSQL DB on a linux box for the first time and you are sure your pg_hba.conf on the target box is setup correctly then try this:

    setsebool -P httpd_can_network_connect 1
    

    This should configure SELinux to allow Apache/PHP to connect to other hosts.

  • National Broadband Map Review

    National Broadband Map Review

    The National Telecommunications and Information Administration (NTIA) in collaboration with the FCC has published a series of broadband maps on a new site called National Broadband Map (NBM). These maps show what broadband services are available throughout the United States as well as other interesting broadband data.

    Hit this link and click the “Explorer the Map” option on their main page to see a map of the US with shaded areas where selected broadband services are available. You can click different selections above the map to toggle the various broadband technologies. To see other maps such as advertised versus actual broadband speeds click on the “Show Gallery” option in the lower right hand corner.

    Rochester, NY does pretty well on advertised versus actual although there a few slower than advertised points here and there. Upload performance data is also available. Usually the cable and DSL providers don’t brag much about upload performance likely because in most cases it is lousy compared to download performance. I think upload performance will become more important to the typical internet user than it as in the past now that people are sharing their pictures and video online.

    The NBM site use a variety of open source technologies including:

    • JQuery – My favorite JavaScript library.
    • Modernizr – A JavaScript library to detect browser capabilities.
    • OpenLayers – Provides a JavaScript API to display WFS and WMS GIS layers.
    • GeoServer – A Java based server software that provides WFS and WMS services.

    What is particularly interesting about the site is the developer resources. They provide a series of API’s you can call from your own web applications to use their data. Output formats include XML, JSON, and JSONP implementations. If you want to use the data locally without the APIs you can download it.

    I do have a couple criticisms regarding the maps and ironically, they are bandwidth related. The first is that there are too many tiles returned when viewing the default map of the US. I noticed the map was a little slow to fill in. When I enabled Firebug and clicked on the “Explore the Map” option off the main page, over 500 tiles were pulled down. In fact, Firefox/Firebug became unresponsive. I would expect less than 30 256×256 tiles need to be pulled down for a reasonably sized browser window. I wager there is something goofy going on like a bounding box not set for the area displayed.

    My second criticism is that the site is not using gzip to compress JavaScript files. Modern web applications tend to lay on the JavaScript pretty heavy and this one is no exception. OpenLayers.js is nearly 1MB all by itself. By enabling gzip on sites with large JavaScript files you can significantly improve site performance. This is a good topic for a future post.

    Overall I think the National Broadband Map Site is an excellent resource. It provides very useful data on broadband technologies/speeds, makes this data available via APIs or download, and also demonstrates a variety of open source web application technologies.

    Is it worth the $20 million that contractors were paid to build the map? I would say certainly not at first glance but I would want to hear the whole story before I jump to conclusions. I.e. how much of that $20 million was spent on actual development? I am much more skeptical of the alleged $293 million required to collect the data.

  • MsMpEng.exe – Microsoft Security Essentials high CPU Utilization

    MsMpEng.exe – Microsoft Security Essentials high CPU Utilization

    If you are running Microsoft Security Essentials with real-time protection enabled on a machine running ThinkVantage Access Connections you might notice the MsMpEng.exe service consuming most of your CPU time. This will cause your Lenevo laptop to run obnoxiously slow. Allegedly this issue was fixed with a new version of Access Connections but on a laptop I was working on the problem persisted even after I updated Access Connections.

    If logging is enabled in Access Connections the “AccConnAdvanced.html” file will continuously be updated. Microsoft Security Essentials appears to then scan this file over and over again after each change. This is probably causing the processor to burn your precious battery life away. This way Lenovo can sell more battery pack upgrades. 😉

    There are two ways to fix this: Add an exception to Microsoft Security Essentials or disable logging in Access Connections.

    If you want to continue logging Access Connection activity you can add an exclusion in Microsoft Security Essentials:

    1. Open up Microsoft Security Essentials and click on the “Settings” tab.
    2. Select “Excluded files and locations”.
    3. Click the “Browse…” button and select the “AccConnAdvanced.html” which, should be under “C:\Program Files\ThinkPad\ConnectUtilities\” by default. Click “OK”.
    4. Click “Add” and then “Save changes”. MsMpEng.exe CPU utilization should then drop to around 0%.
    add microsoft security essentials exclusion

    Here is how you can disable logging in Access Connections (at least on Windows XP).

    1. Launch Access Connections: “Start”->”Programs”->”ThinkVantage”->”Access Connections”.
    2. Once Access Connections is up switch the view to “Advanced” by clicking the “Advanced” button in the upper right hand corner.
    3. Click the “Tools” tab and then “Diagnostics” and then the “Event Log” tab on the Diagnostics Tools screen.
    4. Click “Disable Logging” and then click “Close”. The AccConnAdvanced.html file should no longer grow and MsMpEng.exe CPU utilization should drop to nearly 0%.
    access connections tools
  • Titanium Appcelerator Quirks (Updated)

    Titanium Appcelerator Quirks (Updated)

    I recently started tinkering with the Appcelerator Titanium Development Platform and have run into a couple of quirks.

    Web Inspector will not Launch

    If you create a Titanium project on any drive other than C:\ on a Windows system, you will not be able to launch the Web Inspector. This is a apparently a known bug in Titanium Developer.

    Conflicting PHP Installations

    If you attempt to launch a Titanium Appcelerator PHP app in Titanium Developer on a Windows system that already has a local PHP installation, you may see the following error:

    Kroll Event Window Instance: YourApp.exe – System Error

     

    The program can’t start because php_mbstring.dll is missing from your computer. Try reinstalling the program to fix this problem.

    Titanium Appcelerator php_mbstring.dll error

    Don’t bother re-installing anything. What is likely happening is that your pre-existing PHP installation added a “PHPRC” environment variable that points to your existing PHP install folder. I think Titanium’s command line PHP instance sees this variable and then attempts to use the php.ini file in that path. Your existing PHP installation folder does not likely have the PHP settings and/or module paths that Titanium needs so it breaks.

    To fix this without renaming your current PHP installation folder you can delete the “PHPRC” environment variable. Your existing PHP installation should work fine without it because PHP will look for the php.ini file in the same folder it is running from. To delete the “PHPRC” environment variable on Windows 7, click Windows Start, right click “Computer”, left click “Properties” -> “Advanced system settings” -> “Environment Variables…” -> select “PHPRC” under “System variables”, and then click “Delete”.

    how to delete the phprc environment variable

    Hopefully you can now launch your Titanium application without an error and your existing PHP installation will continue to work normally.

  • Limited screen resolutions running CentOS as a VirtualBox guest

    Limited screen resolutions running CentOS as a VirtualBox guest

    If you are attempting to run a newer version of CentOS as a guest on VirtualBox you need to install the “Guest Additions” on your CentOS VM to enable higher display resolutions. If you don’t, 800×600 and 640×480 will probably be your only options.

    This is in the manual of course but if you were in a bit of rush like myself you may have missed that part. 😉 Once you complete the “Guest Addition” installation process the CentOS guest desktop will dynamically re-size to match your view-port. Installing the Guest Addition will add some other handy features including a shared clipboard and shared folders.

    If you are running an older CentOS guest you may have to manually add additional resolutions to the xorg.conf file.

  • Php-cgi.exe application error on IIS with FastCGI

    Php-cgi.exe application error on IIS with FastCGI

    I recently installed PHP 5.2.14 on a Windows 2003 machine running IIS 6 with FastCGI to do some PHP testing at home. I chose the fast CGI install and added several extensions during the install including Curl and Oracle. When I attempted pull a test page after the install completed, I saw the following php-cgi.exe application error on the Windows server’s desktop:

    The instruction at “0x100f36ec” referenced memory at “0x000c0194”. The memory could not be “read”.

    IIS sent the following error message back to the requesting browser after a couple minutes:

    FastCGI Error
    The FastCGI Handler was unable to process the request.

     

    Error Details:

    * The FastCGI process exited unexpectedly
    * Error Number: -1073741819 (0xc0000005).
    * Error Description: Unknown Error

    HTTP Error 500 – Server Error.
    Internet Information Services (IIS)

    After some trial and error I was able to get my test page to display if I commented the “extension=php_curl.dll” and “extension=php_oci8.dll” lines in my php.ini file:

    ; Local Variables:
    ; tab-width: 4
    ; End:
    [PHP_CURL]
    ;extension=php_curl.dll
    [PHP_GD2]
    extension=php_gd2.dll
    [PHP_MSQL]
    extension=php_msql.dll
    [PHP_MSSQL]
    extension=php_mssql.dll
    [PHP_MYSQL]
    extension=php_mysql.dll
    [PHP_MYSQLI]
    extension=php_mysqli.dll
    [PHP_OCI8]
    ;extension=php_oci8.dll
    [PHP_PDO]
    extension=php_pdo.dll
    [PHP_PGSQL]
    extension=php_pgsql.dll
    [PHP_SHMOP]
    extension=php_shmop.dll
    [PHP_SOAP]
    extension=php_soap.dll
    [PHP_SQLITE]
    extension=php_sqlite.dll
    [PHP_XMLRPC]
    extension=php_xmlrpc.dll
    

    After some more trial error I was unable to get PHP to work without leaving the two lines commented. I tried both the VC6 thread and VC6 non thread safe versions and both exhibited the same behavior. On the PHP download page there is a “Which version do I choose?” section that basically explains that I should be using the VC9 version for IIS. Unfortunately, I only saw the PHP 5.3.3 VC9 download and I wanted to test with PHP 5.2.14.

    I downloaded PHP 5.3.3 anyway and it worked. I guess I will be testing with PHP 5.3.3.

    On a somewhat related note, if you are using FastCGI with IIS, you will probably want the VC9 PHP 3.3.3 non thread safe version. This article explains why.

  • How to get the contents of an Oracle CLOB data field in PHP

    How to get the contents of an Oracle CLOB data field in PHP

    The Oracle “CLOB” (Character Large Object) is a data type used to store up to 4 Gigabytes of text. Retrieving the contents of a CLOB is not as intuitive as you might think.

    Let’s say you have a CLOB field/column named “mychars” in an Oracle DB table named “mytable” along with some other fields. You want to simply echo out the text in the “mychars” field:

    
    

    The above code will give you an error that looks like the following:

    Catchable fatal error: Object of class OCI-Lob could not be converted to string in somefile.php on line 14

    If you try to do a print_r() on the CLOB in an attempt to figure out what you are dealing with you will get something that looks like:

    OCI-Lob Object ( [descriptor] => Resource id #3 )

    This is because a Lob object is returned instead of the contents of the CLOB.

    To get the CLOB contents you will need to call the load() or read() methods on the returned object. The latter will require the length of data to read in bytes but has the advantage of not being limited by the script memory limit:

    load();
                //or
                echo $row['mychars']->read(2000);
            }
        }
    ?>
    
  • How to reverse the keyhole on a Kwikset Lever so the teeth face up

    How to reverse the keyhole on a Kwikset Lever so the teeth face up

    So let’s say you just purchased a Kwikset entry lever from Lowes. You manage to get it installed and even get the levers in correct orientation. If you are lucky the keyhole will be correctly oriented so you can insert the key with the teeth up. If you are not so lucky, the keyhole will be upside-down so the key goes in with the teeth down.

    Allegedly the lock will still work even if the tumbler springs have failed, if the keyhole/cylinder is oriented so the teeth go in up so this is the desirable orientation. The directions included with the entry lever do not tell you how to do this.

    Fortunately, Kwikset has a video on their website that shows how to reverse the cylinder. There is a small clip on the cylinder you can push/pry out with a small flat-head screwdriver. You then pull the cylinder straight out, rotate it 180 and then push it back in and re-install the clip.

  • How to add a custom context menu to a Spark TextArea in Flex 4

    How to add a custom context menu to a Spark TextArea in Flex 4

    There is a current known issue with adding custom context menus on a RichEditableText Spark component:
    http://bugs.adobe.com/jira/browse/SDK-23926

    This includes the TextArea component. Essentially, any custom context menus will not show up. There is a work around mentioned in the comments for the bug on Adobe’s website but I thought I would re-hash and show an example since this had me a bit stumped.

    The work around is to attach the context menu to the TextArea’s TextDisplay object via the “textDisplay()” accessor method. I have created a simple example with source.