This is something Syck won’t parse, although it’s correct YAML, as xitology from #yaml told me. He also informed me about his SoC project called libyaml, that would be a fast, feature complete alternative to Syck. If Google accepts his proposal he expects a release in 3 to 4 months.
Recently I needed a DSL like the one in Rake for one of my projects. At first I just googled around a bit hoping to find a comprehensive tutorial. I did gain somemoreorlessuseful insights, but what I wanted was something as clean and coherent as a Rakefile:
namespace"samples"dotask:builddo# Build the sample programsendend
After reading lots of tutorials and gaining come clues all I managed to code was:
namespacedo|n|n.taskdo|t|# Build the sample programsendend
I felt terrible and started reading the Pickaxe, desperate for a solution. Proc, Binding, Object, Kernel. I was looking everywhere for some clues on how to make my DSL as great as Rake’s. Finally I found what I was looking for: Object#instance_eval!
I’ll spare you any further explainations and present you the source (abridged, download full version) to my DSL implementation:
class PseudoRakefiledef evaluate(&block)Tasks.new({},{},self,&block)endprotectedclass Tasksattr_reader:parentdef initialize(args,options,parent,&block)# snipinstance_eval&blockenddef task(task,args={},&block)Tasks.new(@args.merge(args),@options.merge(:task=>task),self,&block)enddef namespace(name,&block)Tasks.new(@args,@options.merge(:namespace=>name),self,&block)end# snipdef puts(msg)Kernel.puts"#{@options[:namespace]}:#{@options[:task]}#{msg}"endendendrakefile=PseudoRakefile.newrakefile.evaluatedonamespace"samples"dotask:builddodevelop('deal',:do_it=>:great)sleep2develop('solution',:do_it=>:sloppy)endtask:destroy,:probability=>1doputs"Tear everything down like a little kid"rm("Schroedinger's Cat",:probability=>0.5)rm("some unimportant file")endendend
It’s free to use for anyone, but you’d make this boy very happy by leaving a comment, especially if you have improved the core idea or actually use my code in your projects.
Part of my education is learning how to do presentations. It’s no standalone course but rather an integral (or not so integral) part of every subject.
Some time ago I stumbled about some great advise when doing presentations: The Takahashi Method. After deciding that Takahashi’s way of conveying information was a little too pure for me, I settled with copying the Ruby On Rails Presentations.
This approach is not only clear enough to keep the focus on the presenter but also puts some real (scientific) data across.
He wrote about some major pains in the proverbial with FastCGI:
It’s hard to set up
It’s hard to monitor
It requires dedicated tasks to keep working (reaper, spawner, spinner anyone?)
Currently no one is actively developing the Apache module.
According to him SCGI is better, because it only took him 15 minutes to set up properly. And now for the but:
As you, dear well informed reader, of course know one feature of FastCGI is to keep multiple instances of the Rails dispatcher open. SCGI in combination with the Apache module supports exactly one instance of the dispatcher. There is one obscure and in reality impossible way of changing that but believe me you don’t want to do this.
For me monitoring seemed easier because reaper, spawner and spinner already exist for FastCGI opposed to my self-written Ruby script that tries to do the same for SCGI.
And if that wouldn’t be enough SCGI also simply delegates every request below a defined path to Rails, which of course sucks if you have static content in your application. You can try to work around that, but once you generate .js or .css files through Rails, you pretty much start hating SCGI.
But uninformed as I was, I just went ahead and let SCGI handle my requests. Till today. Today I made Rails use FastCGI. I didn’t exactly follow the instructions in that article, instead of compiling anything myself I just let apt and RubyGems do all the hard work:
For me switching from SCGI to FastCGI brought nothing but relieve: My requests seem to get handled faster (probably because of the multiple instances running concurrently) and I no longer have to breach DRY, as my .htaccess doesn’t need to exclude non all rails handled requests.
Wolfgang Sommergut found SynchroEdit an open-source browser-based simultaneous multiuser editor. But unfortunately the Demo seemed broken when I tried it out, so I started to look for alternatives.
And alternatives I should find: Wikipedia has an article, that although sparse on content contains links to seemingly every collaborative editor there is. JotSpot Live is a hosted application that works (I actually tried the free plan) on Firefox and Internet Explorer, but not Opera. It once told me it lost it’s connection while I was typing on IE, but apart from that it seem slick, stable, WEB 2.0 like.
There’s also LivePad, a Mozilla only browser based rich editor, that’s free as in speech and works flawless, but takes quite some processor power.
Because i couldn’t find any really mind-blowing web applications, I decided to give standalone applications a look. Although there are two working, free solutions, I’ll ignore MoonEdit and just describe my experience with the better looking, cross-platform Gobby, because Gobby is what the developers of the great game Clonk use.
After some initial work to get Gobby running on Windows (you have to download and install GTK support packages), Gobby itself is a great piece of work. Editing works smooth and changes are visible immideatelly. Furthermore multiple documents, syntax highlighting (even for Ruby) and a seperate chat during the editing process are supported.
All in all I have to say, whenever possible I’d use Gobby, because it’s simply ten times more powerful then it’s web based equivalents, and free.
If I’d to go with a Web Application I’d choose the non-free JotSpot, because it supports many different browsers and just works out of the box.
So he went on and patched ERB so that it supported escaping of ampersands (by prefixing them with a \) and till yesterday that seemed like the Ruby like solution to my. But then I woke up today and everything seemed clear.
I was a fool. Not only did I completely ignore the potential security breach (XSS) that was introduced by essentially removing html_escape’s teeth, but I also neglected to see the really Rails like solution.
Rails is based on many principles that sound like buzzwords, but in fact aren’t. Convention over configuration is one of them, and it means that there’s always one favoured way to do something. And for his problem this way is replacing the < with a plain old <:
Yesterday I went from some revision I never cared to remember to the new and shiny 762. But not everything went smooth. While the svn update worked perfectly, the migrations simpley kept on failing. I even considered looking at the SQL for myself, but thankfully I rerun them once again, and voila, everything worked. This is a documented bug, but no fix is available as of now and why my “solution” worked is incomprehensible to me. (Also, I didn’t investigate)
Even considering all these bugs Typo is still the best blogging software around (not only because it’s written in Rails) and I’ll happily keep on playing beta testing guinea pig.
Although they amongst others feature a rendering of the AIDS virus and some people seem to object to that, I can’t help but admire this great design and the message it carries: The future (as the past) belongs to science and progress! Yay!
Princeton University emeritus professor and renowned oil analyst Ken Deffeyes thinks that the all-time production peak for petroleum, or “peak oil,” will occur on or around this Thanksgiving.
According to the article the professor already correctly predicted the US Oil Peak in 1970, so there might be some truth to it, but as the Austrian cabaret artist Josef Hader says: “I can’t stand all the people that rant about people more than 100m away.”
Today I tried to connect an iRiver H10 to my Windows XP Professional SP 2 Notebook. At first everything went fine, XP recognized the new device and showed the “Add new Device” Dialog, but the driver installation failed. Windows Update didn’t have any drivers and neither did the iRiver Homepage. Firmware updates, check. Manuals, checkk. Drivers, fail.
And to make my day worse it also failed on two different machines in the same way.