<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5650062946095888903</id><updated>2011-10-07T14:06:11.685-07:00</updated><category term='flash'/><category term='xml'/><category term='encrypt'/><category term='ecmascript'/><category term='ibex'/><category term='apple'/><category term='security'/><category term='mac'/><category term='passwords'/><category term='pptp'/><category term='mtu'/><category term='xslt'/><category term='adobe'/><category term='ubuntu'/><title type='text'>two bit fool</title><subtitle type='html'>my brand of crazy only costs 25 cents</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-4627022956708316692</id><published>2010-11-02T23:43:00.000-07:00</published><updated>2010-11-02T23:43:46.702-07:00</updated><title type='text'>what is software engineering?</title><content type='html'>It is rare to come across a conference video that talks about the history of the technology and craft of building software. &lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://confreaks.net/videos/282-lsrc2010-real-software-engineering"&gt;http://confreaks.net/videos/282-lsrc2010-real-software-engineering&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This talk gives an interesting look at the history of the software industry, and talks about how the waterfall method -- now widely regarded as a failure -- was inspired by a gross misreading of a paper that was  trying to explain why such a ridiculous method would never work. As a bonus, you can have a good cry when you learn that Agile methods were being discussed decades ago, until they were pushed aside by broken academic theories, like waterfall.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-4627022956708316692?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/4627022956708316692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2010/11/what-is-software-engineering.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/4627022956708316692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/4627022956708316692'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2010/11/what-is-software-engineering.html' title='what is software engineering?'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-2860299023245932570</id><published>2010-06-15T04:29:00.000-07:00</published><updated>2010-06-15T04:29:13.019-07:00</updated><title type='text'>book review: coders at work</title><content type='html'>I just finished &lt;a target="_blank"  href="http://www.amazon.com/Coders-at-Work-Peter-Seibel/dp/1430219483?ie=UTF8&amp;tag=betterthansim-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969"&gt;Coders at Work&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=betterthansim-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=1430219483" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important; padding: 0px !important" /&gt; this past weekend, and it was a everything that &lt;a href="http://two-bit-fool.blogspot.com/2010/02/book-review-beautiful-code.html"&gt;Beautiful Code&lt;/a&gt; wasn't.&lt;br /&gt;
&lt;br /&gt;
The concept is simple: Peter Seibel sat down with 15 different programmers (including such greats as Brendan Eich, and Don Knuth) and asked them the kind of questions that a fellow developer would ask. The interviews were insightful, and in-depth: giving a glimpse into the history of each person, and exploring their personal views on everything from the dangers of C to the usefulness of debugging tools more advance than simple print statements.&lt;br /&gt;
&lt;br /&gt;
Software is often a solitary and opaque profession, and this is the next best thing to personally sitting down with these computer legends to pick their brains. If you are involved in software development (programmer, architect, analyst, whatever), &lt;b&gt;I highly recommend this book&lt;/b&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-2860299023245932570?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/2860299023245932570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2010/06/book-review-coders-at-work.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/2860299023245932570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/2860299023245932570'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2010/06/book-review-coders-at-work.html' title='book review: coders at work'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-7658319331518031604</id><published>2010-03-13T12:11:00.000-08:00</published><updated>2010-03-13T12:14:26.827-08:00</updated><title type='text'>iPhone app economics: HTML5 vs native</title><content type='html'>&lt;p&gt;I don't develop iPhone apps, but I found &lt;a href="http://www.quirksmode.org/blog/archives/2010/03/the_payment_arg.html"&gt;Peter-Paul Koch's article&lt;/a&gt; so ridiculous that I decided to respond. He tries to make the case that there is no money in developing native apps for the iPhone, and he recommends making HTML5 apps instead.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;In the article, he suggests that iPhone app developers fall into 3 buckets:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;paid by clients&lt;/li&gt;
&lt;li&gt;don't care about the money&lt;/li&gt;
&lt;li&gt;lone guns expecting to get rich&lt;/li&gt;
&lt;/ol&gt;&lt;/p&gt;&lt;p&gt;But this is an artificial division, it's not about the developers, it's about the economics of the apps -- what matters is how much money the app makes, not the developer. An app that doesn't make enough money to pay for the development (and ongoing costs) is a failure, or a hobby. Whether you are a lone developer or paid by someone else, making apps that lose money is bad business. The real question is...&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;&lt;b&gt;If the goal is to make money selling an iPhone app, which one will have better profit margins: a native app or an HTML5 app?&lt;/b&gt;&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;The thing that Apple has done exceedingly well is to make the process of finding, purchasing, and installing an app dead simple. This is in stark contrast to an HTML5 app -- as Peter-Paul says:&lt;br /&gt;
&lt;/p&gt;&lt;blockquote&gt;The counter-argument is that the HTML5 app route doesn't allow developers to get paid. That's true -- for now.&lt;br /&gt;
&lt;/blockquote&gt;&lt;p&gt;He makes some wild guesstimates on the economics of the app store -- numbers that don't agree with &lt;a href="http://gigaom.com/2010/01/12/the-apple-app-store-economy/28"&gt;what other people have found&lt;/a&gt; -- to show that there isn't much money in distributing apps through the App Store...&lt;b&gt;but compared to what?!?&lt;/b&gt; He says that an HTML5 app is a better option &lt;a href="http://en.wikipedia.org/wiki/Fait_Accompli"&gt;a fait accompli&lt;/a&gt;, but he makes no attempt to calculate the economics of it. Even &lt;i&gt;if&lt;/i&gt; he could successfully discredit the idea of making money on native iPhone apps, that doesn't automatically make HTML5 apps a better option.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;If you ever wondered what &lt;a href="http://en.wikipedia.org/wiki/Confirmation_bias"&gt;confirmation bias&lt;/a&gt; looks like, this quote is from the start of his article (emphais mine):&lt;br /&gt;
&lt;/p&gt;&lt;blockquote&gt;In response to my HTML5 apps argument a few people came back to how the payment thingy is missing from my idea, and how it will (apparently) be worthless because of that. I've been thinking about that a lot in the past few days, and &lt;b&gt;I'm increasingly of the opinion that the payment argument is nonsense.&lt;/b&gt;&lt;br /&gt;
&lt;/blockquote&gt;&lt;p&gt;I'm a proponent of open standards and platforms, and I hope a day will come when developers can make money without making native iPhone apps. But that idealism is tempered by the reality of the present, and Mr Koch has given &lt;b&gt;no compelling evidence that HTML5 apps would make a better profit than a native iPhone app&lt;/b&gt;. At best, he's made the case that iPhone app development might not make enough money for the lone developer, and that is a risk for any type of software development.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;HTML5 apps have tough competition on the iPhone, because in general, native apps:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;are more performant&lt;/li&gt;
&lt;li&gt;work better offline&lt;/li&gt;
&lt;li&gt;leverage iPhone capabilities (camera, gps, etc)&lt;/li&gt;
&lt;li&gt;are easy to find, buy, and install&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;&lt;p&gt;The internet has a culture of freedom, and with such a variety of free services, consumers don't often need to pay for online applications -- most are supported by advertising dollars or hoping for the big buyout. However, like most iPhone/iPod Touch users, I have no problem dropping a few bucks in the App Store jar from time to time. Apple has created an environment where it is easy to buy apps, and when it is easy and inexpensive, people don't mind paying -- the same lesson that iTunes taught us about music. If purchasing apps online was as simple as the App Store, people would be more willing to pay, and services would be more willing to charge.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;So, if someone wants to make the case for HTML5 apps, develop an app both ways (HTML5 and native), track the costs and revenue, and let's compare some &lt;i&gt;real&lt;/i&gt; numbers.&lt;br /&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-7658319331518031604?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/7658319331518031604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2010/03/iphone-app-economics-html5-vs-native.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/7658319331518031604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/7658319331518031604'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2010/03/iphone-app-economics-html5-vs-native.html' title='iPhone app economics: HTML5 vs native'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-4778778716728356489</id><published>2010-02-19T06:54:00.000-08:00</published><updated>2010-02-19T07:02:03.819-08:00</updated><title type='text'>screen resolutions...is 1024 the standard?</title><content type='html'>&lt;p&gt;
While trying to figure out if it was still important to support screen resolutions of 800x600, I pulled up several of the most visited websites to see where they fall. Here are the ones that work in a width of 800 or less:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;baidu&lt;/li&gt;
&lt;li&gt;blogger&lt;/li&gt;
&lt;li&gt;go&lt;/li&gt;
&lt;li&gt;google (also: gmail, google calendar, google reader)&lt;/li&gt;
&lt;li&gt;rapidshare&lt;/li&gt;
&lt;li&gt;skyrock&lt;/li&gt;
&lt;li&gt;twitter&lt;/li&gt;
&lt;li&gt;wikipedia&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
And here are the sites that aim for 1024px and require horizontal scrolling at 800px:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;amazon&lt;/li&gt;
&lt;li&gt;aol&lt;/li&gt;
&lt;li&gt;bbc&lt;/li&gt;
&lt;li&gt;bing (aka live.com)&lt;/li&gt;
&lt;li&gt;cnn&lt;/li&gt;
&lt;li&gt;craigslist&lt;/li&gt;
&lt;li&gt;dailymotion&lt;/li&gt;
&lt;li&gt;ebay&lt;/li&gt;
&lt;li&gt;facebook&lt;/li&gt;
&lt;li&gt;flickr&lt;/li&gt;
&lt;li&gt;friendster&lt;/li&gt;
&lt;li&gt;imdb&lt;/li&gt;
&lt;li&gt;linkedin&lt;/li&gt;
&lt;li&gt;microsoft&lt;/li&gt;
&lt;li&gt;msn&lt;/li&gt;
&lt;li&gt;myspace&lt;/li&gt;
&lt;li&gt;orkut&lt;/li&gt;
&lt;li&gt;photobucket&lt;/li&gt;
&lt;li&gt;wordpress&lt;/li&gt;
&lt;li&gt;yahoo&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
And &lt;a href="http://www.w3schools.com/browsers/browsers_display.asp"&gt;w3schools says&lt;/a&gt; it is at about 1% for their visitors. Sure seems like support for 800px wide displays has gone out of style. Guess those iPads will spend most of their time turned sidways.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-4778778716728356489?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/4778778716728356489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2010/02/screen-resolutionsis-1024-standard.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/4778778716728356489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/4778778716728356489'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2010/02/screen-resolutionsis-1024-standard.html' title='screen resolutions...is 1024 the standard?'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-76761780960672123</id><published>2010-02-18T07:25:00.000-08:00</published><updated>2010-02-18T07:37:52.290-08:00</updated><title type='text'>removing a file when the filename starts with a dash</title><content type='html'>When you royally goof up a command, you may end up with some strange filenames.
 
