Posts Tagged ‘Programming’

My favorite jQuery plu­gin by far has to be the jQuery Cycle Plu­gin. It’s a generic slideshow plu­gin, but it’s ver­sa­tile enough that I’ve used it to build a slider, a port­fo­lio, and just recently, an iPhoto-like image flip­per. This was inspired from the CJ Image Flip­Box. Unfor­tu­nately, the way the plu­gin is designed, you can’t mesh it with Fan­cy­box because the plu­gin cre­ates an anchor and an image which inter­cept the mouseclicks pre­vent­ing the Fan­cy­box from acti­vat­ing. So to get around the prob­lem, I used the Cycle plu­gin to cre­ate my own.


This post is a bit over­due con­sid­er­ing the project for which I did this was com­pleted months ago. I finally got around to doc­u­ment­ing it. Magento’s prod­uct list view lets cus­tomers add prod­ucts to the shop­ping cart one at a time. The client wanted cus­tomers to be able to add mul­ti­ple prod­ucts to the shop­ping cart simul­ta­ne­ously. Given the time con­straints for the projects, I cre­ated an ad hoc AJAX method to accom­plish this fea­ture request.


I finally got around to down­load­ing the iPhone SDK to see what I can do with it. Since I’ve dab­bled in game devel­op­ment back when I worked with Flash and Direc­tor, I fig­ured I’d see what I can do with the iPhone. I wanted to start with a frame­work and I looked at Torque and Unity. Though inex­pen­sive by game engine stan­dards, dur­ing a reces­sion­ary time of cost cut­ting, it’s hard to val­i­date a nearly $1000 pur­chase, espe­cially if you don’t know yet if that invest­ment would pay off. So I finally set­tled on the cocos2d-iphone frame­work which is based on the cocos2d frame­work for Python. There is lit­tle to no doc­u­men­ta­tion, so be pre­pared to read source code. Mon­o­cle Studio’s whitepa­per will def­i­nitely help you boot­strap your project. In the spirit of that paper, I thought I’d share my trans­la­tion of the cocos2d “Hello, World” exam­ple adapted for the cocos2d-iphone framework.


Get­ting CSS rules to work across all browsers is a con­tin­u­ous fight. Thank­fully, there are workarounds and DHTML meth­ods to cor­rect many of these prob­lems, and if those fail, reluc­tantly there are hacks avail­able. Unfor­tu­nately, it seems I’ve run into a dif­fer­ence of opin­ion between the browsers, most likely as a result of the W3 Con­sor­tium fail­ing (yet again) to be explicit with their stan­dards. The prob­lem is the dif­fer­ence between the way Fire­fox and Opera inter­pret the “word-spacing” CSS prop­erty ver­sus the way Safari and IE inter­pret the prop­erty. More specif­i­cally each browser treats the non-breaking space dif­fer­ently. FF/Opera both respect the non-breaking space and Safari/IE both ignore the space. For exam­ple, if the text is “first foo bar last”, FF/Opera would like:

first        foo bar       last

whereas in Safari/IE the text would appear like:

first        foo        bar        last

Per­son­ally, I agree with the FF/Opera devel­op­ers and feel that the non-breaking space should be respected since I’m explic­itly telling the browser that words to either side of the non-breaking space should be treated as a unit. So now I’m going to have to put each phrase in some sort of HTML block and depend on a com­bi­na­tion of padding and mar­gins to accom­plish the same effect in order for it to be cross-browser compatible.