Kernel word recovery crack, Mobile themes website for samsung wave 525, Dekha ek khwab sony tv title song, Song zombies on your lawn, Bloody mary nerve endings mp3, Digittrade tv jukebox, Padosan songs mp3, Gold cup series 70 manual, Nieuwste versie van mozilla firefox en, Cant install spotify on mac, Web brute force password cracker, Belkin g peek driver windows 7

Archive for the ‘Life’ category

Github repository

February 14th, 2013

Added the tool of which displays information about open files to my github.

C++11 lambdas

July 1st, 2012

A small extract from my ongoing project Jam Fabric. C++11’s lamba functions can make code very consise.

bool Workspace::isEquivalentTo(const Workspace *other, bool checkValues) const {
    QList<Unit*> myUnits = findChildren<Unit*>();
    QList<Unit*> otherUnits = other->findChildren<Unit*>();
 
    if (myUnits.size() != otherUnits.size())
        return false;
 
    std::sort(myUnits.begin(), myUnits.end(), [](Unit* a, Unit* b) {
        return a->name() < b->name();
    });
 
    std::sort(otherUnits.begin(), otherUnits.end(), [](Unit* a, Unit* b) {
        return a->name() < b->name();
    });
 
    if (!std::equal(myUnits.begin(), myUnits.end(), otherUnits.begin(), [checkValues](Unit* a, Unit
* b) {
        return a->isEquivalentTo(b, checkValues);
    }))
    {
        return false;
    }
 
    return true;
}

Dynamic parser engine for Qt

July 20th, 2009

I’m still working on a long term project to write a music editor, something I will describe more in detail at another time. Suffice it to say that the vi editor was an important model for it, and that I want to be able to perform every operation using commands I can type on a command-line, and using keyboard shortcuts in a command-mode that generates sentences in the command language. I also want the language to be extensible by plugins and other commands. Using a command language as a base for the program’s operation also brings me the benefits of easy undo implementation, macros and save files with full history.

I could probably have used QtScript instead of defining my own command language, however I wanted the syntax to be close to vim’s, I wanted the syntax to be easy to use as a command language, not as a scripting language, and I needed a parser anyway to grok command-mode commands. I didn’t like any of the existing parser generators and parser engines I could find, so I spent some time writing a dynamic parser engine that is nearing completion now.

I tried hard to break free from the Yacc/Lexx tradition, and used some concepts borrowed from NLP. The idea was not to create the most efficient parser (computers are fast anyway), but one that is easy to use and reuse (and probably abuse). It allows for optional words and ambiguous sentences. It is not token based, ie. there is no separate tokenizer and it can be specified per terminal whether it requires whitespace at the end or not. Commands are parsed as soon as the user starts to type so feedback can be given whether the syntax is valid, and completions can be shown. This also makes for a powerful context help mechanism.

The following piece of code shows how to create a basic grammar. A “sentence” is a toplevel command. The “verb”, “object” and “complement” functions specify named groups. The “cut” functions here are borrowed from prolog, and are just optimizations: they tell the parser to commit to the current parse tree (no backtracking) up to the cut when one is encountered.

Grammar* g = new Grammar();
g->addSentence( "debug_cmd", 
    sentence( verb("debug"), object(r(GRAMMAR_TOP))) );
g->addSentence( "goto_cmd", 
    sentence( verb("goto"), cut(), complement("position", r("position_expr"))) );
g->addSentence( "move_cmd", 
    sentence( verb("move"), cut(), object(optional(r("object"))),
    complement("position", r("position_expr"))));
g->addSentence( "mark_cmd", 
    sentence( verb("mark"), cut(), object(r("mark"))) );
g->addSentence( "dm_cmd", 
    sentence( verb("dm"), cut(), object(oneormore(r("mark")))) );
g->addSentence( "quit_cmd", 
    sentence( verb("quit"), cut() ) );
 
g->addRule( "object", choice( w("cursor"), r("mark") ) );
g->addRule( "position_expr", 
    choice( r("time_expr"), r("metric_expr"), r("mark") ) );
g->addRule( "time_expr", 
    seq( complement("value", number()), complement("unit",r("time_unit")) ) );
g->addRule( "time_unit", wordchoice( "ms", "s", "m", "h" ) );
g->addRule( "metric_expr", seq( number(), r("metric_unit") ) );
g->addRule( "metric_unit", 
    wordchoice( "measure", "measures", "bar", "bars" ) );
g->addRule( "mark", choice( r("global_mark"), r("local_mark") ) );
g->addRule( "global_mark", rx( "\\b[A-Z]\\b" ) );
g->addRule( "local_mark", rx( "\\b[a-z]\\b" ) );

The next piece of code illustrates how to bind commands to the (transformed) parse trees. The ArgSpec provided in registerCommand define the mandatory named groups in a matched sentence. The command with the most specific matching ArgSpec will be executed. This allows commands to be overloaded.

Executer* x = new Executer();
x->setContext( new Context() );
executer->registerCommand( "debug_cmd", ArgsSpec(), &Context::debugCommand );
 
ArgsSpec goto_args;
goto_args.insert( "position", "position_expr" );
x->registerCommand( "goto_cmd", goto_args, &Context::gotoCommand );
 