&lt;div class="highlight"&gt;&lt;pre&gt;
&lt;span class="nv"&gt;$ echo "hi" &gt; -oops.txt&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

And filenames that start with a dash can be tricky to delete.

&lt;div class="highlight"&gt;&lt;pre&gt;
&lt;span class="nv"&gt;$ rm -oops.txt&lt;/span&gt;
&lt;span class="nv"&gt;$ rm \-oops.txt&lt;/span&gt;
&lt;span class="nv"&gt;$ rm "-oops.txt"&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

All the above commands treat the -o as an option, and return the following error: &lt;b&gt;rm: invalid option -- 'o'&lt;/b&gt;. Luckily, Ubuntu returns some extra help in the error message.

&lt;div class="highlight"&gt;&lt;pre&gt;
rm: invalid option -- 'o'
Try `rm ./-oops.txt' to remove the file `-oops.txt'.
Try `rm --help' for more information.
&lt;/pre&gt;&lt;/div&gt;

So all you need is a path on the front of that nasty filename.

&lt;div class="highlight"&gt;&lt;pre&gt;
&lt;span class="nv"&gt;$ rm ./-oops.txt&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-76761780960672123?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/76761780960672123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2010/02/removing-file-when-filename-starts-with.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/76761780960672123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/76761780960672123'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2010/02/removing-file-when-filename-starts-with.html' title='removing a file when the filename starts with a dash'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-3831960951364942720</id><published>2010-02-17T18:04:00.000-08:00</published><updated>2010-02-17T18:43:34.737-08:00</updated><title type='text'>book review: designing visual interfaces</title><content type='html'>&lt;p&gt;
&lt;a href="http://www.amazon.com/gp/product/0133033899?ie=UTF8&amp;tag=betterthansim-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0133033899"&gt;Designing Visual Interfaces: Communication Oriented Techniques&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=betterthansim-20&amp;l=as2&amp;o=1&amp;a=0133033899" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /&gt;
&lt;/p&gt;
&lt;p&gt;
This book gives (what I can only assume is) a thorough treatment of the design of visual interfaces, with a focus on computer interfaces. I can only assume it is thorough because I skipped or stumbled over several sections with dense and confusing wording. For example:
&lt;/p&gt;
&lt;blockquote&gt;
The triadic structure of the sign permits the sign process (semiosis) to be considered at three levels. Syntactics addresses the internal structure of the representamen itself, particularly in terms of the relationships among its parts. Semantics addresses the tacit relation between representamen and sign object (that is, the intended meaning of the sign). Pragmatics considers the effect of the syntactic and semantic aspects in relation to a particular interpreter in their personal psychological context. 
&lt;/blockquote&gt;
&lt;p&gt;
There were plenty of gems in this book, and the way illustrations (and screenshosts) were employed to explain the different concepts was very useful. However, the style of the writing often made it unpleasant to read, and I came away feeling like I had missed as much as I had learned.
&lt;/p&gt;
&lt;p&gt;
The thoughts I came away with:
&lt;ul&gt;
&lt;li&gt;be consistent with the surroundings (OS, app, form, controls, etc)&lt;/li&gt;
&lt;li&gt;align elements along vertical horizontal grid lines&lt;/li&gt;
&lt;li&gt;use the same (or multiples of) height and width for all controls&lt;/li&gt;
&lt;li&gt;make clear visual representations of grouping and hierarchy&lt;/li&gt; 
&lt;/ul&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-3831960951364942720?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/3831960951364942720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2010/02/book-review-designing-visual-interfaces.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/3831960951364942720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/3831960951364942720'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2010/02/book-review-designing-visual-interfaces.html' title='book review: designing visual interfaces'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-2729969929689209210</id><published>2010-02-14T17:38:00.000-08:00</published><updated>2010-02-14T18:04:38.303-08:00</updated><title type='text'>book review: beautiful code</title><content type='html'>&lt;p&gt;
It's always disappointing when a book with such a great potential falls short, and sadly &lt;a href="http://www.amazon.com/gp/product/0596510047?ie=UTF8&amp;tag=betterthansim-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596510047"&gt;Beautiful Code: Leading Programmers Explain How They Think (Theory in Practice (O'Reilly))&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=betterthansim-20&amp;l=as2&amp;o=1&amp;a=0596510047" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /&gt; is a victim of a great idea with a poor execution.
&lt;/p&gt;
&lt;p&gt;
The basic idea was to get a bunch of great programmers together and have them tell stories about their experiences in the real world: developing a new system, learning the value of reading other people's code, squeezing every ounce of performance out of some critical code, or being inspired to implement some clever new algorithm. This would had worked wonderfully if they had just limited the number of people that contributed to the book. Instead they crammed over 30 people into 500 plus pages, and ended up with about 16 pages each. 
&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;
This book tried to soar to such great heights and suffered the fate of Icarus. If only they had picked 10 programmers and given them each 50 pages, this could have been a book with some real meat. Instead the brief chapters feel like a series of taste tests collected while wandering around the supermarket -- too brief and unsatisfying to call a meal. Sorry, but this one is &lt;span style="font-weight:bold;"&gt;not worth reading&lt;/span&gt;.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-2729969929689209210?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/2729969929689209210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2010/02/book-review-beautiful-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/2729969929689209210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/2729969929689209210'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2010/02/book-review-beautiful-code.html' title='book review: beautiful code'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-710865910174750595</id><published>2009-11-12T06:04:00.000-08:00</published><updated>2009-11-12T06:45:34.547-08:00</updated><title type='text'>sudo PATH fix for Ubuntu</title><content type='html'>&lt;div class="alignright" style="float: right; margin-left: 10px; margin-right: 10px;"&gt;&lt;img src="http://farm1.static.flickr.com/8/7340412_2db9809b94_m.jpg" alt="angry cat" width="240" height="180"&gt;
&lt;div class="photo-credit"&gt;Photo by &lt;a href="http://www.flickr.com/photos/gumuz/"&gt;gumuz&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;&lt;b&gt;&lt;a href="http://www.modrails.com/"&gt;Passenger&lt;/a&gt;&lt;/b&gt; is fantastic way to run Rails apps. The installation is nothing short of awe inspiring, and the thing &lt;b&gt;just works&lt;/b&gt;. If you are using Rails, you should be using it along with &lt;a href="http://www.rubyenterpriseedition.com/"&gt;Ruby Enterprise Edition&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Rails deployments used to be a nasty mix of different software with configuration nightmares that would make a sysadmin weep. The Phusion folks deserve a huge round of applause, and some donations on their very funny &lt;a href="http://www.modrails.com/enterprise.html"&gt;"Enterprise License" page&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;sudo PATH bug in Ubuntu&lt;/h2&gt;
&lt;p&gt;The only annoyance I've had, and this is no fault of Passenger, is with running the passenger-status tool. It requires some extra permissions, but running it with sudo does not work "out of the box."&lt;/p&gt;

&lt;!----------------- start of formatted created by pygmentize -----------------&gt;
&lt;!-- original shell code
$passenger-status
Permission denied

$sudo passenger-status
sudo: passenger-status: command not found--&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="nv"&gt;$passenger-status&lt;/span&gt;
Permission denied

&lt;span class="nv"&gt;$sudo passenger-status&lt;/span&gt;
sudo: passenger-status: command not found
&lt;/pre&gt;&lt;/div&gt;
&lt;!-----------------  end of formatted created by pygmentize  -----------------&gt;


&lt;p&gt;The problem here is that although I've modified my PATH to include the path to the passenger-status command (/opt/ruby-enterprise/bin), my PATH does not include it when using sudo. A quick glance at the sudoers man file reveals the &lt;b&gt;env_keep&lt;/b&gt; option, but this &lt;a href="https://bugs.launchpad.net/ubuntu/+source/sudo/+bug/50797"&gt;totally&lt;/a&gt; &lt;a href="https://bugs.launchpad.net/ubuntu/+source/sudo/+bug/192651/"&gt;doesn't&lt;/a&gt; &lt;a href="https://bugs.launchpad.net/ubuntu/+source/sudo/+bug/226595"&gt;work&lt;/a&gt; on ubuntu.&lt;p&gt;

&lt;h2&gt;the "fix"&lt;/h2&gt;

&lt;p&gt;The &lt;a href="http://stackoverflow.com/questions/257616/sudo-changes-path-why"&gt;workaround&lt;/a&gt; for this bug is incredibly low-tech, but works like a champ. Just add the following line to your .bashrc file.

&lt;div class="highlight"&gt;&lt;pre&gt;
alias sudo='sudo env PATH=$PATH'
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;To test it without logging out and back in, just reload that file...

&lt;div class="highlight"&gt;&lt;pre&gt;
source ~/.bashrc
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Not pretty, but it does the job.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-710865910174750595?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/710865910174750595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2009/11/sudo-path-fix-for-ubuntu.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/710865910174750595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/710865910174750595'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2009/11/sudo-path-fix-for-ubuntu.html' title='sudo PATH fix for Ubuntu'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm1.static.flickr.com/8/7340412_2db9809b94_t.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-8840836800343618418</id><published>2009-08-28T20:25:00.001-07:00</published><updated>2009-08-28T20:25:36.613-07:00</updated><title type='text'>syntax and style of programming languages</title><content type='html'>When picking a programming language, there are several factors to consider:

&lt;ul&gt;
  &lt;li&gt;syntax/style&lt;/li&gt;
  &lt;li&gt;supported platforms&lt;/li&gt;
  &lt;li&gt;previous experience with the language&lt;/li&gt;
  &lt;li&gt;size of and activity of the community &lt;/li&gt;
  &lt;li&gt;language features, libraries and frameworks&lt;/li&gt;
  &lt;li&gt;how well it fits the problem domain&lt;/li&gt;
  &lt;li&gt;dynamic/static typing&lt;/li&gt;
  &lt;li&gt;&lt;i&gt;and much more...&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;b&gt;The style and syntax of the language has a big impact on the decision
when picking a new language&lt;/b&gt;, more so than the overall constructs of the
language. A developer is much more likely to accept a language with a similar
syntax -- if you want to test that theory, ask a ruby developer to pick between
smalltalk and python.
&lt;br&gt;&lt;br&gt;

Style and syntax are important for a few reasons:

&lt;ol&gt;
  &lt;li&gt;efficiency of writing code&lt;/li&gt;
  &lt;li&gt;how easily it can be: read, understood, and maintained&lt;/li&gt;
  &lt;li&gt;effect to the structure and design of the program&lt;/li&gt;
&lt;/ol&gt;

Some of these choices have been made by the language designers through the
syntax, and others have been made by the community that uses the language.
If you want to have code that is maintainable, it has to be easily read and
understood, and &lt;b&gt;style/syntax has a big impact on the readability your
of code&lt;/b&gt;.

&lt;h2&gt;examples&lt;/h2&gt;

Let's take a look at some JavaScript (v1.5):

&lt;!----------------- start of formatted created by pygmentize -----------------&gt;
&lt;!-- original javascript code
function allGreetings(people) {
  var firstName, lastName, message, person;
  var greetings = [];
  for(var i = 0; i &lt; people.length; i++){
    person = people[i];
    name = person.firstName() + ' ' + person.lastName();
    if (person.isBirthday()) {
      greetings.push("Happy Birthday, " + name);
    } else {
      greetings.push("Have a Great Day, " + name);
    }
  };
  return greetings;
}
--&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;allGreetings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;people&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;firstName&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;lastName&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;greetings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;people&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;person&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;people&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39; &amp;#39;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isBirthday&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;greetings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Happy Birthday, &amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;greetings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Have a Great Day, &amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;greetings&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;!-----------------  end of formatted created by pygmentize  -----------------&gt;


There are certain elements of this code that are required by the language:
the "function" and "return" keywords, the curly braces, and the parenthesis
on function calls. However some things -- like the camelCase names and
whitespace -- are the style elements that have been generally adopted by
the javascript community.
&lt;br&gt;&lt;br&gt;

Let's take a look at the same code written in Ruby:

&lt;!----------------- start of formatted created by pygmentize -----------------&gt;
&lt;!-- original ruby code
def all_greetings(people)
  people.map do |person|
    name = "#{person.first_name} #{person.last_name}"
    if person.birthday?
      "Happy Birthday, #{name}"
    else
      "Have a great day, #{name}"
    end
  end
end--&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;all_greetings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;people&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;people&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
    &lt;span class="nb"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;first_name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;last_name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;birthday?&lt;/span&gt;
      &lt;span class="s2"&gt;&amp;quot;Happy Birthday, &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nb"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;
      &lt;span class="s2"&gt;&amp;quot;Have a great day, &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nb"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;!-----------------  end of formatted created by pygmentize  -----------------&gt;

This comparison is not intended to &lt;i&gt;pick on&lt;/i&gt; JavaScript, but the Ruby
version has some clear wins: such as the "map" method, and implicit return.
&lt;b&gt;Most people would agree that the Ruby syntax is "cleaner"&lt;/b&gt; or "easier to read"
-- and a lot of that comes from the decrease in the amount of punctuation
(semicolons, curly braces, and parenthesis).

&lt;blockquote&gt;
&lt;b&gt;Note:&lt;/b&gt; there a lot of different ways
that we could write each of the above examples to help improve the style,
but I think that each of these generally reflects the style of code typically
written in each language.
&lt;/blockquote&gt;


There is plenty of debate about syntax and style, so let me fan the flames
with my wild claims about what makes for better style...

&lt;h2&gt;camelCase sucks&lt;/h2&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;
someLanguagesLikeJavaHaveAdoptedTheCamelCaseStyle
doYouFindThisStyleOfNamingEasyToRead
&lt;/pre&gt;&lt;/div&gt;

The only advantage that I can see for using camelCase naming is fewer
characters. Otherwise, it's generally harder to read, and there is
confusion about what to do with acronymns in the name -- should they
be TitleCase or ALLUpperCase? &lt;b&gt;I'm looking at you, XMLHttpRequest!!!&lt;/b&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;
languages_such_as_ruby_use_underscores_instead
but_fall_into_the_camel_case_trap_with RubyClassAndModuleNames
&lt;/pre&gt;&lt;/div&gt;

Need I say more?

&lt;h2&gt;use punctuation sparingly&lt;/h2&gt;

Punctuation is a powerful and terse tool. Imagine writing a book with only a
single non-alphanumeric character...

&lt;blockquote&gt;Wouldn#apostrophe#t it be tough#end of sentence# You could use
the special character to start and end #quote# blocks #quote# with special
meaning #ellipsis#
&lt;/blockquote&gt;
&lt;blockquote&gt;
###or you would have to assume that the punctuation had
different meanings# based on its context # which would be ambiguous# right#
&lt;/blockquote&gt;

If you rely too heavily on a small set of punctuation, you get Lisp:

&lt;div class="highlight"&gt;
&lt;pre&gt;
((defmethod problem-successors ((prob binary-tree-problem) state)
 (let ((n (* 2 state)))
   (list n (+ n 1)))))
&lt;/pre&gt;
&lt;/div&gt;

So, we clearly need a little variety in the punctuation, but if we overuse it
(&lt;i&gt;cough...Perl...cough&lt;/i&gt;) we will write code that we have almost no hope
of understanding a few weeks later. How long does it take to figure out
what the following code does?

&lt;!----------------- start of formatted created by pygmentize -----------------&gt;
&lt;!-- original perl code
#!/usr/local/bin/perl

$count = 0;
while (&lt;stdin&gt;) {
    @w = split;
    $count++;
    for ($i=0; $i&lt;=$#w; $i++) {
 $s[$i] += $w[$i];
    }
}

for ($i=0; $i&lt;=$#w; $i++) {
    print $s[$i]/$count, "\t";
}

print "\n";

--&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="c1"&gt;#!/usr/local/bin/perl&lt;/span&gt;

&lt;span class="nv"&gt;$count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s-Regexp"&gt;&amp;lt;stdin&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;@w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;split&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;$count&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="nv"&gt;$#w&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nv"&gt;$s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nv"&gt;$w&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="nv"&gt;$#w&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="nv"&gt;$s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;$count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;\t&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;!-----------------  end of formatted created by pygmentize  -----------------&gt;



&lt;h2&gt;language keywords&lt;/h2&gt;

Most keywords in a language will be used a lot, and should be kept short
because they will be typed so often. For example:
&lt;b&gt;def&lt;/b&gt; is better than
&lt;b&gt;function&lt;/b&gt; and
&lt;b&gt;var&lt;/b&gt; is better than
&lt;b&gt;local.&lt;/b&gt;
&lt;br&gt;&lt;br&gt;

And if you are using a dynamic language (which you should be, by the way),
it's also better if your keywords can be runnable commands that obey the same
rules as the rest of the code. For example, many languages have a way to import
an external library. However that is usually a compile-time feature of the
language.
&lt;br&gt;&lt;br&gt;

Let's look at importing in Python:
&lt;!----------------- start of formatted created by pygmentize -----------------&gt;
&lt;!-- original python code
# here we can use "import"
import SomeLibrary

# but here we have to call "__import__"
module_name = "SomeLibrary"
module = __import__(module_name)
--&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="c"&gt;# here we can use &amp;quot;import&amp;quot;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;SomeLibrary&lt;/span&gt;

&lt;span class="c"&gt;# but here we have to call &amp;quot;__import__&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;module_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;SomeLibrary&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;module&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;__import__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;module_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;!-----------------  end of formatted created by pygmentize  -----------------&gt;

And in Ruby:
&lt;!----------------- start of formatted created by pygmentize -----------------&gt;
&lt;!-- original ruby code
# because require takes a string
require "foo"

# it works when passed a variable containing a string
mod = "foo"
requrie mod--&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="c1"&gt;# because require takes a string&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;

&lt;span class="c1"&gt;# it works when passed a variable containing a string&lt;/span&gt;
&lt;span class="n"&gt;mod&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;requrie&lt;/span&gt; &lt;span class="n"&gt;mod&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;!-----------------  end of formatted created by pygmentize  -----------------&gt;

&lt;h2&gt;conclusion&lt;/h2&gt;

I've only scratched the surface here, but it should give some sense for the
importance that a language's syntax (and style) have on writting readable code.
&lt;br&gt;&lt;br&gt;


There are an outrageous number of programming languages, with more popping up
all the time, and with this variety of languages comes a
&lt;a href="http://merd.sourceforge.net/pixel/language-study/syntax-across-languages.html"&gt;
variety of syntax&lt;/a&gt; and style choices. If you are picking
a new language (or, heaven forbid, creating a new language), choose carefully.
&lt;br&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-8840836800343618418?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/8840836800343618418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2009/08/syntax-and-style-of-programming.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/8840836800343618418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/8840836800343618418'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2009/08/syntax-and-style-of-programming.html' title='syntax and style of programming languages'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-4938864633993069608</id><published>2009-01-26T21:49:00.000-08:00</published><updated>2009-08-28T21:54:14.315-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pptp'/><category scheme='http://www.blogger.com/atom/ns#' term='ibex'/><category scheme='http://www.blogger.com/atom/ns#' term='mtu'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>pptp problems with ubuntu intrepid ibex</title><content type='html'>&lt;div class="alignright" style="float: right; margin-left: 10px; margin-right: 10px;"&gt;&lt;img src="http://farm1.static.flickr.com/40/90534369_5d9c3fc4e4_m_d.jpg" alt="ibex" height="240" width="160"&gt;
&lt;div class="photo-credit"&gt;Photo by &lt;a href="http://www.flickr.com/photos/lightmatter/90534369/"&gt;lightmatter&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;There have been &lt;a href="https://bugs.launchpad.net/ubuntu/+source/network-manager-pptp/+bug/292799"&gt;some&lt;/a&gt; networking &lt;a href="https://bugs.launchpad.net/ubuntu/+source/network-manager-pptp/+bug/151112"&gt;bugs&lt;/a&gt; introduced in Intrepid Ibex.&lt;/p&gt;
&lt;p&gt;One that I found particularly difficult to resolve was a problem with the pptp connection. Thanks to the power of Google and the collective wisdom of other Ubuntu users, I found a workaround. I am posting it here in hopes that other people may be able to find it a little easier, and if I eventually reinstall Ibex, I don't want to have to go looking.&lt;/p&gt;
&lt;p&gt;First, you need to test to see if your problem is the same as mine. Fire up your pptp vpn connection, and run the following command (in the terminal):&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;ifconfig&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;In the output, look for the "ppp0? section, a few lines into that section you will see the &lt;a href="http://en.wikipedia.org/wiki/Maximum_transmission_unit"&gt;MTU&lt;/a&gt; size.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;ppp0&lt;/p&gt;
&lt;p&gt;Link encap:Point-to-Point Protocol&lt;br&gt;
inet addr:xxx.xxx.xxx.xxx&amp;nbsp; P-t-P:xxx.xxx.xxx.xxx&amp;nbsp; ...&lt;br&gt;

UP POINTOPOINT ...&amp;nbsp; &lt;strong&gt;MTU:1416&lt;/strong&gt; Metric:1&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Now you can try to change that MTU size (to something smaller) with a command like this:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;sudo ifconfig ppp0 mtu 512&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;You will want to try some different values to find the sweet spot, but I recommend starting low and working your way up. Once you find a good value for the mtu, you can make the change permanent by editing your &lt;strong&gt;/etc/ppp/options&lt;/strong&gt; file. Search that file for the mtu section, and you will find a line that looks like this:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;#mtu &amp;lt;n&amp;gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Just uncomment that line and change &amp;lt;n&amp;gt; to your desired MTU size...&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;mtu 512&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;...save it, then restart your pptp vpn connection. If you want to confirm that the new MTU size stuck, just run ifconfig again. Hope that helps&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-4938864633993069608?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/4938864633993069608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2009/01/pptp-problems-with-ubuntu-intrepid-ibex.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/4938864633993069608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/4938864633993069608'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2009/01/pptp-problems-with-ubuntu-intrepid-ibex.html' title='pptp problems with ubuntu intrepid ibex'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-6630678253972660144</id><published>2008-08-16T21:42:00.000-07:00</published><updated>2009-08-28T21:43:32.562-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ecmascript'/><category scheme='http://www.blogger.com/atom/ns#' term='adobe'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><title type='text'>ECMAScript 4 breakup hurts (Adobe) Flash</title><content type='html'>&lt;p&gt;Now that ECMAScript 4 is dead, &lt;a href="http://www.mikechambers.com/blog/2008/08/14/actionscript-3-and-ecmascript-4/"&gt;the rationalizations begin&lt;/a&gt;, and Adobe is doing the &lt;a href="http://blogs.adobe.com/open/2008/08/blog_entry_dated_81408_715_pm.html"&gt;breakup-was-a-good-thing speech&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The most common response goes something like this:&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;em&gt;This doesn't affect ActionScript 3. If anything, this gives Adobe more freedom to innovate.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But that, quite frankly, is &lt;strong&gt;a total load of crap&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Adobe was a major force behind ECMAScript 4, and they've been &lt;a href="http://opensource.adobe.com/wiki/display/site/Home"&gt;banging the open source&lt;/a&gt; drum very loudly -- they even gave away the Tamarin VM in hopes that it would one day become the de facto implmentation.&lt;/p&gt;
&lt;p&gt;Adobe was doing this for three reasons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Silence critics&lt;/strong&gt; who disliked the Flash player for being proprietary.&lt;/li&gt;
&lt;li&gt;Become the &lt;strong&gt;market leader&lt;/strong&gt; for the ECMAScript 4 language and VM.&lt;/li&gt;

&lt;li&gt;Gain support/contributions from a &lt;strong&gt;broader developer community&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;So now that &lt;a href="http://www.betterthansimple.com/blog/2008/08/14/ecmascript-v4-derailsfinally/"&gt;ECMAScript 4 has derailed,&lt;/a&gt; what is the impact on Adobe?&lt;/p&gt;
&lt;p&gt;They &lt;strong&gt;gained some new developers&lt;/strong&gt; who saw ActionScript 3 as a "real language," and they &lt;strong&gt;lost some existing developers/designers&lt;/strong&gt; who think ActionScript 3 is too complex. Meanwhile, the rest of the Web shrugs its shoulders and continues its distrust of Adobe's proprietary Flash player. In short, they are back where they started.&lt;/p&gt;

&lt;p&gt;Or as &lt;a href="http://whydoeseverythingsuck.com/2008/08/ru-roh-adobe-screwed-by-ecmascript.html"&gt;Hank Williams brilliatly puts it&lt;/a&gt;:&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;em&gt;In essence, Adobe has shown up to the prom, but its date has stood it up. ActionScript is now not based on any standard. It is its own, proprietary, albeit open source language. Adobe is on its own island as the rest of the industry moved to some watered down version of what it could have been.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;And yes, there are many things that Flash can do which are hard or impossible with open source web technologies. However, the same used to be true when comparing Windows and Linux on the desktop, but today Ubuntu is competing (and often winning) on: features, applications, sex appeal, and ease of use.&lt;/p&gt;
&lt;p&gt;Eventually the open community wins because it has an limitless supply of free talent and a collective ability to filter the good ideas from the bad. Adobe can go off on its own and innovate like crazy, but their failure to align themselves with the standards community is going to hurt them in the long run.&lt;/p&gt;
&lt;br&gt;
&lt;br&gt;



&lt;div style="border:1px dotted #ccc; padding:8px; background-color:#eee; margin:12px"&gt;&lt;b&gt;
tom&lt;/b&gt; - August 21st, 2008
        3:46 pm



            &lt;div class="commenttext"&gt;&lt;p&gt;I think Flash's days are numbered, but not due to the derailed ES4 work.  The new functionality and innovation appearing in the minority browsers is already giving developers an alternative to flash for some things, and the IE team's reawakening from its long slumber could seal the deal if they start implementing these features too in their run-up to better standards compliance (obviously nobody is holding their breath on that though).&lt;/p&gt;
&lt;p&gt;Specifically I'm talking about SVG, CSS extensions, the canvas element, and video/audio elements.  I'm not suggesting that those are as simple and integrated to use as flash, but the gap is narrowing very quickly.&lt;/p&gt;
&lt;p&gt;But I really don't see the ES4 derailment hurting Adobe in any meaningful way for a while.  Not with their huge market share at least.  And their only real competition (except for the built-in stuff I mentioned above) is silverlight at this point, which sure ain't any more "open" than flash.&lt;/p&gt;
        &lt;/div&gt;
        &lt;/div&gt;




&lt;div style="border:1px dotted #ccc; padding:8px; background-color:#eef; margin:12px"&gt;&lt;b&gt;
two bit fool&lt;/b&gt; - August 25th, 2008
        8:47 pm



            &lt;div class="commenttext-admin"&gt;&lt;p&gt;@tom: There are two reasons that I expect Microsoft will continue to lag behind on the standards necessary to put Flash out of business: &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;Silverlight&lt;/b&gt; -- Any work to improve IE's support of web standards may compete with (or at least, distract from) work on Silverlight.&lt;/li&gt;

&lt;li&gt;&lt;b&gt;Backwards Compatibility&lt;/b&gt; -- Microsoft learned a hard lesson with IE7, and the desire to "breaking the Web" again could dilute the support for standards.  &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Hopefully the push from things like Firefox will eventually put enough pressure on them to force the change. But I wonder who will deliver the first serious blow to Flash's dominance: wide adoption of more powerful web standards, or Silverlight?&lt;/p&gt;
        &lt;/div&gt;
        &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-6630678253972660144?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/6630678253972660144/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2008/08/ecmascript-4-breakup-hurts-adobe-flash.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/6630678253972660144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/6630678253972660144'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2008/08/ecmascript-4-breakup-hurts-adobe-flash.html' title='ECMAScript 4 breakup hurts (Adobe) Flash'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-5261769055070704278</id><published>2008-08-14T21:38:00.000-07:00</published><updated>2009-08-28T21:39:03.131-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ecmascript'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><title type='text'>ECMAScript v4 derails…finally</title><content type='html'>&lt;p&gt;ECMAScript v4 was bound to fail. It was making a drastic departure from the current standard, ECMAScript v3, by adopting ideas like: packages, namespaces, early binding, and optional static typing.&lt;/p&gt;
&lt;p&gt;ECMAScript is best known for the Javascript dialect, a language that is availble in nearly every web browser. Javascript is powerful because it has a relatively simple syntax, and the flexibility of a dynamic language. The low barrier to entry has turned it into one of the most widespread lanugages in use today. It seems that the pioneers of ECMAScript v4 had lost sight of those benefits as they tried to turn ECMAScript into a "real" progamming langauge.&lt;/p&gt;
&lt;p&gt;For whatever reason, Adobe (the company that ate Macromedia) drank the ES4 (ECMAScript v4) cool-aid, and they created AS3 (ActionScript v3). AS3 is based on early drafts of ES4, and it is the language for the latest versions of the ubuquitous Flash player. Adobe open sourced their &lt;a href="http://www.mozilla.org/projects/tamarin/"&gt;Tamarin VM&lt;/a&gt; to help encourage the adoption of ES3. Then they marketed their "more mature" language so aggressively that Flash developers started convincing themselves that they were &lt;a href="http://www.colettas.org/?p=193"&gt;better off with static typing and no eval&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://two-bit-fool.blogspot.com/2009/08/why-adobe-flex-makes-me-want-to-cry.html"&gt;When I first tried Flex&lt;/a&gt;, Adobe's poster child of AS3, I was stunned. It felt like I had stepped back into the early days of Java. I was contantly fighting the syntax and the framework, interrupted by frequent "breaks" as I waited for the lathargic compiler. After countless expeditions into the nested maze of class documentation, I gave one final laugh at its ridculous verbosity, and walked away.&amp;nbsp; Some other &lt;a href="http://ajaxian.com/archives/generics-in-javascript-2#comment-261797"&gt;Flash developers noticed the same trend&lt;/a&gt;, and they wondered if Adobe was headed in the wrong direction.&lt;/p&gt;

&lt;p&gt;Now, much to my relief, the &lt;a href="https://mail.mozilla.org/pipermail/es4-discuss/2008-August/003400.html"&gt;ECMAScript folks have come to their senses&lt;/a&gt;, leaving Adobe out in the cold. So, while the &lt;a href="http://www.gskinner.com/blog/archives/2008/08/javascript_stal.html"&gt;ES4 fans look for a scapegoat&lt;/a&gt;, the rest of us will breath a sigh of relief and go back to using programming languages that get out of our way.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-5261769055070704278?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/5261769055070704278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2008/08/ecmascript-v4-derailsfinally.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/5261769055070704278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/5261769055070704278'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2008/08/ecmascript-v4-derailsfinally.html' title='ECMAScript v4 derails…finally'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-4489917823456327752</id><published>2008-06-26T21:34:00.000-07:00</published><updated>2009-08-28T21:35:08.125-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='passwords'/><category scheme='http://www.blogger.com/atom/ns#' term='encrypt'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><title type='text'>always encrypt passwords</title><content type='html'>&lt;p&gt;Let's&lt;strong&gt; pretend that you run a website or newsletter&lt;/strong&gt;. For fun, let's call it: &lt;a href="http://www.techsupportalert.com/al_subscribe.htm" target="_blank"&gt;Gizmo's Tech Support Alert&lt;/a&gt;...&lt;/p&gt;
&lt;p&gt;Subscriptions to your newsletter are free, but you also have a premium edition which costs $10 per year. You don't want to worry about the security hassles of storing financial information, so you off-load all the financial transactions to a third party.&lt;/p&gt;
&lt;p&gt;Since you're not storing any "confidential" information in the user accounts, you assume that &lt;strong&gt;the worst thing that an attacker could do&lt;/strong&gt; with login information &lt;strong&gt;is cancel an account&lt;/strong&gt;. So, you decide to make life a little easier for you and your subscribers.&lt;/p&gt;

&lt;p&gt;If someone types in their email and hits the "&lt;strong&gt;forgot my password&lt;/strong&gt;" button, you &lt;strong&gt;email them their current password&lt;/strong&gt;. And, to encourage your premium subscribers to renew, when their subscription is almost over, you send them a friendly email reminder with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a link to the login page&lt;/li&gt;
&lt;li&gt;their username&lt;/li&gt;
&lt;li&gt;their password&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All seems well. The users don't have to remember their login information, because as long as they remember their email, you can send it to them. &lt;strong&gt;This is a nice user experience, but it is &lt;span style="color: rgb(255, 0, 0);"&gt;ABSOLUTELY &lt;span style="color: rgb(0, 0, 0);"&gt;the&lt;/span&gt; WRONG&lt;/span&gt; thing to do.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you don't encrypt your passwords, you will eventually make some nerd angry enough to write an article about it, and he will use your newsletter as an example (wink).&lt;/p&gt;
&lt;h2&gt;Unencrypted Passwords are Evil&lt;/h2&gt;
&lt;p&gt;Even if you don't store confidential information on your site, it is still negligent to store (or email) unencrypted passwords. To make matters worse, if you send an email to your paying subscribers to encourage renewal, that &lt;strong&gt;exposes account information in &lt;em&gt;unsolicited&lt;/em&gt; emails&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If an attacker gets access to the database or emails, they would have the login information for your subscribers. At the very least, &lt;strong&gt;an attacker could start canceling people's subscriptions to the newsletter&lt;/strong&gt;, and that will be a problem for you; but your users will have a much bigger problem if they used the same password for the newsletter subscription as they did for another (more important) account.&lt;/p&gt;
&lt;p&gt;While &lt;em&gt;you&lt;/em&gt; may be savvy enough to have a different password for every website, lots of other people look at their limited time and memory, and don't realize the risks of reusing passwords. Even if you advise them to have unique passwords, &lt;strong&gt;&lt;a href="http://www.guardian.co.uk/technology/2008/jan/17/security.banks" target="_blank"&gt;the majority of users will continue to use the same &lt;span class="nfakPe"&gt;password&lt;/span&gt; on multiple sites&lt;/a&gt;&lt;/strong&gt;. So it is the responsibility of the website developers and operators to keep passwords safe, by not storing them and by not emailing them.&lt;/p&gt;

&lt;h2&gt;How to Handle Passwords&lt;/h2&gt;
&lt;p&gt;First off, assume that you &lt;em&gt;don't&lt;/em&gt; know how to safely manage passwords -- even the &lt;a href="http://www.codinghorror.com/blog/archives/001140.html"&gt;smart folks at Mensa&lt;/a&gt; seem to have gotten it wrong. There are a lot of hard won lessons in website security that you don't want to repeat. So hop on to your favorite search engine and start reading (search for things like: &lt;a href="http://www.google.com/search?q=secure+hashing+passwords"&gt;secure hashing passwords&lt;/a&gt;). Then &lt;strong&gt;find and use existing tools and libraries for your website's security&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In case you can't find any existing security solutions, or if you still want to brazenly create your own,&lt;strong&gt; &lt;/strong&gt;here is a list of the things your website should do...&lt;/p&gt;

&lt;h2&gt;When a user creates a new account:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;/strong&gt;require an email address and send a link to that email address to activate the account
&lt;ul&gt;
&lt;li&gt;make it clear that you will never sell or give away their information unless required by law&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;store a hash of their password using bcrypt&lt;/strong&gt; (or at least sha-1)&lt;/li&gt;
&lt;li&gt;use &lt;a href="http://en.wikipedia.org/wiki/Salt_%28cryptography%29"&gt;salt&lt;/a&gt; to prevent &lt;a href="http://en.wikipedia.org/wiki/Rainbow_table"&gt;rainbow table&lt;/a&gt; attacks&lt;/li&gt;

&lt;li&gt;use a turing test (e.g. &lt;a href="http://en.wikipedia.org/wiki/Captcha"&gt;captcha&lt;/a&gt;) to prove your new user is an real person
&lt;ul&gt;
&lt;li&gt;note: captcha is not 100% reliable (and getting less so)&lt;/li&gt;
&lt;li&gt;consider &lt;a href="http://www.arraystudio.com/as-workshop/the-captcha-alternatives.html"&gt;alternatives&lt;/a&gt; like word puzzles and image identification&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;When a user tries to login:&lt;/h2&gt;
&lt;ul&gt;

&lt;li&gt;apply the hashing algorithm to their submitted password and compare it to the stored hashes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;give the same error message when the username is wrong or the password is wrong&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;if you tell them which part of the login was wrong, they can guess to find usernames&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;when the login is invalid, insert a short delay before displaying an error, to slow down &lt;a href="http://en.wikipedia.org/wiki/Internet_bot"&gt;bots&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;lock an account if it fails on several consecutive login attempts&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;this lock can: be self-expiring, require administrative action, send an email to the user, or require captcha to unlock&lt;/li&gt;

&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;after several consecutive login attempts from a single IP address fail (on one or more usernames), block that IP
&lt;ul&gt;
&lt;li&gt;this block can be self-expiring, require administrative action, or require captcha to unblock&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;When a user forgets their password:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;have them submit their email address&lt;/li&gt;
&lt;li&gt;then show them a message explaining how long it may take to get the email&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;don't tell them if the email is invalid&lt;/strong&gt; (or an attacker could keep guessing to search for valid email addresses)

&lt;ul&gt;
&lt;li&gt;just say: &lt;em&gt;"if you don't get the email, check the spelling of your email address and try again"&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;send the email: it should explain why they received it and contain a link to a Reset Password page
&lt;ul&gt;
&lt;li&gt;the link &lt;em&gt;should NOT&lt;/em&gt; include any account information, like email address or username&lt;/li&gt;
&lt;li&gt;the link &lt;em&gt;should&lt;/em&gt; include a &lt;a href="http://en.wikipedia.org/wiki/Uuid"&gt;UUID&lt;/a&gt; to guarantee that no one can guess it&lt;/li&gt;

&lt;li&gt;after a certain amount of time (e.g. 15 minutes) the link should expire&lt;/li&gt;
&lt;li&gt;clicking the link after the time expires will open a page with a link to the Forgot Password page and a message explaining the expiration&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;don't send the forgotten password email to a single user more than once until the previous "forgot password" link has expired&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These requirements are tricky, and I've probably screwed up some and entirely omitted many others. This is a wheel that doesn't need reinventing. So I'll say it again, &lt;strong&gt;find and use existing tools and libraries to handle the security on your website&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;You don't want your site be some nerd's example of a security faux pas.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-4489917823456327752?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/4489917823456327752/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2008/06/always-encrypt-passwords.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/4489917823456327752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/4489917823456327752'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2008/06/always-encrypt-passwords.html' title='always encrypt passwords'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-1949236368095004067</id><published>2008-05-15T21:32:00.000-07:00</published><updated>2009-08-28T21:32:41.298-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mac'/><category scheme='http://www.blogger.com/atom/ns#' term='apple'/><title type='text'>my brief affair with a mac book pro</title><content type='html'>&lt;p&gt;It finally happened. Last week, I got a MacBook Pro for work.&lt;/p&gt;
&lt;p&gt;I’ve been a proponent of Apple products for a while now. Years ago, my wife and I bought a PowerBook, and when it needed to be replaced, we didn’t hesitate to get a MacBook. I’ve been very happy with both machines: no fighting viruses/trojans, great bundled software, simple, usable, and no-hassles.&lt;/p&gt;
&lt;p&gt;When people ask for my recommendation on a new computer (as if using computers at my job makes me somehow qualified), I ask if it is for personal use: email, internet, and such. If so, I say: &lt;em&gt;get a Mac&lt;/em&gt;, because &lt;strong&gt;a Mac makes for a great personal computer&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;So, it may be a little surprising to hear that &lt;strong&gt;I am trading in my new MacBook Pro for a run-of-the-mill MPC laptop&lt;/strong&gt;. Why? Three reasons…&lt;/p&gt;

&lt;h6&gt;#1: Apple Store&lt;/h6&gt;
&lt;p&gt;I was eager to get my new laptop, so I ran over to the Apple store. As it turns out, if you are looking to make a quick purchase of an Apple product, the Apple store is the wrong place to go. It’s an interesting idea to remove the cash registers while hiding all the stock in the back room, but it is not practical for two very important reasons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First-time customers don’t know where to pay&lt;/li&gt;
&lt;li&gt;You have to wait for (or go find) an employee for any purchase&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;After waiting about 10 minutes, I finally had to interrupt two employees to ask for help. They were too busy chatting (probably about how cool their iPod-ish name tags were) to ask me why I was patiently standing there looking helpless. Then, I had to endure several minutes of smarmy Q&amp;amp;A before he understood that all I wanted him to do was go in the back and get a MacBook Pro.&lt;/p&gt;
&lt;h6&gt;#2: Walled Gardens&lt;/h6&gt;
&lt;p&gt;The robust and seamless nature of the Mac (and iPhone) is largely due to the control that Apple has over the entire process: hardware, software, distribution, etc. It’s hard to imagine that equally compelling products could come from a more open ecosystem, and if they did, it would take much longer.&lt;/p&gt;

&lt;p&gt;To me, it’s a design vs evolution (or craftsman vs committee) debate. The OSX vs Linux comparison makes for a great example…&lt;/p&gt;
&lt;p&gt;With OSX, there is a small group in charge, and they exert their control to create a very consistent and stable platform. The focus is narrow, so the details get taken care of. Also, with lots of control, it is easier to have a high level of integration between the parts (a.k.a. seamlessness). The downside is that potential good ideas from the outside are often locked-out.&lt;/p&gt;
&lt;p&gt;Linux, on the other hand, is more open and has less filtering from the top. This means that you get an amazing diversity of ideas, which allows innovation that can’t happen in a closed environment, but it also creates a ton of mediocre and crappy ideas too. So it becomes a survival of the fittest for Linux features/apps. The downside to the open system, is the dilution of effort. There is so much diversity that it takes longer to get enough people focused in the same direction to make significant progress.&lt;/p&gt;
&lt;p&gt;In the long run, bet on the open system, because &lt;a href="http://www.codinghorror.com/blog/archives/000898.html"&gt;walled gardens don’t last&lt;/a&gt;.&lt;/p&gt;
&lt;h6&gt;#3: Old Habits&lt;/h6&gt;
&lt;p&gt;When I’m working, I want efficiency, and if I have to hesitate because the keyboard shortcut is different or because I need to &lt;a href="http://www.hcibib.org/tcuid/chap-4.html#t1"&gt;reach for my mouse&lt;/a&gt;, time is lost. Not only do I lose time because it physically takes longer, I lose time because I have to focus on the keyboard/mouse and then return my focus back to the actual work. &lt;strong&gt;A good tool should become “invisible” so I can focus on the work, not on the tool.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;My old laptop was a dual-boot machine with Ubuntu Linux v7.10 and Windows XP, and I spent 95% of my time in Ubuntu. I’m a keyboard maniac, so when I originally transitioned from Windows to Ubuntu, it was a very easy transition because the keyboard shortcuts in Ubuntu are so similar to Windows.&lt;/p&gt;
&lt;p&gt;True, if I had been using a Mac all along, then I would be used to its keyboard shortcuts, but that is just a “walled garden” argument design. The Mac has a small percentage of large market, and when they don’t conform to the defacto standards, they get punished by the fact that &lt;a href="http://www.useit.com/alertbox/990822.html"&gt;consistency is one of the strongest contributors to usability&lt;/a&gt;.&lt;/p&gt;
&lt;h6&gt;The Break Up&lt;/h6&gt;
&lt;p&gt;Mac, I’m afraid that this is goodbye. You are sexy, and we had some good times. Playing with photos and movies was fun, but I want to get serious, and you just weren’t as open as I had hoped. I know you’ll do fine without me; there are lots of designers and trendy people out there to make you happy.&lt;/p&gt;
&lt;p&gt;I wish you the best, and remember: &lt;em&gt;It’s not you. It’s me.&lt;/em&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-1949236368095004067?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/1949236368095004067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2008/05/my-brief-affair-with-mac-book-pro.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/1949236368095004067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/1949236368095004067'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2008/05/my-brief-affair-with-mac-book-pro.html' title='my brief affair with a mac book pro'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-4528447152367045862</id><published>2008-05-08T21:30:00.000-07:00</published><updated>2009-08-28T21:30:50.788-07:00</updated><title type='text'>e4x to the rescue (sort of)</title><content type='html'>&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note:&lt;/strong&gt; This is the follow up to a old, poorly-written, &lt;a href="http://two-bit-fool.blogspot.com/2008/09/pains-of-xml-processing.html"&gt;rant on e4x&lt;/a&gt; where I used the wrong terms and left huge holes in my arguments. I can only hope to do so poorly this time.&lt;/em&gt; &lt;/p&gt;
&lt;h2&gt;A simpler DOM&lt;/h2&gt;
&lt;p&gt;Many developers (myself included) tried to scab together our own object-ish XML processing. Usually this meant converting the XML into a big "object tree" where the names of the object properties were the same as the XML nodes. This would allow us to turn:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;&amp;lt;root&amp;gt;&amp;lt;foo&amp;gt;hello&amp;lt;/foo&amp;gt;&amp;lt;/root&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;into:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;code&gt;root.foo // returns "hello"&lt;/code&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;And when we did this, we quickly ran into problems:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Attributes:&lt;/strong&gt; What if an attribute had the same name as a child node?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Collections: &lt;/strong&gt; It would be nice to skip array-like access for nodes that only have a single child, right?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Naming collisions:&lt;/strong&gt; How do we make sure that the properties and methods that we need to have on a node don't conflict with the names of the child nodes? For example, what if a node is named "children?"&lt;/li&gt;

&lt;/ul&gt;
&lt;h2&gt;e4x bring object traversal to the masses&lt;/h2&gt;
&lt;p&gt;So e4x comes along, and it looks a lot like that stuff that developers had been scabbing together. It added some nice syntax for "querying," and they prefixed the attributes with an @ symbol -- so we don't have to worry about attribute names and node names colliding -- but otherwise it's mostly the same. &lt;/p&gt;
&lt;p&gt;The two places where they dropped the ball were on collections and the naming collisions. Let's ignore the collection problem for now and talk about their "solution" to the naming collisions that can occur between methods/properties and node names. They decided that all methods/properties of a node (children, length, toString, etc.) would be accessed as methods, requiring parentheses, and all the child nodes would be accessed as properties; no parentheses.&lt;/p&gt;
&lt;p&gt;It's too bad that they didn't just use a prefix to distinguish between traversing xml nodes and methods/properties. Much like the attributes are prefixed with the @ symbol, I wonder why they didn't use some prefix (a # sign, perhaps) for xml nodes.&lt;/p&gt;
&lt;p&gt;This is a big problem because it creates an inconsistency with most languages, because they follow &lt;a href="http://msdn.microsoft.com/en-us/library/ms809977.aspx"&gt;a rarely discussed rule-of-thumb&lt;/a&gt; (see the &lt;em&gt;When to Use Properties vs. Methods&lt;/em&gt; section)...&lt;/p&gt;

&lt;p&gt;* &lt;strong&gt;methods/functions are verbs&lt;/strong&gt;: perform an action&lt;br&gt;
* &lt;strong&gt;properties are nouns/adjectives&lt;/strong&gt;: read/write values&lt;/p&gt;
&lt;p&gt;Let's look at some Javascript for example:&lt;/p&gt;
&lt;p&gt;* String.length&lt;br&gt;
* Document.links&lt;br&gt;
* Window.parent&lt;br&gt;
* String.toUpperCase()&lt;br&gt;

* Document.write()&lt;br&gt;
* Window.close()&lt;/p&gt;
&lt;p&gt;Now let's see if e4x follows that same &lt;em&gt;rule&lt;/em&gt;:&lt;/p&gt;
&lt;p&gt;* &lt;span style="color: red;"&gt;XML.name()&lt;/span&gt;&lt;br&gt;
* &lt;span style="color: red;"&gt;XML.length()&lt;/span&gt;&lt;br&gt;
* &lt;span style="color: red;"&gt;XML.parent()&lt;/span&gt;&lt;br&gt;

* XML.replace()&lt;br&gt;
* XML.insertChildAfter()&lt;br&gt;
* XML.contains()&lt;/p&gt;
&lt;p&gt;Nope.&lt;/p&gt;
&lt;p&gt;And what happens when you try to implement e4x in a language like Ruby? Ruby has no properties and parenthesis on method calls are optional.&lt;/p&gt;
&lt;p&gt;In case you missed it, I had &lt;a href="http://www.betterthansimple.com/blog/2008/01/09/some-days-adobe-flex-makes-me-scream/"&gt;a bug&lt;/a&gt; where I called node.children, instead of node.children() because I relied on that rule-of-thumb. It served as another fine example of why &lt;strong&gt;consistency is so critical to usability&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;
&lt;strong&gt;Random light switch trivia:&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;In the United States it is universal for the "on" position of a toggle switch to be "up", whereas in the UK, Australia, and New Zealand it is "down."&lt;/em&gt; -&lt;a href="http://en.wikipedia.org/wiki/Light_switch#History_and_culture"&gt;wikipedia&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;br&gt;
&lt;br&gt;
&lt;div style="border:1px dotted #ccc; padding:8px; background-color:#eee; margin:12px"&gt;&lt;b&gt;
Tom&lt;/b&gt; - May 9th, 2008
        9:51 am



            &lt;div class="commenttext"&gt;&lt;p&gt;Good points.  As you pointed out, the issue comes down to XML element name mapping in the object graph.  Since they went down the road of using the exact names from the XML, they needed to make the built-in properties be methods to avoid name collisions with elements that might be named "parent" or "name", etc. (which are probably commonly found in XML).&lt;/p&gt;
&lt;p&gt;e.g. given &amp;lt;foo&amp;gt;&amp;lt;name&amp;gt;bar&amp;lt;/name&amp;gt;&amp;lt;/foo&amp;gt;, x.name is different than x.name().&lt;/p&gt;

&lt;p&gt;But you could also make the argument that constantly writing x.#foo.#bar is less convenient (and hence less usable) than x.foo.bar.  It's really more of a trade-off for consistency in attribute/method conventions vs. the readability of the code/API.&lt;/p&gt;

        &lt;/div&gt;
        &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-4528447152367045862?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/4528447152367045862/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2008/05/e4x-to-rescue-sort-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/4528447152367045862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/4528447152367045862'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2008/05/e4x-to-rescue-sort-of.html' title='e4x to the rescue (sort of)'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-6206673992185354572</id><published>2008-01-27T21:25:00.000-08:00</published><updated>2009-08-28T21:26:49.440-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='xslt'/><title type='text'>the pains of xml processing</title><content type='html'>&lt;p&gt;&lt;em&gt;This is part one of my xml/e4x ramblings... &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/XML"&gt;XML&lt;/a&gt; is all the rage these days. But, like many over-hyped technologies, it has become a victim of its own success, leading to all sorts of &lt;a href="http://en.wikipedia.org/wiki/Xml_database" title="XML Databases"&gt;crazy ideas&lt;/a&gt;. If you find yourself using XML for anything other than document markup or data transport, worry.&lt;/p&gt;
&lt;p&gt;The most common challenge you will face when dealing with XML is extracting the data. This is known as &lt;strong&gt;XML processing&lt;/strong&gt; has often been accomplished by using XSLT, DOM, or SAX.&lt;/p&gt;
&lt;h2&gt;Do you speak XSLT?&lt;/h2&gt;

&lt;p&gt;XSLT is a bit like learning a foreign language:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;declarative programming&lt;/li&gt;
&lt;li&gt;strange and complex syntax&lt;/li&gt;
&lt;li&gt;templates, patterns, and rules&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The easiest way to scare you away from XSLT is with a &lt;a href="http://www.brics.dk/%7Eamoeller/XML/xslt-4.1.html"&gt;tiny example&lt;/a&gt;. That's crazy, right? Using XSLT on XML looks a lot like "fighting fire with fire." Let's be honest, despite all the hype, XML is no joy ride; it can be so aggravating that it makes the &lt;a href="http://mail.bitmover.com/pipermail/lmbench-users/2003-November/000076.html"&gt;Linux guy &lt;span style="font-weight: bold;"&gt;almost&lt;/span&gt; use the F-Word&lt;/a&gt;. Add XSLT to the mix, and who wouldn't start cursing like a sailor?&lt;/p&gt;

&lt;h2&gt;The dark days of DOM&lt;/h2&gt;
&lt;p&gt;So, with XSLT out of reach for most sane people, many turned to DOM (Document Object Model). The great thing about DOM is the consistent mapping between the structure of the XML and the structure of the DOM objects. Start at the root node, get the child nodes, then get the children of those child nodes. And on it goes.&lt;/p&gt;
&lt;p&gt;Unfortunately, the DOM syntax almost encourages ugly code. Even the more respectable sites were putting out &lt;a href="http://www.w3schools.com/dom/tryit.asp?filename=note_parsertest_crossbrowser"&gt;crap examples&lt;/a&gt; like this:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;  document.getElementById("to").innerHTML=xmlDoc. / getElementsByTagName("to")[0].childNodes[0].nodeValue;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;If you've spent any time in DOM-land, you probably carry the shame of writing at least one of these brittle nuggets:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;xml.firstChild.childNodes[2].lastChild.childNodes[4]. / getAttribute('i_hope_this_xml_never_changes');&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2&gt;SAX player&lt;/h2&gt;

&lt;p&gt;Now let's contrast the declarative style of XLST with the event-based approach of &lt;strong&gt;Serial API for XML&lt;/strong&gt; (SAX). Using SAX reminds me of those old &lt;a href="http://www.flickr.com/photos/balakov/291703663/"&gt;music boxes&lt;/a&gt;. The ones with the metal drums that turn, making the bumps pluck the metal forks to produce each note. In SAX, you create callback functions (the metal forks), and as the SAX parser (the metal drum) reads through the XML, it fires events (the bumps).&lt;/p&gt;
&lt;p&gt;&lt;em&gt;How was that for a strained analogy?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;So, SAX has big problems:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;the burden it puts on the programmer to keep track of their location within the document&lt;/li&gt;
&lt;li&gt;the event-based model can be off-putting to programmers who are more comfortable with the typical step-by-step procedural coding&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;&lt;em&gt;Stay tuned next week for&lt;/em&gt;...e4x to the rescue (sort of)&lt;/h2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-6206673992185354572?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/6206673992185354572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2008/09/pains-of-xml-processing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/6206673992185354572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/6206673992185354572'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2008/09/pains-of-xml-processing.html' title='the pains of xml processing'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-645815977479361574</id><published>2008-01-09T21:21:00.000-08:00</published><updated>2009-08-28T21:23:28.981-07:00</updated><title type='text'>why adobe flex makes me want to cry</title><content type='html'>Adobe Flex can be used to create some &lt;a href="http://www.adobe.com/devnet/flex/?navID=samples"&gt;impressive&lt;/a&gt; &lt;a href="http://examples.adobe.com/flex3/labs/configurator/configurator.html"&gt;UIs&lt;/a&gt; that can be delivered over the &lt;a href="http://www.adobe.com/products/player_census/flashplayer/version_penetration.html"&gt;most established&lt;/a&gt; plugin in the universe. For this and other reasons, I am forcing myself to use it on my current project. It is a love/hate relationship, with very little love.&lt;/p&gt;
&lt;p&gt;For a moment, let's ignore the pain of super-verbose static typing, and the crushing weight of a class hierarchy that makes the Java class libraries seem thin . . . let's focus on the basic inconsistencies in the &lt;a href="http://livedocs.adobe.com/flex/2/langref/"&gt;API.&lt;/a&gt; We'll start with some of the widgets that you would use on an edit form: TextInput, DateField, NumericalStepper, and ComboBox.&lt;/p&gt;

&lt;p&gt;You may have noticed that &lt;span style="font-weight: bold;"&gt;Text&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;Input&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;Date&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;Field&lt;/span&gt; lack some basic naming symmetry. And if you forget, and use a TextField, well that is a Class too, but it's not at all what you want. Why they couldn't call it &lt;span style="font-weight: bold;"&gt;DateInput&lt;/span&gt; is a mystery to me. But it gets worse...&lt;/p&gt;
&lt;p&gt;All of these edit controls have properties (or functions) to set the value that shows up in the UI control. It seems like we could take advantage of a little &lt;a href="http://en.wikipedia.org/wiki/Polymorphism_%28computer_science%29#Ad-hoc_polymorphism"&gt;&lt;span style="font-weight: bold;"&gt;ad-hoc polymorphism&lt;/span&gt;&lt;/a&gt; and name the property something like: &lt;span style="font-weight: bold;"&gt;"value"&lt;/span&gt; for all  those different classes. So, then it wouldn't matter if I had a TextInput or a DateField, I could just call:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt; uiComponent.value = something&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Instead they've given us:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;DateField.&lt;span style="font-weight: bold;"&gt;selectedDate&lt;/span&gt;&lt;br&gt;
TextInput.&lt;span style="font-weight: bold;"&gt;text&lt;/span&gt;&lt;br&gt;
NumericalStepper.&lt;span style="font-weight: bold;"&gt;value&lt;/span&gt;&lt;br&gt;
ComboBox.&lt;span style="font-weight: bold;"&gt;selectedItem&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;. . . awesome. But we are not done yet. I've saved the best for last, because this one just bit me . . . again.&lt;/p&gt;
&lt;p&gt;Since we are dealing with UI classes, hierarchy abounds, and we need to get at the parent and children of most objects. Well, if we are using any of the UI containers we call &lt;span style="font-weight: bold;"&gt;getChildren()&lt;/span&gt;. If we are using a class like CompositeEffect, we need to call the &lt;span style="font-weight: bold;"&gt;children property&lt;/span&gt;. And if we want to get the children of an XML node we need to call the &lt;span style="font-weight: bold;"&gt;children() function&lt;/span&gt;, not the children property!!!&lt;/p&gt;
&lt;p&gt;I just wasted 20 minutes (plus another 30 on this rant) because I was calling &lt;span style="font-weight: bold;"&gt;.children&lt;/span&gt; instead of &lt;span style="font-weight: bold;"&gt;.children()&lt;/span&gt;. And now for the best part . . .&lt;/p&gt;

&lt;p&gt;&lt;span style="font-weight: bold;"&gt;The super-strict compiler&lt;/span&gt;, with all the help from the carpal-tunnel-inducing variable-typing information that I had to hammer into the code,  &lt;span style="font-weight: bold;"&gt;didn't even throw a warning&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-style: italic;"&gt;Are you @&amp;amp;#$ kidding me?!?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;So, I write a rant that no one will read, say &lt;span style="font-style: italic;"&gt;'calm blue ocean'&lt;/span&gt; a couple hundred times, and dream of a day when I will be back in the comforting embrace of languages like &lt;a href="http://www.ruby-lang.org/en/"&gt;Ruby&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By the way, Ruby has a solution so simple (and elegant) to the "is it a property, or is it a function?" problem: There are no public properties. It's always a method. But, the parenthesis are optional.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;xml.children&lt;br&gt;
- or -&lt;br&gt;
xml.children()&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;. . . it's all good in Ruby-land.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-style: italic;"&gt;Here's my guess as to why we ended up with XML.children():&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Flex dev #1: &lt;/span&gt;an XML object has to be dynamic to allow traversing the names of the nodes, so we can't do any compile time checks on properties.&lt;/li&gt;
&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Flex dev #2: &lt;/span&gt;yeah,  if someone had xml like this:&lt;br&gt;

&lt;blockquote&gt;&lt;p&gt;xml = &amp;lt;root&amp;gt;&amp;lt;foo&amp;gt;hello_world&amp;lt;/foo&amp;gt;&amp;lt;/root&amp;gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;. . . then xml.foo should refer to the "foo" node.
&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Flex dev #1: &lt;/span&gt;so we'll have to make children a function call instead, otherwise it will get confused with the node name in xml like this:&lt;br&gt;
&lt;blockquote&gt;&lt;p&gt;&amp;lt;root&amp;gt;&amp;lt;children&amp;gt;&amp;lt;foo&amp;gt;&amp;lt;/foo&amp;gt;&amp;lt;/children&amp;gt;&amp;lt;/root&amp;gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;/li&gt;
&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Flex dev #3: &lt;/span&gt;Wait, if xml.children will return the "children" node, isn't that the same as calling the children method? But more importantly, if it's going to be a function shouldn't we rename it to getChildren() so it's clear that it's a function call and not a property?&lt;/li&gt;
&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Flex dev #1: &lt;/span&gt;shut up, rookie!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ugh.&lt;/p&gt;
&lt;br&gt;
&lt;br&gt;



&lt;div style="border:1px dotted #ccc; padding:8px; background-color:#eee; margin:12px"&gt;&lt;b&gt;
Paul B&lt;/b&gt; - January 9th, 2008
        7:10 am



            &lt;div class="commenttext"&gt;&lt;p&gt;I was thinking about moving to Flex from Flash 8. Now I'm not so sure. I'm not the best developer in the world to begin with, so fighting through this chaos may not be a good option. &lt;/p&gt;
&lt;p&gt;Thanks for the insight.&lt;/p&gt;
&lt;p&gt;BTW, Flash 8 has it's own set of frustrations as I'm sure you know. Maybe someday Adobe will get on the ball and clean up this mess.&lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;div style="border:1px dotted #ccc; padding:8px; background-color:#eee; margin:12px"&gt;&lt;b&gt;
Tom&lt;/b&gt; - January 9th, 2008
        7:13 pm
            &lt;div class="commenttext"&gt;&lt;p&gt;based on your example and some googling, it looks like flex implements &lt;a href="http://www.ecma-international.org/publications/standards/Ecma-357.htm" rel="nofollow"&gt;e4x&lt;/a&gt;, so you can blame more than just adobe engineers for children().&lt;/p&gt;
&lt;p&gt;I think you were on the right track with your theoretical conversation between flex engineers as to why the compiler can't catch your error, too.  Flex/ActionScript/JScript.NET/Javascript2 all allow for more strict type checking, but they also must allow for old-style vars and "expando" dynamic properties.  That's actually the beauty of e4x:&lt;/p&gt;
&lt;p&gt;var el = &amp;lt;foo&amp;gt;&amp;lt;bar/&amp;gt;&amp;lt;/foo&amp;gt;;&lt;br&gt;alert(el.foo.bar);&lt;/p&gt;

&lt;p&gt;You don't need to use the chilren() property, you can just access the XML DOM like a javascript Object.&lt;/p&gt;
&lt;p&gt;But sometimes the compiler can't figure out what you've done is wrong at compile time:&lt;/p&gt;
&lt;p&gt;var x:XML = read_from_somewhere();&lt;br&gt;alert(x.foo.bar);  // valid????&lt;/p&gt;
&lt;p&gt;I think this can only be caught at runtime, if read_from_somewhere() doesn't return xml that matches the properties specified.&lt;/p&gt;
&lt;p&gt;And while getChildren() might make it less likely you'll accidentally use it incorrectly, the compiler would still need to allow x.getChildren to be accessed as a property in the event that you define xml like &amp;lt;getChildren/&amp;amp;gt&lt;/p&gt;
&lt;p&gt;I definitely hear you on the inconsistency with the "value" properties of widgets though.  Nearly all toolkits suffer that.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;



&lt;div style="border:1px dotted #ccc; padding:8px; background-color:#eef; margin:12px"&gt;&lt;b&gt;
two bit fool&lt;/b&gt; - January 10th, 2008
        6:38 pm



            &lt;div class="commenttext-admin"&gt;&lt;p&gt;Paul,&lt;/p&gt;
&lt;p&gt;Flex isn't all bad. It has some very respectable UI components. And the availability of the source code is nice.&lt;/p&gt;
&lt;p&gt;But it does have a definite "Java smell".&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;




&lt;div style="border:1px dotted #ccc; padding:8px; background-color:#eef; margin:12px"&gt;&lt;b&gt;
two bit fool&lt;/b&gt; - January 12th, 2008
        7:03 pm



            &lt;div class="commenttext-admin"&gt;&lt;p&gt;Tom,&lt;/p&gt;
&lt;p&gt;Good call. e4x definitely deserves some "credit" for my headaches. So much so, that I'll probably write a separate post about it.&lt;/p&gt;
        &lt;/div&gt;
        &lt;/div&gt;




&lt;div style="border:1px dotted #ccc; padding:8px; background-color:#eee; margin:12px"&gt;&lt;b&gt;
mzx&lt;/b&gt; - June 24th, 2008
        7:30 am



            &lt;div class="commenttext"&gt;&lt;p&gt;first learn than blame..&lt;br&gt;
flex is working fine for me. When i feel i have troubles with some say DateInput, im welcome to extend and override whatever i need in few lines of code. So add method value() to each uicomponent u need, or create getMyChildren for XML class this is not big deal imho&lt;/p&gt;

        &lt;/div&gt;
        &lt;/div&gt;













&lt;div style="border:1px dotted #ccc; padding:8px; background-color:#eef; margin:12px"&gt;&lt;b&gt;
two bit fool&lt;/b&gt; - June 26th, 2008
        10:46 am



            &lt;div class="commenttext-admin"&gt;&lt;p&gt;mzx,&lt;/p&gt;
&lt;p&gt;I wasn't saying that we &lt;b&gt;can't&lt;/b&gt; "fix" the naming problems. I'm just lamenting the fact that the Flex designers failed to be consistent in such an obvious case -- a "value" property for UIComponents.&lt;/p&gt;
&lt;p&gt;As for extending the XML class, you can't. &lt;b&gt;The XML class is final and can't subclassed&lt;/b&gt;. Even if you could, it still wouldn't resolve the problem that all property access on an XML object is DOM traversal. So, you can't create a getter called "children" to allow this: &lt;b&gt;node.children&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;It would have to be a function, called like this: &lt;b&gt;node.children()&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Then programmers are faced with the &lt;em&gt;&lt;b&gt;"is it a property or is it a function?"&lt;/b&gt;&lt;/em&gt; problem because "children" is named like a property but called as a function. This is a problem that I talk more about in &lt;a href="http://www.betterthansimple.com/blog/2008/05/08/e4x-to-the-rescue-sort-of/" rel="nofollow"&gt;another article&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;



&lt;div style="border:1px dotted #ccc; padding:8px; background-color:#eee; margin:12px"&gt;&lt;b&gt;
Dylan&lt;/b&gt; - June 27th, 2008
        10:24 am



            &lt;div class="commenttext"&gt;&lt;p&gt;Your post actually uncovered some answers to the .value, .text, .children .getChildren() and .children() I was looking for.  Obviously I'm having the same frustrations you did and it's reassuring to see that I'm not alone.&lt;/p&gt;
&lt;p&gt;Thanks for your post.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;



&lt;div style="border:1px dotted #ccc; padding:8px; background-color:#eef; margin:12px"&gt;&lt;b&gt;
        two bit fool&lt;/b&gt; - June 28th, 2008
        7:55 am

            &lt;div class="commenttext-admin"&gt;&lt;p&gt;Dylan,&lt;/p&gt;

&lt;p&gt;It's nice to know that my rant actually helped someone.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;


&lt;div style="border:1px dotted #ccc; padding:8px; background-color:#eee; margin:12px"&gt;&lt;b&gt;
        ECMAScript v4 derails...finally&lt;/b&gt; - August 14th, 2008
        9:55 pm



            &lt;div class="commenttext"&gt;&lt;p&gt;[...] When I first tried Flex, Adobe's poster child of AS3, I was stunned. It felt like I had stepped back into the early days of Java. I was contantly fighting the syntax and the framework, interrupted by frequent "breaks" as I waited for the lathargic compiler. After countless expeditions into the nested maze of class documentation, I gave one final laugh at its ridculous verbosity, and walked away.&amp;nbsp; Some other Flash developers noticed the same trend, and they wondered if Adobe was headed in the wrong direction. [...]&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;

&lt;div style="border:1px dotted #ccc; padding:8px; background-color:#eee; margin:12px"&gt;&lt;b&gt;
        Mike&lt;/b&gt; - October 14th, 2008
        11:52 am

            &lt;div class="commenttext"&gt;&lt;p&gt;...but thats not all: Flex have memory leak issues, too. I thought about develop my next whole project with Flex or just use a component from Flex. &lt;/p&gt;
&lt;p&gt;By testing my application, I found out, that there are many memory leaks, so you cant use it for a long running applications. &lt;/p&gt;
&lt;p&gt;e.g. the following two line will cause a memory leak: &lt;/p&gt;

&lt;p&gt;private function httpServiceResult(evt:ResultEvent):void {&lt;br&gt;
  xmlDatasource.removeAll();&lt;br&gt;
  xmlDatasource = new XMLListCollection(XML(evt.result).children());&lt;br&gt;
          }&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;



&lt;div style="border:1px dotted #ccc; padding:8px; background-color:#eee; margin:12px"&gt;&lt;b&gt;

        Jovi&lt;/b&gt; - March 19th, 2009
        10:26 am


            &lt;div class="commenttext"&gt;&lt;p&gt;I am pissed for almost an hour now, that there is no such thing as the JS getElementsbyTagName in Flex. I am probably too confused to see the easy solution, but say i wanna reset all textinputs somewhere, how can I get a list with all of them, no matter how deep they are nested in containers?&lt;/p&gt;
&lt;p&gt;I must write my own recursive function for that, i guess.&lt;br&gt;
Unfortunately , I am the total recursion noob and cannot even think the solution in my had.&lt;br&gt;
Meh.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-645815977479361574?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/645815977479361574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2009/08/why-adobe-flex-makes-me-want-to-cry.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/645815977479361574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/645815977479361574'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2009/08/why-adobe-flex-makes-me-want-to-cry.html' title='why adobe flex makes me want to cry'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5650062946095888903.post-3023668228717807626</id><published>2007-03-06T21:05:00.000-08:00</published><updated>2009-08-28T21:06:00.468-07:00</updated><title type='text'>apple dropped the ball with iTunes on Windows</title><content type='html'>Let me start by saying that I own a Mac -- a PowerBook to be specific. I like it, and &lt;span style="font-weight: bold;"&gt;I like Apple&lt;/span&gt;; they've got a lot going for them:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;iPod/iTunes mania&lt;/li&gt;
&lt;li&gt;fantastic marketing&lt;/li&gt;
&lt;li&gt;sleek-looking, high-quality hardware&lt;/li&gt;
&lt;li&gt;ravenous fans that would happily buy iPoop&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But there are two things that make me curse Apple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;DRM&lt;/li&gt;
&lt;li&gt;iTunes on the PC.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I'm not going to rant about DRM, because that song has been sung too many times already. Yes, DRM sucks, but it's the cost of working with the music and movie folks, and &lt;span style="font-weight: bold;"&gt;Apple has done a decent job of hiding the headaches associated with DRM&lt;/span&gt;. Sure, they have to own hardware, software, and the entire purchasing process to make DRM transparent, but they did it, and better than anyone else.&lt;/p&gt;
&lt;p&gt;So let's talk about iTunes on the PC. No other piece of software from Apple has such a big potential for impact in the PC world (with the possible exception of Quicktime, but that honeymoon ended years ago). iTunes is the ultimate "why you should switch to Mac" marketing opportunity for Apple. A chance to show these poor PC users what they have been missing out on for all these years...and &lt;span style="font-weight: bold;"&gt;Apple dropped the ball, big time&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;If you don't believe me, get a PC (I'm using a WinXP laptop with a1.7GHz Intel Centrino and a gig of RAM) and use iTunes. Import lots of music, subscribe to podcasts, and just use it for a while. What you will find is that &lt;span style="font-weight: bold;"&gt;the UI will often become horribly unresponsive&lt;/span&gt;.&lt;/p&gt;

&lt;p&gt;It's not just that it takes too long to do the hard stuff, &lt;span style="font-weight: bold;"&gt;it fails to show basic feedback to user input&lt;/span&gt;. I'll click a button and the button won't depress, click on a menu and get nothing, grab the scroll bar and find that it is frozen in place. This is unforgivable, especially from a company that has been an industry leader in software usability.&lt;/p&gt;
&lt;p&gt;The fans will cry, "but iTunes runs fine on a Mac!" Well, it's better on the Mac, but it is not perfect. And if you, like me, got one of those pre-Intel Macs -- the ones that Steve Jobs swore were "the fastest computers in the universe" -- you have probably seen some of those same UI gaffs on the Mac.&lt;/p&gt;
&lt;p&gt;Sure, I'll give Apple a little slack, because they are writing software on someone else's platform, but they didn't even satisfy &lt;a href="http://www.useit.com/papers/responsetime.html"&gt;the most basic response time requirements&lt;/a&gt; of a GUI. If, you think that the platform can take the majority of the blame, then try &lt;a href="http://picasa.google.com/"&gt;Picasa&lt;/a&gt;; it makes iPhoto look slow and simple.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5650062946095888903-3023668228717807626?l=two-bit-fool.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://two-bit-fool.blogspot.com/feeds/3023668228717807626/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://two-bit-fool.blogspot.com/2007/03/apple-dropped-ball-with-itunes-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/3023668228717807626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5650062946095888903/posts/default/3023668228717807626'/><link rel='alternate' type='text/html' href='http://two-bit-fool.blogspot.com/2007/03/apple-dropped-ball-with-itunes-on.html' title='apple dropped the ball with iTunes on Windows'/><author><name>two bit fool</name><uri>http://www.blogger.com/profile/10580835797007108705</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_6H6hVNAI0Ck/Spiqj6zRW7I/AAAAAAAAAGw/di4B0XKInnI/S220/gravatar.png'/></author><thr:total>0</thr:total></entry></feed>
