Sunday, 29 December 2013

Tom Sawyer & Huckleberry Finn

Two of my favorite books, read by my favorite Librivox reader:

 

If you only have time for a short read, then you should read chapter II.  It's also a very good recipe for setting up Open Source projects... ;-D

Wednesday, 25 December 2013

A Christmas Riddle

A man and his wife lived happily in a small cottage in the midst of an enormous rose garden, eeking out a humble living, distilling rose oil perfume to fill the delicate glass flagons which they crafted in their glass blowing workshop. 

Those, they traded in the market during the winter, and, in the summer, they sold the most beautiful cut roses.

One Christmas morning, an apprentice wizard visited their stall and purchased a small flagon of pure rose oil in the shape of an exquisitely blown red Welsh dragon.

The wizard carefully carried the fragile vessel home, lit his fire, petted his frog familiar and then perused an ancient spell book to study an incantation that would enable him to travel into the past.

The King of the realm had died a short while ago and war was looming --- all because the wizard's kitten had startled the huge battle horse of the King into rearing up in fright.  The hapless cat was instantly trampled to death by the hooves, and alas, the King perished in the fall.

The wizard's plan was to travel back in time and lock his unlucky kitten up that day, and to make the disaster unhappen that way.

But alas, the one and only immutable rule of the universe is that the present is the present from the future to the past, and once it has been gifted, it can never be returned, by anyone, for whatever reason, not even with magic.

The spell thus went awry and reality asserted itself and redirected the magical energy onto the creator of the ingredient used to cast the incantation -- the rose oil.

In the time-space chaos that ensued in the wizard's attempt to create a void in history, the destiny of the wife of the rose garden became entangled with the dead king's current reality.

The wife was cast into Limbo and trapped between future and past:  each morning she turned into a ray of sunshine, which shone into the realm of the dead, to be transformed into a rose that the king held in his cold, dead hands; whilst he was praying for the burning viking boat to appear which would carry him across the river of time, once the rose had completed it's bloom and dropped it's last petal.

Every day (and many pitch-dark nights), she was thus in solemn attendance to the dead King, until every moonlit night at midnight, when she would return to the the cottage in the rose garden as a moonbeam, to coalesce into human shape for a few hours, to be with her beloved husband.

Many long years passed in this strange way, and she herself had lost the gift of speech ever since that fateful Christmas day. 

But one summer morning, just before her transformation, which always would occur as soon as the first rays of the sun lit the sky, she spoke to her husband:

"My lord the King, has left the purgatory of Silence last night and sailed away aflame for a new beginning.  My own path will be swifter than his for I have already completed my wait by the river side. 

Thus, when the sun rises, it's rays will carry me away to be transformed into one of the roses in our garden.

When this rose wilts, I will follow whence our tragic King has gone, unless you can find me and cut the stem, as the very first rose you pick from that moment onwards.  Be wise how you chose, my love, or this goodbye will be forever. "

Scarcely had she finished her words, when the sun rose and her shape faded into the first rays of the morning,  before her husband could embrace her to kiss her goodbye.

Without a moment of hesitation, her husband ran out into the rose garden, and, amongst the thousands of perfect, beautiful roses of every color and blooming stage, he picked the one and only true rose that was his wife, who with a flash became her former self in flesh and blood, and they lived happily ever after.

How did the husband know which rose to choose?

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

