I dropped YAML in favour of plain ruby for config files
write: h = { :a => 123, :b => "321", 'c' => 0.123 }
instead of
---
:a: 123
c: 0.123
:b: "321"
like a lot of people i put config values in hashes and used YAML to read them from file. Take database.yml in Rails for example. YAML feels like coder nirvana when you have suffered from XML pain in Java land for many years. YAML syntax is so much nicer. But to express ruby values, plain ruby syntax for me is even more straight forward. To check syntax I always had to try and err before use with YAML.dump {:foo=>"bar"}.
I thought about just writing plain ruby and eval it. Problem is, eval avoids polluting the global namespace and the variables you set in an evaled file will not show up anywhere. Using global variables(yuck), constants, @@ variables or similar constructs would defy the purpose of getting a nice syntax for the user.
Then I got the idea of using the introspecitve powers of ruby to the retrieve the local variables which got defined on evaling a file from the binding. I wrote a function which does exactly this. From a known binding it extracts the loaded variables afterwards. The values are then injected into a hash an returned.
def load_values_from_file(filepath)
b = binding
v1 = eval "local_variables", b
eval IO.read(filepath), b
v2 = eval "local_variables", b
(v2 - v1).inject({}) do |c, key|
c[key.to_sym] = eval "#{key}", b
c
end
end
and my future config files will be plain ruby, which I know better than YAML syntax.
test test test

http://www.flashbynight.com/test/
stumbled upon that in the anarchia tumblelog of christian neukirchen and of course, nerd that i am, i could not resist.
my score to beat: 25
hehe, have fun
Die Welt ist eine Labyrinth

