Guillaume “Zifro” Desrat’s former blog

BarCamp (Ruby &) Rails in Paris ?

Filed under: parties, Ruby — Zifro February 26, 2008 @ 8:59 am

The French Ruby users association, Ruby France is looking forward organizing a BarCamp in Paris.
If you’re interested, please take a look and answer the poll.

For more information, read this post (warning : French language).

Is Prague sweet in late March ? (EuRuKo 2008 inside)

Filed under: Ruby — Zifro February 3, 2008 @ 9:10 pm

The 2008 European Ruby Conference will be held in Prague, on March 29th and 30th.
The website has been launched few days ago, so I don’t feel sorry for not relaying this kind of information faster :)

A call for paper has been made, so if you’re a Ruby enthusiast with something nice to present, send them your paper.
For more information, visit http://www.euruko2008.org/.

DSL with Ruby : how to get a step ahead ? (make it written in French, for my colleagues’ sake)

Filed under: work, WinDEV, code, Ruby — Zifro November 29, 2006 @ 12:50 am

DSL is the acronym for Domain Specific Language. A DSL is a language designed for a particular purpose, for an intended audience who may not feel fine with a complex programming language. For example, Microsoft Excel macros are part of a DSL.

I’m currently working on an application which exports data into a text file, formatted with given tags and given parameters, then send it to another remote software, which will handle it (I skip here the whole process, which isn’t interesting at all for those who don’t work on it) to finally have the data printed and sent by mail.

WinDEV doesn’t offer built-in testing, so I made the application write a checksum like log, to verify the number of each type of data exported. Well.
But as we’ve got several undocumented (yeah, I know, real developers don’t write neither documentation nor comments, I should just read the code…) data handling rules, some of the corrections I add last month made errors appear in other parts of the file generated.
At this point, it gets enough freaky for me. I NEED REAL TESTS !

So, I decided to write, on my spare time, a tool to validate the file (if fields are all filled, if the values make sense, if the email field really contains an email address, and so on). Playing with metaprogramming and code injection, I got this skeleton of testing code (hiding all the automagical thingies in FileAnalysis.rb) :

#!/usr/local/bin/ruby -w

require "FileAnalysis"
include FileAnalysis

trap('SIGINT') { puts "\n\nAborting tests...\nBe sure to run *ALL* the tests at once from time to time ;-) \n\n"
exit
}

FileForPrinting.is "MMMMMMMM_data_2006_11.txt"
FileForPrinting.analyze do |line|

line.store? do |mag|

store.should_have_all_fields_filled
store.should_have_a_valid_email_address

end

line.cust? do |cust|
# here goes the tests for customers lines
end

line.art? do |art|
# here go the tests for article lines
end

end

This looks like a DSL to me (and it’s pretty like “Creating DSLs with Ruby” on Artima.com). Tests are quick to write, and fully understandable (okay, for those who know which tags are in the file, and which tests could apply to those lines).

Unfortunatly, my colleagues, who’ll have to deal with this piece of code, sooner or later, aren’t… English-friendly :)
For one thing, we don’t write code in English at work (WinDEV is set to “I code in French, pal” mode), and they’re not used to read and write this language. On the other hand, I don’t feel comfortable with writing tests in English for something I work on daily, in French. I mean : why the hell would I write line.store? instead of ligne.magasin ?

So I’ve the idea of pusching the DSL work one step further, turning it into a French written test tool, which would look like :

FichierAImprimer.est "MMMMMMMM_data_2006_11.txt"
FichierAImprimer.analyse ligne par ligne

ligne de type magasin ?

la ligne devrait avoir tous les champs remplis
le magasin devrait avoir une adresse electronique valide

ligne de type virement ?

...

fin des tests

Okay, that would be very cool. Of course, I might end up writing slightly different code lines, to save some time working on that, but I think you get the idea. I suppose I’ll call a method, just after starting the program, as the first line of the code, to parse the file (or, maybe another one which will contain the tests) to replace some strings by another, according to rules I’ll set up (delete a blank space if it is immediately followed by a “?”, “le” and “la” at beginning of the line should be deleted as well, and so on…).

This would mix the two categories of DSL : the ones which are new dedicated languages to serve one goal, and the ones which are evolution of existing programming languages.

At this point, I have only two questions to you, readers : have you ever written a DSL to be used by non-English people, and what’s your opinion about all this ?

Back from Paris

Filed under: friends, Ruby, geek, girls — Zifro November 19, 2006 @ 11:44 pm

Ouch. A three days week-end. Eventful and restless.

I caught a train on Thursday evening, an hour and half after leaving the office, to arrived at 11pm in Paris. pouype was kind enough to host me for the week-end. He was waiting for me at the railroad station and drove me to his house, in a nice and quiet suburb.

On Friday morning, pouype and I got into the train, he to go to work, I to go to La Defense, to attend Paris on Rails conferences, in IBM’s Descartes Tower.
The conferences were very interesting, and it was the opportunity to meet many of those from Ruby France and Rails France I chat with on the Internet. I also met the team from the company I have job interviews with the week before, and the recruiter from Teamlog was here as well. I’ll write a complete page about these conferences in some days.

