Excel function to calculate numerology number
Posted by Bricky in Programming on April 29, 2012
Function below to calculate the numerology number (reduced to 2 digits) for a name in Excel:
=SUM( 1* CHOOSE( CODE( MID( LOWER(A1); ROW( INDIRECT("1:" & LEN(LOWER(A1)))); 1))-96; 1; 2; 3; 4; 5; 6; 7; 8; 9; 1; 2; 3; 4; 5; 6; 7; 8; 9; 1; 2; 3; 4; 5; 6; 7; 8))
Press Ctrl+Shift+Return to have Excel treat it as an array function (it will enclose it in curly braces { and }). A1 is the cell reference containing the name.
Popularity: 1% [?]
Me versus the Argentine Ants
Since we moved into our new apartment (about 6 months ago) we’ve had incredible problems with insects:
- First it was mosquitoes. Literally hundreds of them would be wandering around our bedroom each night (we used to vacuum them!), until we found the (several) places they were coming in.
- Next it was cockroaches, large and small, to be found in the most unexpected of places. Roaches are standard fare in this city however, so a few visits from the exterminator to the building put an end to them (at least for the present).
- And lastly, we’ve had ants.
Tiny Argentine Ants, maybe 2 to 3 millimetres in length, turning up everywhere that there’s food exposed. We’d find them in the sink every morning if we didn’t do the washing-up the night before. In cakes (even when in a supposedly airtight container), in the rubbish bin, in the bathroom (very often in the bath for some reason? I guess they’re easier to see there), and finally, the other day, feasting on our medialunas on the living-room table.
We took to following them (they make these hilarious little trails) and blocking the hole they came through with a little silicone gel. This stopped them for a short while, but they quickly find another route.
Other common remedies (washing their trails with soapy water, spraying with vinegar, salt barriers, coffee grounds) also offered brief respite.
Happily now however, it appears that we have found a solution (although I say that very tentatively, it’s early days yet) – boric acid. This wondrous substance (used for cleaning apparently) works as a slow-acting poison which allows the ants to bring the foodstuff (with which it is mixed) back to the nest before killing them (and hence destroying the ants in the nest also).
We tried two different mixtures:
- 50% boric acid + 50% sugar, diluted in water (enough to dissolve the sugar). Soak kitchen paper towels in the solution and place on a small plate (the sugary solution will makes a mess otherwise).
- 25% boric acid + 75% honey, mixed until the boric acid dissolves.

Ants eating the Boric Acid & Honey solution.
Although both mixtures were effective (the ants ate both), the honey mixture (b) was much more popular (so popular in fact, that many of the ants drowned themselves in it).
To give an idea of scale in the picture on the left: the piece of plastic that contains the honey solution is part of a light switch – about the size of a 2 euro coin.
The ants found the mixtures after about 2 hours (which we placed in 4 different locations around the apartment). For the next 12 hours or so we had a continuous stream of guests (around 30 eating at time), then the numbers started to gradually decrease, down to around 5 after 24 hours. And now, after about 48 hours there is usually just one or two.
Of course we can’t be sure yet if this will be a permanent solution (there is still a question whether the ants made it back to the nest(s) alive), but it is certainly looking positive for the present.
Argentine ants are quite unique by the way: they share nests, never fight amongst themselves, and have several queens. Well worth reading about.
Edit (5 days later): Well the ants stopped coming to these particular buffet lunches, however we noticed that they are still very much present elsewhere in the apartment – so it seems that they became aware of the poison and have started avoiding it.
A little googling turned up this (authoritative-sounding) document which states that
For boric acid or borate baits, the concentration of active ingredient that will be most effective in killing the colony (rather than just stopping the ant trail) is between 0.5% and 2%. Higher concentrations may be used to quickly eliminate ants indoors.
So our 25% to 50% concentration was insane overkill!
It also states that,
The optimum sugar concentration in liquid bait is 25%.
So, again, our 50% to 75% sugar content was somewhat overzealous
Back to the drawing board then. We’ve mixed new traps, this time with 1% Boric Acid, 25% sugar, and the remainder water. We’ve placed these (4 of them) in (new) strategic locations around the apartment. Interest in them has been very poor so far: they’ve been down for about 12 hours now, and on the few occasions that we’ve checked we’ve had no more than 2 ants at any one trap (often none).
We’ll give it some time though and see how it goes
Update (6 weeks later): Well the ants did express an interest in the new traps. For a week or two the numbers held at about 5 to 10 ants per trap at any one time (and even the corpses building up around the traps didn’t seem to deter then), and gradually the numbers reduced to maybe one at a time.
We were considering removing the traps (now littered with ant corpses), when suddenly the numbers jumped significantly about a week ago, up to 10 or 15 at a time. These appeared to be new ants, often bigger than the previous ones (if only very slightly), who were re-exploring all the tracks that the other ants had used previously (even the dead-ends).
Now this new batch has begun to reduce in number also, and the ants arriving are getting smaller – so it would appear that the traps are having the desired effect on this nest also (or at least the ants have communicated to one another that the traps should be avoided).
The plan currently is to leave the traps in place for another few weeks – until they no longer receive visitors.
Popularity: 1% [?]
“Order By” for Zend Db findDependentRowset()
Posted by Bricky in Programming on November 9, 2011
This is another one of those note-to-self style posts.
Design decisions on Zend Db’s “Zend_Db_Table_Row_Abstract” class prevent the inclusion of an ‘order by’ clause directly in the (incredibly useful) “findDependentRowset” function.
But you can pass in the order by clause indirectly through a select statement as follows.
What you want would be something like:
$depRows = $row->findDependentRowset('DEP_TABLE_NAME', /*order by=*/'SORT_ORDER ASC');
and you get this by doing the following:
$depTable = new DEP_TABLE_NAME();
$depRows = $row->findDependentRowset($depTable, null, $depTable->select()->order('SORT_ORDER ASC'));
Popularity: 2% [?]
AppleScript desktop dialer for Asterisk
Posted by Bricky in Mac, Programming, VOIP on February 12, 2011

