soledad penadés
repeat 4[fd 100 rt 90]

Archive for the ‘ruby on rails’ Category

20060420 /tmp/mysql.sock issue with Ruby On Rails under mac os X

I was retaking my self taught course of RoR yesterday and I started getting this error when accessing the database, each time I wanted to generate the scaffolding of one model:

Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Oh well, I thought, aggghh. When I tried to install php, ror, mysql, etc… I did a great mess here, and although I hadn't had any problem with php (once I installed xampp), seems like I have a separate mysql installation (the remaining of the first, separated one, I tried first).

After trying to find out what was the problem with that socket, specially because it shouldn't look at that file, but at one under xampp files, I found a quicker solution:

In the config/database.yml file, I replaced all appearances of localhost with 127.0.0.1.

And voila, it started working. Although it's not very efficient, as it makes every connection to go through TCP, and not via a socket, as it would do if the host was localhost.

I think I'll have to take my time once and clean this horrible mess, but by the moment it works.

20060401 What is Flex?

I have been a bit disconnected from the Flash scene for a while and it's changed quite a lot! So I thought I may share with you my discoverings while I'm getting updated on the latest news.

There's this new thing called Flex. From what I understand, it will allow you to build entire interactive applications which run both on server and client side, using Flash for the interface.

Roughly, the interesting part here is that not all the processing is ran in the server, but also the client's computer is used to run the application. So, things such as updating graphs are made in the client side, with the data that the server sends you, allowing the server to save processing power and bandwidth.

The interface is specified with an XML based language and the application logic is written with ActionScript2; you can do it with the official Flex editor (even in WYSIWYG mode) or with your favourite IDE with custom XML language schemas support (one example: Eclipse). Then, you drop your code in the Flex server, and it will serve the appropiate interface data to the client depending on their actions.

This concept reminds me a lot to the first .net demonstrations I saw: you write code once and it will be served to the user through the .net server, which will determine the appropiate html and javascript stuff to be sent to the clients depending on their browser capabilities. The problem were the browsers' implementations and their support of javascript. Each time I asked the speakers about this, they never knew what to reply. Such an embarrassing question…

In that, Flex has already won the battle. As it uses the flash player to run in the client, they can guarantee a more or less known scenario and then the developers can build an application knowing for sure that it will always work, and there won't be weird implementations of one javascript method on certain browsers, etc.

It also reminds me to the AJAX approach: do not reload the whole page, send only the useful data, and redraw whatever is needed on the client side. The weak points of AJAX are still the different browsers' implementations, and rich media inabilities: graphics would be great, if all browsers implemented SVG properly. And unfortunately, browsers are unable to play sounds just by using html/javascript: as far as I know, when someone needs to play a sound nowadays, they end using a Flash object to play it (and yes, I'm ignoring the MIDI at all).

The advantage of AJAX versus Flex is that you don't need all the human and technical infrastructure that a Flex server requires. It is way cheaper to start building things with the Ajax philosophy (see ruby on rails), and honestly, most of the applications don't really need to have fancy 3d realtime graphics with motion blur and stereo surround sound.

Conclussion? Flex looks promising but it has its own application field, which can fulfill very appropiately. For relatively low-demanding requirements applications, there are other solutions which can work (and are working, indeed) pretty well.

Of course I might have misunderstood something. If there's something you feel is wrong please do not hesitate to leave a comment and I'll correct it.

Extra final bonus

Finally, if you are really curious and want to know some hidden and technical details about how the flash player is implemented -which is what at the end is going to affect everybody: you and your users- take a look at kaourantin.net. That's the blog of one of the engineers at Macromedia/Adobe developing the Flash player. He will get you informed about the changes they make and, from time to time, those little secrets that might explain certain flash oddities.

20060128 Some things I want to give a try: results

Some months ago, I said I wanted to test several things, and here are the results:

  • CakePHP: it's promising although it lacks lots of documentation and I don't have time to guess how does it work. I'll wait until it is a bit more consolidated to have another look. I have been testing it today with a local copy of the xplsv.tv database (to have some real data where the tables are more related than in my blog), and although I managed to create the models, controllers, views and so on, I get stuck when it comes to simple things like specifying the relationships between tables, the maximum number of records retrieved each time… I know I could go and find the answers by digging into the code but hey, I want to save time, not spend it guessing how things work…
  • Flock: it didn't appeal to me, I don't use blogger as my blog platform and in general it didn't look much better than camino or firefox. It even was a bit slow. More of a hype than nothing really impressing. I'll have to wait a bit more, as its team said they are working on new improvements.
  • Pong: I ignored it completely. In fact I am using ping-o-matic.
  • flash 8: not yet…
  • ruby on rails: no time either :-(

And that's all!

20060111 Ruby On Rails Cheat sheet by ilovejackdaniels

Dave Child loves to make cheat sheets! He surprised (helped) us in the past with the php, css, javascript and etc sheets, and now we have the Ruby On Rails cheat sheet. This is going to be very useful for people like me, which tend to forget those little details like the available predefined variables when you have to deal with more than one single language or project at the same time :)

It is very similar to the notes I usually made when I was studying: everything very synthetized, all in a single page if possible. So that's why I found these sheets very natural to me.

Thanks, Dave!

20051122 RadRails: a nice IDE for rubyonrails

I started developing code with subethaedit. It's not bad, considering that the personal, non commercial edition is free, but somehow the lack of a tree with all the files and its folders (like visual studio, eclipse, etc) annoys me.

So I started with skEdit, which is quite nice (although I really *hate* to have to close all the files when it has to refresh. It's painful), but it's not free and the demo version is limited to 25 days only. A big problem I found is that it can't syntax highlight ruby (.rb) files. So it's as useless as coding with textpad.

Then I finally found RadRails. It's based on Eclipse, but it's well adapted and very easy to "install" (i.e., it has no installation, you just drag and drop it to the applications folder, at least on Mac Os X <3 <3). It has nice syntax highlighting and the files/folder tree feature, and no need to close all files to refresh the tree, so by the moment it's more than enough for my needs. Also, I haven't tested it, but the page states that it works on linux and windows as well. It doesn't eat resources as eclipse does. I think it's worth a try.

I'd like to have a look at TextMate but for some weird reason I wrongly downloaded an expired version from the wrong page and it has decided that my test license has expired and never allows me to have a test with a new version, downloaded from their original web. I promise I never tried to crack it, just downloaded it from a wrong page :-(
Shame on the author for not taking care of the distribution of the program, and not appearing on the first place on google searchs!

Maybe one day I'll write them and ask. If I like it (I liked it after seeing the video [link to a MOV file]) maybe I would buy it. Or not: let's see how I work with radrails…