Sunday, November 8, 2009

Android Development on Sprint/HTC Hero and Ubuntu

I now have a shiny new HTC Hero from Sprint which I purchased just to experiment w/Google Android.

My primary devbox is Ubuntu Intrepid. Sprint is still on Cupcake (Android platform 1.5). Still have not figured out how to "sync" between Ubuntu and Android, but development works just fine.

The Hero connects to Ubuntu Intrepid via USB and it can be mounted as a file system.

How to use the Hero as a development target.



On the Hero, select "Settings" then "Applications"

Check the "Unknown Sources" box.

Select the "Development" option.

There are three options inside Development: "USB Debugging" "Stay awake" "Allow mock locations" - select to your taste (I enable all three).


On Ubuntu, I assume you have eclipse w/the ADT plugin.
From eclipse, navigate to the build configurations. There is a dialog entitled "Android Device Chooser" - select your Hero and then run. Your application should appear on the Hero.












How to mount your Hero as a USB drive from Ubuntu.



On your devbox, create /etc/udev/rules.d/51-android.rules


gsc@cornfed:66>pwd
/etc/udev/rules.d
gsc@cornfed:67>cat 51-android.rules
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"


Connect the Hero to your devbox via USB. There should be some chatter in /var/log/messages about the new device. Something like this...


Nov 8 16:32:49 cornfed kernel: [185299.048021] usb 8-4: new high speed USB device using ehci_hcd and address 13
Nov 8 16:32:49 cornfed kernel: [185299.193667] usb 8-4: configuration #1 chosen from 1 choice
Nov 8 16:32:49 cornfed kernel: [185299.203424] scsi17 : SCSI emulation for USB Mass Storage devices
Nov 8 16:32:54 cornfed kernel: [185304.220343] scsi 17:0:0:0: Direct-Access HTC Android Phone 0100 PQ: 0 ANSI: 2
Nov 8 16:32:54 cornfed kernel: [185304.239535] sd 17:0:0:0: [sdc] Attached SCSI removable disk
Nov 8 16:32:54 cornfed kernel: [185304.239674] sd 17:0:0:0: Attached scsi generic sg3 type 0


On the Hero, pull down the status bar (i.e. push the Home symbol then touch the top of the display and drag your finger down). There should be a message saying "USB connected, select to enable". Press this. A dialog will appear warning about the mount. Select OK.

At this point you should have a freshly mounted USB filesystem. There will be more chatter in /var/log/messages (like so...)

Nov 8 16:36:44 cornfed kernel: [185533.291475] sd 17:0:0:0: [sdc] 3862528 512-byte hardware sectors (1978 MB)
Nov 8 16:36:44 cornfed kernel: [185533.294342] sd 17:0:0:0: [sdc] Write Protect is off
Nov 8 16:36:44 cornfed kernel: [185533.299343] sd 17:0:0:0: [sdc] 3862528 512-byte hardware sectors (1978 MB)
Nov 8 16:36:44 cornfed kernel: [185533.301341] sd 17:0:0:0: [sdc] Write Protect is off
Nov 8 16:36:44 cornfed kernel: [185533.302919] sdc: sdc1


Of course, df(1) will also report the filesystem


gsc@cornfed:68>df -k
Filesystem 1K-blocks Used Available Use% Mounted on
--other filesystems deleted for clarity--
/dev/sdc1 1928992 631840 1297152 33% /media/disk


At this point, you can treat this like any other mounted file system. Huzza!


gsc@cornfed:69>cd /media/disk;ls
albumthumbs DCIM HTC Sync rosie_scroll
amazonmp3 download Music Wallpaper

Monday, November 2, 2009

Apple iPhone Tech Talks World Tour - San Jose

