Multipart Form Posting in Android

I'm chugging away making a native Android app for the rather splendid @stringfellow.  It's been quite the eye-opener in terms of Android fragmentation, the joys of returning to Java after a (very) long hiatus and the intricacies of the platform as a whole.  I fully intend to write-up a few posts on what I've done (and hope for feedback on how things can be improved) but the following was an unexpected pitfall I think is worth talking about now.

Naturally the wealth of apps on Android and other mobile devices require some kind of network interface for consumption of data and communicating details back to servers.  Android - being built with Java - allows you to use the org.apache.http.client.HttpClient which is great until you want to send an image/file or anything else in a multi-part form.

The version of HttpClient in Android (2.2 - not developing against other versions yet) does not have support for multi-part forms.  You could write content as separate entities/directly to the stream but that can soon get messy.

To make things simpler, grab the HttpClient (4.1.3) jar from Apache, drop into your Android project build path and do the following in your request/response handler:


Chrome Dev Tools: CSS Auto-Complete

The Chrome Dev tools provide a lot of functionality to you as a developer when making changes to scripts, CSS, HTML or testing out the performance of a page.

Chrome filters the properties based on the text you enter
One of the great features of editing CSS is the auto-complete that allows you to quickly add style elements.

Begin typing and Chrome will provide a list of matching CSS properties, use the arrow keys to select an item, hit tab and you'll then be able to set the value.

When setting a value hit ctrl+space and you'll get a list of values appropriate for the property.

Hitting 'ctrl+space' provides a full list of static values
The final icing on the cake; if you enter a value such as 22px you can then use the up and down arrow keys to change the value.  This is ideal when attempting to position of scale elements on the page as all CSS changes are applied in real-time :-)

A vast array of other features are available in the tools.  Full guidance on how to use them is available here

PostLib

I played around with Posterous some time ago (the old version of this blog used to be there).

Twitter recently acquired Posterous and there has been some talk about it shutting down.  Naturally some people would like to get their content out of the system sharp-ish but the latest API needs a key.

I wrote PostLib ages ago when I was looking to process content from Posterous offline.  I couldn't find the original project (but I had the debug version of the dll referenced in an old project).  I've used Reflector to extract the source code and update it to .net 4.0 (it was 2.0).  No promises on it's full capabilities or the quiality of code but it should help out someone.  You can grab it from here

It uses the old API so it may not be perfect, but it does seem to be responding with the expected content.  Hopefully it'll help people out.  You can use it by putting a reference to the project and then doing the following: