Archive for April 16th, 2008

Published by Fabian on 16 Apr 2008

Imageflow – revised

I have been working recently on integration a great Imageflow library from Finn Rudolph, which however was code wise err a bit hacky. It was using plain Javascript, with many global variables and some cross browser hacks. Also its lightbox integration was not compatible with Lightbox v2.04.

To practice my Javascript skills a bit I decided to refactor that library. There is another serious alternative called Protoflow, but its scaling algorithm doesn’t work on different sized images well. I made it working quite nicely with Lightbox and additionally cleaning up lots of code. Quite some temporary variables are no longer required due to the object-ness of the widget. It also will not produce namespace conflicts anymore.

The script is available for download here.

I am pretty sure that the code can be still improved. Initially i started with a 1-1 port to Object. Basically just namespacing the whole thing. Then I did an iteration cleaning things up, after that I removed some browser hacks, especially using Prototype Event class for that. After that I cleaned again, and thats how it is now. 6KB compressed using YUIcompressor. I have not yet verified that it works cross browser as good as the original, but thats what I am going to do next. Additionally i try to improve my prototype skills and hack some for each loops.

Expect some updates on this blog entry and the script.

Feel free to post ideas in the comments.

Note that however I am not giving support for this script. Make sure to visit the original Imageflow site first and get a version from there running. There is quite a lot of documentation and help available. Afterwards you may come here again and try my variant of the script :-)

Updated 2.May 2008:

Just integrated the options into the object creation. you can now pass changed options more easily. Also merged a feature that allows you to prevent images being scaled larger than they actually are.

Published by Fabian on 16 Apr 2008

Response to Andy Jeffries: Why Ruby is better than symfony

Dear Andy,

I read your blog about symfony and that you now switched to Ruby on Rails. You claim to work with symfony, but I cannot understand how you then can come up with those 20 things that Ruby handles better than symfony. Perhaps you made some up to complete your list of 20? Or you just don’t know?

Yes I am biased to symfony, but I am not advocating the one or the other here.

So here my remarks to each of your points:

  1. If you think that Propel is inferior to AR, thats fine with me. Btw there is a doctrine replacement for symfony available.
  2. Also matter of taste, I think both do a good job here, and neither is perfect :-)
  3. You miss to mention that symfony also has an integrated test system and fixtures. I wonder how you could miss the entire chapter about testing in the symfony book.
  4. Propel has Behaviours, and there are tons of readymade plugins out there for that purpose.
  5. the built in webserver is unique to RubyOnRails. In my personal opinion thats unneded but helps with prototyping.
  6. Well thats php not symfony. If ruby is better thats fine.
  7. Yeah big big minus for symfony. Luckily there are a few guys that started working on this in plugins.
  8. It sounds like that you think symfony has got no environments? it has.
  9. PHP hasn’t, but symfony has a database session store, cool eh?
  10. Symfony hasn’t too much support for webservices built in. sad but true.
  11. Thats a nice feature. I think thats on the roadmap for sf1.1.
  12. You can do custom tasks in symfony. 1.1 has even the same syntax.
  13. Deployment is cool? symfony also has something there. I never used it because I think that deployment is a more controlled process rather than a developer executing a task. What I saw from the symfony one it also was not too powerful.
  14. I thought RoR has an own server :-)
  15. Well you can write easy filters in symfony 1.0. Fabien changed the filter system for 1.1. I am not sure if i will like it.
  16. No interactive debugging in symfony. I think its a PHP issue but actually it is an issue.
  17. Cron isn’t supported in symfony. But you can designate some scripts as batch scripts.
  18. Profiling is nice. I have to have a look at it!
  19. Flash
  20. Again a whole chapter that you seem to have missed in symfony. I personally find caching a very good part in symfony. It is fast and very easy to use.

Wrapping it up, I can notice that you missed your target of listing what is better in Ruby on Rails than in symfony:

there are some things that make it less than perfect when compared with something like Rails

In 8 out of 20 of your points you were just unaware of the features of symfony. I cannot believe that you claim to develop in symfony but haven’t read the great documentation. The whole book is online and free.

Other aspects of both, symfony and Ruby on Rails, I personally dislike: developer and process tools, such as crons, deployment, servers etc do not belong into a web application framework. It should be inside the development process. Perhaps even bundled with an IDE, bug tracker, or SCM tool. But not in the “language” itself.

But since you are so happy about RoR, I am very excited, because I will try it also myself.
In essence I think that symfony and Ruby on Rails are very similar. The major difference is the language. I think.