g++, my nemesis
Monday, November 20th, 2006dbmanager.cpp:626: error: request for member 'ival' in '*((+(unsigned int)(+ res)->string::operator bool()) + ((const char*)"insertid"))', which is of non-class type 'const char'
dbmanager.cpp:626: error: request for member 'ival' in '*((+(unsigned int)(+ res)->string::operator bool()) + ((const char*)"insertid"))', which is of non-class type 'const char'
Use this as you would use | sort | to sort package names according to dpkg versioning logic:
#!/usr/bin/perl
sub dpkgcomp
{
return 1 if(system(”dpkg –compare-versions $a lt $b”));
return -1 if(system(”dpkg –compare-versions $a gt $b”));
return 0;
}
@l = <>;
chomp(@l);
@s = sort dpkgcomp @l;
print join(”\n”, @s), “\n”;
Today I’ve tried parsing XML with xml.dom.minidom and xml.sax that both come with recent Python distributions. It made me want to kill people.
Then someone on irc pointed me to xmltramp, a wonderful (and small!) piece of python code that no amount of googling had turned up for me. xmltramp is absolutely brilliant, and was easy to hack for my subversive purposes.
People also tell me ElementTree is good.
Yesterday I wrote a db4file implementation for grace’s dbfile interface, using version 4.3 of Sleepycat’s db4 library.
Then my coworker tried it on 4.0, and it broke. Turns out the DB->open call got a bloody extra argument, for transaction support. Why the hell change a signature; what’s wrong with just creating a new function name. You can always pull it back together in 5.0…
When you’re using a lot of SQL from a programming language (be it PHP or C++), put comments inside all your queries indicating which function executed them. That way, logging becomes much more useful, like this:
sqlite3_trace: SELECT /* createobject uniquecontext */ content FROM objects WHERE id=4
(I did not come up with this trick - but it is useful enough to post it here anyway.)