Page 478 shows the "ADT" for a queue. I tend to read the code and skim the comments, given that I've been fooled more than once by out-of-date comments. I was therefore confused by the "addQueue" method. My first take was that it did what it said, e.g., added a queue to the existing queue. Going back through the comments, however, I found that it really was an "enQueue" operation.
When I looked up the STL syntax, I found that it uses push/pop (which I associate with stacks, not queues). In any case, it just seems confusing to use the name "addQueue" for this functionality.
See also other errata.
Friday, January 11, 2013
Are there any human proofreaders left?
"Watership Down" by Richard Adams, Scribner trade paperback edition 2005, page 14:
I daresay a good many rabbits would have kept quite and thought about keeping on the right side of the Chief...
Saturday, November 28, 2009
Adding RSS feeds in Google Chrome
Whilst in Google Chrome, I tried clicking on an RSS feed icon in Craigslist and was rewarded with a bunch of XML. To avoid figuring out which piece I needed to add a feed to Google Reader, I did the following:
- Went into Firefox
- Clicked on the RSS icon
- For "Subscribe to this feed using:", I clicked on Google
- Then clicked on "Add to Google Reader"
I haven't verified that this actually worked, so I may have to go back and wrestle with the XML, but I'm hoping I don't.
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.
Subscribe to:
Posts (Atom)