Asterisk Desktop Dialer
You’ll need a mac (obviously), a desktop phone (even more obviously), and an asterisk server (most obviously), preferably on your lan, which you can configure to allow network access to the AMI (Asterisk Manager Interface).
Read the rest of this entry »
Popularity: 3% [?]
Install python lxml 64 bit on OSX 10.5
Posted by Bricky in Mac, Programming on February 11, 2011
This is one of those note-to-self style posts again.
I’m not really clear on why this has to be so damned complicated: every time I mess with lxml on OSX it costs me half a day!
The second-last time I had to do this, I actually stripped everything but the 32 bit executable out of apache to force it into 32 bit mode, so that I wouldn’t have to compile a 64bit lxml! (and yes, that’s just stupid, don’t do it).
Anyway, this is how I managed to get it to compile this time:
mkdir /tmp/lxml-build
cd /tmp/lxml-build
curl -O http://codespeak.net/lxml/lxml-2.3.tgz
tar -zxf lxml-2.3.tgz
cd lxml-2.3
mkdir libs
cd libs
curl -O ftp://xmlsoft.org/libxml2/libxml2-2.7.3.tar.gz
curl -O ftp://xmlsoft.org/libxml2/libxslt-1.1.24.tar.gz
cd ..
Here we need to modify the build code for lxml. (Yes, I know this shouldn’t be the case, but the arch is hardcoded in there for 10.5 as i386, and we simply have to change it).
Open the file buildlibxml.py, and, at around line 284, find the following lines:
if minor_version < 6:
env.update({
'CFLAGS' : "-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -O2",
'LDFLAGS' : "-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk",
'MACOSX_DEPLOYMENT_TARGET' : "10.3"
})
else:
… changing them to the following …
if minor_version < 5:
env.update({
'CFLAGS' : "-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -O2",
'LDFLAGS' : "-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk",
'MACOSX_DEPLOYMENT_TARGET' : "10.3"
})
elif minor_version < 6:
env.update({
'CFLAGS' : "-arch x86_64 -arch i386 -O2",
'LDFLAGS' : "-arch x86_64 -arch i386",
'MACOSX_DEPLOYMENT_TARGET' : "10.5"
})
else:
i.e. we change the first case to 10.4 and earlier, and add a case for 10.5 (the minor_version < 6 stuff).
We can now continue with the compilation as follows:
ARCHFLAGS='-arch x86_64' python setup.py build --static-deps --libxml2-version=2.7.3 --libxslt-version=1.1.24
ARCHFLAGS='-arch x86_64' sudo python setup.py install
And that should be it.
If something goes wrong, do a make clean before changing the build options. And note that you’ll probably need to restart apache (sudo apachectl restart) to pick up on changes.
References: here, here, and here.
Popularity: 3% [?]
HTML vertical text (Safari, Firefox, Chrome, and Opera)
Posted by Bricky in Programming on September 15, 2010
I recently had a requirement to display a large amount of tabular data in a small space – and to get it looking right, some of the text simply had to be vertical. My first solution was to use javascript on page load to replace the text with svg code, which essentially drew an svg image of the vertical text in place. While this looked fine, it resulted in quite a bit of client-side code running at page load, which resulted in a noticeable delay when the page got large.
My second solution was considerably neater however: css transforms.
Examples above. The first block is an image (screenshot of this in Safari), the second block is the real thing. If your browser supports this, the two should look broadly similar. The CSS for this is as follows:
.vText {
-moz-transform: rotate(-90deg) translate(0, 100%);
-moz-transform-origin: 0% 100%;
-o-transform: rotate(-90deg) translate(0, 100%);
-o-transform-origin: 0% 100%;
-webkit-transform: rotate(-90deg) translate(0, 100%);
-webkit-transform-origin: 0% 100%;
transform: rotate(-90deg) translate(0, 100%);
transform-origin: 0% 100%;
}
The first two lines (the -moz lines) are for current versions of firefox, the next two (the -o lines) are for recent versions of opera, the next two (the -webkit lines) are for Safari & Chrome, and the last two are for the future (assuming this gets beyond a working draft).
And no, this CSS doesn’t work with IE at present.
So how does it work?
transform-originsets the, wait for it, origin, at the bottom-left corner. This will be the centre of the rotation when we rotate.translate(0, 100%)moves the block vertically down by its own height (i.e. y = 100%), so that its top border is where its bottom border was.rotate(-90deg)rotates the text 90° counter-clockwise.
The big caveat here is that the transforms do not change the original element dimensions (e.g. if it’s 100px wide before the transform, it will still take up 100px width after the transform), so you will generally need to put your vText element in a containing block which has the required width and height (i.e. after the transform) set.
Popularity: 34% [?]
iPhone gets Delivery Reports – finally!
Thanks to the incredible efforts of francois.guilleme, the iPhone finally has delivery reports!
By intercepting calls to/from CommCenter, his library modifies outgoing SMS headers (adding the delivery report flag), and captures incoming SMS reports (displaying them either as a flash message, a regular sms message, or a simple ‘tick’ mark).
All the details (including source) are up on the google code site. Installation is simple, just add http://iphonedelivery.advinux.com/cydia or http://iphonedelivery.advinux.fr/cydia as a cydia source, install the iPhoneDelivery package, and robert is your relative.
Popularity: 100% [?]
OS X: Fix Argentina DST October 2009
Well, at almost the last minute, DST was cancelled in Argentina this year. And this broke things, mostly computers. (Not for the first time either, the same thing happened two years ago here).
The debian folk came out with a fix at the last minute: so that fixed the linux machines, but OS X is a slower beast to move, so it’ll be a while before any change works its way through. In the meantime, Mac users in Argentina are left with broken clocks.
Argentina_DST_Update_2.pkg – for 10.6.x only!
(Updated 2010-03-15)
I am no Mac expert, and this isn’t entirely tested, so be warned.
Anywho, this is how to update the tz data (aka zoneinfo), which should, in theory, fix the problem:
mkdir tzfix
cd tzfix/
curl ftp://elsie.nci.nih.gov/pub/tzdata2009n.tar.gz | tar -zxvf -
vi +219 southamerica
Change the two lines:
Rule Arg 2008 max - Mar Sun>=15 0:00 0 -
Rule Arg 2008 max - Oct Sun>=15 0:00 1:00 S
to the following
Rule Arg 2008 2009 - Mar Sun>=15 0:00 0 -
Rule Arg 2008 only - Oct Sun>=15 0:00 1:00 S
(i.e. just two words to change). If it makes you feel better, here’s a diff.
Ok, save & close, and then compile it as follows:
sudo zic southamerica
sudo cp /usr/share/zoneinfo/America/Argentina/Buenos_Aires /usr/share/zoneinfo/America/Buenos_Aires
The sudo is necessary because you’re changing /usr/share/zoneinfo.
And that’s mostly it. Verify that it worked as follows:
zdump America/Argentina/Buenos_Aires
America/Argentina/Buenos_Aires Sun Oct 18 20:43:42 2009 ART
(note that the timezone is now ART, not ARST as previously).
So that fixes things for most of the command-line stuff. But you’ll notice that the clock on your desktop, iCal, and others, are still incorrect. We need to fix the ICU database also. Thankfully the latest sources are available for this from apple itself:
curl -O http://www.opensource.apple.com/tarballs/ICU/ICU-400.37.tar.gz
tar -zxf ICU-400.37.tar.gz
cd ICU-400.37/icuSources
ICU doesn’t come with the tzdata, but the readme in tzcode helpfully notes that if we place the tzdata*.tar.gz file in tools/tzcode/ it will be compiled automatically. You can pack up your own tzdata2009n.tar.gz that we used earlier if you wish, or use the one I prepared here:
cd tools/tzcode/
curl -o tzdata2009o.tar.gz http://brickybox.com/wp-content/uploads/2009/10/tzdata2009otar.gz
cd ../../
./runConfigureICU MacOSX --with-data-packaging=archive
gnumake
sudo install -o root -g wheel -m 0644 -Sp data/out/icudt40l.dat /usr/share/icu/icudt40l.dat
And that’s it. We have a new ICU database. Reboot to see the changes.
Update (21st October):
This technique works on the iPhone too. The iPhone already has zic (well, at least my one has), so you can simply copy your modified southamerica file onto the phone somewhere, and run (as root):
zic southamerica
cp /usr/share/zoneinfo/America/Argentina/Buenos_Aires /usr/share/zoneinfo/America/Buenos_Aires
And you can simply copy the data/out/icudt40l.dat you created for OS X into /usr/share/icu/icudt40l.dat on the iPhone. It causes Springboard to crash, but after a reboot everything works perfectly.
Update (10th November): I can’t believe it, today 10.6.2 update broke the damn icu stuff again.
mkdir 10_6_2_fix
cd 10_6_2_fix/
curl -O http://www.opensource.apple.com/tarballs/ICU/ICU-400.37.tar.gz
tar -zxf ICU-400.37.tar.gz
cd ICU-400.37/icuSources/tools/tzcode/
curl -O ftp://elsie.nci.nih.gov/pub/tzdata2009r.tar.gz
cd ../../
gnumake
sudo install -o root -g wheel -m 0644 -Sp data/out/icudt40l.dat /usr/share/icu/icudt40l.dat
Thanks to Jonathan Tapicer for pointing out that the tzdata file name has been updated (now at version R).
Update (5th February): I’ve had several requests to package this up in an installer, so here goes:
Argentina_DST_Update.pkg – for 10.6.x only!
(I don’t have a 10.5.8 any longer, so I can’t compile for it, sorry)
Update (15th March 2010): Yes, the ICU fix is broken again today. The problem seems to be more to do with automatic timezone detection (which OS X is now seeing as GMT -4) than anything to do with zoneinfo. For now, to fix it:
- Download and install the new Argentina_DST_Update_2.pkg – for 10.6.x only!
- Open a terminal and type:
systemsetup -setusingnetworktime off
systemsetup -settimezone America/Argentina/Buenos_Aires
This is fairly straightforward: it disables automatic timezone detection, and sets the timezone manually (you can use the -listtimezones switch to see a list of available timezones). If anyone knows how to update DateAndTime.prefPane (which appears to use GeoKit) please let me know.
Update (4th April 2010): I’m pleased to announce that 10.6.3 includes updated tzdata for Argentina (and elsewhere) that fixes all this silliness. Get it now (via software update) to make this problem go away.
Popularity: 16% [?]
Mika – Grace Kelly
“You only want what everybody else says you should want” – my sentiments exactly.
There aren’t many people in the world who could pull off an act like this.
Popularity: 2% [?]
Ireland: A Country of Sheep
Posted by Bricky in Uncategorized on October 3, 2009

Voters in the Lisbon Treaty Referendum 2009
Popularity: 2% [?]