James Crisp

Software dev, tech, mind hacks and the occasional personal bit

Author: James (Page 3 of 18)

Short Talk: Starting Android Development

I’ll be giving a short talk on Starting Android Development on Tuesday at the Sydney ALT.NET group.

We’ll be covering:

  • the platform
  • app design and abstractions
  • Java and IDEs for Android Dev
  • Emulator
  • Code walk through of a simple application I’m writing

Richard Banks (@rbanks54) will also be giving a talk on .NET bdd tools.

More info and RSVP on the ALT.NET blog.

See you there!

Migrating from Palm OS to Android

Palm and its Demise
I’ve been using Palm organisers and smart phones since the year 2000. I enjoyed developing for them, writing several medical applications, and using them extensively for calendaring, contacts and memos (PIM). The Treo smart phones were visionary at the time, providing integrated phone and PIM functionality, plus push email and basic web browsing.

I was at the lavish developer conference in Sydney, when Palm was the market leader, and announced they were splitting into two separate businesses – software and hardware, and developing a new OS (Cobalt), which never saw the light of day. After that, Palm slowly lost its lead. I would have been interested to try out Palm’s last throw – the Pre and WebOS – but it never made it to Australia. Now Palm has been purchased by HP, and it is abundantly clear that Palm has had its day, and it’s time to move on. Goodbye Treo 650 and Palm OS Garnet!

Where to next?
Well, major contenders for smart phones at this point are iOS and Android (sorry Windows Phone 7, maybe next release :)). The iPhone is a nicely crafted piece of consumer electronics, and it’s the obvious choice for many people. Personally, I like the polish, but find the limitations of the OS and clumsy notification system, vendor lock in and tightly controlled environment does not appeal. Android, especially with 2.2, is pretty smooth. It requires a lot more tweaking than an iPhone to get it to a good state, but once set up, it’s a really nice experience and lets you do quite a lot of stuff you can’t do on an iPhone. I chose a HTC Desire HD and Android 2.2.

Android Migration
What I particularly want to share is how I migrated my data across from Palm OS to Google services and Android 2.2, and what applications I chose to replace the beautifully crafted Palm PIM system. There’s still some Palm users out there hanging on, and I’d encourage you to take the leap and move over to Android.

Aims

  • Powerful calendar app on the Phone with hour by hour day view, easy and quick to add/change events, and ability to include additional public calendars. Synchronisation with a desktop application.
  • Contacts synced with Google mail / Google contacts and a desktop application.
  • Memos/Notes synced only with a desktop application (not cloud)
  • Push email

Apps & Architecture
After quite a bit of research and trial, I decided to go with:

  • Google services for Calendar and Contact storage in the cloud
  • Business Calendar for android calendar app. Uses Google services, day by day view and supports multiple calendars. It works pretty well though still in Beta, and has frequent updates and improvements.
  • Built in contact app from HTC. It syncs with Google contacts (links to facebook too) and works well with the phone app. It’s meant to sync with twitter too but HTC apps for twitter don’t seem to have been updated for new Twitter authentication system.
  • Outlook 2007 for the desktop PIM application (I prefer Palm desktop, but yes, no future there)
  • gSync to synchronise Outlook with Google services for Calendar and Contacts (this works pretty well, though not 100% reliably for things like deleting one occurrence of repeating events). I also set the synchronisation for the calendar to only be 100 days in the past and future as this made it a lot faster to sync)
  • B-Folders Android app and wireless sync to desktop for memos/notes (B-Folders works ok for this but is a bit clunky for editing notes on the phone and requires you to enter a password frequently)
  • Built in Gmail app works well for email and I use the Gmail web client with offline sync on my PC

