published 27 days ago
(21.07.2008 00:19)
$KCODE = 'u'
require 'rubygems'
require_gem 'activerecord'
require 'rest_client'
class MyModel < ActiveRecord::Base
end
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:database => "hello_world",
:encoding => 'UTF8'
)
MyModel.find(:all).each do |record|
p RestClient.post('http://localhost:5984/hello_world', record.to_json)
end
Posted in ruby, coding | Tags activerecord, couchdb, json, mysql, rest, ruby | no comments | no trackbacks
published about 1 month ago
(12.07.2008 22:28)
»When the burning husks of your startups warm
the last of your bones, remember I told you so.«
— Zed, in Rails is a Ghetto
Posted in ruby, coding | no comments | no trackbacks
published about 1 month ago
(22.06.2008 16:23)

taken at the Rails Konferenz 2008 by patrick lenz.
Posted in ruby, coding, mac | Tags 2008, konferenz, mac, rails, ruby | no comments | no trackbacks
published 8 months ago
(16.12.2007 19:21)
“The Sapir-Whorf Hypothesis theorizes that thoughts and behavior are determined (or are at least partially influenced) by language. […] To this day it has not been completely disputed or defended, but has continued to intrigue researchers around the world.”
Posted in ruby, coding, wisdom & quotes | no comments | no trackbacks
published 9 months ago
(11.11.2007 15:04)
—Matz, on Ruby becoming “Enterprisey” (via project.ioni.st)
that’s almost a shock, makes me afraid. but he’s right—at last railsconf europe for example, sun, ibm & co showed up. pushing their tools, and ideas of “how to develop”, without any deeper knowledge of ruby. let’s hope they’ve learnt or are willing to learn, and aren’t just disguising just to enter this market and sell their stuff to people who can’t tell the difference.
make sure ruby and the community stay the way they are, it’s what’s makes it special, and what made it successful.
Posted in ruby, coding | no comments
published 10 months ago
(07.10.2007 14:02)
duck typing is actually a simple concept. the best explanations i have come across (from wikipedia 1,
2):
»Suppose you see a bird walking around in a farm yard. This bird has no label that says ‘duck’. But the bird certainly looks like a duck. Also, he goes to the pond and you notice that he swims like a duck. Then he opens his beak and quacks like a duck. Well, by this time you have probably reached the conclusion that the bird is a duck, whether he’s wearing a label or not.” (Immerman 1982, p. 102)«
So, in programming, duck typing is a style of dynamic typing in which an object’s current set of methods and properties determines the valid semantics, rather than its inheritance from a particular class, or implementation of a formal interface.
The ruby mailing list has a great post called ”How to duck type? - the psychology of static typing in Ruby”, explaining the rationale and why duck typing is a good thing (in ruby). an excerpt:
»Many people coming to Ruby from a statically-typed language are somewhat
afraid of Ruby’s dynamism, or “don’t get it(TM)”. David Black and I (edit: Tim Bates)
believe that this is in part because it is thought that the uncertainty
and changeability built into Ruby are dangerous and one wants to find
shelter from them.«
Posted in ruby, coding | Tags duck, ruby, typing | no comments
published about 1 year ago
(11.08.2007 16:32)
jetzt.de (the “youth” magazine of the süddeutsche zeitung) gives an interesting overview of 25 current german startups, asking every one of them around a dozen questions.
greenmiles.de
i found the greenmiles.de idea particularly interesting: you enter your planned trip and transportation type, then they calculate how much co2 is produced. you can then donate an appropriate amount of money to climate conservation programs, allowing you trip to be climate neutral. of course very rough, but nevertheless interesting feedback on how much co2 one of us produces in his day to day life. for example, one round-trip flight hamburg-munich produces 9m³ of co2, which equals a cost of 8 euros.
german startup technology choices
i was curious which technologies these startups would consider best for their success, so i looked at the programming languages and frameworks they used. here are the results:
|
60%
|
php
|
|
16%
|
ruby (= ruby on rails)
|
|
16%
|
java
|
|
4%
|
asp.net
|
|
4%
|
(project offline)
|
a couple of observations:
php & java have been at the availability of web developers since at least 1999 (that’s when i started) and ruby on rails had it’s 1.0 release in december 2005. so i can only say: go rails! :-)
so let’s say konichiwa to these ruby on rails projects:
looking at php
of course with 60%, php is the most important language by far. it’s the technology one needs least development experience for, and it allows fast results; therefore very appealing. working with less experienced developers however also means things can go really bad down the road – remember the studivz scalability and security issues, for example.
and still not all of the startups seem to do their php development in a professional way. some use a CMS (typo3) as a base for their site, others still run php version 4, which has been replaced by php5 three years ago and is now discontinued.
there is only rails
the java and php projects use a variety of frameworks, but in the ruby projects – there is only rails. that’s good – a ruby web developer will almost certainly know how to work with rails. a php developer will more than likely not know how to work with your framework, since there are so many open source php frameworks out there, and still many people roll their own one.
on a side note, only one startup runs on microsoft technology …
i figured out what a site runs by looking at their webserver’s responses (server type, cookie name) and the generated html. if in doubt i checked their tech jobs postings, too. for the technically inclined, here’s the full list:
dealjaeger.de java
spickmich.de php
cellity.com java (jboss)
autoaid.de php (symfony) AND/OR python
hitflip.de php
verwandt.de php
amiando.de java
dawanda.de ruby on rails (/w mongrel server)
hiogi.de php
zeitkapsel.de php
wazap.de java
schutzgeld.de php (typo3)
frazr.de php
rankaholics.de php
sevenload php
imedo.de ruby on rails (/w mongrel server)
globalzoo.de php
greenmiles.de php (typo3, still php4!)
jajah.com asp.net
mitbringzentrale.de – (offline)
mymuesli.de php (still php4!)
qype.de ruby on rails (/w lighttpd server)
spielerkabine.de ruby on rails (/w lighttpd server)
edelight.de php
studivz.de php
Posted in ruby, php, coding | no comments
published about 1 year ago
(18.05.2007 00:18)
just gave my flickr api toys a little overhaul. check them out. more coming soon, for example entering your username to show your contacts’ photos, instead of mine.
Posted in ruby, coding, photography | no comments
published about 1 year ago
(18.04.2007 13:37)
»Because if itself is an expression, you can get really obscure with statements such as:«
if artist == "John Coltrane"
artist = "'Trane"
end unless nicknames == "no"
from the original pickaxe by dave thomas.
Posted in ruby, coding | Tags coding, expressions, madness, ruby | 1 comment
published about 1 year ago
(18.03.2007 11:20)
update: here’s the same for PHP’s XML Parser.
a quick comparison of the two libraries available for processing XML in ruby shows dramatic performance differences.
am i missing something, is there a fundamental flaw in the test? of course REXML is pure ruby, while libxml is C; but can the difference really be so huge?
loading an xml file
| file size |
libxml |
REXML |
factor |
| 10KB |
0,83 |
39,17 |
47,0 |
| 100KB |
6,67 |
306,56 |
46,0 |
| 1.6MB |
71,88 |
3954,21 |
55,0 |
simple xpath expression
| file size |
libxml |
REXML |
factor |
| 10KB |
0,12 |
124,68 |
1004,7 |
| 100KB |
0,67 |
678,11 |
1016,8 |
| 1.6MB |
6,21 |
22578,18 |
3633,6 |
the test code
def benchmark
start = Time.new.to_f
10.times { yield }
puts ((Time.new.to_f - start) / 10) * 1000
end
doc = nil
File.read('products.xml')
require 'rubygems'
require 'xml/libxml'
benchmark do
doc = XML::Document.file("products.xml")
end
benchmark do
doc.find('//articles/article/shortdesc').each do |node|
end
end
require "rexml/document"
benchmark do
doc = REXML::Document.new File.read("products.xml")
end
benchmark do
doc.elements.each("//articles/article/shortdesc") do |node|
end
end
Posted in ruby, php, coding | Tags benchmark, libxml, rexml, ruby, xml | no comments