After the conferences, pouype (who joined after his day job) and I stayed next to the tower, so I could catch anyone I knew coming out, to introduce him to pouype. After discussing the interest of each conference with kristalino and bartocc , pouype, underflow, zencocoon and I walk around to finally have a drink and, after being cordially invited to leave, had pizza for dinner (where we were asked to leave too, a little after at 10pm O_o).

On Sunday, pouype, his wife and I went to a Greek restaurant, after what she stayed at home while we drove to La Cité des Sciences de La Villette, for APRIL’s 10th anniversary. We attended a conference and then leave to meet leeloo, the Mandriva Girl, and one of her friend, who lives in Montpellier, so we’ll plan to see each others sooner or later.
I didn’t watch my clock and I was four minutes late to get the train back to the South :-\

After considering waiting for 11 hours at the railroad station, as the following train to Avignon was at 7:54am on Sunday (!), I choosed to wander around and try to find a cheap room.

I did. But you can imagine the comfort of a EUR 50 (USD 64) room, less than a quarter of a mile far from the railroad station… I even blocked the door with chairs, in case someone tried to rob me during the night… (I took some pictures, I’ll upload them later)

Finally, I caught the earliest train this morning, and got back home at 11am.

Eventful, restless.

Friday was a good day

Filed under: work, friends, Ruby — Zifro November 14, 2006 @ 9:35 pm

Last Friday was a very good day.

I had a job interview with Teamlog’s human & social resource manager, had lunch with the local agency director, who interviewed me a month or so before, and then meet their client, who might hire a Ruby on Rails (and some other skills) developer.
Their company, which I won’t name here, is really amazing : they deal with cool technologies, in a nice environment, use eXtreme Programming, and, best of all : they develop software with Ruby, my favourite programming language.
I think the (four !) interviews with them went fine… I’m looking forward hearing some good news… I hope :)

Afterwhat, I headed to Lyon and parked at fredix‘ home. We waited for alex and jsh to arrive, and then got to the Pizza Hut. We spent a very nice evening, ate more or less gigantic pizzas, and discussed some points of our beloved association, Ruby France.

Finally, I drove alex back home and got on my own way, to arrive at 2 am… quite a looooong day.

uKR : a framework for developing modular Ruby applications

Filed under: code, Ruby — Zifro September 19, 2006 @ 1:55 pm

As I wrote in this previous post, I’ve started working again on some Ruby code.

I’m currently extracting the micro-kernel part of YAIB to turn it into a framework for developing modular Ruby applications.

The goals of the project (simply called “uKR” until I find a good name) are to provide a complete-but-expandable, clear and clean, well-documented and well-commented, framework for event-driven modular applications.

A modular architecture based on an applicative micro-kernel allows the developers to share the tasks between each others, code separate stuff with a common communication message (read about it on OSNews).

It also allows to intercept crashes : if the sound module of an application has unexpectedly terminated, the micro-kernel is up to detect it, and rerun it a number of time.
It can also handle updating running applications : a module downloads its update, ask the micro-kernel for being reloaded ; its message queue is saved, the module is reloaded, given back its message queue, and run.
Other idea : a module can choose to offer many services to other, like authentication ; it sends messages to other modules anytime someone logs in, like “hey, this one is approved, you can process his/her requests”.

Truly, there are many applications of the micro-kernel paradigm to software applications, not only operating systems. Of course, I haven’t detailed why some people *HATE* them, I’ve just explained why I’ve used it for YAIB and why I’m about to write this framework.
Want examples ?

A multimedia player : one module for the user interface, sending events like “play”, “pause”, “next”, “stop” events to the module playing the music or the video, while another one is downloading the new version of the UI module.

An IRC bot : one module handle the connection to the server while other focus on dealing with channels managements, authentification, serving news to chatters, …

The first work is to clean the code from what hasn’t to be in, and re-design some of the internals, with the developer needs in mind. If you have any idea about it, please leave a comment or email me (zifro@).

I might release it (in an early version) by December (at last !).

YAIB will be based on it - sort of “hey, look, it works” application - as soon as it becomes usable.

PS : thanks anamorph for having motivated me yesterday. You’re a friend to me.

One week

Filed under: work, healthy life, Ruby — Zifro @ 12:33 pm

It’s one week I haven’t updated my blog. Sorry -_-

First, I’m still alive.

Second, I went to the haidresser and shaved my beard, so that I don’t look like this any longer like that (okay, the sunglasses add a bit to the guru/scary effect).

Third, I had much work at the office, related to the project I more or less described here. It will soon be used by one of our stores. I hope it will work :)
Finally, I started working again the evening on YAIB , splitting it into three parts as I may have written here : the micro-kernel, the IRC library and the bot itself.

Monday, WinDEV.

Filed under: work, WinDEV, code, Ruby — Zifro September 11, 2006 @ 5:59 pm

I’m currently working on software to help our customers save time, by extracting data from their databases, to generate a big file and then send it to a partner, who’ll print all the letters and checks.

Honestly that’s a big advance for our customers, something like one day work saved.
But as my company will handle some of the administrative part, I have to write the checks parameters, like the name, the address and stuff.