Data Migration

  • First, sync data with Outlook. Only outlook <= 2003 is supported. I installed Outlook 2000 for the sync. To change from Palm desktop to Outlook for HotSync, on Windows, run PalmOne > PIM Conduit Sync > Sync with Outlook from the start menu. If you don’t have this app, you can download the latest version of Palm Desktop from the Palm site and it will include it.
  • I had a lot of errors during sync but managed through largely retrying to get a clean sync to happen.
  • After a clean sync, I upgraded my outlook to 2007 as this has a better user interface and works with gSync.
  • Next, I used gSync to sync about a year of past calendar data and all contacts into Google services. It works pretty well. Some calendar events seemed to get duplicated but not enough to be a major hassle. I did try syncing more years of history in Calendar with the cloud, but it seemed to slow down my Business Calendar start up time significantly, so I cleared out everything and only synced a much smaller length of time – about a year. I then changed the sync to only 100 days in the past and future to make it run faster (takes about 3 minutes). I currently have the sync run a few times a day automatically but sometimes kick it off manually too.
  • Use ‘Google contacts > More actions > Find & Merge Duplicates’ to clean up and combine your contacts. I had a lot of email addresses in Google contacts which also had contact records from the Palm. This command did a good job combining them.
  • I exported all memos using Palm Desktop into individual text files (one per category), and then imported them into B-Folders as per these instructions. I had to manually change line endings (\r\n to \n) to avoid double spacing. A few days later, a new version of B-Folders was released which can import all exported Palm memos from a single categorised file. I haven’t tried this but feature, but it sounds like a time saver! The B-folders sync between phone and desktop app is manual and initiated from the phone. It has worked well so far.

Conclusion
In conclusion, I now have my data and quite workable PIM functionality on my Android phone. Business Calendar has a great multi-day view that my old palm didn’t, but it is a bit slower to add new events. The HTC Contacts app gets pictures from Facebook which is pretty cool, and syncs with my gmail so I don’t have to maintain email addresses in two places. It is a bit more clunky to edit and add contacts though. On the memo/note front, B-folders encrypts notes which is cool… but a bit irritating to need to enter your password every time you launch the program. Also it is more clunky to edit notes and does not save your last open note, and position in the note between launches. The rest of the phone functionality is great though and a huge step forward from the Palm. It’s really for a separate post to talk about these, but good web browser, GPS with maps, train timetables, movie times near you, twitter client, etc make it an amazing device and well worth the upgrade.

TRON and NORT

On the ultra-geeky front, I watched the original TRON last night, kindly leant to me by my buddy Doctor Dray. Having never seen it before, but heard a lot about it, I was keen to watch it at last. The core idea of computer programs personified is pretty cool, and the 80s rendering is interesting to watch (looks like stuff we did in computer graphics class at uni!). The plot does stretch belief a bit too thin at times though. To get an idea how far movie tech has come between the 80s and today, check out the original 80s trailer and the new Tron Legacy trailer.

Also, at high school, I and my fellow geeks spent quite a bit of time writing games in C like the TRON light cycle game, cunningly avoiding copyright violation by calling them NORT. After writing the 2 player version, we moved on to writing simple AIs so that you could play against the computer. Recently going through an old computer’s hard disk, I found the code for these. Thanks to the backward comparability features of Windows they still run, although they were written in Borland C/C++ for DOS! Amazing blast from the past.. here’s a picture of AI NORT in action:

nRake Microsoft Case Study

nRake is now the subject of a Microsoft case study. Check it out here:

UPDATE: Now on the Microsoft Case Study site.

Rails Refactor & Hack Night

During the RORO hack night last Wednesday, Ryan Bigg (@ryanbigg) and I worked on a Rails Refactor, something I’ve been meaning to get going for a long time.

How often have you wasted time doing renames in rails? Sure it’s hard to automate everything without understanding the code, but there sure are a lot of mechanical steps that you can easily automate. Ryan and I took on controller renames and got a fair way in the few hours we spent on the night.

Code is on github

To rename a controller:
$ rails_refactor.rb rename OldController NewController

  • renames controller file & class name in file
  • renames controller spec file & class name in file
  • renames view directory
  • renames helper file & module name in file
  • updates routes

To rename a controller action:
$ rails_refactor.rb rename DummyController.old_action new_action

  • renames controller action in controller class file
  • renames view files for all formats

Looking to extend it with model renames, and then more complex refactoring.
If you like it, please fork and contribute 🙂

Odd Date and Time Comparisons in Rails & Hack night

