Textapox is catching
Look out for this new disease sweeping the children of the world. Symptoms include coloured spots on exposed areas of skin and uncontrollable giggling.

21 September 2009 |
||
Textapox is catchingLook out for this new disease sweeping the children of the world. Symptoms include coloured spots on exposed areas of skin and uncontrollable giggling.
|
||
3 September 2009 |
||||||||||||||
More Spreadsheet TomfooleryI’m still messing around with my bookkeeping. Here is another nifty formula for OpenOffice Calc. I have a list of revenue and the dates that revenue was received like so:
I want to create a month-by-month summary of these figures. Here is the (rather complex) formula to make that happen: =SUMPRODUCT(A1:A5>=DATEVALUE("01 Jul 2009");A1:A5<DATEVALUE("01 Aug 2009");B1:B5)
That formula will give the total of all amounts for July. By repeating this for each month, you can get monthly summaries for the whole year. |
||||||||||||||
16 August 2009 |
||
Metamorphosis
I’m still doing some contract work here and there but am spending most of my time looking after the kids and doing housework. To be perfectly honest, I’m enjoying it. Its really nice to take a break from full-time work, the first time I have not been working flat-out in about twelve years. So where to from here? While kids and housework keep me reasonably busy, I’m not the kind of guy who can just sit around. So I’m planning to create some products for sale. I’ve set up a new site called siliconsparrow.com where I will base my professional operations. I am excited about the possibilities. Unfortunately it means this blog will become a bit neglected. I’ll only be posting personal and hobby stuff here, and perhaps more housewife-related stuff like recipies! |
||
4 May 2009 |
||
TV addictionOne of the little rules in our house is that kids are not allowed to watch TV before school in the morning. But these two are so addicted to the glow of a screen, they watch my screen saver and pretend it is a movie! Sometimes they are quite amusing to watch, they come up with things like “Oooh, watch out little blob, that big blob is going to get you” or “That’s two cows dancing!”. My screen saver is Electric Sheep by the way. |
||
13 April 2009 |
|||||||||||
Toshiba vs Dell – Cashback deals and Customer ServiceI’ve never done a good ‘ol consumer rant on this site so here we go. I’ll put my grumpy old man hat on… A couple of months ago, it so happened that I bought a Toshiba laptop and a Dell screen in the same week. Both products offered a $100 cash-back deal. What happened next showed very dramatically the difference in attitude towards customers of these two companies. How the Toshiba cash-back works
|
| Company | Time I spent applying for the cashback | Time before I received the cashback |
|---|---|---|
| Toshiba | 3 hours | 6 weeks |
| Dell | 0 | 1 day |
UPDATE: This Dilbert cartoon says it all…
17 December 2008 |
||
Simple Slide Show is now open source
As a bonus, I have added a new feature to allow you to customise the colour and font used in the image captions. You could use the source code from this to make your own more fully-featured slide show application, or just use it as example code for writing whatever. I hope you find it useful. CLICK HERE to go to the download page. It’s free! |
||
9 December 2008 |
||
Linux is amazingly usefulIt’s incredible the things you can do in Linux. Here’s two amazing things I’ve done today: Amazing thing #1 I had a corrupted disk and I wanted to run some recovery tools on it but to be safe, I wanted work with a copy of the corrupted disk. So I created a raw copy of the entire disk and piped it to a different machine which had enough storage: cat /dev/hda1 | netcat -q 1 192.168.0.15 9998 That created a file of 1128GB in size – probably the single biggest file I’ve ever created. It took more than 12 hours to copy to the other machine! Then I created a loopback device so the system could pretend the file was a real disk: losetup /dev/loop0 /home/adam/recovery.raw Then I ran xfs_repair on it and recovered all the files. In the old days I would have to physically install a second hard drive in the corrupted box – did I mention that I did all this remotely from off-site through an ssh session. Amazing thing #2 I needed to find all the Makefiles for an older version of my projects and update them. This command searches through a bunch of folders for files which contain the string “1.6″ and loads them all up in a text editor for me. It sure beats manually going through dozens of folders and eyeballing every file. find /usr/src -name Makefile | xargs grep -l "1.6" | xargs kate |
||
15 November 2008 |
||||||||||||||||||||||||||||||||||
Update on TwinHan remote for Mythbuntu 8.10
Anyway, onto the odd device, my TwinHan remote control. Setting this up is much easier under Mythbuntu 8.10. Here’s the step-by-step: Step 1 – Configure LIRC Plug the IR receiver into a USB port. Wait a moment for it to register and then type the following command: ls /dev/input/by-id It should produce output like this. This step is just to verify the correct device name for the remote. usb-Twinhan_Tech_Remote_Control_1111111-event-kbd usb-Twinhan_Tech_Remote_Control_1111111-event-mouse usb-Twinhan_Tech_Remote_Control_1111111-mouse Now edit the file /etc/lirc/hardware.conf and enter values for REMOTE_DRIVER and REMOTE_DEVICE: REMOTE_DRIVER="devinput" REMOTE_DEVICE="/dev/input/by-id/usb-Twinhan_Tech_Remote_Control_1111111-event-kbd" Due to a bug in this version of Ubuntu, you will also need to run the following command: lshal | grep input.product It will spit out a few lines of text. Verify that it produces a line like this: input.product = 'Twinhan Tech Remote Control' (string) Then edit the file /usr/share/hal/fdi/preprobe/20thirdparty/lirc.fdi and make it read like so: <?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
<device>
<match key="info.product" contains_ncase="Twinhan Tech Remote Control">
<merge key="info.ignore" type="bool">true</merge>
</match>
</device>
</deviceinfo>
Finally, download this file: and put it in /etc/lirc/ At this stage, I had to reboot so that everything loaded properly. Once you have rebooted, you can test the remote control by typing: irw Now every time you press a key, you should see it printed on the screen. Press Ctrl-C when you are done. STEP 2 – Configure MythTV commands We are getting closer now. The next step is to set up a file called ~/.lirc/mythtv which contains the mappings between the keys on the remote and the functions in MythTV. Once again, I have already prepared this file which you can download here: Rename this file to mythtv and move it to ~/.lirc/ Once that is done, restart MythTV. Here are the key mappings you will end up with:
STEP 3 – Configure MPlayer The final step is to configure the mapping between the remote and the commands in MPlayer. Since MPlayer is a separate program, it needs to be configured separately to MythTV. To configure it, we need another lircrc file but this time is has to be called ~/.lirc/mplayer. Download it from here: Rename it to mplayer and put it in ~/.lirc/ and that should be that! Here are the key mappings for MPlayer:
If you do not like the key mappings I have chosen, you may edit the files in ~/.lirc. The format should be fairly easy to follow. |
||||||||||||||||||||||||||||||||||
22 October 2008 |
||
Baud rate converter website is up
The address is http://serialgadget.com/ |
||
Currency Calculation in PHPThanks to some help from Stack Overflow, the new and excellent Q&A site for programmers, I have put together a PHP class which can perform a currency conversion using up to date exchange rates pulled live from Yahoo. Here is the code for y’all to share:
<?php
// fx.php - PHP Code to convert currencies using Yahoo's currency conversion service.
// by Adam Pierce <adam@doctort.org> 22-Oct-2008
// This code is public domain.
class ForeignExchange
{
private $fxRate;
public function __construct($currencyBase, $currencyForeign)
{
$url = 'http://download.finance.yahoo.com/d/quotes.csv?s='
.$currencyBase .$currencyForeign .'=X&f=l1';
$c = curl_init($url);
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$this->fxRate = doubleval(curl_exec($c));
curl_close($c);
}
public function toBase($amount)
{
if($this->fxRate == 0)
return 0;
return $amount / $this->fxRate;
}
public function toForeign($amount)
{
if($this->fxRate == 0)
return 0;
return $amount * $this->fxRate;
}
};
?>
Because it creates an object, that object will remember the exchange rate so it doesn’t need to look up the rate again and again if you want to do multiple currency conversions on the same web page. Usage Example:
<?php
// Create an object to convert Australian Dollars to Euros.
require 'fx.php';
$fx = new ForeignExchange('AUD', 'EUR');
// This function formats a value with 2 decimal places.
function fmtMoney($amount)
{
return sprintf('.%.2f', $amount);
}
$auPrice = 25.50;
echo '<p>Your price is AU$'. fmtMoney($auPrice)
.' which is approximately €'. fmtMoney($fx->toForeign($auPrice)) .'</p>';
?>
…enjoy. |
||
Powered by WordPress