January 21st, 2009
It took me long enough to realize that foldr still moves from the beginning to the end of a list. Somehow I thought it started at the right (i.e. the tail) of the list. Once I realized that Exercise 7 was easy:
Write your own definition of the standard takeWhile
function, first using explicit recursion, and then foldr.
Read the rest of this entry »
Posted in Haskell | 1 Comment »
January 21st, 2009
Probably not a coincidence, but all this lifecycle stuff reminds me of applets, albeit with somewhat more complicated argument lists and fancier names. There are certain patterns that show up again and again. Event listeners are one. Event loops are another. And life cycle methods are a third. Sometimes the trick to learning a new system is recognizing the old patterns in new language. Of course, this can trip you up badly when the pattern is something truly new, and when you try to fit it into old mental models. You can also get tripped up by assuming that certain contingent details are the same in the new instantiation of the pattern as in the old one.
The tab key doesn’t work like you’d expect–it doesn’t advance from one field to the next. I’m not sure if this is a limitation of the framework or just the sample app. This is completely irrelevant on a phone, but may become important if third parties start using the Android platform as a base for netbooks.
Too much copy and paste , and not enough thinking in the tutorial. I should try to work backwards from the sample app on the screen to understand where the different fields are coming from. Let’s see there are:
Read the rest of this entry »
Posted in Mobile | No Comments »
January 20th, 2009
Real World Haskell, Exercise 4, p. 98:
The asInt_fold
function uses error
, so its callers cannot handle errors. Rewrite it to fix this problem.
Read the rest of this entry »
Posted in Haskell | 4 Comments »
January 20th, 2009
Perhaps just because it’s an initial tutorial, but the event handling model feels like a sort of monolithic Java 1.0/Mac OS 6 event loop rather than the more flexible event listener based approaches of Swing and other more modern GUI frameworks.
Local variable access is much more efficient than field access in the VM. I guess the CPU (or battery) is too underpowered to do fancy JIT tricks, as I’d expect a good optimizer to account for this. Worth remembering. Hmm, does Dalvik even have a just-in-time compiler? Apparently not.
Read the rest of this entry »
Posted in Mobile | No Comments »
January 19th, 2009
There’s a tab character in the Notepadv1.java sample file. Tab characters should not be used.
Android has an embedded SQL database, Useful.
I wish XML layout files would open in XML view by default rather than layout view.
The tutorial is a little flaky with XML terms. It’s an XML declaration, not an “XML header”.
Some things that look like XPath expressions at first glance, aren’t.
Trying to read a tutorial in one window and use Eclipse in the other is painful. Maybe if I put my laptop on the desk?
The tutorial’s naming conventions aren’t following Java standards. Someone likes to put “m” in front of all the instance fields.
XML localization and UI construction: nice.
Read the rest of this entry »
Posted in Mobile | No Comments »
January 18th, 2009
Had to upgrade to Eclipse 3.4.1 to to get the SDK working. No big deal.
Hello World is now running. The emulator took a while to start up.
“Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.” Oh well, it’s just an emulator. No big deal.
It is nice that the emulator works well on a Mac.
Posted in Mobile | 2 Comments »