Thanks you “The Ruby Programming Language Book” and why the lucky stiff and his poignant guide to ruby for clueing me in. Again - consider this a note to myself or as practice.
This is mainly an exercise for myself. Nothing new here. Just a place for me to keep all that in mind.
Actually I didn’t want to write about the iPhone because I was sick of this whole hype. It was almost like in the movie »Being John Malcovich« when John Malcovich enters his portal and all he can say or hear is his name »Malcovich«
»i’m sick of these iphone news - i want mac and mac os x rumors and news. come on - one day without any iphone news please!« via twitter
Now more and more people around me got themselves an iPhone and there were plenty of occasions for them in the last couple of months to show how cool this device really is. Still I had doubts, touch keyboard and everything but right from the introduction of the original iPhone it was clear to me that it was superior to any other device out there. I’d like to point out that it was clear to me. I’m well aware of other opinions from other people but I don’t care about those for this post.
At the 25C3 (25th Chaos Communication Congress) even more people showed off with their iPhones which lead me to the spontaneous decision to buy one for myself. This is how it happened. The salesperson was very friendly and the whole setup wasn’t taking too long. Since that day I’m extremely happy with it. I have to say though that I was not using any kind of internet service on a mobile phone before. It seemed kind of wrong on my previous phones and I didn’t see any potential use for it on other available devices. It reminded me on the story about my very first computer. Back in 1994 when all my friends had Amigas, C64s, Ataris or even Windows 3.11 machines, i couldn’t see any potential use for me. Sure enough they were good for games but even the games were kind of, uhm bad. There were exceptions but for me it just wasn’t worth spending so much money. Then one day, my best friend from school (probably 4th or 5th grade) got the first PowerMac as a christmas present. We spent lots of time together and sure enough we did spend a lot of time in front of his mac as well. It was instantly clear to me that this computer, this operating system was really something good and way more sophisticated than all the other systems I mentioned before. Hell it had 1024×768 resolution and 16 Bit colors where all my other friends were still in the Vesa/VGA world. It was clear to me that if my parents would buy me a computer, i had to be an Apple Macintosh. While all my other school friends spent their time playing dull little computer games, my friend and I would create a small school magazine, created graphics for school presentations and played with Macromedia Director to create foolish little adventure games of our own. A whole different story.
In a way using the iPhone feels the same. There are a lot of people with Blackberries or Nokia Communicators etc. For some reason you don’t see those people using it for anything other than writing emails, sending sms, calling people, managing addresses. In rare occasions you see them actually browse web pages. If you held one of these devices in your own hands you know that it is no fun to use them - everything is in this »serious business« theme. I don’t know how to describe it, I just have the feeling that the iPhone is the complete opposite of every other device out there.
It is fun to use, in every aspect and emailing, phone calls and sms are probably the most normal things you would do and I mean it in a way that you do it when you have to do it but there is so much more on this device that you can do. Things you want to do, things that I haven’t seen on other devices and if I’ve seen them the differences were like comparing Photoshop and Paint although thats probably a little exaggerated. On the other hand - have you seen the illustrations / drawings that people do with an app called brushes on the iPhone?
http://www.flickr.com/search/?q=iphone+brushes&m=tags
or Disneys Art Director:
http://flickr.com/photos/stefsketches/sets/72157607051336347/detail/
And that is really just one aspect of this device out of a million. All the apps Apple is shipping a very good. Much higher quality and usability as any other windows mobile counter part. The interfaces are just beautiful, as if they were made just for your fingers to touch (as a matter of fact they are). I’m kind of laughing at the people who are using their phones with a stylus.
The other part I really like is the app store. Call me fanboy but I think the user experience to get new apps is very good. Of course there is lots of room for improvements but again, its working very well.
I already bought a couple of apps and I downloaded bunch of free ones. The process of installing (once you set up your store account *sigh*) updating and uninstalling is so smooth its completely effortless. The apps themselves, as well as the games are usually a lot of fun. Of course there is a lot of crap too but I already found so many good or fun ones, I really don’t care if 100.000 people freak out about iFart.
I got my iPhone for about a week now and it already helped me in a handful of occasions with its location aware features or the UMTS/EDGE connectivity in combination with a really good web browser or other apps.
I’m really happy with it and no matter if the Android will be on the same level or better - for now the iPhone feels far superior to any other device. The touchscreen, the user interface, the applications and the games. (Yes I had the Android in my hands for a couple of hours. Yes I tried couple of applications, pre-installed and downloaded ones)
In the end I have to admit that I am not entirely sure about being completely in this Apple vendor locked in world. I look at it carefully but its hard as it is working so smoothly and bringing me so much joy, joy I really haven’t anticipated from a mobile phone with a touch screen interface.
Not sure if a post like this can be taken seriously, but I was so happy that I needed to write about it.
Mission accomplished, like it or hate it ;)
Update 1:
A friend just told me that this post was 18 months too late - I’m aware of that.
The new year has just begun and I’m spending the last couple of days of my vacation. The last three weeks were my first real vacation since march. For the last 9 months I was busy building a website for an international corporation with ruby on rails. I thought I should share some of the experiences we (the entire development team) made. For anonymity purposes I will call this project miracleCMS2.0.
This post is about rails and windows, or deploying rails on windows. When the project started it wasn’t really clear what technology would be involved. When I joined the team, Zope was chosen to build the new customers website and content management system. The only problem was that there was nobody in this company with deep knowledge of the Zope framework. To make it worse, there wasn’t any real web developer either. My knowledge of Zope was so limited that I wouldn’t be any help as well.
Needless to say that the timeframe for this project was so narrow that chances for getting it done in time were close to zero with any framework or cms.
Based on very good experiences from recent projects I made a pitch for rails as base technology and after some internal presentations and meetings it was agreed that we would use it. There was only one problem. The customer had a homogeneous Microsoft environment, which meant Windows 2003 Server, MS SQL Server and IIS. We all know that rails isn’t famous for working smooth on windows, many of us tried, many of us gave up. We tried to convince the customer to give us a linux/bsd virtual machine in their Microsoft world but they refused. After a couple of days it was clear that we would have to deploy on windows no matter what. Windows alone scared us but MS SQL Server and IIS really made us reconsider our rails choice although it wasn’t based on first hand experience.
Anyway, it was too late to go back. We started internally on linux only, of course with mysql as db backend. We hired another guy who was only there to figure out how to run our rails app on windows and after a couple of weeks we had a capistrano task to deploy from our linux / mysql machines to the windows / ms sql machines.
We chose to try it with IIS and Pen as a load balancer for a couple of mongrels. We also installed the ISAPI rewrite module so we could rewrite requests to the Pen load balancer and to the mongrels.
For the first hours it seemed to run. That alone was a success. We managed to make a capistrano task that would deploy the software, the data and interact with the windows machines, restarting services and everything. At least that was what our first euphoria was suggesting.
After another couple of hours the whole setup broke together like a card house as the Pen load balancer would stop working once in a while. The IIS itself stopped working too because the ISAPI rewrite module didn’t rewrite properly or the whole machine was just so busy with doing nothing it couldn’t do anything else.
Now the customer insisted on his Microsoft software as he payed so much money for license fees and all and so we invested hours, days and maybe even months to make it work but if we got some part working, another one would break apart. The whole setup just felt unstable.
One day I had enough and installed Apache2.2 on one of the windows machines as a proof of concept.
Apache comes with mod_proxy and mod_rewrite which just eliminated two (or three if you count IIS) of the fragile software parts right away. To make this short - it worked right away and without any issues. Over the next days I told my colleagues that I installed apache and how much smoother everything was running and as much as they liked the good news, they new how bad the news for the customer would be. Fortunately, the customer was also pleased with the new stability and found acceptance for the apache setup over the next couple of months (yes - it was a process).
The MS SQL was also an issue of course as you wouldn’t get real utf-8 encoding and other quirks but these problems were mostly manageable but they costed a lot of time and money.
Actually that was the one big lesson of deploying on windows. It costs a lot of time and money to make it work. It slows your development down, massively.
Thats why I’d like to postulate the following advices:
If you want to use rails, do whatever you can to convince the customer not to use windows.
If you fail at convincing your customer not to use windows, try at least to get a virtual machine with linux to run the web server on
If that fails too, try to convince him not to use IIS but Apache. Try also to use PostgreSQL or MySQL instead of MS SQL
As I said, if you fail at one of these steps, you will have so much pain, so much waste of time, money and resources for making _everything_ work in a smooth and performing way. Besides that you’ll get deeply frustrated!
I mean there are solutions, blog posts and stuff but you have to patch them together and most of them are for specific software versions, some google results point to non existent pages, promising forum threads have nothing but more questions, the plugins you could use were abandoned a long time ago and make everything unstable. Oh and I forgot to mention the windows clean install after you messed up the first time. I don’t know if I have to say more but maybe previous experiences with Cygwin ring a bell. You’ll just end up with a pile of software and configuration that wasn’t meant to work together. Get as far away from it as possible! Seriously! Not fun! Having a ruby installed in the Windows and Cygwin world … *shiver*
Our project currently runs on Windows2003 Server with Apache 2.2 with mod_rewrite, mod_cache and mod_proxy and does so pretty fast and stable. The db server is a MS SQL machine.
Until something fundamentally changes, I hereby swear not to deploy a rails web application on windows again.
Got myself a new phone and a new contract. So from now on please consider all mobile phone numbers you have from me as invalid and update your address books with that one:
+49 (0) 151 240 67 434
If you haven’t got received an SMS with a similar announcement, it is likely that I don’t have your current number.
KTHXBYE
I’m a heavy macports user. I’ve installed tons of ports and for a while now, I was under the impression that macports matured enough to stop worrying about potential dependency nightmares. Basically macports already felt like the FreeBSD ports collection. Sure, there are b0rken portfiles now and then but thats ok. As I said - I already had a huge collection of ports installed and updated and everything was fine.
Until yesterday. When you have that many ports installed, the command line interface can get a little messy which is why I thought:
» Hmm, aren’t there any good GUI tools out there for managing macports? «
The only thing I found was Porticus (no, I won’t link to it - for your own safety). It basically promised nothing more than a decent GUI. Well in a way it even did but as you might know, there is this (unwritten?) law: » Thou shall not use a GUI wrapper for a command line tool «
So I broke this law. I used Porticus to update some ports, I clicked some options which seemed right at the moment and only one hour later I found my whole macports installation disrupted.
It started out real simple. All I wanted was to install apache2 which needed the port uuid. Now I already had that, but in the wrong version. Now macports wouldn’t let me update that port that easily but instead of reading the macports help, I fired up Porticus and said: » Well, just update what you need to update, so I can have apache2 in the end hmmkay? «
What porticus did was upgrading _all_ ports because in a way, every port can be linked to some other port. » You want apache2? You need uuid, but then you’ll have to update postgres as well and uhm yeah somehow openssl and gnome. You said I should update what I need to update. «
Now this would be fine, in a way, but all the updates failed for some reason. Porticus didn’t stop though and went through the whole dependency chain do break all the other ports as well.
Now there might be even an explanation for all this. Maybe its not Porticus’es fault at all. The thing is though, when you use a GUI tool which doesn’t give you _all_ the options of the command line tool it is wrapping, nor does it give you proper explanation of the options it exposes, you end up clicking on checkboxes you shouldn’t have clicked.
If I had uesed the commandline tool, I would’ve read the man page, I would’ve read all the explanations for the various options and I could’ve picked even the right ones, based on this information.
So in the end, I rm -rf’ed the whole ports directory and started over. I already got half of my work related ports installed. Hoorray!
» THOU SHALL NOT USE GUI WRAPPERS FOR COMMAND LINE TOOLS «
If you do it anyway - there is no point of being angry if something went wrong. You should be prepared for this moment and take it with dignity. Your co-workers and friends will thank you.
Just upgraded to the most recent wordpress as I intend to write more than 140 characters soon. Maybe.
Wasn’t sure if I should abandon this Blog. In the last couple of days though, I thought I might be in the mood again. In the meantime I got hooked on twitter which was just what I needed on my current 10to6 job (follow me: @hukl).
Now as the current project is getting closer and closer to the finnish line, I am planning to share all the experiences. I’ve read through so many blogs, manuals and api’s that I have to contribute something back.
Read you soon - If anyone is still out there!?
Pops up a dialog asking for a search query, then runs grep on the selected dir in the project drawer and shows the results in a HTML output window with the search query highlighted.
Just have a project with 8000 files in it and TextMates » Find in Project « command is just too slow and I’d have to clear the logfiles before that.
With this bundle I can use grep which seems a lot faster and I can ignore logfiles and svn meta data files.
Have to make this bundle a little more customizable and prettier but for now it does the job.
The command line equivalent would be:
grep -r "query" -n --exclude=\*.svn\* --exclude=\*.log\* /your/path/
Credits go to: Andreas Marr for giving me the grep command as it is used in this bundle.
Screenshots