und kann die Kunst uns retten? Wie hohl und leer das ordinäre marketing treiben im weinberg der brand builder manchmal ist zeigt uns Alexis Lloyd mit seinem AD GENERATOR. Generativ verknüpft er unsere geflickrte welt mit der Prosa der WErbetreibenden um in einem endlosen strom neue konsumbotschaften fuer uns zu
erzeugen. Gentlemen(and ladies likewise), please start you very personal ad generator.
Technorati Tags: art, generator, marketing
update: iPhone look alikes
I joked a little about the absurd prospect of expecting the asian companies to patiently wait for Apple to launch their iPhone. But in a kind of actio-reactio reversed surprising quantum world move the response was there before the action.
LG in conjunction with PRADA did launch a slick touchscreen device and PRADA might turn out out to be the perfect partner to get it right with successfully locking on to the luxury target group.
Don’t get me wrong, I still believe in the iPhone becoming a huge success. There is a reason why there is hardly any mention of the software. Software makes all the difference nowerdays. I personally definitly won’t fuddling around with yet another stupid gadget. And it doesn’t have multitouch either.
rails 1.2.1 got “Mehrwertsteuererhoehung”
Sorry for the german in the title, but i just stumbled over the coincidence of the Rails 1.2.1 release lines of code increased conforming to the german VAT update we got this januar. VAT is now 19% in Germany and ruby came from 6246 to 7428 lines of ruby code. That is an 18.924111431316 percent increase, which rounds up quite nicely to 19%. I checked against the last pre-1.2 release .
With 7428 lines of code rails still stays a lithe and lissom young framework. All the best for the REST.
cheers
Technorati Tags: rubyonrails, release, 1.2.1,
Stupid devices: The Blackberry
Oh yeah, i also became one of those blackberry users. It is a really good on-the-go traveling email device. When last year i was wasting days and days on airports while traveling back and forth to lots of meetings the blackberry gave me back some productivity. Because of the blackberry i could spend the precious time at my desk with getting real things done instead of wading through dozens of mails.
But, the blackberry is a phone, and an organizer, and therefore contains all kinds of smartphone application. And there is an alarm-clock wake-up application you might think. No, it is not. It is an annoyance. First, the meeting calendar can’t be used for wake up because it only pops up a little reminder windows and makes a mellow ‘ping’. Not for me to wake up from. And then there is the Alarm clock. Easily to define your wake up time with the thumbweel and you set you daily alarm. Yep, thats right, a daily alarm, every day. There is no option of only setting up a single alarm for the next morning but only a daily alarm for all days to come. This works perfect for getting you out of the bed the next day. I am kind of sleepy then and normally don’t like to bother to unconfigure the alarm clock. And usually i forget that also for the rest of the day. And this it what kicks me out of bed the day after. The forgotten alarm clock remembers its daily duties and kicks in on 6:45 saturday morning. I don’t like having electronics next to my bed and so i can’t even switch it off from there. stupid device, great email road warrior though.
good morning
Technorati Tags: stupid, blackberry, usecase
The lunatics have taken over the asylum
in Monschau, Germany(the middle of nowhere), “The Web´s most ambitious RUBY ON RAILS Startup” started looking for some fellow ruby coder to kick-off their project. But there is a twist, a big one:
MUST BE BORN BETWEEN JULY 24 AND AUGUST 22 OR NOVEMBER 23 AND DECEMBER 19 AND BE BETWEEN 18 AND 99 YEARS YOUNG
And seemingly the search with increasing despair:
15th Jan: Startup looking for web designer/programmer/co-founder
16th Jan: The Web´s most ambitious RUBY ON RAILS Startup based in Monschau Germany is looking for a Ruby on Rails guru to lead our development team as Co-founder and Co-CEO
and latest to date:
18th Jan: The most ambitious Ruby on Rails project calls for a Rail’s guru to lead team as Co-founder
RoR, TDD, AJAX!, scalable websites, whatever you like, you name it you get it, its all there and you can become “importend” part and development team lead, Co-founder even!
“NOVEMBER 23 AND DECEMBER 19 “, sigh, and so another bright future fades away for me, 16th Nov, misssed by a few days, phew.
oh, and some more requirements are piling up, you won’t make it without
a deep love for humanity and the relentless will to facilitate happiness and emotional fulfilment for all.
yep, ok for me!, but as i said, wrong dates. The position is “Full-Time”, but please keep in mind:
There is no immediate compensation for the first few months. Once the first round of financing is finalized then we will begin paying a salary.
so better bring you own, for the “entrepreneurial” spirit i guess. Me beeing you would contact Gabriella von Schadewitz right away in case i would be more lucky with the stars.
have fun
and oh, don’t forget to check their website: http://simplyooh.com
one browser to rule tham all?
huch, da hat mich dion aber erschreckt.
in a surprise move, they have created Microsoft Firefox 2007 that mimics a lot of features from Mozilla Firefox.
soweit sind wir also schon. Nach dem ersten Schreck allerdings und einem kurzen Blick über die Seite sortiert sich die Welt jedoch schnell wieder ins gewohnte.
have fun
Aus für Amateure
Die Niederländer legen die Latte mächtig hoch in Sachen Webenwicklung. Peter Paul Koch berichtet über das neue Accessebilty Gesetz in Holland. Auf Quirksmode schreibt er schon seit Jahren für geordnetet Verhältnisse im Sachen CSS, HTML und Javascript. Er war einer der ersten, bei dem ich systematische Lösungen gefunden habe, die sich wohltuend von den cut-copy-paste Orgien der unzähligen Cargo-Cult Adepten abhob.
Das Gesetz ist zwar schon seit letztem Jahr in Kraft, aber wer liest sowas denn schon? Wie kann man auch ahnen das die Leute was von ihrem Handwerk verstehen und Regeln wie die folgenden festlegen:
- valid HTML 4.01 or XHTML 1.0
- CSS and semantic HTML and separation of structure and presentation
- progressive enhancement
- the W3C DOM (instead of the old Microsoft
document.all)- meaningful values of
classandid- meaningful
altattributes on all images
Und das gilt wohlgemerkt:
As of 1 September last year, every website built for a government agency is required by law to use [die so festgelegten Regeln]
, und von denen gibt es 125! In der Konsequenz bedeutet das die Vertreibung der Armateure aus dem Geschaeft mit öffentlichen Webseiten. Zum anderen aber macht es die Produktion teurer und Regierungen sind auch nur Kunden die am Ende immer Geld sparen wollen/müssen. Da per Gesetz aber alle bestehenden Regierungsseiten bis 2011 entsprechend angepasst werden müssen entsteht auf jeden Fall ein lukrativer Markt. Auf diese Weise werden qualifizierte Leute gefördert und der gesamten Branche ein Qualifizierungsanreiz aller erster Güte gegeben. Und Qualität ist ja noch immer das beste Geschäft, PPK auf jeden Fall scheint sich zu freuen. Volkswirtschaftlich ist Qualifikation in Zeiten der Globalisierung sicher eine probates Mittel für ein an natürlichen Rohstoffen ja so reiches Land wie Holland. Davon sollte man lernen.
Und nun, wer Traute hat, der kann sich ja mal selbst versuchen. Ich weiss nicht welcher Affe mich geritten hat die full flash version der neuen Homepage meines Arbeitgebers zu checken, aber hey! Die 80% können sich sehen lassen, dass ist deutlich besser als die 58% für das Posting auf Ajaxian zu dem Artikel in Quirksmode, und das ist ja schliesslich das Zentralorgan des Web2.0.
My personal favorite: “meaningful values of class and id", ganz, ganz großartig, nachdem ich heute mal wieder rätsend darüber saß wofür wohl “pb-id” stehen mag.
cheers
Technorati Tags: accessebilty, css
