Monday 30 September 2013

Sqlite compiler spam delenda est.


Because sqlite produces ~50000 extra letters of bumpf per compile that often obscures actually important compiler messages, I've not been as diligent as I should have been about reading compiler messages.  A lot the time I get lucky and it doesn't matter, but I also got caught out by that.

Here is how to get rid of all the noise and make your compiler output useful once again:

First we take a snapshot of the 'native' compiler messages that come with the trunk:

make 1>stdout.report 2>stderr.constant;
sort --unique stderr.constant > stderr.unique;
grep -v -F sqlite stderr.unique

This removes the sqlite warnings and shows you only the current warning messages that are actually ~/trunk related.

Any subsequent compiles that are started with the line below will use the generated stderr.unique file to filter output and remove every compiler message that is 'native' to the trunk, leaving just the compiler messages that pertain to your code:

make 2>&1 >stdout.report | tee stderr.report | grep -v -F -f stderr.unique >&2 2>/dev/null

You can also type this line when you invoke the emacs compile buffer and your C-x ` will continue to work.

Update:

Daniel Shahaf kindly mailed me his solution:

When I ran into this problem, I solved it differently: by building sqlite3 as a shared library and pointing configure to that.  Details  here:

https://svn.apache.org/repos/infra/infrastructure/buildbot/aegis/buildmaster/master1/projects/subversion.conf

# Built from the amalgamation with:
# s=/home/buildslave18/slave18/tools/sqlite; sudo rm -rf $s && sudo mkdir -p $s/include $s/lib && sudo cp sqlite3.h $s/include && sudo gcc -W -Wall -Wextra -Werror -fPIC -shared -o $s/lib/libsqlite3.so sqlite3.c -ldl -lpthread
# NOTE: this doesn't create a .la file for libtool, so libtool won't add this library to rpath of binaries compiled against it, so we have to set LD_LIBRARY_PATH below.
    '--with-sqlite=/home/buildslave18/slave18/tools/sqlite',

That approach is used by the warnings bot:
http://ci.apache.org/builders/svn-warnings

I suppose there's more than one way to skin a cat.

Cheers,

Daniel
(who can do './autogen.sh >/dev/null && ./configure -q && make -s' and
get no output and no warnings)

Thursday 26 September 2013

The handrolled version of *_create_custom_diff_cmd

This may or may not be a good idea, but if you enjoy this sort of thing, my latest effort at code comedy is here.

This is probably not the final version because copying Mel the Programmer's strategies is almost never a good idea, but, it just had to be done at least once ;-)



Update 30mins later:  Hah, already busted.  I take away any special end characters but if what I'm handling is not a delimiter, then I end up stealing user's chars.   Added a new test for this, now I have to fix it =)

(and why is it that every time, no matter how long I stare at my effort beforehand, the moment I commit code, I find a whopping show stopper a few minutes later? :-D )

Update on update:  Fixed.  And I should have coded that in the first place, the repetition should have made me suspicious, and I did think about it at the time, but thought that it can't be done differently for some reason.   Next time, I'll lay off the catnip before I commit.

Tuesday 24 September 2013

Chocolate Russian

Whenever I'm too lazy to organise dinner there is always the classic, efficient and healthy alternative: the babushka of all cocktails that is dinner, dessert and after dinner coffee with a few shots.  And possibly breakfast.

Recipe: 1 measure of brandy, 2 measures of vodka, 3 measures of double cream. Blend with fork in glass. Take the parmesan grater and process one square of dark chocolate flakes into the glass so they sit like a mound of snow.  Blend in, repeat.

Drink very slowly, whilst listening to an appropriate song:



I love Dschingis Kahn, this video and the song. It's just fun, in the same way that Village People put on a great show, with brilliant songs. What is the lyric about?

Well, here is my translation, it's even singable (for those of you who are fond of drinking songs :)

Moscow - strange and mysterious,
Towers of dark red gold,
as cold as ice

Moscow - but those who know you well
know that a fire burns so hot, deep inside.

Cossacks hey, hey, hey empty your glasses!
Natascha ha, ha, ha, you look fine!
Towarisch hey, hey, hey, let's drink to life!
To your health brother, hey brother ho!

Moscow, Moscow throw the glasses at the wall,
Russia is a gorgeous land, ho, ho, ho, ho, hey!
Moscow, Moscow,
your old soul is everything
at night the devil's partying, ha, ha, ha, ha, hey!
Moscow, Moscow,
Love does taste like caviar
Girls are meant to kiss and dance, ho, ho, ho, ho, hey!
Moscow, Moscow,
jump the table, dance with us,
until the table crumbles up, ha, ha, ha, ha, ha!

Moscow
Portal into the past
a mirror of Rus and Tzars
as deep-red as blood

Moscow, those who know your soul
know just how love will burn
as hot as white coals

Cossacks hey, hey, hey empty your glasses!
Natascha ha, ha, ha, you look fine!
Towarisch hey, hey, hey, let's drink to love!
To your health sister, hey sister ho!

Moscow, Moscow throw the glasses at the wall,
Russia is a gorgeous land, ho, ho, ho, ho, hey!
Moscow, Moscow,
your old soul is everything
at night the devil's partying, ha, ha, ha, ha, hey!

Moscow, Moscow
We drink our vodka pure and cold
and live to be a 100 old
Ho ho ho ho ho, hey
Moscow, Moscow
Granddaddy your glass is empty
In the cellar there is plenty
Ha ha ha ha ha

Cossacks hey, hey, hey empty your glasses!
Natascha ha, ha, ha, you look fine!
Towarisch hey, hey, hey, let's drink to love!
To your health brother, hey brother ho!

Moscow, Moscow throw the glasses at the wall,
Russia is a gorgeous land, ho, ho, ho, ho, hey!
Moscow, Moscow,
your old soul is everything
at night the devil's partying, ha, ha, ha, ha, hey!
Moscow, Moscow,
Love does taste like caviar
Girls are meant to kiss and dance, ho, ho, ho, ho, hey!
Moscow, Moscow,
jump the table, dance with us,
until the table crumbles up, ha, ha, ha, ha, ha!

   @}-,--'---,----

Now apparently there is no official Russian toast:

"No one says "Na zdorovje" as a Russian drinking cheer. 

This is increadibly widespread myth. It does mean "To you health", but they only sayy it as a reply to "Spasibo" i.e. "Thank you". 

Furthermore, there is no universal drinking cheer in Russian, however paradoxical it might sound. Sometimes they say "Budem zdorovy" meaning "Let's stay healthy". 

Which sometimes is shortened to just "Budem" (see Ukranian version). or "Chtob vse byli zdorovy", i.e. "Let everybody be healthy". Thanks to Dmitry 

Old index: Na zdorovje (to your health), Vashe zdorovie or Na zdorovia (Not used !)"

... so, I suggest you either just sing this song instead, or pick on toast at random from this handy (and very educational) list  of international toasts.

Prost Mahlzeit!

Sunday 22 September 2013

Even left over lunches don't come free

I keep meaning to write something about the weird experience that re-learning to code can be.  I wrote the following to a friend of mine, and I think I could rewrite it, but well, it says all that needs to be explained I guess.

My svn jutsu is pitiful, because I literally had no time yet to learn it and also, no cause (as in need-it-right-now project I need to do-right-now).

See, if you know more than a beginner but less than a newbie, the question is, what part of the universe of confusion to you de-entropy first?

If you want to do A but suddenly codus interruptus hits and you first need to figure out B, which depends on knowing C that requires you check out D... E... Zzzz(repeat ad nauseum) the best decision is to patz and just get the job done without getting sidetracked into studying properly. 

The OPW placement was great, but put a lot of pressure on me to produce something semi-decent(and, I was (and am) slooooow) and so, I didn't have much time to read into things too deeply, plus, what can I say, coding is a habit and restarting after 10 years isn't all that easy -- you need to rebuild your coding short term memory space/riffs to be reliable, fluid and have enough slots, and that takes time.   

They say you never forget how to ride a bike, that's true, but when you try after a long time, you get doms in your muscles, wobble the wheels and possibly fall off at least once. 

Is it easier to re-learn than to start from scratch?  I don't think so, it's harder in quite a few ways, because you tend to be overly critical without having the matching sound judgment.  Even left over lunches don't come free :)

Reading through a manual for general understanding is very different to needing to get from A-B, and I had a lot of A-B'ing to do.  

In fact, I didn't use svn at all (other than to stash code) until I put a lot of code in the wrong tree and had to use diff to get my work out *blush* , so I managed to contribute to svn (the gtest project) using svn the first time when I made the branch where I stashed the completed job.  Plus I had commit access and no idea how to test this before I make a (potential) mess, so it had to work the first time.  Ostrich egg omlette, anyone?

I had kittens over the merge -- I let my branch rot somewhat.  So, I somehow ended up using kdiff at first and got spammed by 30 unresolved merges I had noooo idea what they were.  In my defense, making a large svn branch with lots of code snippets in many files and letting rot (I had no idea this could be a problem btw) is perhaps not the optimal introduction to basic svn usage... 

Eventually... I r.e.m.e.m.b.e.r.e.d that svn itself has a merge program and that kdiff is actually trying to do the merge instead of just showing me the code (I'm slow I know, LOL)  and it did it all bar a couple of simple line hierarchy queries.  

And, to top it all, this one segment of code that drives kdiff is actually the *one{and only}* thing I understand in svn (because I coded it, plus I tried to code a fix in for the merge label bug which died because it broke something else, and there could only be one), but did I make the connection?  Of course not, doh.   

Maybe I should've bought a dunce cap instead of a Stetson.

----  Well, this is what she wrote. ----


Friday 20 September 2013

basename basically not so basic


It appears that GNU has three kinds of basename. 

They all do different things despite looking like the same thing, and usually it would make sense for something as basic as basename to be consistent.  However, no such luck, and I ended up suitably confused, and asked a friend to clue me up.  This is what he wrote:

"There are two different things called 'basename' here. There is 'locate --basename', and there is the GNU make function $(basename ...). They are both inspired by the command basename(1), which does yet a third conceptually similar thing (strip off the directory part and optionally a given suffix, if present), but other than that they have no connection to each other at all.

"Note that $(basename ...) is running the *GNU make function* 'basename': it is *not* doing the same thing that $(basename ...) would do in the shell and running the shell command 'basename'. If you wanted to do that in make, you'd use $(shell basename ...).

locate considers the basename of a file to be the last component of a filename. GNU make considers it to be *everything* in the filename before the first dot. When you consider their likely use cases, this makes sense: in make, you generally don't want to throw paths away when transforming names, because you're going to want to look those paths up again. If you wanted to strip pathnames too, you could say $(notdir $(basename ...))."

...so basically, basename is the same basic idea based on different bases.

In other, unrelated news, those who have managed to miss this video about 'Bohemian Gravity' below should watch it right now:




Tuesday 17 September 2013

I found find. Now I'm lost.

I used find before quite a lot, but it never occurred to me to type 'man find'.

Well, I just did and found the software equivalent to this:




30 pages of man file.  Is there anything find doesn't do?

I'm going to have to grow a second brain I think.

Monday 16 September 2013

Eight Gambling House Rules

1. Any game is eligible that is played face to face with real objects.  If there is no agreement on what should be played, a game is selected by lottery.  No game may be played more than 3 times in a row.

2. Handicaps and and stakes are up to the players to haggle over.

3. Players can wager as they see fit and as much as their bankroll contains.

4. Every 1st of the month, the current winner is payed out and then the bankrolls are re-bought to equal amounts of a previously agreed amount N (plus penalties from the last month).

5. Refusal to play without offering a timely alternative  appointment (or missing a play date) attracts a penalty of 1/5th of the total bankroll in play in favour of the stood-up player, ie, if you hold 18 units of 20 possible ones, the penalty is 4 units.

6. You must play a minimum of 3 times a week, if all parties fail to play, a penalty of 1/5th of every stack is returned back to the cashier and added onto the next month's bankroll pot.

7. If one player bankrupts the other, winnings are payed out immediately however, the bankrolls are only reset on the 1st of each month.

8. Winnings are earmarked for toy purchases --- items that you love to have, but that are a guilt trip to buy.  This way, you have no choice but to choose fun!

Thursday 12 September 2013

I'm having a bash

I am currently working on my BRANCH_README file and I'm finding that my bash skills are seriously lacking :(

Sadly, I'm no longer a mud wizard, so the trusty old

   patch Gabriela barbarian_bash_skill +MAX
                                                             
spell is not longer an option and I will have to read a tutorial along with the bash reference instead.

UPDATE:  The above tuts are good, but this tutorial is amazing and has many examples, and in-depth explanations as to why and how things work.  
                                                          
However, it's sort of traditional that one has to 'bash with a bonecrushing sound':

  ... and this album is about as Heavy Metal as Cool Jazz can get.

Friday 6 September 2013

Productive Procrastination

I rediscovered my old math grind bible -- Engineering Mathematics by K. Stroud.

It's not a math course as such, more like a collection of sure-fire 'how do I calculate ...' recipes and a decent amount of exercises for every topic with answers.


So, I'm working through this book instead of playing Sudoku every time need a short puzzle break --- of course it's still procrastination, but, it feels a lot more productive!