Everything is working almost out of the box. However one thing was tricky to set up: Capistrano deployment and spawner/reaper. There is no spinner i Rails 1.1 (I don't remember when it disappeared) but spawner can respawn fcgi processes if they die.

The problem is that spawner writes pid files into the tmp/pids directory of your current deployed version of app. When you deploy new version, you want to invoke reaper script to restart fcgi listeners, but the pid files are now in the previous release (yes it sounds complicated). We don't want to kill poor spawner and his beloved kids. We want them to live forever! So the trick is to copy pid files from previous release to current one (simple huh?). Below is a custom Capistrano restart task:

One thing that annoyed me (not any more) was the fact fcgi processes listen on wildcard ip address (0.0.0.0) which is not wanted for obvious reasons (we are on a single machine). This is another custom Capistrano task which is invoked only on so-called "cold_deploy":

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

Ruby on Rails and Unicode (Nothing is perfect)

Unfortunately Ruby on Rails (and Ruby in general) does not support Unicode out of the box. This sucks. It is possible to use Unicode in Rails projects as shown on Rails Wiki. After 2 hours of testing I've found that almost everything works good. I even asked Julik (author of unicode_hacks plugin) if it's true what the wiki says about bugs triggered by these hacks. He told me to be careful around ActionMailer. I instantly did some testing and found it works ok (besides I had to explictly set base64 encoding for email body, but it's ActionMailer problem).

One thing that annoyed me was Google WSDL driver (by soap4r) which no longer works. This issue is connected to $KCODE variable which is set to 'UTF8' to make all this Unicode stuff work. When it's set GoogleSearch doesn't work. I tried to set proper soap envelope options but it didn't work so I've come with this ugly hack:

I turned off unicode_hacks and now everything works. Soap4r was broken because of overriden versions of String methods. So now I have SOAP, ActionMailer and Rails in general working. Only things (but essential!) that left are broken (unicode-unaware) String methods (I live with jcode).

The reason why all was broken before, was unicode versions of String methods provided by Julik's unicode_hacks (among others tweaks). They're used deeply in the code of Soap4r (which is anyway aware of existence of Unicode) despite these methods don't know anything about multibyte characters.

Don't get me wrong: unicode_hacks are the only way if you want to do some serious work with multibyte character strings. You can also take a glance at Unicode Library for Ruby by Yoshida Masato.

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

Track keywords in Ruby on Rails using Google API

Below is essential part of code which tracks ranks of keywords in Google. As almost always in Ruby world, this source code is self-explanatory. It was partially inspired by this Bernard Peh's article. If you are PHP developer and willing to become programming language polyglot, compare length of relevant code and its readablity. If you think this snippet sucks in any way, comment on! Some variables in the code are defined outside of its scope, but it's not hard to find which.

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

Ruby on Rails served by Lighttpd behind reverse proxy on Apache 2.0

Summary: If you want Apache 2.0, PHP and Rails, do yourself a favor, use reverse proxy and Lighttpd.

After few unproductive hours spent fighting FastCGI and Apache 2.0 and far too much coffee drunk, I was forced to make a decision.

Our Apache server hosts PHP applications for a dozen of our clients and needs to work very stable and uninterruptedly. There is also an urgent need to host Rails applications on the same server, namely the same IP and in some cases simultaneously in the same URL namespace with PHP applications. This is a bit tricky but useful setup if you take the possibilities into account.

O.K. Lets get to work. We have the Apache server (btw. on Debian, so we will do it Debian way). We want to minimize changes in its configuration. We definitely need to enable mod_proxy:

a2enmod proxy

Then we need to configure it, so we create file /etc/apache2/sites-available/lighty-rproxy and put some date in it:

If you now point your browser to configured domain (we use famous example.com) you should see information about "Bad Gateway". Don't panic. We have all under control. Inhale... Exhale... Yes. Like this.

What we just saw was reaction of Apache which wanted to redirect everything inside exmaple.com to another http server on the same host (localhost) but on port 81. So now we need to put something there.

We install Lighttpd:

apt-get install lighttpd

and configure it. Below are excerpts from /etc/lighttpd/lighttpd.conf we need to change. First we enable mod_rewrite and mod_redirect:

As you can see this configuration is pretty simple but works and is a good start for more complicated setups where you separate application server from http server or create other sophisticated configurations. Just remember to properly set rights to log and tmp directories in your Rails app. Lighty needs to write to them. I overlooked this at first and lost some time so you don't have to.

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

News from the field

This one is about time and that's why is so short. As you probably know, we're moving the blog (and everything connected to Trix) somewhere else. First we thought to move it to our virtual server but now we're buying a dedicated server at hetzner.de. We can not stretch the time so it will take longer. We are testing now our server environment (read Debian) and next week will be deploying it on the shiny new dedicated server at hetzner. Stay tuned.

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

Buffering...

If you click play on the video from last post you will not be happy. Your eyes will be given a black screen to watch and nice sentence to read: "This video is currently not available. Please try again later". Ain't cool, huh? WTF? I've clicked the video two days ago and watched it successfully. Apparently the one who uploaded this clip to Google Video erased it later. How come? Well...

It was this person's free choice. This is so Web2.0. You add content. You build smart mob, collective intelligence etc., finally, you have ability to erase content whenever you want. Content is yours. Google Video provides a platform. Nothing else.

Hmmm... So what about permalinks? How to accept these two excluding pillars of Web2.0?Can anybody tell me? Anyone?

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

Who is really behind all this Web2.0 thing (watch the video)

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

Wireless entertainment considered cool

I've just put PSPRadio on my PSP and I can listen to my favorite Frisky Radio virtually everywhere in my house, even in my backyard which is very practical considering incoming summer :) This is what I call technology. Great. I just need some PDF reader for my shiny PSP. Great work Raf! PSP Radio is great piece of software! Keep it up!

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

Just before the move aka migration

This saturday I'm finally going to finish my little blog engine in Rails. This was a busy week and I've had no time to write antyhing although so much happened. I hope I'll be able to write more as soon as we move to new domain and new engine. I know I could use some already well known blog engine, but hell, how would I learn anything?

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

U. S. Patents BS (Balthaser case)

I just took a glance at the recently acquired Balhaser's patent (which is valid in USA anyway) and it made me laugh. It was filled in 2001 and they've just described normal process of developing and using desktop application with one exception: they've added this expression: "via Internet". I won't comment on this more because I have to fill my own patent form. I want to patent "Methods, systems and processes for the design and creation of emotion-rich applications via Internet". And I don't care about prior act. Any comments? A little flame war?

Update: I've just signed up for free version of Balthaser's "design system". It's just a website editor in Flash. It looks nice but it's closed and I doubt it will get wide acceptance. So I was quite right that they've just brought application development to your browser. They've embedded IDE in Macromedia Flash presentation. And indeed, prior art for their lame patent exists.

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

Extracting the essence

Recently I've been overwhelmed (Have you too?) by Web2.0 stuff. Clearly, I needed some time to aggregate and filter all the information on this exciting topic. So this post is my try to extract and enumerate the most important characteristics (at least for me) of the before mentioned topic and how to exploit them in a business way. (read: how to make money with Web2.0).

Because the difference between "taxonomy" and "folksonomy", the very important thing was achieved: ease of building logical and searchable structure of user-contributed content. When you compare, let's say the biggest catalogue of Web1.0 (especially the way it's built) and possibilities of simple tagging (del.icio.us) from the point of view of average user, you will admit it's the brilliant way to exploit social nature of human.

Nowadays, everyone and everything is going mobile, we want to use everything on the go. Personally, I read e-books on my way to work and back, take pictures and immediately send them to my flickr account, play games, call friends and co-workers, and so on. I try to use every moment spent alone to do something (even if it's having fun or resting actively). Before you ask, I am not some freaky geek without social life. I just don't like wasting my time. I took myself as an example of this trend which escalates among youth even faster. Implementing Web2.0 principles in mobile world we can further exploit all this "social thing". Possibilities here are enormous. I bet you can come with some bright ideas quickly (don't hesitate to comment on them).

Today I've read article describing research on strength of Internet ties and the way Internet users socialize comparing to ones who don't use The Network at all. The results can be condensated into this sentence: "People who use Internet are far more social beings". They mention previous research results which imply something opposite, but are much older and I think just not fresh and thus irrelevant.

The whole Web2.0 thing is about delivering easier, more useful ways to enrich our social lives by creating the infinite flow of information, knowledge, content, interaction etc. interconnected with links. And content is still the king. Links are the base of The World Wide Web. Everyone (even my father) knows what link is. The Web2.0 is still about links. Links are still base of The Web.

I think I'll need at least one more try to come with more clearer extract of business and social aspects of Web2.0 movement. This is for now. Comments are appreciated.

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

Go 2.0

Almost every single aspect of The Web is going through two-dot-o hype. Now, with launch of mobileglu.com we are going to "two-dot-o-ize" our cellphones with flickr.com , del.icio.us, upcoming.org all mashuped (mashed up?) in a friendly and usable manner. If you know any other services interesting and innovative like mobileglu, let me know. As authors stated on their site, they've worked one week to deliver first version of this application. Impressive.

Notice, all applications they've combined in this mashup are branded with "Yahoo company" mark. The first thing I thought spotting this was: "War 2.0 is coming". I immediately googled after this term, but nothing emerged. It seems like there's no such thing (as the well-known rule says), fortunately. The only thing I stumbled upon was an article on "Cold War 2.0" which somehow made me happy about the fact I live in Poland and our government is still far behind these ideas of gaining more control over us by trying to control Internet.

Generally it looks like Yahoo wants to get back to the shape they used to have and compete with Google. It's getting interesting when you add Microsoft IE7 to the mix, which is (from what I heard and read) pretty lame and just try to follow Firefox.

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

Structured Blogging, Web2.0 essence

Some time ago I've read an article. It was full of terms such as semantic web, intelligent content and other buzzwords. I have to admit I've not understood a word. It was so blurry then. I don't really remember when it was - one or two years ago? Sounds probably. One thing I remember is this (famous now) Web2.0.

Today, after 2 hours of brainstorming with one of my friends (a very good marketer) we've begun to ask ourselves what is the essence of Web2.0 and how Web2.0 looks or will look like.

We are in the middle of making a list of features for our new product (hopefully killer app). Last months we've been moving around the concepts of Ajax and have used the term Ajax interchangeably with Web2.0.

We were missing the point.

Web2.0 is not about Ajax. It's about those buzzwords I stumbled upon last year ago. Semantic web is by far the more important one. Semantic stands for meaning. You may think: but the meaning is already here, in every sentence on the Web. It's true. But for machines it's not. They don't understand the meaning of sentences written in natural human readable form. They need something else. Hints. Decorating the content of the Web1.0 with hints for computers makes Web2.0 come true. Structured Blogging is the first place where you can read more on this topic and be finally enlightened. It's a good word considering the impact Web2.0 will have on Internet.

My prediction is simple: Revolution comes. Don't sleep through this opportunity to make the world better (and get rich).

Any comments? Ideas on how to ehm.. get rich "using this tools and techniques"? (David Deangelo's beloved question)

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

Home sweet home

After approx. 13h of work today, I am finally home. 13h of pure adrenaline fighting with so called database. You guess, I will only tell that it sometimes let you have the same value in unique column twice. I have witnesses.

In few weeks this nightmare will come to an end. Let's hope to the happy end. And how this imaginary happy end looks like?

TCO is much lower than now.

Maintenance is easier.

Stability of rock.

No licensing issues.

No more 13h days at work.

I don't want more. This would be enough. After the switch we finally will be free from expensive licensing although I don't consider this main reason this migration. I've just lost too many evenings like this one using this piece of software. It can be good, but not for our purposes. Our needs developed greatly and we have to move on. We will never miss you. Ever.

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

Skype, MacOS X, Bluetooth headset. Holy grail?

I always wanted to work at home. To have the safety of being next to my bed and my computer at the same moment. To have the ability of taking a short nap every moment I want. Some of you may think it's hard to maintain discipline. And you're right.

But let's go back to the topic. If you work at home you're obliged to have a rather good Internet connection. Lousy dial-ups won't do any good. 512Kb/s will satisfy almost all of your needs (except downloading these Oracle databases from production servers).

Next thing you'll need is a very comfortable operating system. You have a choice. I use MacOS X myself and find it excellent. You also have to set up all applications you use to work with. Sometimes it's can become tricky easily when you use very advanced and rare tools which are impossible to install on a typical home workstation but in most cases there is a solution.

Then you will need some way to cooperate with your boss and co-workers. I would recommend here some of tools made by 37signals. Personally Basecamp and recently created Campfire are my favorites.

Last thing you need is some voice instant messaging. Skype is the most popular one, but there's one catch. Windows versions are far more stable than MacOS X, and Linux versions. I used all of them. Linux and MacOS X versions are far behind considering functionality. I don't blame Skype programmers. They're have a business to run and Microsoft Windows users are the vast majority. To make Skype work you need some headset of course. I personally use Bluetooth headset from Logitech, but sometimes it drives me crazy. This is common to all wireless devices I know. Batteries will run out of energy only when you're speaking with your boss about the recent crash of your program or whatever you do to pay your bills. They also tend to loose connection without reason. Murphy's Laws at their glory.

These would be all you need.

I work in office mostly and at home partially, mostly Saturdays and when it rains too heavily. I think I am more productive working this way. Changing work conditions helps me to come with good and innovative ideas more often. And if I have worse day I can sleep longer and do my assignments later but more enjoyable.

If you don't agree drop some comment, they're always read and answered.

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

Airport successfully installed. Two screws left unused.

Yesterday, after long day at work I finally came home, ate dinner and unpacked mysterious package received that day. It was earlier ordered AirPort for iMac mini. The wrapping was tight, everything looked ok. I took my two special iPutty knives and opened iMac. When looking inside I was wandering which screws should I remove to get to the motherboard. Of course I could google for some videocasts and tutorials on this topic, but my only computer at home was already dismembered. And besides who needs to RTFM? Last but not least I found three critical screws and after few seconds the motherboard was mine. On these iMac mini photos you can see the finesse the motherboard was built with. Next, I removed the daughterboard with Bluetooth module, and installed AirPort module on it. Notice, now I got two daughterboards. One came with AirPort and the other was installed because of Bluetooth module. Someone wants to buy the spare daughterboard? Let me know. The most interesting and funny thing is Apple uses sticky tape inside their computers widely. The AirPort chipset is taped to daughterboard, almost all cables are taped . I think it's ok, but somehow it doesn't fit to the trendy and sophisticated Apple design. Ok, back to AirPort. After reassembling iMac, I had no blood on hands but two screws left. And you know what? iMac works without them. So, besides I've upgraded this piece of hardware I've also improved the mobility by lowering overall weight. After those interesting moments with screwdriver I came with this conclusion: You can always remove some parts and a device will still be working fine. And you can use these parts to assemble some new revolutionary hardware. Any questions?

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

Big Money research

A lot of people on SEO and e-marketing forums are not sure if AdSense "fraudsters" are really so successful as all the buzz implies. So we've come with a little experiment. We set up two AdSense accounts and on one of them we act ehical and obey all the rules. On the second one we're not so saint. The experiment is about who will make more money in short and long term. We are of course conscious about breaking some rules (and laws!) on that second account and we know it can be blocked any minute. Of course we won't hire any Africans to click on our ads for 5c per hour. We will use some more advanced fraud techniques. After publishing results of this experiment we will donate all the money from the second not-so-saint account to some open-source project. Any suggestions are welcomed.

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

We're moving to dedicated hosting soon.

Unfortunately, due to slow blogger.com hosting and other issues and limitations, we're moving to dedicated hosting soon. Expect new blog engine, new design and of course more juicy news. Our next goal is to give you aproximately 5 news daily and one bigger article on a weekly basis.

We expect the transition will be smooth, despite the fact we probably will use some new and unexplored tools by us. As some of you readers may guess we're moving to RubyOnRails.

Stay tooned!

Update: If you know some affordable hosting companies selling RubyOnRails accounts, drop us a note.

This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.

Accidental ethernet cable disconnection testing

Today we are testing update for our major software product. As always on saturdays, I'm at home skyping with boss. He's in Germany. We want to see how our application behaves when someone accidentally pulls the ethernet plug out. So, here's what I hear in my uber-cool bt headset: