Google

Functional Programming Example in Dart

For a quick reference.

At the time of writing (Feb 2014), the top results from a Google search on ‘Dart functional programming’ or ‘Dart list comprehension’ don’t immediately yield clear examples. That’s crazy given that Dart is such a boss language. So here’s an example:

// double all values
List myList = [1, 2, 3, 4];
List doubledList = myList.map((x) => x * 2);

You can do the standard map, reduce, filter on Iterables on Dart. Of course you can chain them up like other languages. Although it’s not strictly using the set building notation like in Python, you can still pretty much do everything so something like:

[x * 2 for x in myList if x % 2 == 0]

in Python would look like:

myList.where((x) => x % 2 == 0).map((x) => x * 2);

Validate and Format Addresses using Google API

Suppose you want to make some web app that lets users input addresses. I would be nice to

  1. Weed out minor misspelling
  2. Standardise format (proper capitalisation, abbreviated province/state or full name etc)
  3. Input in freeform but store civic number, street name, city etc separately
  4. Verify the address exists of course

Some governmental entities provide this information via public APIs but if you want a uniform service, why not use Google? Read More…

Google Android 1.6 Camera Exposure

While developing an image processing software on G1, we noticed that our pictures are constantly overexposed although the API seemed simple enough and that we don’t have that many parameters to play with. Especially at API level 4.

Turns out, we need to make use of Camera.autoFocus() to adjust metering from the G1. It’s a bit lame that we can’t set them separately…

Google Android T-Mobile G1 1.6 Phone Review

T-Mobile G1As a gadget enthousiast and as a mobile developer, here’s some thoughts on the Google Android HTC Dream / T-Mobile G1 phone at the time of Android 1.6 ‘Donut’

Physically, the phone can be said to be bordering normal phone size, creeping towards smartphone size. In the pocket, it takes less volume than your typical blackberry.

The trackball is a nice alternative input choice for those who prefer not using big hand gestures on the touchscreen. But its reliability can leave a bit to be desired. Scrolling fast is a bit of a trouble. The G1 tend to not be able to track as fast and sometimes the action of taking your thumb off or the action of clicking the trackball can cause undesired movements. Read More…

 Scroll to top