One of these parameters is the (sort of) checksum of the magnetic ligne at the bottom of the check ; it aims at checking the check authenticity.
The algorithm I was given by our bank director office is the following :

rlmc = 97 - (N x 100 - 97) where N is the concatenation of the 31 digits of the magnetic line (check number and two bank codes).

So I code it, run it, and WinDEV : string to number convertion and big numbers handling TADA !
It appears that WinDEV doesn’t handle big numbers (string to number convertion sucks hard too).

So, “just to try”, I typed in the same thing in irb :
irb(main):001:0> s = "6459010034010041908006791980430"
=> "6459010034010041908006791980430"
irb(main):002:0> rlmc = 97 - ((s.to_i * 100).modulo(97))
=> 54
irb(main):003:0>

Oh… it works :p

$LOAD_PATH problem (and solution) with Ruby under OpenBSD

Filed under: *BSD, Ruby — Zifro September 7, 2006 @ 1:57 pm

I first wanted to include the previous post in this one, explaining how I went to reinstall Ruby and have all those troubles, but I splitted it in two parts, as it was two different (but linked) stories.

After reinstalling everything I need on my box, I grabbed the latest release of Ruby (1.8.5), su to the root account, and typed the magical ./configure ; make ; make install
Then I downloaded the gems (0.9.0), ruby setup.rb it and rand the gem command.

ruby: No such file to load -- rubygems (LoadError)

I browsed and found that my Ruby installation was probably broken at some point, because I had to be in the gem directory to run the command successfully.
Asking irb (and checking Ruby on anamorph’s box) confirmed what I feared : site_ruby/ wasn’t in the default $LOAD_PATH.
So I set it manually in order to install Rails and its dependencies, but still looked for a way to fix it.

Yesterday evening, after hours of searching, trying, looking at the configure, and Ruby and gems documentation, I asked on #ruby-lang on FreeNode.
drbrain helped me explaining it should be the shell that the ./configure run in to be the problem. As export CONFIGURE_SHELL didn’t helped, I ran ksh (which was previously the root shell) to configure and compile the latest snapshot.

Yeah ! Finally it works ! Thanks a lot drbrain :) This post coul have been titled “Last night a chatter saved my life” ;-) The $LOAD_PATH was fine, I reinstalled the gems, then Rails.
Perfect.
Tricky heh ?

So, to conclude, I gonna change the root shell from bash to ksh. I don’t know yet what’s wrong with bash and configure, but I learnt that even the shell can turn a simple installation into a nightmare.

yaib.net & yaib.org : using Ruby on Rails for advertising on YAIB, pass exams and self pleasure

Filed under: Studies, Ruby — Zifro August 25, 2006 @ 1:19 pm

Last Friday was the best one of the year. The blue sky, the warm weather, the cars racing… and so on. This one is going to be the most quiet of the year.
Bosses ar not here, I plan to code only one thing (an FTP transfer extension to the reporting tool used here), and I won’t go to the car meeting and races tonight.

I spent a lot of time diving into Ruby on Rails world so that I’d be able to have something to show, mid-September, and pass the final exams. So I worked until unusual hours (4:00 am, 00:30 am, 3:15 am) and have done much (mostly the interface) so far. Yesterday I fell asleep early (I was in bed at 11 pm) so I’m not a zombie today.

My interest for Rails started back in September or October of the previous year, when I was looking for something that could help me design portable interface, dreaming of a browser connecting to a local tiny webserver. The friend who taught me IRC (at a guild-master level), who also lead me to code Ruby, then told me about RoR. It’s fate.
Since, I have taken a look at it (the Agile Web Development with Rails book is worth reading), played a bit with AJAX calls and stuff, but nothing really big or production-class.
I choosed to use Rails to develop two websites : yaib.net and yaib.org (note that these aren’t links, their content isn’t online yet) and present that work for the project exam of my night courses.

So it serves three goals : learn the Rails framework, pass my exams and advertise for my Ruby written IRC bot YAIB.
Now that I’m dealing with it daily (er… nightly), even if I am not using much of ActiveRecord’s capabilities (the database I designed is really… basic), I can speak a little more about it :
It’s clearly fantastic. Every time I search how to do something, there’s an elegant solution provided directly by Rails, when not by Ruby itself. Not only Rails helps you design quickly and code elegantly, it leads you to think different (so yes, there is a little adaptation phase before you’re fully effective), and develop better.
Of course, Rails has limitations : no support of stocked procedures (but it’s not what it aims at ; its goal is to abstract the database layer, all data-related logic is contained in the model and has to be handled there), no multiple database support either.

But it does what it’s done for : develop database-backed web applications.
At this point, I believe J2EE and PHP are not really challengers. The market isn’t exactly the same, and, of course, one should use what he feels comfortable with.

So, I’ll spend the next weeks working hard on it, trying not to neglect the French Ruby users association in which I’m involved as the current secretary.
When I have finished yaib.net and yaib.org, I’ll have to put them online, so if you know a good Rails hosting plan, drop me a line below.

Note : Yesterday, on IRC, just before I quitted, Forth told me he liked my new blog. Thanks to you friend !

- Next Page >>>