(The solution to this riddle will be posted on New Year's morning.  It is not a trick question.)

Sunday, 22 December 2013

Ye cannae change the laws o' physics!

Just a heads up to everyone, the EU decided that from September 2014 onwards, maximum wattage on vacuums shall be 1600W, and some times after that, 900W.

This is being sold as 'new technology' that retains the same 'airwatts' and saves energy.

The recipe for this free lunch?  Why, we made the intake smaller, and the 'airwatts rating'  stays the same.  Profit!

Result?  You have a dustier house or vacuum longer.  Not fun for people with allergies or bad backs.  So you might want to consider buying  a Miele 2200 watt vacuum (I did)

How do I know this?  Well, I designed myself a ventilation system for my glassblowing hobby so that I don't breathe the fumes and the dust is carried away.

I have the same torch (Arnold Herbert 50mm) as this guy:


The ship I dream of building but never will (I'm not strong enough, they weigh a ton):


I'm nowhere near as good as these guys, I just make humble glass fairy wands to decorate my houseplant collection, tiny sculptures and some pretty glass beads to wear.  I bought the Herbie because it's a one knob operation that gives me a pinpoint flame and a serious flamethrower in one easy turn.  I like clear borosilicate for it's ice-like appearance and soft glass for it's lovely colors.

Also, the herbie has a pilot flame, so I can use a foot pedal to save on air, oxygen and propane, since a lot of the time in glass blowing is spent letting the glass 'coast' and that doesn't need a flame, just patience to let the glass find it's own shape.  It's  a little bit like programming in that sense, you code some stuff and then it magically takes shape as you think about what you just created :-)

It's all about the process.

Word of warning: glassblowing is as, if not more addictive than coding!

Thursday, 19 December 2013

Welcome... to the machine...

Today I had the pleasure of having an MRI scan in a GE450 scanner.  What does the MRI say?

BZZZT.  ClonK.  RRRRR. rrrrr.  Wummmmmmmar.  RwwwwwR.  OiOiOiOiOing.  DsZsZst! PssshT.  BrrRRrzt!


A bit like this, just much, much better:


Some tips for maximum fun in one of those:

1. Get the doc to prescribe you about 6mg of Valium to ensure you have a good time.  Even if you're not the claustrophobic type, your mind will say: Wooo! And your body will scream: Earthquake!  Run!  Instinct > logic.  And lying completly still for 25 minutes is also much easier with 'Mother's little helpers.'

2. Ask them to turn off the muzak in the ear defenders they'll give you.  The sound that thing makes is an experience not to be missed, no sound system comes close in quality.  

3. Wear just cotton clothes without any metal anywhere, leggings, tshirt with long arms.  Long arms because they pipe in some oxygen and it'll be a bit chilly otherwise.  Cotton clothes because that way you can avoid that naff open back gown they hand you, no idea who thought it was an acceptable garment, but it's just icky to wear.  Ladies, remove all the metal from your bra and sew it closed.

4. Ensure you have a comfy neck roll, a pillow can easily get annoying because it tilts your neck.

5. Ask how long it takes, so you know, that helps if you get a little cramped in there.

The technology is just something to be admired, it's one of the finest machines humanity has ever built!

Tuesday, 17 December 2013

Mmh, Lemonade!




Note that this recording is a 'direct cut' -- one band, one take, directly cut onto the LP die.  No tape, no cutting, no remedial sound engineering, just proper handmade stuff --- what you hear is exactly what there was!

Saturday, 14 December 2013

The UNIX command line explained simply for UNIX experts

Seasoned UNIX users and developers of software often forget how mindbogglingly complex their creations are, because they use and work them every day, and --- it's just ever so obvious, right?

Why do newbies and even experienced users have such difficulty in grasping the timeless elegance and simplicity of a well-formed UNIX command line?

Well.  Allow me to put you, the expert, into the newbie's position for a moment :)

In the UK and Australia, there exists a particular fiendish form of crossword puzzle:  the cryptic crossword.

Here is a classic example of the type of mystifying clue such a puzzle offers:
15D Very sad unfinished story about rising smoke (8)
is a clue for TRAGICAL. This breaks down as follows:
  • 15D indicates the location and direction (down) of the solution in the grid
  • "Very sad" is the definition
  • "unfinished story" gives "tal" ("tale" with one letter missing; i.e., unfinished)
  • "rising smoke" gives "ragic" (a "cigar" is a smoke and this is a down clue so "rising" indicates that "cigar" should be written up the page; i.e., backwards)
  • "about" means that the letters of "tal" should be put either side of "ragic", giving "tragical"
  • "(8)" says that the answer is a single word of eight letters.
If the above maketh your mind go carroussel and gives your brain slight vertigo, you now know how most newbies and other mere mortals feel about the UNIX command line and the many cool options your software can be used with :-)

Example taken from The Guardian crossword of Aug 6 2002, set by "Shed", found in the Wikipedia explanation of Cryptic Crosswords.

Ps.: Brit and Aussie geeksters  who are crossword fiends will of course not be fazed at this attempt to demonstrate the users' head space, and I'll wager that at least one of them will now probably feel inspired to set a cryptic crossword with UNIX clues :-)

Thursday, 12 December 2013

SVN Book diff idea

It would be nice to have SVN book versions on the website that have a differing portions of the text in blue for changes, and green for new additions and red for now obsolete parts.

It would make re-reading the book for a new version much easier for old hands, you could immediately spot everything you need to reconsider.

So, if I upgrade from 1.6 to 1.7, I would like to have the normal 1.7 book, the 1.7/1.6 'blue/green' version and the 1.6/1.7 'red' version.

