Programming

Measuring Distance with Arduino

The Ping))) is ultrasonic range finder that is pretty easy to use in an Arduino project. In my case, I’m using it to monitor the water level in a sump pump. I have an Arduino Uno R3 (with Ethernet Shield) connected to a Ping))) and a TMP36 temperature sensor that is perched above my sump pump. Every 2 minutes the Uno will send out a ping, and figure out the distance to the water below. The TMP36 is used to account for the air temperature in the speed of sound calculations.

Sublime Text 2 and Arduino

If you’re looking to get into Arduino, and you’re a programmer, the first thing that will jump out at you is the Arduino IDE. It’s best described as “spartan” (to say the least). As I’m used to full featured IDE’s I started looking for a replacement to the default Arduino IDE.

There are extensions to use Visual Studio, but that means me starting up a VM to run Windows which I don’t really want to do for Arduino development. There is a another IDE which looks promising called Maria Mole - but it’s Windows only so not really a contender for me. I need something for OS X. I looked at setting up Eclipse as my default IDE, but ran into some issues with that. Nothing to major, but as I don’t like Eclipse in the first place I wasn’t to motivated to sort things out, so I abandoned Eclipse as an IDE choice.

The next thing I tried was Sublime Text. There is an Ardunio plugin called Stino that turns Sublime into a not bad IDE. In terms of writing your programs, Stino can pretty much do everything the Arduino IDE can do: compile programs, upload them to your Arduino board, import libraries, etc.

Embed GPS in a JPEG

One of the handy things about the JPEG format is the ability to store meta-data inside the image using EXIF. There are a few libraries out there for the various programming languages that can help you out with this, and Android actually has something built in to the SDK - the class ExifInterface.

Google’s documentation on writing latitude and longitude to a JPEG are a bit light on details - they loosely hint at the format that latitude or longitude should have. (See the documentation for ExifInterface.TAG_GPS_LATITUDE). The API itself is pretty straight forward, but what Google doesn’t tell you is HOW the GPS coordinates should encoded.

Using AutoCompleteTextView and SimpleCursorAdapter

I have a simple little pet project (for Android), and one of the things I wanted to do was to to have a text field that would show me previous values as I typed in the text box (see screenshot below). Of course, this control is already a part of the Android SDK - it’s our good friend the AutoCompleteTextView.

To populate the drop-down, I have an SQLite table called vehicle_descriptions, which looks something like the screenshot below. What I want is for a given vehicle (a value derived from another control on my Activity) to show me the value of the description column in the table.

Picking Apart PDF with Ruby and Linux

I ran into a curious problem for a side problem of mine where I had some information in PDF files, both text and images.  What I want to do is display the information from the PDF’s on a mobile (Android) device.  PDF isn’t exactly a mobile friendly format, so I got the idea use HTML.  The next trick then becomes how to get the content out of the PDF’s I want into HTML.  Tux to the rescue!

Purging your Privates (MSMQ with Powershell)

A project I’m currently on makes heavy use of MSMQ and private queues.  Every so often, it’s necessary to purge messages from the queue during development. I got tired of always using the MMC snap-in to perform this task, so I whipped up this quick PowerShell script to handle the dirty work for me.  Granted, it’s pretty crude, but it gets the job done.  Any suggestions or improvements, feel free to let me know.

First Impressions: Windows Phone 7 Development

I’ve spent a bit of my spare time in the past week looking at Windows Phone 7 from a developer’s point of view.  I’d have started sooner, but honestly, I didn’t see the point until there were actually devices that I could hold and use.  I know that in the U.S., some guys got developer phones from Microsoft, but I don’t think that anybody up here in Canada was that lucky. So, over the past year or so I’ve been dabbling with Android and I actually like programming for Android. 

Using IntelliJ for Android Development – the Sequel

A while ago, I posted a blog article about using IntelliJ for Android development.  Given that was a year ago, and one version of IntelliJ later, I thought I would do a follow up post.  Long story short (and to sound like a TV commercial):  I liked IntelliJ IDEA 9 so much, I bought a license.

Since I blogged last year, the Android plug-in for IntelliJ has really matured.  I guess the only draw back to it is that you only get the Android plug-in when you buy the Unlimited Edition of IntelliJ – it’s not in the Community Edition.  Here are some general comments/thoughts/observations of mine:

Javascript IDE's

Lately I’ve found myself doing a lot more web application development in JavaScript.  Typically, I always seem to fall back on plain old Notepad++ or Visual Studio.  As a developer, the user experience in either is, IMHO, somewhat lacking.

However, for the past week, I’ve been using RubyMineRubyMine is a Ruby on Rails IDE from Jetbrains, but it seems to work rather well for editing JavaScript and HTML files.  Plus, as an added bonus, it automatically comes with built in support for jQuery.

MVP in C# For 2010

I guess I forgot to mention this:  On April 1, 2010, I received an e-mail from Microsoft that my MVP in C# was renewed for the third year.  This makes me a happy, because with Resharper 5 (and therefore Visual Studio 2010) and Windows Mobile 7, I’m hoping that this will be an exciting year for the .NET crowd. 

Well, okay, perhaps I didn’t forget.  Given that it was April 1st when I got the e-mail, I like to give things a few days to settle down.  I am acquainted with some mischievous pranksters who would think it was a funny April Fools joke.