ChromeOS Notebook Cr-48

Yesterday (This is now some days ago ;)) I got the chance to take a quick look at the Google Chrome OS Notebook, and I gotta say I’m really impressed. Even though I could not take a look at the OS itself really, thanks to no available wifi, on first glance it looks quite nice. It mainly is a Chrome browser running fullscreen so I don’t expect much of a difference from the experience than running it on my Macbook. To me, at the right price, this would be an awesome machine. When I take a look at the apps I use most of the time, almost all are browser based anyway, and through my Palm offering a wifi hotspot everywhere there is a cell signal, I can live with that. The power of HTML5 will also increase the usability even without connectivity in the near future. But the OS is really not what I’m lusting for… Sell me the hardware!

The hardware

I know that the machine will most likely not be available to a broad audience, but really this is a machine I would buy. The design is simple yet functional, the keyboard has a good touch to it at first glance, while the touchpad feels right as well. The machine is light, but feels sturdy and the outer shell has an almost leather like touch, similar to my Palm Pixi. There are no annoying stickers, or crazy amount of LEDs bagging for attention. The battery life is supposed to be close to 8h which is enough even for a long meeting-, or travel-day. So please manufactures take a good look at this! I bet I’m not the only one looking for such a machine. Currently there seems to be no PC manufacturer left offering at least a decent design, bundled with a nice machine, the only one coming close is Lenovo I guess.

I still got some hope left that maybe I’ll be able to beta test the machine, but I guess there a probably 1.000.000 people hoping the same. So to the guys who build the machine, just build more an sell them, kthxbye.

Growling from Node … or why is Array.pack missing from Javascript?

Since it came out I’ve been really interessed in Node. So I decided to do something with it, and to get me started I hacked together a little module to allow me to do what every good programming environment should allow: Sent me some Growl notifications :D…

Nodejs growl.png

This involved some rather low level UDP packet construction, but for now it works. Maybe somebody will find it useful, I put the code up on Github.

While writing the module I realized I was missing one piece coming from network coding using ruby, Array.pack(format) why is this missing? Is there an alternative? How do I turn an Array into a buffer following some custom format? Well for now I solved this by a little hacked function extending Array, this is neither clean nor well tested but it works for me while looking for a way to this right. For anyone interested here it is, and don’t kill me cause it’s ugly

https://gist.github.com/734947.js

Enjoy.

Coding for the caffeinatedcoders

A couple weeks ago me and a friend decided to get our projects together and from
now on publish under the caffeinatedcoders. From now on I can focus on doing what I love, develop web applications using the bleeding edge of technologies. This will include my love for Ruby (on Rails), as well as Javascript coding. Stay tuned our first project in on it’s way, the code is just flowing from my fingers right now ;). I can say so much the web apps we build follow the Unix way, do one thing and do it right!

Embedding Fonts for use in Tumbler Theme cross domain (Firefox, Chrome, IE approved)

Looking for a nice way to change the look of my Blog headline, I decided to go
go with embedding font. There are great resources to be found on that, for
example take a look at the html5 boilerplate,
or the tutorials on html5rocks. In essence the
code looks like this

https://gist.github.com/701088.js

The Problem on using this on Tumbler is that the fonts have to be hosted
somewhere different than the theme, to me this was actually not a big Problem,
since I own a server running Nginx for serving all kinds of static content, or
at least I thought so. While working on the Template everything worked fine in
Chrome, and the new font looked good. The problem arises when doing this cross
browser, because IE as well as Firefox only accept relative URLs in the src for
the font. So while Chrome shows the font as it is supposed to Firefox and IE,
showed the fallback, even though they actually downloaded the font, but did not
use it, due to the “same origin” restriction. Poking around the net I discovered
a nice work around which works great as long as you got a server somewhere
under your own control. All the server serving the font gotta do write a HTTP
header. Using Nginx this is easily done by adding the following to the
configuration

https://gist.github.com/701102.js

That’s it from now on embedding fonts using a non relative url will work cross
browser in Firefox, Chrome, as well as IE. I found it documented for Apache
using the above code simply adapted the code for Nginx.

Ruby render :action => “new” does not call new method…

… Even though I should know that It drove me crazy the last hour. It’s important to remember when using render in error handling with nested resources. The following actually does not work, since when calling render :action => “new” in the error handling, @b will not be set, an therefore render will fail (probably unless @b is not used at all)

https://gist.github.com/661956.js

It’s important to actually set @b in this case even though it is not actually needed for the create

https://gist.github.com/661962.js

Just nice to know, because it actually feels like calling a controller but it doesn’t.

Getting your test records made for you

For the longest time I’ve been working with fixtures in ruby for testing, until
I recently discovered the factory_girl_rails gem. Fixtures are nice, they
provide a constant set of data to rely on without having to write them all the
time. While for a lot of purposes fixtures are nice, if you need to create new
objects all the time it can be a chore to to so. Especially maintaining them can
become quite a lot of work, especially when having objects which are
interrelated. This is where factories come in. They provide a new object
whenever you need one. I myself am still pretty new to it but it is just so easy
to even model interrelated objects and using them for your tests without having
to worry about updating them, unless your data model changes, which should not
happen that often. So just as a quick introduction those a 2 models following a
:belongs_to, :has_many relationship.

http://gist.github.com/646058.js

Coding for the caffeinatedcoders

A couple weeks ago me and a friend decided to get our projects together and from
now on publish under the caffeinatedcoders. From now on I can focus on doing what I love, develop web applications using the bleeding edge of technologies. This will include my love for Ruby (on Rails), as well as Javascript coding. Stay tuned our first project in on it’s way, the code is just flowing from my fingers right now ;). I can say so much the web apps we build follow the Unix way, do one thing and do it right!

This variable access in ruby shouldn’t work, or should it?

Ok this is weird, and seems kind of dangerous.

http://gist.github.com/624138.js

In my opinion there should be an error thrown when I access, a local variable and it is undefined, it should not be passed to the instance and the similar named variable from the instance is passed back. Esspecially when using initializations like the following.

http://gist.github.com/624144.js?file=Variable%20initilization

A long discussion showed this is really something to think about wether it’s a bug or a feature…