(blue & green might not be possible to automate, but even just the blue version would be very useful, or perhaps it's even possible to have this all in one version.)

Sunday, 1 December 2013

Programming a bunny to test the sheep's programming


I like the way he goes to nip the sheep's legs the moment they get uppity --- that bunny learned well from the dog's example!

On another, unrelated note, this time about naff UIs:

Google now helpfully tries to force users to 'add' an unrelated account to their list of your accounts, which is something you find out if you have a guest who wants to use your computer to check their email.

The only way to prevent Google from linking both your accounts for eternity is to remove your all cookies and then your guest can log in unmolested.

Of course you then need to delete all your cookies once more afterwards if you want to log in with your account again,  what a waste of user's time!

Maybe Google should leave herding to the rabbits...

Friday, 22 November 2013

Ruby Koans Meditation

Even if you never ever plan to code in Ruby, do check out the Neo Ruby Koans meditation.

It is the cutest, most fun programming course I've ever took.

But be sure to study the Tao of Programming first.


Thus spake the novice programmer:
``It is time for me to begin.''


Thursday, 21 November 2013

Why I don't use a smart phone

Of course I own a smartphone.  Just that it's not a phone (I have an (ancient)(lightweight) Nokia for this task) but my Apple only does 3 things that are useful to me:

1) work as a timer and reminder
2) enable me to take cooking recipes I find on the web into my kitchen
3) play the odd mp3 over the small speaker as a bedtime story

Other than that, the screen is too small to comfortably read or do anything on, and whilst I could get a bigger model, the small one I have is already too heavy to lug about as is, and, a larger screen would still be too small.

Don't you get bored just sitting around, say, waiting for Godot or on other occasions?

Nope, because my brain is a far more useful and interesting device than a smartphone, and if I really am in idle input mode, I have a tiny little Samsung U5 so I can listen to audio books.  This little toy weighs 28 grams and I can tuck it anywhere into my clothes.

Also, I quite like just sitting somewhere and looking at the world pass by, giving my mind the free run of my brain to grep for interesting things in my thoughts I've been unaware of so far.

If you do not have idle time for your brain to run riot in, it kills your creativity -- 'boredom' is the best inspiration because your mind hates a void and will find a way of entertaining you with ideas, the moment you give your mind time and space to talk to you.


It's a different kind of apple... :)

Saturday, 16 November 2013

--invoke-diff3-cmd branch ready for review




Finally the feature --invoke-diff3-cmd for Subversion is ready -- 23 files in 8 directories, 86 code snippets for a total 782 lines of code, 53 log message components plus a BRANCH-README file.

Friday, 15 November 2013

Fayzah Ahmed & Band

I'm not sure what I admire most about this video:



The VOICE.  So beautiful, so skilled, so much feeling.

The dress.  When singers still had taste.  And decorum.

The band.  Is there an instrument missing?  And they READ! 

The musicians.  The concentration and volta is wonderful.  Plus, they dress like gentlemen.  With class.

The crowd.  They are WILD!

The stage decoration.  Wish I had that in my living room!

Ok, I admit this is is probably a little uncomfortable to listen to if you're used to a western scale, but once you've wrapped your eardrums around the scale... it's simply gorgeous, and given that not even Zappa and Bird surprise me anymore with their music, I'm much appreciative of the fact that I cannot anticipate this music, and every note is still a surprise, no matter how often I listen to it. 

Sunday, 10 November 2013

Making sure I stay lucky



After nearly losing all my work yesterday, I've made this little script to run in the Emacs compile buffer before the make command.  This runs svn diff every time I compile and puts the result into a separate directory.

#!/bin/sh
CURRENT_DIR=`pwd` 
DATE_MARKER=$(date +%Y%m%d%T) 
SECURITY_PATCH_DIR=/home/g/security_patches/ 
WHAT=`echo "${CURRENT_DIR##*/}"`
EXT=.patch
SECURITY_DIFF=${SECURITY_PATCH_DIR}${WHAT}${DATE_MARKER}${EXT}
SVN=/home/g/InstalledSVN1.9/subversion
$SVN diff > $SECURITY_DIFF 

Saturday, 9 November 2013

Why checkpoint commits are a good idea...

