Tuesday, September 13, 2011

Debug with Android Source in your Android App

As a new Android developer, I discovered a tip that has helped me tremendously as I've worked on Saver, a savings planning application. To debug with Android source and Eclipse, install the following packages (usually via Help -> Install New Software...):

"http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update"

Restart Eclipse to complete the installation. Support is available (as of 09/13/2011) for Android versions ranging from 1.5 (Cupcake) to 2.3.4 (Gingerbread).

Wednesday, September 7, 2011

JUnit - Integrating Ant

I currently use Ant as my build tool for personal projects. It's easy and flexible enough for my needs.

The build.xml file I use for my template project is available here.

The general steps for the test task are are as follows:
1) Make a test report directory
2) Specify a property that serves as a match for tests
3) The junit task takes a variety of arguments
     fork - run tests in separate JVM
     printsummary - print a separate line for each test case
     haltonerror - halt the build if an error occurs during a test
     haltonfailure - halt the build if a test fails
4) Specify a formatter and whether or not to use file based output (I set it to false as I prefer to see the output at console initially)
5) Define a set of tests based on pattern matching
6) Define a classpath 

More information on the JUnit Ant Task is available here.
     

Saturday, September 3, 2011

Installing Ruby 1.9.2 and Rails 3.1.0 on Ubuntu 11.04

The following are the steps I take to install Ruby 1.9.2 and Rails 3.1.0 on a fresh install of Ubuntu 11.04:

# Update the package index
sudo apt-get update

# Install pre-reqs (Needs to be on a single line)
sudo apt-get install build-essential git-core curl build-essential bison openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf nodejs

# Install RVM (pre-reqs include git-core and curl)
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

# Reload .bashrc to gain access to RVM
. ~/.bashrc

# Install Ruby 1.9.2
rvm install 1.9.2

# Set Ruby 1.9.2 as default
rvm --default use 1.9.2

# Install Rails
gem install rails

# Install mysql2 gem (optional)
sudo apt-get install libmysqlclient16-dev
gem install mysql2

# Install pg gem (optional)
sudo apt-get install libpq-dev
gem install pg

Friday, September 2, 2011

About Patterns - Observer

The Observer pattern allows a developer to signal one or more objects when an object changes state (1:N). The Design Patterns text describes the interacting classes in the Observer pattern as a subject and its observers. The subject is under observation and when its state changes the observers are notified. This is also known as publish-subscribe.

A few things to consider with the Observer pattern:
  • The Observer pattern should be used when you either don't know how many objects need to be changed when the subject changes or an object needs to notify other objects without assuming too much about the other objects
  • Subject and observer are not tightly coupled in this situation so layering can remain intact
  • The subject can broadcast information to observers but can still add and remove observers at any time
More information including a sample implementation is available here.

Thursday, September 1, 2011

Strangeloop Conference Schedule

Here's my schedule for Strangeloop. I'll be attending mostly the web talks but also a few Android and FP talks.

Monday, September 19th, 2011

0730-0830 : Breakfast
0815-0830 : Welcome
0830-0920 : Category Theory, Monads, and Duality in (Big) Data
0930-1020 : Functional Thinking (Grand Ballroom)
1030-1120 : Building Applications with jQuery UI (Gateway 3)

1130-1300 : Lunch

1300-1350 : Airplane-Mode HTML5: Is your website mobile-ready? (Arch View)
1400-1450 : CoffeeScript, the Rise of "Build Your Own Javascript" (Lindbergh)
1530-1620 : Monads Made Easy (Grand Ballroom)
1630-1730 : We Don't Really Know How to Compute (Grand Ballroom, Keynote)
1930-2130 : Strange Loop Trivia Extravaganza (Grand Ballroom)

Tuesday, September 20, 2011

0730-0830 : Breakfast
0830-0920 : Core HTML5 Canvas: Mind-blowing Apps in Your Browser (Gateway 2)
0930-1020 : Taming Android (Arch View)
1030-1120 : A Tale of Two Runtimes (Gateway 3)

1130-1215 : Lunch

1215-1310 : Language Panel (Grand Ballroom)
1330-1420 : Product Engineering (Grand Ballroom)
1500-1600 : "Post-PC Computing" is not a Vision (Grand Ballroom)
1610-1710 : Simple Made Easy (Grand Ballroom)