Yesterday, I stumbled across the Bogosort sorting algorithm. The example implementations looked horrible so I tried to implement it in a short and readable way, in Ruby of course.
Here is my first and only attempt of a Ruby Bogosort.
# Use: ruby bogosort.rb a b c
def sorted
for i in (0..$array.length-2)
return false if $array[i] > $array[i+1]
end
return true
end
$array = ARGV
$array = $array.sort_by {rand} while not sorted
puts ">>>>>>>>>>>>>>>> #{$array}"
You can find the Java implementation on the wikipedia page:Bogosort
Here are other C, Java and Python implementations: http://www.algorithm-code.com/wiki/Bogosort
I wonder if the C and Java examples really have to be that long.
After being in a radio show (german) about web browsers recently and reading all that hype about client side web applications, I got more and more thinking. I can’t see really the use case now and I wonder if I’m that alone with this opinion. But let me explain my thoughts on it.
For now there are several kinds of client side web applications. There are text processors, photo managing tools, presentation slides editors, spreadsheets etc etc. But is there a real use for them. Personally I’d rather have my text processor on my hard disk, I’m also not processing my camera RAW pictures in a web browser and so on. For all of these serious tasks there is already software exactly suited for the job. Its hard to imagine that one day an online text processor would outperform Word, Pages or even editors like Textmate or Eclipse.
There is also no real advantage to do these kind of tasks within the browser. Even the software, although it is distributed directly through the net, is practically on your hard disk and the whole purpose and the recent efforts are about making these web applications run in your browser even when you’re offline.
So your work is kind of stored on your machine within the browser context, the software you’re using is on your machine and you don’t even have to be online to work with it. It just doesn’t sound like a web application.
The whole point of doing something in the web is to connect people and information. There were plenty of implementations of Hypertext prior to its premiere in the world wide web. Bringing this concept to the web also brought a very useful extension. Rather than creating local hyperlinks only you could set hyperlinks to completely different servers across the whole planet. You could connect information that was impossible to connect before. The web is also a lot about communication these days. Look at these endless lists of online communities or projects like twitter. Its about connecting people, sharing and distributing information.
A word processor simply doesn’t make sense within the web context without making explicitly use of these features of the web which I just mentioned. Now managing my photos online only makes sense if I want to share them. Flickr is the perfect example for that. You have a very good chance improving flickrs user experience by using frameworks like the recently hyped sproutcore to make everything look like serious application environment but it is only an enhancement to a service that had no desktop equivalent before.
Webmail is kind of the same story, told from a different angle. There are a lot of desktop mail client applications. Still there are also a lot of webmail interfaces out there. GMail is probably one of the most famous ones as its making heavy use of client side javascript to make the whole interface feel like an application rather than like a website. Webmail has several reasons why it exists. You need webmail when you travel without your own computer and you want to check mails. But that is only because your mails are online. You have to go online to work with the medium mail.
So when there is a web application that is more or less cloning an existing desktop application without adding capabilities that are unique to the web environment, it is completely useless. Why I create my presentation with a 10 times slower version of keynote online? Why would I edit my photos online where I have limited tools and therefor limited possibilities? Why would anyone re-implement the Desktop itself in a web application when it has no features could really need?
Check the EyeOS Website. I mean hello? When I read about it I imagined a person who doesn’t have a graphical operating system but wants to have a desktop like look and feel on the screen. This person than decides to install a browser in order to use EyeOS’s web based desktop. Thats the only use case I can come up with. They’ve entirely forgotten what the web is and what it is good for.
In the end your favorite web application is currently not available due some stability or scaling issues or maybe both. Now you’re sitting there, can’t edit your documents, can’t manage your mails, can’t work with your photos, can’t access your bookmarks etc etc. In this scenario you got one new major dependency to able to work. It isn’t enough that your computer works and that you have the proper software installed, you must also hope to get a decent internet connection without people in the same cloud sucking all the precious bandwidth with their heavy downloads etc.
I know I’m exaggerating here quite a bit. Apologies.
My point is that I’m not against the idea of client side web application. Not at all - the recent developments and achievements are truly awesome. in fact, before writing this post I played around with sproutcore. I’m just against this whole hype of cloning the desktop experience into the web without any sense for the web itself. I think we should rather focus on enhancing and developing present and new concepts which progressively explore the possibilities the web offers for us. Think Wikipedia not Word. Think flickr not iPhoto. Sync, aggregate, share and communicate over the web rather than building self contained and therefor boring and uninteresting islands.
I mean sure, Keynote or iPhoto in the web browser is impressive but - yeah - thats basically it. Wikipedia is a lot more impressive, even with a old school interface.
But we’ll see how far everything goes, with client side storage and all that. In my opinion though the whole “software distributed through the browser” thing is as visionary or useful as the 3D desktop.
