Sunday, October 25, 2009

Google Android ArrayAdapter vs SimpleCursorAdapter

I've been trying to create a "mover" interface in Android. I use the term "mover" to describe a interface displaying two lists where you can move items from one list to the other. This can be done with arrow buttons if you have enough screen real estate, but I don't think that will work on the small screen of a cell phone.

In any case, my first attempt contained two ListViews, one with an ArrayAdapter of Strings, the other with a SimpleCursorAdapter. For reasons which I haven't yet figured out, the items in one list were a different font size than in the other list. The SimpleCursorAdapter font size was smaller than the ArrayAdapter. I tried a number of changes in the layout file (e.g., changing weights and such), but none of them worked.

I ended up reworking my data storage so that I could use SimpleCursorAdapters for both ListViews, and the font sizes matched. I'm guessing that the Adapters (which I consider the "Controller" in the model-view-controller paradigm) are making some decisions "behind the scenes".

Onward to the next Android mystery...

Wednesday, October 21, 2009

The More Things Change...

I went to the StackOverflow DevDay in San Francisco on Monday. Lots of information, most of it useful. Mark Harrison's presentation where he "deconstructed" a Peter Norvig Python script gave me a few new pointers about Python. It also got me to thinking about list comprehensions, specifically the "why"? Performance? Possibilities for parallelization?

This morning's Google search was, therefore:

Python "List Comprehension" advantages

which turned up this:


He mentions performance (as well as parallelization):
Simple for loops implemented in python are handled by the interpreter, and are slow. List comprehensions and map() have a in-built, fast, internal C implementation which does away with the overhead of the for loop.
Good to know about, but mildly ironic in that it leads back to C code for performance. The 70's meet the 00's.

Monday, September 7, 2009

I miss my Java 1.5

I've been experimenting with the Blackberry development environment for the last couple of weeks.

On the plus side, it's great that:
  • It's a free download.
  • It integrates with Eclipse.
  • It provides emulators for various Blackberry models.
On the flip side:
  • I hit a problem using Subversion that I was never able to figure out (and no one posted any answers to my question on the Blackberry forum). I ended up doing a "dual-directory structure" kludge that allows me to continue development, but it's a klumsy kludge.
  • I miss some of the features from "contemporary" Java. The Blackberry system offers Java J2ME 1.2, which doesn't include features like String.split and reflection. I'm working around these issues, but I'm not sure what else I'll hit as I continue.
  • There are some anomalies with getting the sizes of controls such as edit fields and buttons. I'll figure it out eventually, but it's getting in the way of making my app portable to non-Storm Blackberry models.

Friday, August 28, 2009

"SQL for Smarties" Errata (part 1)

I need to learn more about SQL, and someone I respect recommended Joe Celko's book. I've been delving into it over the past few weeks. I'm learning a lot, but have hit a few typographical errors. Give the size of the book, it's not surprising. I would still (even given these errors) recommend this book for someone who has a good knowledge of SQL and wants to learn more. I would, however, caution them to run the SQL examples themselves to verify that the syntax is correct.

Here is the first set of errata. If any of these seem incorrect, don't hesitate to post a correction to my correction.

Code typos:

Page 73:
One of the "course_name" columns should be "course_code"
Page 461:
Condition "AND P2.salary_amt < P1.salary_amt" gives bottom n salaries, not top n.
Page 741:
I can't parse the example "color || = 'Purply Green')". I think it should be "color || '' = 'Purply Green')"
Page 746:
The two SELECT examples are inconsistent. One has a CAST operator and the other doesn't.

Non-code typos:

Page 33, bottom sentence:
"correction" -> "correct"

Monday, July 27, 2009

Technology for Education and Entertainment

I hadn't had an eye exam in a couple of years, and my doctor has recommended once a year. I made an appointment at the UC Berkeley Optometry Center and showed up at the appointed hour.

To show the eye charts, they now use a flat screen connected to a Windows computer instead of a projector. In the middle of the exam the screen saver kicked in and the screen went black! I just started laughing. The intern was relieved that I found it funny instead of vexing. I actually looked at her computer to see if I could fix it. The screen saver interval was locked down, however, so I left it up to her and their IT department.

They decided to take pictures of the insides of my eyes. It added a little to the fee, but (after I asked) they said they could email the pictures to me. To take the pictures, they had a device made by Canon with a digital camera back (that was then connected to a computer). They tried a couple of times, but couldn't get the picture to show up on the computer. They then called the tech guy. He just unplugged the camera from the computer, plugged it back in, turned off the camera and the device and turned them both back on. And it all worked.

I could have done that!

Monday, June 29, 2009

Is someone gaming Google "Web Clips"?

In GMail today, I noticed that the "web clip" at the top of the list of emails just said:

Dictionary.com Word of the Day - Presented By: - 18 hours ago

Unclear as to what that meant, I clicked on it, and found myself on what looked like a cleverly-disguised ad for one of these "work-at-home" marketing scams, complete with misspellings:

"We knew we had to do something, so we put our heads together and started trying online job opporuntities."

Can we trust Web Clips any more?


Tuesday, June 9, 2009

AOL to Google "conversion" project

I know a couple of folks who are still using AOL as their email (and contact and favorites) service. Some of them are receptive to moving to Google, so I've started working on helping them. A few weeks ago I actually put together a "business plan" for a service that would provide this functionality:

http://docs.google.com/Presentation?id=dgjndsm4_0c68v7vcn

In the meantime, however, Google came out with their conversion service:

http://gmailblog.blogspot.com/2009/05/import-your-mail-and-contacts-from.html

It's not complete, but it's free, and thus that business plan hits the dust. I am, however, going to continue my efforts to help folks that do want to move their data from AOL to Google:

http://www.chriskeith.me/ck/Home/overview

I probably won't be updating this blog with every change that goes here, but will occasionally mention significant milestones. Feel free to pass this on to anyone that uses AOL (if you actually know anyone who does...) but wants to move to Google.