[12:11] <gbb> idea:  [c/sh]ould merge automagically take a security diff before merging, just to protect the clumsy from their foolish mistakes?  (I merged my working copy instead of my test dir in gdb, oww, repairable but ugh...)
[12:12] <stsp> gbb, you mean something like merge --dry-run?
[12:13] <stsp> with such things, it's tricky: if we do a check by default, one set of people will complain about the additional overhead, while the other group will complain about the need to specify an option to get the safe behaviour
[12:13] <gbb> hrm dry-run would have helped but not protected me from merging over all my work.  ;(  (luckily my emacs is my handbag and most of those files were still open)
[12:14] <stsp> i think it's the type of mistake that you just need to learn to avoid over time
[12:15] <stsp> if we had checkpoints implemented, you could checkpoint your working copy before a merge, to keep a record of the pre-merge state
[12:15] <stsp> i think that would be a nice solution
[12:16] <stsp> merge could automatically create such a checkpoint, in fact!
[12:16] <gbb> not sure what check points are.  but currently you can only revert to pristine, not to pre-merge
[12:16] <stsp> see http://subversion.tigris.org/issues/show_bug.cgi?id=3626
[12:17] <stsp> or shelving, even
[12:19] <gbb> that would be the ticket :)
[13:20] <ASFBot> gbg * r1540299 (subversion/branches/invoke-diff-merge-feature/ (14 files in 6 directories)) http://svn.apache.org/r1540299 : On the invoke-diff-cmd-feature branch: Checkpoint commit (ignore, trivial).
[13:32] <gbb> as Mr. Twain remarked: "A man who carries a cat by the tail learns something he can learn in no other way."
[13:32] <stsp> :)

Wednesday, 6 November 2013

My day/week/month is made!

Julian Foad said:

"Your BRANCH-README file <http://svn.apache.org/repos/asf/subversion/branches/invoke-diff-cmd-feature/BRANCH-README> is a fantastic window into the branch, much more detailed and helpful than the rest of us ever write. I can easily see exactly what the whole feature does, how it's structured, and what your plans are, without having been paying close attention. I'm mentioning this mainly so anybody else contemplating taking a look at this knows this is a good place to start reading. And I'm pleased to see you have taken care to adhere to our coding style. "

It's the most wonderful compliment I've heard in years :)

{And, to be honest, writing this BRANCH-README helped me a lot in getting things done and keep me focused on what I was (and am) trying to do.  It was danielsh who suggested that I should write one (ironically I initially omitted it, despite fixing a part of the hacking guide entry for this most excellent advice.)}

Don't delay, write _your_ BRANCH-README today!

Thursday, 31 October 2013

This task only takes 2 minutes!

...but if that 2 minute job occurs 1000 times, it's 33 man hours.

That's only 100 users doing the same thing 10 times each.

If you have 1000 users who need to do this once every day at work, that's 200 times per person per year,  or 6 1/2 hours per year per person, and per 1000 users this is 6666 hours or 277 full 24 hour days or 833 8-hour work days, days, or 4 employee years (@200 days per year) + 33 days.

So the 2 minute task is quite the time (and money) sink!

Monday, 28 October 2013

Char Sui chasing Bratwurst & Eggs chasing Chicken Kiev chasing Omlette

Day 1:

Make lots of cuts into the top of a pork belly.  If you like, stab it with a needle too(or a bunch of needles you tied together), as many times as you can be bothered.  Put on a trivet on a plate uncovered into the fridge to dry out, overnight.

Day 2:

In the morning, rub the belly top with ground sea salt working the grains into the cuts.  Make a mix of 1TB  fishsauce, 1 tsp Fivespice powder, 2 TBL vodka, 2 TBL rosewater, pour into a tray with sides that the belly can sit in.

Bathe the non-salted parts of the belly in this,  leave to sit for 3-4 hours.  Dab the moisture off the top, bathe the sides of the belly again, and rub some more salt into the top.  Leave to sit another 3-6 hours. Wipe the top again.

Now take a pyrex tray (I like the big quiche forms) put the trivet back, place belly in skin side down, cover with foil and bake @150 C in a convection microwave (oven only!) for 30 minutes.  Remove the foil, bake another 30 minutes, douse in whatever marinade was left.    Turn over on the trivet.  Bake (no nuke!) another 10-15 minutes @ 170C, until the skin blisters.

Grab a big black iron wo or fry pan.  Put a big hunk of beef tallow in so it's about 2cm deep in the very middle, heat smoking hot.  Sling the belly in, skin down and cover this show with a fat guard (also, wear an apron and stand back, this can and will spit) and watch the skin crackle and pop like popcorn.  When it looks nice, remove, turn over and put on the cutting board.  Eat in slices.  Works great cold too! (and stays crunchy, so it's lunch box material!)

Day 3: 

Heat the wo again, cook 2-3 belly slices for breakfast, along with 2-3 eggs.

Heat the wo yet again, and fry a bratwurst along with 2-3 eggs for lunch.

In afternoon, go to work on a big fat chicken, Pepin style:




Note: Pepin doesn't remove the Parson's nose(ie, the tail) here -- and that usually has the glands the birds use to oil their feathers with, and that doesn't taste that nice.  So I always cut it off and chuck it. (If you have a deserving doggie, then a few minutes in the nuke will make a good treat from this)

The chicken roll Pepin demonstrates is very nice(as is all of his food!), but for my purposes, I split the bird up, and peel the skin off the chicken breast halves.

