Archive for the ‘programmieren’ Category

FileColumn: regenerate images

Sunday, August 12th, 2007 by Thilo Utke

If you change the images dimensions or introduce a new version for models using file column you need a way to update the existing ones.
Here is a script that will regenerate all file column images and its version. We still look for a way to generate only new versions.

Using Mocha - A review

Wednesday, August 1st, 2007 by Thilo Utke

For aprox. 3 months we have been using mocha now. And we promised to get back to this subject when we passed our 2000th revision.

In this post I’d like to share some expirence we made while using mocha. But first a short introduction to mocha taken from the rubyforge page.

Mocha is a library for mocking and stubbing using a syntax like that of JMock, and SchMock. One of its main advantages is that it allows you to mock and stub methods on real (non-mock) classes and instances.

We started to use mocha on an existing test suite and changed our test code in place when we wrote a new test or had to update old ones. The transition was mostly painless, there were three things where we stumbled.
(more…)

Bilder aus dem Netz mit file_column runterladen

Sunday, July 29th, 2007 by Thilo Utke

Hier also ein weiteres Post zum Thema file_column Hacks.

Vor kurzem mussten wir die Anforderung umsetzen, dass Bilder, die im Netz liegen, wie eine vom Client hochgeladene Datei speichern zu können. Warum wir sowas machen wollen? In diesem Fall, um Daten von einer Anwendung über http nach autoki zu importieren. Dazu gehörten auch Bilder, die über eine URL erreichbar waren.
(more…)

ruby ist nicht von hinten wie von vorne

Tuesday, February 13th, 2007 by Alexander Lang

heute habe ich eine kleine merkwuerdigkeit bei ruby gefunden, man sehe sich mal folgenden code an:

def x
return x if (x = true)
end

def y
if (x = true)
return x
end
end

wie zu erkennen, wird in beiden faellen in der if-bedingung der variable x der wert true zugewiesen. dieser wird dann von der funktion zurueckgegeben. oder? interessanterweise gibt funktion x einfach nur nil zurueck. hab ich was verpasst?