Just a quick recommendation for anybody working with MongoDB on a Mac, checkout MongoHub it makes working with the DB so much easier while providing an easy to use frontend to check the current state of the DB. I was using Futon4Mongo before that but I gotta say that while working with the DB a fast as well as reliable native app is hard to beat.
Category: Uncategorized
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.
For my own sake … Promotejs
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.
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…
My Kindle 3rd Gen
Well well so here it is my 3rd Gen Kindle (WiFi Edition). I was thinking about an e-reader for more than a year now but the price as well as the size of the new Kindle put me over the top. The main reason I bought the device is to read up on all those stories I bookmark every day. Since I’ve been using Instapaper since quite some time, and since reading on the web is not all that nice I’ve been looking for an alternative. And here it is…
Through the use of Ephemera there is a nice way to sync my Kindle with all those unread items in my Instapaper list, and I finally got a nice device to read those long articles without spending even more time in front of my Macbook. The Kindle really is an awesome device for that.
But I gotta admit on the trainride today I started reading The Picture of Dorian Gray von Oscar Wilde and it is really enjoyable, and thanks to Project Gutenberg, free as well. We’ll see If I get to enjoy those classics on my endless subway rides. If not the device is gonna fulfill it’s intentional purpose for me… reading Instapaper, and therefor mainly Hackernews.
Airdisk needs repair… but it’s working on my Mac?
While getting a new 1.5TB disk for my Media to be shared on my local network via my AirPort Extreme I discovered a weird problem. I got the disk pre-formatted with an FAT32 partition, since I wanted to store larger files I reformatted it to HFS+ simply by selecting the *partition* and selecting erase.
it showed the “Disk needs repair” message. So I reconnected it to my Mac and checked the disk, which showed no errors, but would not mount on the Airport. After some trial an error I figured the problem to be that there is a difference between formatting the drive and the partition. When looking at the *drive* in Disk Utility it still showed FAT32, but selecting the *partition* it showed HFS+.
The solution to the problem is formatting the *drive* HFS+, afterwards the Airport mounts the disk just fine, and all my media now resides on my network for my devices to see.
Moving to tumblr
… obviously I’ve been moving my website again. Until recently I’ve been very satisfied using Squarespace but I realized that of all the features it offers I’m only using the blog really. Since I’m already hosting a personal blog where I post all those snippets and music etc. which I find around the net on Tumbling the net. I decided it might be a good move to go all tumblr. I’ve spent yesterday moving all my posts over and create pages for coding projects, and now the move is complete.




