Archive for the ‘Computers’ Category

self reminder about “le vélo star”

Thursday, November 5th, 2009

So, this is a XML list of vélo star stations and this is the state of a particular station (as an HTML fragment)

safari 4 and…

Wednesday, October 28th, 2009

I preferred when Safari was chewing up tons of memory. At least then it didn’t crash every 10 minutes on random web sites. (more…)

dear php, about array declaration

Tuesday, September 29th, 2009

So, the following is legal:

$foo = array(
  "bar" => 2*2
);
var_dump($foo);

But this is not:

class Foo {
  public static $foo = array(
    "bar" => 2*2
  );
}
var_dump(Foo::$foo);

I’m sure there is a reasonable explanation for this behavior, but I’m not sure I really want to hear about it.

Having fun with a GPS, a bit of Rails and lots of javascript

Sunday, June 28th, 2009

wtp-screenshot A few months (well, almost years…) ago, I had this project of mine which only led me to write a small google maps rails based application. And since I was having some spare time recently and some good weather, I was also playing a bit with my GPS. So, one thing leading to another, and the rewrite starts to look good. But I still have quite a few features to add. And with some luck and inspiratio, I may even be able to finish the original application.


safari 4 and threads

Thursday, June 25th, 2009

Dear Lazyweb, why does Safari 4 takes up to 500 threads after a few days running? Not that I mind much the 5.6GB of virtual memory it takes or the almost 700 MB of real memory, but I’m just curious.

at last!

Friday, April 10th, 2009

I’m 2 months late on this one, but one can now merge gmail contacts!

dear google docs and search people

Friday, March 27th, 2009

It would be nice if you could work together so that I can directly open PPT/PDF/DOC/whatever files directly from the search interface with the docs viewer (which is far friendlier than the HTML output). kthxbye. (more…)

Using ruby2ruby for translating ruby code

Thursday, March 26th, 2009

Once upon a time, I wanted to be able to generate RPN-style code from a more common Ruby-based syntax (and DSL). Fast-forward, I have been playing today with ParseTree and ruby2ruby (Thanks Ol for the hints!); The latter provides a to_sexp method on all Proc objects (which was lacking from the former). Given that a sexp is an abstract representation of a code portion, I can then use this structure to generate a new representation (in RPN, obviously) using my own “compiler”.

A real simple example (extracted from my test suite), with just an arithmetic operation:

    assert_equal "kmh,8,*", evaluate_rpn_block {
      kmh * 8
    }

The evaluate_rpn_block method calls ruby2ruby’s to_sexp and then goes through the result tree. A more complete example of what can be done:

    assert_equal "kmh,100,GT,0,kmh,IF", evaluate_rpn_block {
      if kmh > 100 then
        0
      else
        kmh
      end
    }

From there, what is lacking would be plugging the internal available functions (and operators) and matching the names used with existing definitions.

How I Learned to Stop Worrying and Love… Hpricot

Tuesday, March 17th, 2009

When I first started to code scripts with Ruby, one of the features that I loved was the Rexml library which made parsing XML just a breeze, most likely because I was coming from a Perl/Sax background and at the time I was surrounded by Java programmers, but also because it really is that easy to use.
At home, I have this small script that takes a XML file listing books that I have, do stuff to it and outputs more XML but in a different format and with some filtering. At first, it was ok. But recently, the source XML file got a bit hairy and larger that it used to be (just 2MB, but that’s already a bit of a constraint). So I looked around a bit, and in fact there are now a few alternatives which are faster; One of them being Hpricot which is originally an HTML parser (as I already used it earlier on) but which also works well for well-formed XML. And in fact, it isn’t much harder to use (even easier at some point) and yes, it is faster. The same script (almost) is about 7 times as fast using Hpricot rather than good ol’ Rexml. Ok, I’m convinced. (more…)

Dear google reader developers…

Saturday, February 28th, 2009

Automatic translation is nice, but please, allow it on a per-post basis instead of per-feed. kthxbye. (more…)

About

My name is Sebastien Tanguy. This is my weblog. I am currently a software developer, but every now and then I also talk about music, books or photography.

 

February 2012
M T W T F S S
« Jan    
 12345
6789101112
13141516171819
20212223242526
272829  

Archives