ArgsSpec move_args;
move_args.insert( "object", "" );
move_args.insert( "position", "position_expr" );
x->registerCommand( "move_cmd", move_args, &Context::moveCommand );
 
ArgsSpec mark_args;
mark_args.insert( "object", "mark", ArgsSpec::ArrayType );
x->registerCommand( "mark_cmd", mark_args, &Context::markCommand );
 
ArgsSpec dm_args;
dm_args.insert( "object", "mark" );
x->registerCommand( "dm_cmd", dm_args, &Context::deleteMarksCommand );
 
x->registerCommand( "quit_cmd", ArgsSpec(), &Context::quitCommand );

And finally, a function that demonstrates how to implement a command function that can be called by the Executer.

void Context::gotoCommand( Args args ) {
    ConstituentNode* position = args[ "position" ];
    if ( position->isa( "time_expr" ) ) {
	log( "goto time " + position->value( "value" ) 
	      + " " + position->value( "unit" ) );
    }
    else if ( position->isa( "metric_expr" ) ) {
	log( "goto metric " + position->value( 0 ) + " "
	      + position->value( 1 ));
    }
    else if ( position->isa( "local_mark" ) ) {
	log( "goto local mark " + position->value() );
    }
    else if ( position->isa( "global_mark" ) ) {
	log( "goto global mark " + position->value() );
    }
}

Some random notes to finish this quick tour:

– This is unfinished work. The API will change. (ConstituentNode is a bad name, registerCommand
may take an extra instance argument, etc)
– A mechanism will be added to do automatic type conversion. For instance, convert a time_expr
(value + units) to a normalized time in second that is easier to use in a function, and easier to extend
(the move command doesn’t need to be modified if a time unit is added).
– Custom completers (for instance for filenames) are not shown here. (work in progress)
– The library includes a command-line widget with autocomplete functionality.
– A Context base class is provided with functions to access history and ease debugging.
– I don’t share the source at the moment, but it will be open source once it is in a more finished state.

Freestyle experience

September 25th, 2008

Slow tripping tribalesque music from outer space ! A dozen people with hangs, didgeridoos, percussions, guitars, a bass, a keyboard, a sax, a clarinet and of course some vocal power are preparing for the concert of their live, at the Molodoï, on November 8th.

The new Freestyle Experience is the continuation of last year’s Freestyle experience project, this time with even more musicians and chaos, but still led by Greg and the holy hang.

Urban Caravan

September 9th, 2008

September, the holidays are over. After the death (or is it just a very slow period?) of the Presbytarians, I was bandless. Until I met François at the weekly jam session at the Jimmy’s bar, who invited me to play the keyboard for Urban Caravan (or is it Urban Caravane ?).

I really like the jazz funk style, and this should give me the motivation to learn how to play like Herbie Hancock… Now all I need is the skills (and a lot of patience) (and more skills).

I’ll be an Akademy tourist !

August 8th, 2008

If you’re looking for me, I’m here. See you !

Bass repair

August 5th, 2008

I bought a new 500K log potentiometer to replace the crackling one in the bass. I’m still amazed that they (Aria pro II) use such cheap potentiometers in there instruments, good ones (or even average ones) can’t be that expensive compared to the cost to make the rest of the instrument, can they. The local electronics dealer (Bric’ Electronic) doesn’t have much choice as usual. In this case they didn’t have potentiometers with short poles, so I had to saw a new one up to get the right length to fit the knob. I also had to glue the front pickup that somehow became unstuck.

I played for a few hours yesterday. I really love it. After playing the guitar, finding the notes on a bass is really easy, and you can focus on melodies instead of chords. The hard part now is the left hand technique. I seem to miss some muscle power especially in my weaker fingers, but I’m sure this is at least partly due to bad fingering. I’ll have to record something, just to keep track of my progress.

Jam session presents

July 31st, 2008

[zoom_h4]:http://www.zoom.co.jp/english/products/h4/

We had a little jam session at home yesterday night. There weren’t as many musicians as 3 weeks ago, but I had some fun playing jazzy stuff on the piano along with Sandy on the (latino) guitar and Aurélien (percussions), and a nice chord progression ( AM7 / B7 / D7 E7 / AM7 ) with Damien (tenor sax).

I should really find a way to record those evenings without being too invasive. Some people have bought the [Zoom H4 “Handy Recorder”][zoom_h4], which I must admit is really nice. It’s also a little expensive and I’d be more interested in making something myself. I also need an audio mixer so several instruments can share the amplifier. It’s tiresome to have to bring an amplifier for each instrument, and having to choose between the bass and the guitar is a pity.

After a while my neighbour told me he had an old bass guitar he hadn’t used in over 10 years (his wife didn’t even know he had it). At the time he wanted to start a punk-noise-pop-ish band with friends, but it never became a reality. When he asked me if I wanted to have it, I couldn’t refuse. I’ve always been attracted by bass guitar, but I never bought one, this was the opportunity. The E-string is missing, and the volume potentiometer is noisy, but nothing I can’t fix. Thanks a lot Cédric !

Then Ivan mentioned that he had an old synthesizer at home which he didn’t use anymore, a Roland D-20. So I borrowed it for an indeterminate period of time. I’m hoping to use it to create 80’s style synth sounds (Can I smell Dépêche mode?).