having fun with code

Author Archives: Eneko Alonso

Creating QR Codes with Google Charts API

As simple as a URL: http://chart.apis.google.com/chart?cht=qr&chs=250×250&chl=http://dev.enekoalonso.com

Titanium Developer: love and hate

I’ve been using Titanium Developer for a while now, since I installed it to do some mobile app research one or two months ago. But up until now I barely used it again other than to maintain a desktop app I created for a game, which thanks to Titanium runs in both Mac and PC. [...]

Little tricks: string padding in Javascript

I just found this little trick to zero pad numbers in Javascript. It is also applicable to padding with any character, not just zeros. var n = 123 String("00000" + n).slice(-5); // returns 00123 ("00000" + n).slice(-5); // returns 00123 ("     " + n).slice(-5); // returns "  123" (with two spaces) Found here.

Equivalent of parseInt() in Freemarker

Programming languages have methods to cast integers to strings and strings to integers, but usually is had to find equivalents to parseInt(), a Javascript function that basically removes all non-numeric characters from a string and returns the resulting integer. Today, while working on a Freemarker template, I had to convert strings like “40 ms.” and [...]

Little tricks: editing strings by index in Javascript and Python

Editing strings by index maybe something that we don’t do all the time. But it’s one of these things that, coming from languages like C, one would assume is as trivial as assigning the value of an indexed position. Something like this: var a = "hello world" a[0] = "H" console.log(a) // outputs "hello world" [...]

Change in WebSockets handshake protocol

If you are working with the latest version of Google Chrome (6.0.442.0) and you have been doing some testing or projects with WebSockets you may have already noticed there has been a change in the WebSockets specification for the client/server handshake protocol. More info about the change: http://webreflection.blogspot.com/2010/06/websocket-handshake-76-simplified.html http://blog.chromium.org/2010/06/websocket-protocol-updated.html

More WebSockets, now with Python!

A couple of weeks ago, Tim and I worked on a little game/demo using WebSockets and C# (I haven’t been able to put it online since I do not have a Windows server). It was a lot of fun and we were able to see the potential of WebSockets and how much internet can will [...]

Performance matters

I just read this on an email from a Google’s Closure developer: Adding runtime checks for invalid usage is something we have policy against. It adds to the code size as well as to the runtime cost. I totally agree. Developers should be responsible for their usage of APIs or third party libraries, while these [...]

Awesome! Dinner for Spanish developers at Google IO 2010

Great news. Google will be sponsoring a dinner for all Spanish developers at Google IO 2010: http://programa-con-google.blogspot.com/2010/05/vienes-al-google-i0.html We will be driving from SLO on Tuesday afternoon, but I’m not sure we would get there by 8pm. I really hope I can make it!

Interesting JSON vulnerability (old stuff)

Somebody at work passed this article about an interesting vulnerability in web APIs that use JSON. The exploit combines Cross Site Request Forgery (CSRF) with a JSON Array hack allowing an evil site to grab sensitive user data from an unsuspecting user. The hack involves redefining the Array constructor, which is totally legal in Javascript. http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx [...]

About the blog

This is a blog about development, focused mainly on Javascript but also other languages like python, shell scripts and more.

About the author

Eneko Alonso is a software engineer and UI developer with more than eight years of experience in software and web development. He lives in San Luis Obispo, California and works at LEVEL Studios.

Contact Info

Contact Info