Decided to finally upgrade pyblosxom so that I can create blog entries using reStructuredText instead of raw HTML as I have been up until now.
I've been using ReStructuredText for documentation recently and it's much nicer to write than html, and it's similar to moinmoin's wiki syntax which I've very used to at this point.
posted at: 19:12 | path: /general | permanent link to this entry
I needed to generate a XML file required to submit T4 income tax information to the government, and figured I'd share it incase anyone else was looking for a solution to the same problem. The XML spec isn't that complicated, but the naming convention used by CRA is rather painful to deal with. The script isn't anything special but it should do the trick and can always be easily modified. It also does the schema verification so it will warn you if there are any errors in the xml structure or data.
Here is a copy of the code, see the source file for more information.
osbs-t4xml-20120209.tar.gz
And here is a link to the governments site with more information about filing electronically:
http://www.cra-arc.gc.ca/esrvc-srvce/rf/menu-eng.html
posted at: 02:42 | path: /python | permanent link to this entry
posted at: 19:36 | path: /computers | permanent link to this entry
Airmiles is a canadian rewards point club, where you buy things at participating stores, present your airmiles card, and in turn for you letting them have access to your personal buying habits, they give you points, that you can use to redeem for gift cards or items, trips etc.
One thing that is useful to know is what an airmile is worth, and right now a $20 gift card for groceries or petrol costs 175 points, so 20/175=0.1143, so each point is worth $0.11 cents. So if there is some item offered with 8 bonus points, you can equate that to 8*0.11 or $0.88 cents.
posted at: 14:07 | path: /general | permanent link to this entry
A couple of days ago the lights on my fishtank came on in the morning, but when they did they were flashing on and off like some kind of underwater disco show. I don't think my fish appreciated it much, and so I disconnected the light and started looking into the problem. The lights on the tank are a track of LED lighting that are powered from a 15.2V 1600mA power brick. I figured that was where the problem was and sure enough putting my mutlimeter on it I noticed it fluctuating around a bit. I decided to put my scope on it to see what was going on and got this:
Here we can see the supply is jumping up to 12.5 volts, then dropping down 2 volts every 200 miliseconds or so, which explains why the lights were flashing on and off, but this certainly isn't the desired output. Next up was to open it up and see if anything looked wrong. This proved harder than expected since there wasn't a single screw in the brick design and it was just glued together. I ended up breaking the seal with a screwdriver and finally pried it apart. After some poking about I noticed this one capacitor looks like it had shot its load onto the heatsink.
And here is a not that great picture of the bad cap after it was out, you can see the brown electrolyte that leaked out of the cap
And after replacing it we get a steady 15.2V from the supply as it was designed to do (it's not exactly a clean supply, but it does the job for lighting leds)
Ended up epoxying the plastic case back together and almost as good as new :)
posted at: 00:47 | path: /electronics | permanent link to this entry
zcat boot.img.gz > /dev/sde mount /dev/sde /mnt cp debian-6.0.0-i386-netinst.iso /mnt/ umount /mntFor whatever reason, this seems to boot just fine on this gigabyte board, where doing the same thing onto a partition would give the "Boot Error:" message.
posted at: 19:11 | path: /debian | permanent link to this entry
#!/usr/bin/env python
import PythonMagick
pdf = 'doc.pdf'
p = PythonMagick.Image()
p.density('600')
p.read(pdf)
p.write('doc.jpg')
This sets the density value (default is 72) that the pdf is read at, so that you can get a higher resolution image from the PDF, and then simply writes it to a jpg file.
posted at: 12:41 | path: /python | permanent link to this entry
I had monitor with a problem where it would not power on correctly after it was off. It would just flash over and over again until it got warm, and then would start working and be fine until it was turned off for some time, and then back on again. These types of problems usually end up being something wonky with the power supply and often end up being caused by a capacitor or two that have gone bad. If you crack it open you can usually find them and simply replace them to get the monitor working again. This has happened to me a few times over the years and it's a relatively easy fix, so I thought I'd go over the process here with this one.
After cracking the case open and digging out the power supply, you can identify the bad capacitors by the bulgy bent up ones. Sometimes they will have some gunk on the top. In this case you can see the two caps here that are bad (the tall brown ones):

Using a solder pump, or wick, suck off the solder from the joints (note, I de-soldered the wrong lead in the bottom right, had to go back and de-solder the proper lead after noticing the cap wasn't budging)
And finally install new caps to replace the ones you removed. Make sure you use a similar spec cap. The ones I removed were 1000uF 16V caps, and I replaced them with 1000uF 25V caps. The same or higher voltage will be fine. Also polarity matters, so make sure you line up the negative lead on the cap with what is marked on the board, or the same orentation as the caps you took out.

Put it all back together and if everything went alright it should be working like new.
posted at: 18:56 | path: /electronics | permanent link to this entry
I had this come up when the power switch is pressed on the system, when I just want the system to shutdown no matter what. Searching around I found the following bug report that ended up having the answer:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=556376
This can be worked around by creating '/var/lib/polkit-1/localauthority/50-local.d/allow-shutdown-multi.pkla' with the following contents:
[allow shutdown multi] Identity=unix-user:* Action=org.freedesktop.consolekit.system.stop-multiple-users ResultAny=no ResultInactive=no ResultActive=yes
posted at: 21:37 | path: /debian | permanent link to this entry
posted at: 16:10 | path: /debian | permanent link to this entry