I was lucky enough to get an invitation for the iPhone Tech Talks held in San Jose on 29 October, 2009. The talks were held at the Hyatt in Santa Clara (off Great America Parkway). South bay is a 3 hour drive for me and with the Oakland Bay Bridge closure it might take even longer. I considered staying home to keep working on my next iPhone app. Attending was hanging by a thread, but I wanted to see the show and meet other iPhone developers. In the end, I went and I'm glad I did.

Registration opened promptly at 0800. The registration lady really does ask for photo ID before issuing your badge and mandatory t-shirt. Apple put on a nice breakfast, coffee, fat pills and some fruit. 0800 is rather early for the valley and small talk was hard to drum up.

Shortly before 0900 I was in the large conference room w/Blink-182 (and similar) on the soundtrack. Apple starts promptly and the keynote was a inspiring start for the day. The overall theme: iPhone is cool and popular, write great apps, make money. I like it.

There short video promoting the iPhone and applications. Another video from the very big conglomerate why corporate IT is adopting the iPhone. The speaker had a steady stream of poster children for great apps. I rarely cruise the app store, so this was beneficial for me.

One example was "things" which features a "companion app" - i.e. there is a desktop app and a iPhone app and they share data. I have an application in development which also needs to share data between iPhone and desktop, but I didn't know this arrangement had a name.

There are 3 technical tracks available after the keynote. I stayed in the big hall for "Effective iPhone Development" parts 1 and 2. The talk was good, but I already knew most of the content. One small item I didn't know: don't prefix vars w/a underscore because Apple uses these internally and there might be a collision.

Apple provided a catered box lunch w/a sandwich, salad, etc. Not bad. By lunchtime, people were awake and ready to talk. I picked a table that contained the oldest looking people (being ancient myself) and struck up a conversation. After working from home most of the year, it was fun to meet some new people.

One distressing item: I asked everybody I met if they were able to sustain themselves by creating iPhone apps. The answer was a resounding "no". Perhaps we are all beginners and just haven't paid our dues. Perhaps there really isn't much money in the app store. Not certain, but to actually earn a living from creating iPhone applications seems to be a rare accomplishment.

After lunch I sat through the "Mastering OpenGL ES for iPhone (p1)" - probably should have just snuck out to my truck for a nap. I don't remember much about this talk. If linear algebra scares you... well... perhaps you shouldn't be doing OpenGL. Anyway, less hand wringing/intimidation and more bit twiddling would be an improvement.

Next was "Testing and Debugging Your iPhone Application" - which was disappointingly light. I did get some new information though: when you ship an app, keep the .dSym file for crash analysis (makes sense, I should have already discovered that one). Secondly, Snow Leopard (which I have yet to install) has clang which does a thorough job w/static source analysis. I resolve to upgrade to Snow Leopard as soon as I ship my next app.

Finally, "Maximizing iPhone App Performance" which was also on the light side, but still worth an hour. I probably should have attended the networking presentation instead.

Apple wrapped up the day w/a wine and cheese reception.

Wrapup: the Apple people are accessible, they take questions between sessions and there is a lab where you can bring them specific examples for consultation. The developer outreach is nice, and Apple certainly deserves praise for the effort. There is no paper and AFAIK the slides/sources are not available on the web. Take your notes and be quick.

There are videos from previous "tech talks" available on the Apple developer web site. There is a fair amount of old material, but there is enough new material to make them worth attending.

One factoid tossed out: all the attendees had published iPhone apps (in my case, a very minor application). Write that app if you want to score an invite next year.

It was an inspiring day, even if I didn't meet anybody who has struck gold on the appstore. Maybe next year...

Monday, September 7, 2009

Fresh OS X Dashboard Widget

My latest OS X Dashboard Widget was made available today.

I have an iPhone application which is almost ready for submission. The dashboard widget is meant to be a free sample (and a subset of) of the iPhone application.

I'll have more to say about this once Apple releases the application to the iPhone store.

The Apple Dashcode tool greatly eases widget creation. It wasn't difficult to wrap the widget around my core libraries. I kept the dancing eye candy to a minimum because (after all) I prefer people to use the "for pay" application.

