Mon, 13 Feb 2012

pyblosxom upgrade

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


Thu, 09 Feb 2012

python T4 XML generator

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


Tue, 10 Jan 2012

SSD drive speed

Thought I'd just post a quick review of drive speed after recently upgrading to a new SSD drive. Here are the configurations and speeds:

Two WD 1TB Green drives mirrored (RAID1):
Timing buffered disk reads: 256 MB in 3.05 seconds = 84.06 MB/sec

Two WD 36GB 10k RPM Raptor drives stripped (RAID0):
Timing buffered disk reads: 376 MB in 3.01 seconds = 125.04 MB/sec

OCZ Agility 3 90GB, single drive:
Timing buffered disk reads: 656 MB in 3.00 seconds = 218.45 MB/sec

That is pretty quick. And I think the SSD is limited on this machine as it only has a SATA2 interface which is 3GB/s, as opposed to the SATA3 at 6GB/s.

posted at: 19:36 | path: /computers | permanent link to this entry


Thu, 15 Dec 2011

airmiles worth

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


Sat, 10 Dec 2011

fixing a broken power supply

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:

power supply broken

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.

power supply insides

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

bad 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)

power supply fixed

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


Tue, 20 Sep 2011

Gigabyte boot from usb gives Boot Error

I've had this problem recently with some Gigabyte motherboards, and booting from USB to do a debian install. What happens is I create my USB boot stick, or use an existing one that I know works, and when I attempt to boot from it, I get the boot screen and it simply displays "Boot Error:". After searching around I've seen a few different solutions, some people formatting the usb stick in windows first, some plugging the drive in at the right moment during the boot sequence, etc. I tried a couple of these options without any sucess. But I did finally get it working and for myself, the problem seems to be the way I partitioned the device. Normally I create a single partition on the device /dev/sdX1 of whatever size, and then zcat the boot image to the partition. What I did in this case is ignored the partition table all together, and just ran:
zcat boot.img.gz > /dev/sde
mount /dev/sde /mnt
cp debian-6.0.0-i386-netinst.iso /mnt/
umount /mnt
For 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


Fri, 26 Aug 2011

pythonmagick pdf to image

I've always used PIL for image work in python, but I needed to convert a PDF to an image recently and using image magick looked to be the way. There is a pythonmagick interface to use imagemagick in python, but there is zero documentation... Here is what I'm using to do the job:
#!/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


Wed, 18 May 2011

Fixing bad capacitors on lcd monitors

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):

bad caps

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.

good caps

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


Mon, 07 Feb 2011

System policy prevents stopping the system

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


Wed, 09 Jun 2010

Etch to Lenny upgrade of samba with Windows 98 clients

So I just recently upgraded an old server from etch to lenny, that was hosting some files on a samba share for an ultra old Windows 98 machine. Anyways, upgrade went fine, but I ran into a problem authenticating the windows 98 machine to the samba share after the upgrade. Getting the old IPC$ invalid password deal. After stubling around with samaba for a while I found that at some point between the two releases they have disabled lanman authentication as it's rather unsecure and such. And it turns out that is fine, as long as you don't have any windows machines older than XP. So I had to enabled laman authentication in the samba config file by adding the line lanman auth = yes to my /etc/samba/smb.conf file. That did the trick, and now the ancient windows 98 machine can login to the file server again.

posted at: 16:10 | path: /debian | permanent link to this entry


2012-Feb
2012-Jan
2011-Dec
2011-Sep
2011-Aug
2011-May
2011-Feb
2010-Jun
2010-Apr
2010-Jan
2009-Sep
2009-Jul
2009-May
2009-Jan
2008-Oct
2008-Sep
2008-Jun
2008-May
2008-Jan
2007-Nov
2007-Oct
2007-Aug
2007-Jun
2007-May
2007-Mar
2007-Feb
2007-Jan
2006-Nov
2006-Oct
2006-Sep
2006-Aug
2006-Jun
2006-Apr
2006-Jan
2005-Dec
2005-Nov
2005-Oct
2005-Sep
2005-Aug
2005-Jul
2005-Jun
2005-May
2005-Apr
2005-Mar
2005-Feb
2005-Jan
2004-Dec
2004-Nov
2004-Oct
2004-Sep
2004-Aug
2004-Jul
2004-Jun
2004-May

Powered by PyBlosxom | RSS 2.0