Grab another pyrex quiche dish again.  Put the chicken breast halves like yin and yang, sprinkle with Italian seasoning, use the parmesan grater to grate a clove of garlic on each, and park as much grated cheddar/mozarella as you can pack on it, top with a slice of Emmental.  Cover with a thick slice of middle bacon (the stuff that is one piece of back AND streaky), mill pepper and cover again with more grated cheddar/mozz mix.

Stick that in your convention microwave and combination cook on 140C for 30 minutes.

Heat your wo (which will have plenty of flavored fat still) again to smoking.  Park the baked chicken (cheese side up) in there and fry for about 5-8 minutes until it's cooked through (the bottom will not be cooked when it comes out of the microwave!)

Serve and eat.

Day 4: 

This fat has a bit of cheese in it, so browning meat is not such a good idea, but heating the wo gently to medium and frying some mushrooms and pouring beaten eggs for an omlette is going to make a nice tasting breakfast.

Now go code some stuff! :)

Sunday, 27 October 2013

New invoke-diff-cmd feature: --svn-cfg-file

Wrote this feature yesterday, all in one go.

Had the idea whilst pondering what to do with the --invoke-diff3-cmd interactive user dialogue.

Maybe the new agate necklace magic really works?  Heh.

Saturday, 26 October 2013

My new Agate Necklace

"Agate provides a calming influence, improves perception, concentration and helps to develop and increase one's analytical talents." 

Clearly a must-have for any lady who codes. So, of course I bought it!

(Not that I actually believe this, but hey, I had to justify the purchase somehow, and this is as good a reason as any.  See? The agate is already working!)


Made by Tantric Tokyo.

Thursday, 24 October 2013

How to use svn diff to create a list of visitable files with line numbers in the Emacs compile buffer


Here is how to use the svn diff output within the emacs compile buffer to generate a handy list of files with line numbers that you can click on to visit every bit of code you've changed:

M-x compile

svn diff |\
perl -ne '/Index: (.*)$/ && ($name = $1);\
/^@@.*\+(\d+),/ && print "./$name:$1:diff\n";'  


Tuesday, 22 October 2013

The svn diff Project: First part done, review passed!

The --invoke-diff-cmd part of the svn diff project has been completed (bar one possible improvement).

The BRANCH-README file explains it all.

Of course, there has to be a fitting video for this post:



Now for the second part --- the invoke-diff3-cmd section!

Monday, 21 October 2013

Merging the trunk to branch, the lazy way

#!/bin/sh                                                                                                                                 
${SVN_INSTALLATION?"Please set the environment variable SVN_INSTALLATION."}
SVN=$SVN_INSTALLATION
BRANCH_DIR=`pwd`
tmp=`$SVN info 2>&1 | grep SVN_ERR_WC_NOT_WORKING_COPY`
if [ -n "$tmp" ]; then
    echo "Error: The branch directory does not contain a SVN repository." >&2;
    exit;
fi
TRUNK_DIR=$1
REL_DIR=$2
if [ -z "$TRUNK_DIR" ]; then
    echo "Usage: mergeBranch <trunk directory>" >&2;
    exit;
fi
if [ ! -d "$TRUNK_DIR" ]; then
    echo "Error: Trunk directory not found." >&2;
    exit;
fi
cd $TRUNK_DIR
tmp='$SVN info 2>&1 | grep SVN_ERR_WC_NOT_WORKING_COPY'
if [ -z "$tmp" ]; then
    echo "Error: The trunk directory does not contain a SVN repository." 1>&2;
    cd $BRANCH_DIR
    exit;