The Apple development tools are nice, it is easy to see why people get emotional about them.

Tuesday, September 1, 2009

Backpropagation Neural Network

I have just finished updating "backprop1" - a simple 3 layer backpropagation neural network implemented in Java. There are three demo applications, a point classifier, a XOR demo and a interactive character recognition demo.

You can obtain a copy from Source Forge

Tuesday, August 25, 2009

Server Consolidation

Our SVN code repository has been happily residing on Red Hat 9 for years.

Eclipse Mylyn finally provided the tipping point to upgrade our server since the RHEL9 packages were just too old for Bugzilla 3.

I started out w/Fedora 11, which at first looked amazing. The Fedora people have really made an effort to clean up the installer and to get all the packages to play nice. Our host box is a seven year old PIII and after a few hours X would go crazy and consume the CPU. Easy to deal with by setting runlevel 3, but still...

This isn't meant as a complaint, Fedora is supposed to be on the edge. However, we need stability for a code repository and I didn't want to invest the time necessary to make Fedora behave.

The fallback platform was Ubuntu 9, which has been rock solid so far. I installed CVS (for legacy sources) and SVN (our current workhorse repository). Although the wikis had some complaints, Bugzilla3 pretty much worked as installed (it does need some post-install configuration, but the documentation is good). Our install came up on MySql. PostGreSQL would have been my first choice, but I'm happy to have the task completed.

Seems like there always has to be a problem child and Twiki was ours. Other people have said it and I will too: don't even bother w/the apt packages of Twiki, they don't work. The application is scattered across many diverse directories, I spent several hours tweaking the configuration, file permissions, etc and still didn't get everything working. Finally I deleted the entire install and built from scratch. Success!

All we need now is "Cruise Control"...

Friday, August 14, 2009

JBoss Seam: Working For Me

Tonight I am putting the final touches on my second Seam application. Seam appears to be getting more attention so I decided to share what I hope will be some useful comments.

Currently it seems like enterprise Java frameworks are Spring and everything else. Spring has much to reccomend it: lots of features, well documented, well supported and Spring experience is marketable. As a contractor, I like being marketable.

There are already several comparisons of Spring and Seam floating around the net and I won't compete w/these. For my purposes, Seam looked attractive because it didn't rely upon extensive XML configuration files and promised extensive functionality such as RSS feeds, BPM support, etc. As a contractor, I am hoping for extensive customer adoption and future Seam work.

Mastering Seam is a journey, but the documentation is good and they make it easy to start. Seam will generate a fresh project that compiles and deploys right away. If you already have existing database schema, Seam will generate a scaffolding which will include pages to view, edit and select rows based upon your database schema.

The generated pages make for a great project start. Seam also comes w/multiple working examples which will be an esssential part of your Seam education.

I wish I could say everything about Seam was wonderful, but I wasted weeks and weeks of time trying to use eclipse and JBoss tools. JBoss tools did horrible things to eclipse, causing it to randomly lock up and corrupt my workspace. Of course, eclipse by itself works just fine. I just manage JBoss Application Server from another xterm.

It is a big help to already have the database design nailed before generating your seam application. Once the application was generated, I used the existing page navigation, etc and merely tweaked the facelet pages to appear as the customer required.

The seam forums are quite responsive, although on occasion it is hard to know what is a proper Seam question and what is not. For example, JBoss tools are supported in the JBoss forums.

I did purchase the book "Seam In Action" by Dan Allen, which did help but wasn't enough by itself. Seam covers a lot of ground, you will almost certainly need a good JSF/Richfaces book and a good Hibernate book to complete any real project.

So far I am impressed w/the results of using Seam. Now that I have some experience, I believe Seam will help me develop complex applications much faster. I have been promoting Seam to customers and I expect to start my 3rd Seam application soon.

Good luck w/your projects. Thanks for reading.