Monday, May 25, 2009

Erlang -- let's get it on!

Messed around with Erlang for like the sum total of 2 hours over a year ago. But have decided recently that I'm going to sit down and little by little work towards learning it. It just seems like a great complement on the back end with Ruby, especially with items like CouchDB bubbling up. It's also fun and mind bending exercise to learn new syntax, along with a different language. Erlang is very different than imperative languages. Looking forward to the journey, while continuing to progress deeper into Ruby, JavaScript, REST, TDD, Rails...

So I'm working my way through this book: Programming Erlang: Software for a Concurrent World http://pragprog.com/titles/jaerlang/programming-erlang

mark_holton ~$ sudo port install erlang
---> Fetching gawk
---> Attempting to fetch gawk-3.1.6.tar.bz2 from http://mirrors.kernel.org/gnu/gawk
---> Verifying checksum(s) for gawk
---> Extracting gawk
---> Configuring gawk
---> Building gawk
---> Staging gawk into destroot
---> Installing gawk @3.1.6_0
---> Activating gawk @3.1.6_0
---> Cleaning gawk
---> Fetching tcl
---> Attempting to fetch tcl8.5.6-src.tar.gz from http://superb-west.dl.sourceforge.net/tcl
---> Verifying checksum(s) for tcl
---> Extracting tcl
---> Configuring tcl
---> Building tcl
---> Staging tcl into destroot
---> Installing tcl @8.5.6_0
---> Activating tcl @8.5.6_0
---> Cleaning tcl
---> Fetching tk
---> Attempting to fetch tk8.5.6-src.tar.gz from http://superb-west.dl.sourceforge.net/tcl
---> Verifying checksum(s) for tk
---> Extracting tk
---> Configuring tk
---> Building tk
---> Staging tk into destroot
---> Installing tk @8.5.6_0
---> Activating tk @8.5.6_0
---> Cleaning tk
---> Fetching erlang
---> Attempting to fetch otp_src_R12B-5.tar.gz from http://distfiles.macports.org/erlang
---> Attempting to fetch otp_doc_man_R12B-5.tar.gz from http://distfiles.macports.org/erlang
---> Attempting to fetch otp_doc_html_R12B-5.tar.gz from http://distfiles.macports.org/erlang
---> Verifying checksum(s) for erlang
---> Extracting erlang
---> Applying patches to erlang
---> Configuring erlang
---> Building erlang

Wednesday, February 18, 2009

internationalization


...since I'm going to have to speak Spanish in Alhambra, CA during the AT&T work stoppage... I might as well incorporate that into my web applications and "make lemonade" as the saying goes.

That's just a positive spin on having to go there. We coincidentally have homework due next week related to internationalization.

Been writing the Depot app via the PragProg book in Rails, but am doing so via Test Driven Development (slightly different from the book, per the awesome teaching of @tenderlove in the UWRails class -- this is the 2nd time I've taken this 3 month Rails class, and learning a ton more about Rails 2.2 and especially TDD)... am getting to the part where I'm incorporating internationalization.

I like this i18n features built into Rails, so I figured I'd blog about it, in case anyone else was interested: so certain items have translations. E.g. headers, titles, shopping carts, buttons, links -- not the data in the database, but all the labels and text that would help a user navigate through the application.

The translations are handled in a YAML file, which lets you call out the translation that matches it's hierarchy -- as shown below (Spanish, "es" shown here, there is an accompanying translation file for English, or "en"... could continue on as many languages as you wanted):


http://gist.github.com/66782

So the user sets their language preference via the dropdown (English is default, but they can choose whatever they want), then voila all labels that have a translation appear in that language selected! How does that work? Inside the code for all the pages, it just effectively says "give me whatever language is selected for layout.side.home, etc., and looks it up in the YAML file for that language above, grabs the matching value in that hierarchy, and out pops the word or phrase. For example, the markup for the sidebar links for "store", "questions", "news", "contact" look like this:

http://gist.github.com/66788

This is a common example, and almost identical to the example in the PragProg Agile Rails version 3 book -- maybe armed with this knowledge, I'll internationalize EyeOnMajors and Golfap as soon as it is riding on the Rails... :)

Giddyup.
Holts

Sunday, February 08, 2009

Get Satisfaction -- customer dialogue

An example of what I'm using for EyeOnMajors to elicit customer feedback, ideas, etc.

http://getsatisfaction.com/eyeonmajors

Tuesday, February 03, 2009

forcing repaint DOM in IE6 and IE7?

I have loop that makes server-side Ajax calls on each iteration, and returns data. This could be 50 iterations, 500, 5000, whatever. Upon each iteration, I update that particular row with a server-side response (i.e. "success" or "fail"), and then update the total count processed ("26 out of 432 processed"). -- I update the innerHTML of a div or span, and another div showing the total number of records processed (at the end of an iteration, or in the onComplete callback handler of the Ajax.Request). That is all working perfectly fine... in Firefox, Safari, and every other browser except IE6 and IE7.

I have tried IE hacks such as adding a class to the div, and dropping a class from the div, adding and dropping child nodes from the div, etc -- to attempt to force IE to repaint, I have tried waiting a small interval, to no avail. If you pop up an alert("hai"); at the end of the iteration, the the IE6 and IE7 DOM will repaint with the updated values. (btw, how dumb is that?)

Does anybody have any tried and true ways to make IE6 or IE7 repaint a particular DOM element in these cases (without obviously popping an alert)? It works flawlessly in Firefox. I know IE is a steaming pile, but just wondering if anyone has had any success with a hack that works here.

Wednesday, January 28, 2009

Why "require 'rubygems'" In Your Library/App/Tests Is Wrong

I have been suitably convinced...



http://gist.github.com/54177