While comparing Dates and Times in Rails (both 2.3 and 3), I came across an odd behaviour:

>> Time.parse("Mon, 26 Jul 2010 9:59") == Date.new(2010, 7, 26)
=> false
>> Time.parse("Mon, 26 Jul 2010 10:00") == Date.new(2010, 7, 26)
=> true
>> Time.parse("Mon, 26 Jul 2010 10:01") == Date.new(2010, 7, 26)
=> false

Also

>> Date.new(2010, 7, 26) == Time.parse("Mon, 26 Jul 2010 10:00")
=> false (Rails 2.3)
=> nil (Rails 3)
>> Date.new(2010, 7, 26) == Time.parse("Mon, 26 Jul 2010 0:00")
=> false (Rails 2.3)
=> nil (Rails 3)

Tonight, we’ll be having the RORO hack night in the ThoughtWorks Sydney office, with a focus on open source projects (your own or contributing). A patch for this date/time behaviour might be an interesting area to pursue.

Ruby 1.8 Scoping and Blocks

Quick ruby quiz.. after these two lines execute, what is the value of number?

>> number = 5
>> (1..10).each {|number| print number}

Well, number will be 10, thanks to the block being run and re-assigning the value of number. This can cause you some pretty subtle bugs if you happen to have the same name for a local/function argument, and as a variable name in a block.

In C#, the compiler is kind enough to tell you that this would be a very bad idea and give you an error.

And thanks to Sudhinda for commenting – this has been fixed in Ruby 1.9. In 1.9, the variable used as the argument in the block does not affect the variable outside the block.

Showing Hidden Files in Mac Finder

If you’ve been longing for your Mac finder to show all the files on disk, then this command is for you. Run on the console:

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
Now you’ll be able to see all the .config files in your home directory and all the normal Unix directories on the root.

Azure Build and Deploy using Powershell

Started working with Windows Azure? Want to have automated build and deploy, rather than clicking around in a web console or Visual Studio?

Check out the AzureBuildDeploy repository on GitHub.

I set this up for an Azure proof of concept project. It contains Powershell scripts for simple automated packaging, build and deploy, and a dummy WCF application for deployment to the cloud. The WCF application can however be easily replaced with a web application or what ever other .NET application you would like to host in the cloud.

How to use

  • Clone or download the source from http://github.com/jcrisp/AzureBuildDeploy
  • Update the $serviceName at the top of build-package-deploy.ps1
  • Update the certificate details, and subscription id at the top of deploy.ps1
  • If you plan to use SqlAzure (as in my proof of concept), update the connection details in HelloWorldService.svc.cs. If you don’t plan to use SqlAzure, just stub out the whole FindFirstGreetingUsingSqlAzure() method by returning a string.
  • Test out deployment to the cloud (run build-package-deploy.ps1). You can ensure it is working using the sample client in the repository.
  • Now you’ve got everything working, replace the dummy WCF application with whatever you want.

Notes
In my experience, the deployment of a simple application via these scripts, Visual Studio or the console takes about 16 minutes, from start of deploy to the service able to accept clients. This is extremely slow – I hope it improves!

Workaround for Subversion (SVN) certificate verification error: insecure algorithm on Ubuntu 10.04 Lucid Lynx

If you try to check out your code from a hosted subversion repository, under your shiny new Ubuntu 10.04, you may be disappointed to have it fail with the error:

svn: OPTIONS of 'https://server.com/repo': Certificate verification error: signed using insecure algorithm (https://server.com/repo)

Despite multiple threads on various linux and subversion forums which didn’t really help (it’s not subversion’s fault, it’s from gnu-utils, and yes, it would be great if everyone could get all their hosting providers to upgrade their certificates, and you could patch and recompile relevant utils), I finally found a work around here in Slovak. With a bit of help from Google translate, here is the work around:

Add to the end of your ~/.subversion/servers file:
ssl-trust-default-ca = no

It means you’ll have to verify every certificate manually, but at least you’ll be able to check out your code until you can get your hosting provider to update their certificates! Happy days!

Page 3 of 18

Powered by WordPress & Theme by Anders Norén