Amazon

Monday, April 28, 2008

NetBeans 6.1 + Flex Builder 3

As I am going through Peter Armstrong's book, my current development environment of choice is using NetBeans to edit Rails code and Flex Builder to edit my Flex/ActionScript code.

Even though it means I need to Alt-Tab to switch back and forth between the two depending on which kind of code I am editing, I kind of like the separation of concerns. That is, one application for Rails and the other for Flex/ActionScript. I haven't seen any need to intermingle the two yet.

I was using the RC1 version of NetBeans 6.1, but now looks like 6.1 was official released recently.

Cool stuff.

Monday, April 21, 2008

Why Does This Work?

So I am going through Peter Armstrong's Flexible Rails book.

In Chapter 5, he talks about fixing ActiveRecord's to_xml() method. I am a fan of Rails, but I am not a fan of the solution he chose in his book. IMHO, it's kind of ugly and un-DRY. In other words, inelegant.

My first attempt at a better solution is to write my own to_xml() method, which is as follows:
def to_xml(options=nil, &block)
super options == nil ? { :dasherize => false } : options.merge(:dasherize => false), &block
end
I pasted the above into each of the four models defined in the Pomodo project Peter guides his readers through in the book, and it works, albeit un-DRY.

Then I did some reading on how I might override the built-in method at a single place, and came across this article. So I then removed the code from the model classes and placed the following at the very end of the pomodo/config/environment.rb file:
class ActiveRecord::Base
def to_xml(options=nil, &block)
super options == nil ? { :dasherize => false } : options.merge(:dasherize => false), &block
end
end
To my surprise, it works, too. It has fewer lines of code than both my first stab and Peter's solution, and it is very DRY. In other words, it is elegant.

But now I am left with this question: Why does this work?

I am not as well-versed in Ruby/Rails. Can someone help enlighten me?

Friday, April 18, 2008

300

I just watched the movie "300" on DVD.

I was ambiguous about watching it. However, I was intrigued to watch it due to the high IMDb rating.

I enjoyed watching it.

When I first read about the movie, I was turned off because I kinda knew what the outcome would be already. I am now glad I did watch it.

In fact, I was so intrigued by the historical events that inspired the movie I went online to read more about them here, here, and here.

Thursday, April 17, 2008

I Love My iMac's Screen

For non-work computing, my 24" iMac is my main machine. For work-related computing, I have a 20" HP 2035 LCD attached to my ThinkPad.

I used to think the HP display is pretty good, until recently, when I have been spending an increased amount of time in front of my iMac. The increased use of my iMac made me notice how dim and blurry the HP display is. At first I thought it is a settings thing, so I tried to tweak with the physical controls and the software settings. I also tried switching to a DVI connection to see if it helps. But nope. The iMac screen is just that much brighter and easier to read, even given Mac OS X's preference to render fonts such that they more closely resemble the actual look of the font over pixel-level sharpness (which is favored by Windows). And this is when I have the iMac's screen set at the lowest brightness level available via the OS.

This realization is now making me wanting to order a new LCD for work. Does anyone know of a comparable display I can use for work?

Wednesday, April 2, 2008

Keyboarding & Mousing Pains

I like the look of the thin keyboard that came with my iMac. I like the mini scrolling ball of the Mighty Mouse that came with my iMac. But I hate the ergonomics of them both.

The years I've invested in the software business has taken its toll on my arms. Recently, I have been using my iMac a lot playing with Ruby on Rails, and boy do my arms hurt!

Finally, I broke down and purchased the Microsoft Natural Ergonomic Desktop 7000. I use an old Microsoft Ergonomic keyboard and a Microsoft Natural Wireless Laser Mouse 6000 for work, and they work well in relieving my agony.

Let's see if the Desktop 7000 serve my arms well on my iMac.

Tuesday, April 1, 2008

Rich Web Internet Applications

The term RIA landed in the office recently with a boom, creating quite a stir. Some of the sonic vibrations produced by the initial landing had somehow transformed into words that sounded like Ajax, Silverlight, and Flex by the time they reached my ears.

However, Flex seems to be the clearest-sounding. So, I did some reading on it. Glad I did, too, because I got a chance to sit in a technology demo of Flex today.

In the demo, we were shown how someone took an existing Java-powered web application (J2EE in the back end and JSP out front), and added a slick Flex presentation layer to it.

The demo reminded me of a conversation with a co-worker about a year ago. Back then, we were just beginning to play around with Ajax, Prototype, jQuery, and JSON for our projects. I predicted that these Web 2.0 technologies are not going to stick around very long. Rather, even richer technologies will quickly come along to succeed them (Web 2.5/3.0?). Why? Well, because while these technologies have accomplished a lot of things, they feel raw and unplished to me. My co-worker didn't believe me then, and I myself promptly forgot about it, until today. I didn't even know about Flex and Silverlight then. But, I think I am right.

Rich web internet applications without having to abide by the limitations of HTML and then trying to overcome them with JavaScript? Interesting. Forget the statelessness of your old-school web applications. Say hello to statefulness like you were used to when you wrote desktop applications. Or, maybe it is time to get re-acquainted with client/server applications. Good-bye thin client, hello thick.

So what does this mean? Well, whereas server-side technologies such as JSP, PHP, ASP.NET, and Ruby on Rails traditionally rendered their output as X/HTML + JavaScript, they now have the option to render their output as, say, Flex binaries.

This brought to my mind the whole thing about REST and its implementation within Rails 2. I mean, Rails can theoretically output to SWF, or at least publish data in a format consumable by Flex binaries, no? Maybe this book will provide me with some insight and answers.

I also see Flex and Silverlight putting a 21st century shine on a 20th century promise Java made, except Java's "write once, run everywhere" turned into "write once, debug everywhere". Come to think of it, coding a lot of JavaScript is kind of like that when you are trying to make a fancy widget behave the same across IE 6/7/8, Firefox, Safari, etc.

The Flash player, on the other hand, has been deployed quite ubiquitously across the internet for online ads in the past few years. Perhaps this gave Adobe an opportunity to have worked out the cross-platform/cross-browser kinks. If Java's promise is delivered by Flex/Flash, that is saying something. Of course, targeting mobile devices powered only by Flash Player Lite might prove challenging.

Anyhow, after I have gone through the aforementioned book, perhaps I will have a better idea.

Hmm...

http://handsolomobile.com/