fi
cd $TRUNK_DIR;
$SVN up
tmp=`$SVN info | grep "Last Changed Rev:"`
TRUNK=${tmp##*: }
cd $BRANCH_DIR
tmp=`$SVN info | grep "Last Changed Rev:"`
BRANCH=${tmp##*: }
$SVN up
WHAT=${BRANCH_DIR##*/}
echo "On the $WHAT branch: trunk revision $TRUNK merged into branch revision $BRANCH." > log.mesg
$SVN merge $REL_DIR

Friday, 18 October 2013

What I miss about not being a MUD wizard anymore...

... the screams of agony that freshly killed players type. 


On the MUD, you hunt players with your code. 

With C, the code hunts ->YOU<-

Friday, 11 October 2013

GDB and the shell game

Sometimes, a good thing can be too good, and so it is with GDB's pretty printing of strings.

I spent quite some time trying to figure out why GDB showed me "\"AA" and not (as expected) "AA" or, even just "\"AA"\". 

To cut a long story short, svn_cstring_split() doesn't do strings with spaces inside strings many favours, and so, "AA BB CC" ends up as 3 elements, '"AA', 'BB' and 'CC"' respectively, which then ends up as "\"AA", "BB" and "CC"\" in the GDB display.

I didn't think that GDB would pretty print anything let alone decorate strings with escaping slashes... and so wondered for quite a while where the extra "\ went! :-D

I should have employed this kitty to help me here:


Monday, 7 October 2013

Programming My Old Tom Cat

My cat of act has committed an act of cat and shredded neighbor's toddler.  (Not terribly so, but it's never good!)

He did something like that before I adopted him, which is why he was exiled, and having his tail broken 9 year ago by a toddler apparently was still fresh in his memory and he suffered intense nightmares for a week afterwards.

My neighbor has been supplied with a decent supersoaker so he can easily dispel my cat's territorial ambitions, and because ASBO kitteh is now grounded during the day, I also bought a food maze to keep him entertained.

At least this was the theory and I was convinced this is a great idea after watching this video:




It's not popular.  He worked it for a bit and then decided that he'll go on a nil-by-paw diet instead.  It's not that he can't see the crunchies, it's that he refuses to see them -- he wants his bowl back AND his cat door open, and has formed a union of one, picketing the kitchen, lobbying for that extra portion of wet food he feels entitled to in lieu of the unreachable crunchies.

I on the other hand have realised that the food maze saves food because the crunchies are not sitting in his drool in a bowl.  And whilst he is on cat strike, he at least is not serenading the cat door in protest because his feline right of free movement has been curtailed.

Also, he is a grumpy old man, and really does not like change, at all. 

So, what to do?  Treats.  He may not work for food (as that is surely beneath his catly dignity) and no-one would be so unkindly honest to call him thick... but treats... that's another matter.  Raw beef or ham is kitteh crack that causes instant IQ enhancement!

Stage 1: remove the ring on top, put a box for the cat to sit on, add crunchies to top layer.  Place cat in position, tease with catnip treat, place it on mound of cat food.  Leave your perplexed sphynx to meditate over the puzzle, tease with catnip bicci every ten minutes or until you hear feeding action.  Carry on a few days until this is his new bowl where he feeds and he understands that it contains food inside and that it falls through holes.

Stage 2:  Now that he has understood that his food lives in this annoying plastic tower, remove all the inner layers.  Add crunchies to bottom layer then tease all the way from the fridge to the maze with a delicious strip of ham until he is ready to riproarslaymassacre that morsel... and drop it in small pieces (taking your time) onto the crunchies on the bottom level.  Tease cat with a strip of ham through the paw holes, let him munch his winnings and repeat, then walk off, leaving his prize on the crunchies in the maze.  Steinitz took 2 weeks for this stage, and I started to suspect him of training me to feed him goodies... heh.  But no, I think he was just forgetting he could reach them.  Once he starts eating them up, you can go on to ...

Stage 3:  Replace middle layer.  Add crunchies and drop a few through the holes(the sound of success!) and some thinly slivered raw steak in small pieces.  Tease with a long strip of meat as in step 2.  If your cat has the goldfish nature, this can take quite a few sessions.  He just didn't make the connection that the crunchies land on the bottom layer before dropping through clean and got quite frustrated when he pawed at a goodie that didn't turn up immediately in the bowl.

Stage 4: Replace the top layer and the and top ring.  Fill feeder.

Your cat is now fully programmed to operate the food maze!

Update:  He now has started to use his paw to scoop his wet food in the same way that he fishes for crunchies.  Dare I teach him how to use knife and fork?  Maybe better to just stick to a spoon! :-D

Friday, 4 October 2013

The Story of Alchemy

You can draw many parallels between this book and the state of modern science; how individuals think and explain what they think they know to others(..or not!), and what the collective believes it knows.

Moreover, it's beautifully read by Peter Yearsley!


Wednesday, 2 October 2013

Rotring ArtPen Quality Disappointment

I am the (once proud, but not longer) owner of an array of Rotring Artpens.

After finally running out of my stash of ink cartridges I ordered a batch of new ones from Rotring.

Said cartridges now are shorter by 1mm, with the result that my ArtPens now rattle when I write if I carry a spare ink cartridge.

I could of course 'fix' the problem by stuffing some paper in there, but... eh.  I just feel like my entire kit has been vandalised, why not just charge me a few pennies more and sell quality items instead of junk?

From the Rotring home page:

"Technical pens, mechanical pencils, calligraphy pens: Premium performance tools which enable thinking and creativity with precision."

--- if you can put up with the rattle that is! 

*grump*



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!

Friday, 30 August 2013

Another failed patch

Whilst doing the long overdue merge of trunk into my invoke-diff-cmd branch, I spotted a deprecation warning that looked like a minor oversight, and so, I fixed it, svn compiled, the tests passed and ... the patch turned out to be a no-can-do, because APR_ARRAY_PUSH doesn't care what type you stuff in there.

I thought it did, because of this:

#define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push(ary))) 

which *looks* like it's type-safe at least if you don't know what you're really looking at (and if you haven't bothered to check the underlying code to see what it actually does).  It of course does no such thing -- so, what does this trick that does seemingly nothing actually do?

Ask on #svn-dev and ye shall receive:

[19:32] <breser> gbb: The reason it takes a type is to avoid warnings.  The apr_array_push() function returns a void *.  Technically there's no issue with putting any pointer in a void pointer, however some  compilers will warn you about that since you may not be doing it intentionally.                                                        
                                                                      
[19:33] <breser> gbb: The array code doesn't care what the pointer is  to, it's up to the user of APR Arrays to keep their types straight.   
                                                                      
[19:34] <breser> gbb: In this case the fact that the array code is  taking a type (and casting) is hiding the errors/warnings you would have otherwise seen.                                                                                                                     
[20:30] <Bert> breser, gbb: Apr arrays can be of different kinds than just pointers. In some cases we have arrays of specific struct kinds  (e.g. for property changes in the diff handling) 

Thank you Ben and Bert, it certainly did clear things up, and made me look up the 'long answer' --- the very short answer of course is that C isn't C++, and so doesn't have type-safe templates.  Caveat coder!

Monday, 26 August 2013

DIY Quoting Tutorial Kit

Here's a link to a great UNIX quoting tutorial, and some lovely harp music to study with:


You supply the tea, and when the music is over and the cup is empty, you'll know how to quote just about anything and everything.  You can quote me on that.

Saturday, 24 August 2013

Does Bamboo implement the Dining philosopher's problem?

I read a paper[1] on the enigma of Bamboo's gregarious flowering and I think I have an idea for the solution to the puzzle as to why this phenomenon occurs.

1. Bamboo is wind pollinated.

2. The flowering (whilst almost simultaneous) actually 'moves' through the population like a wave.

However, what if the plants 'voted' every season by releasing a few molecules of a chemical messenger and once a critical mass of this chemical has been accumulated, those plants then themselves start the same way if they are fit enough to bloom, or send out a different 'nay' chemical messenger that neutralises the 'yea' if they are not fit.

Once enough plants are producing the the 'yea' chemical (and the 'nays' are outweighed) so that a critical mass is achieved, it would trigger the hormone that makes the plant bloom so that the wind pollination has the greatest possible effect.  And even if some plants are not ready, the substance when prolific may still have the ability to force flowering, which would explain the uniformity. 

In fact, if I was to design such a population and write a simulation for such a model, this is probably the way I'd go about it, because I can think of no better viability test for a wind pollinated species that rarely flowers to ensure optimal success than such a chemical voting system.

Note it doesn't have to be very noticeable, the actual messenger substance may just be a few molecules -- in the same way that human noses can pick out a one molecules of mercaptan in a huge space for example.  If we didn't know what smells so bad, it would be difficult to find!

[1] http://www.pdn.ac.lk/cjsbs/text/text35.2.1.pdf

Tuesday, 7 May 2013

The SVN_DBG story

Whilst talking on IRC about the exotic design motivation for the --invoke-diff-cmd that I offered, it was realised that I was blissfully ignorant as to how (and why) printf() works, how to escape '%' characters, and what a variadic function is.

As is happens, SVN_DBG which is a test suite friendly SVN debugging tool needed documenting, and it happens to be a very good demonstration of how variadic functions work(esp, if you take time to read the GNU C Preprocessor manual) ,  and so, danielsh kindly tasked me with writing a small precis that introduces the SVN_DBG tool to new devs in the HACKING GUIDE.

As a nice bonus, it turns out that some time ago, I read over a small, but vital clue of how the ANSI C OO stuff works.  I tend to read 'over' some stuff I do not understand in order to keep the universe of confusion minimised, and filed 'va_list' as some funky OO type linked list.   So I was quite chuffed at finally figuring out how the 'and here, a miracle occurs' part works -- it uses a variadic function.

This of course calls for an appropriate video:

Tuesday, 30 April 2013

Diff Project part 1 --invoke-diff-cmd -- Take 2 (interlude)

Because I couldn't decide what to do about the delimiter-prefix issue, where %f1 could potentially cause issues for script users, I made the shape of the switches OS dependent (%f1...%fn for unix, ---f1... for windows) and also added a feature that allows people to change that prefix, so you could say svn diff --invoke-diff-cmd="# diff -u #f1 #f2" if you want, and use '$', '-' or even '---' etc.

Not such a good idea(it was fun to code though) because changing the user interface across platforms is disorienting. 

I also rewrote svn_io_create_custom_diff_cmd() to use svn_string_buf_t instead of the string.h functions I used previously.

However, for now, I'm feeling somewhat strfry(Gabriela) and so I'll take a little break from --invoke-diff-cmd to let the concepts I've learned settle, and instead have a go at writing a short introduction to the SVN_DBG tool for the HACKING guide -- watch this space :)

Monday, 29 April 2013

The RULES of C STRING club

1st RULE: You do not talk about C STRING club.

2nd RULE: You DO NOT talk to the cat about C STRING club.

3rd RULE: If Subversion says "stop" or goes limp, taps out the fight starts.

4th RULE: Only one woman to a fight.

5th RULE: Always more than one fight at a time.

6th RULE: No direct assignments of strings, no third pot of coffee.

7th RULE: Fights will go on as long as they have to.

8th RULE: If this is your first night at C STRINGS club, you HAVE to compile.

Wednesday, 24 April 2013

Life Pro Tip: svn up regularly!

I was fiddling with the --internal-diff command and when testing, svn coredumped on me.   So,  I removed my recent changes leaving the original patch I'm working on in place and... it still coredumped. 

OMG,  what did I break?  And how?  Because nothing I did should have caused this...

Just for luck, I decided to compile the original version, and the bug was there all the time.  Phew, I'm innocent(just this once...)

So, I post the fix to the dev list and --- Ben already found and patched the issue 2 weeks ago.

Note to self:

 before you do anything!

Monday, 22 April 2013

Fun with Null Terminated Character Arrays

The function svn_io_create_custom_diff_cmd(...) that I wrote returns a null-terminated character array (ntca) which
svn_io_run_external_diff(...) passes to

svn_io_run_cmd(...) which passes it to

svn_io_start_cmd3(...) where this loop:

for (num_args = 0; args[num_args]; num_args++)
       ;

relies on the NULL as a sentinel, before copying and utf converting it into the new ntca it then passes into apr_proc_create().

This arrangement presented me with quite some difficulty because it failed at random points and made it appear as if my function was correct, but that the diff programs themselves were randomly failing with colourful error messages.

Unfortunately, I was completely innocent of the idea that this NULL terminator would be an implicit conditional 3 functions ahead.

I mistakenly offset the NULL by one and ... I got a very good (and thorough) demonstration of how droll a broken pointer can be ;-D

Saturday, 20 April 2013

How to deal with recalcitant snakes

Subversion's test suite is written in Python.  Easy enough one would think, but, not so trivial at all and so I have resorted to taking combat lessons from the vorpal bunny:


... as always, it's just a matter of attacking the problem from the right direction.

Thursday, 18 April 2013

Yesterday was my last OPW day...

...and do take note that the door I opened in the previous post was a way-in and not a way-out :)

