Wednesday, January 9, 2019

porting old code from Note.js to D v2

Since about august I started porting code from Node.js to Dlang. Node.js is nice enough but the ecosystem has a Jurassic-going-on-Cretacic flavour to it.

I guess I no longer start drooling when I see templates and I don't swoon when having to deal with strong and strict typing, though templates help a lot and without them I'd have very probably given up and returned to Perl 5.

Here is the code: https://bitbucket.org/emilper/zug-matrix . I started with the naive algorithms from the original code and I am moving away to more formal ways of linear algebra, and already know more about it than I ever did. Again, dlang templates are worth *my* weight in gold :) , reusing code between more symbolic matrices and numeric matrices is worth the efort learning about dlang templates.



Friday, December 14, 2018

almost done with stretching matrices

Almost done with stretching (same as scaling but less high-brow) matrices https://bitbucket.org/emilper/zug-matrix.

Also perfected a method to write correct code while very tired: write tests with what you expect to get while still awake, then scramble the code around until you stumble upon a not-completely-disgusting solution and the tests pass. Maybe I should pattent it ?

Tuesday, October 2, 2018

DBD::mysql failing with mariadb on debian/ubuntu/friends

If installing DBD::mysql build fails on debian/ubuntu/etc. when you have mariadb-server installed, you might need libmariadb-dev-compat .

Monday, April 16, 2018

getting tired of being victimized by overeager JS developers I am taking a hard look at Javascript/Node environment

to keep it real and eat my own dog food I published some code on npm https://www.npmjs.com/package/matrix-mab

may the FSM have mercy of my developer karma :)

Friday, August 11, 2017

dlang - retrieve struct from void pointer passed to extern (C) function

struct Data {
    int depth;
}

extern (C) void startElement(void* userData, const(char)* name, const(char*)* atts) nothrow
{

    Data user_data = (*cast(Data*) userData);
    user_data.depth++;
    // and so forth



I do not know if this is the right way to do it but it seems to work.

Sunday, July 16, 2017

backup sites with cron and ssh

# m h dom mon dow command

33 0 * * *   /usr/bin/ssh root@lunch-break.ro "/bin/tar czf - /home/www/bla " > \
 /home/emilper/backup/bla/www_bla_`date +\%Y-\%m-\%d_\%H-\%M-\%S`.tar.gz 2>>/tmp/cron.log 
52 0 * * *   /usr/bin/ssh root@lunch-break.ro "mysqldump -u root -pblabla --opt bla_db | \
 gzip -9c " > /home/emilper/backup/bla/bla_db_mysql_dump_`date +\%Y-\%m-\%d_\%H-\%M-\%S`.gz \
 2>>/tmp/cron.log