Without OPW I wouldn't have taken up coding again --- In fact I'm very surprised at myself that I am (nearly almost!) a geekess again.  But so it is indeed, I have be given partial commit access to Subversion, and some of the work I produced was good enough to be added to the project.

What's more, with almost every failure I learned a lot -- the Subversion devs are a fount of knowledge and very generous with useful advice and constructive, direct feedback.

I plan to continue to contribute to Subversion --- I only just started to make inroads into producing functional code, so now I can finally get to actually be productive.

I would like to thank the OPW team and Elego for providing me with both opportunity and motivation.

Tuesday, 16 April 2013

An instant playground for Subversion

Subversion is a huge program with many dependencies, and writing a small test program outside of the code body is not so easily possible.

True, you can copy a function and change it and hook into an existing command, but it litters the code and takes up valuable time that you could spend coding what you had in mind instead.

So I made a patch that plugs in a command line option and a function, and thus sets up an instant playground for you.

Seasoned devs might not find this toy very useful, but casual submitters, rookie coders and tourists who just want to poke around the code without too much effort might find this to be just the ticket that makes starting to play easy.  Also, if you want to explore one of the APIs that Subversion uses (APR for example), this patch is for you.

All I need now for perfect happiness is an 'unpatch' tool that removes this patch when it's no longer needed from the resulting patch, without touching any other work that people did!

Sunday, 14 April 2013

The next OPW round is on!

The Gnome Outreach Program for Women is launching  another round of FOSS internships, to start on the 1st of May.

Since OPW doesn't have the cool advertisement video they deserve to have, I think I let Sabah sing to lure the ladies to the show, she has practice and casts the summoning spell so beautifully:




Btw, Sabah is 80 (eighty!) in this video, and the song is a classic Lebanese love song, I hope you enjoy it!