Saturday, November 29, 2008

Open Flash Chart

Finally got around to implementing Shapes and shape_point in the Open Flash Chart Python library. You can now finally draw polygons on to the charts! It didn't take too long to implement which was good. I did get stuck on writing the demo though. I couldn't follow my use of arrays in my code and I had a "null" value problem in the JSON ><. I've now updated the code.google.com page for the library with a new uploaded zip file of the library and a new Wiki page for the change log.

Thursday, November 27, 2008

Photoshopping

Been trying to come up with a good desktop background from my computers.  Haven't had much luck coming up with an idea.  Been playing around with black and white . . .





Tuesday, November 25, 2008

Dumb ATmega8 project

Finally finished the ATmega8 library.  Has API to use a 7-segment LED, pins, PWM, 2-bit flip flop, timers and some other random stuff.  The code size is pretty big though.  Not sure how to optimise the size away without losing the abstraction.  So for the final Alkali programme, it's able to detect light pulses with a reverse biased LED.  Depending on the length of the pulse, it will generate one of three events.  These three events will be "reacted" on by setting the speed of the fan and writing one data bit to the 2-bit flip flop.  The fan has three speeds; maximum, medium and off.  There's an LED that blinks on and off at close to 1 second intervals.  There is an LED that indicates the persistence of a light pulse and its indication will also persist.  The output of the tachometer of the fan is connected to a couple of external interrupt pins and these are used to turn the decimal point of the 7-segment LED on and off.

So yeah, a pretty dumb project . . .

Monday, November 24, 2008

Dumb ATmega8 project, Open Flash Chart

Had some problems with reading in the tachometer output through a couple of external interrupt pins.  It seemed that every time the fan turned on, the "latency" light would turn on.  If it wasn't doing that, it the fan would turn off after a while.  I couldn't really figure out why it was doing this because the timers must have stopped working or the wireless sensor was being triggered automatically.  Eventually I found a remedy.  It was to increase the prescaler for the PWM timer.  I was using a prescale of 1 which may have been too fast and caused the interrupts to fight over each other.  I tried to get some meaningful output written to the 7-segment display but because of the distortion of the tachometer by the PWM, the numbers didn't really make sense.

I finally made changes to the Python library for Open Flash Chart.  Each graph variety class has its own "set" functions to properties that are fairly unique to other graphs.  This means you can change the properties after creating the graph dictionary.

Sunday, November 23, 2008

Dumb ATmega8 project, Open Flash Chart

I've got the tachometer fan being driven by an n-channel MOSFET.  Was done pretty easily.  Vcc is around 7V and the input voltage is either 5V or 0V.  The MOSFET seems to be fully forward conducting at 5V so that's good.  Right now, I have the fan turning on and off every time the wireless / light sensor detects a light event.  So, that's pretty dumb so it fits with the whole theme of the project.  I'm going to try and work on this tachometer thing.  The third year electronic design paper involved using a three pinned tachometer fan so I'm basically going to be doing their project.  Hopefully it'll be easy.

Going to work a little more on the Open Flash Chart Python API as well.

Thursday, November 20, 2008

|-| @< |< ! |\| 7 0 5 |-|, ATmega8, Photoshopping

Managed to update to the 5th release.  Was easier than I expected because last time I borked the installation.  Just had to make sure a file was deleted and to change one line of the start up script.  Still stuck with VESA 3.0 video.  Still can't get it past the max resolution.  Got wireless so that's good enough for me.  One thing that does bother me is that I have to reduce the allocation of shared graphics memory (Intel 3100 GMA) for it to boot through.  But if I do that, then Vista falls back to the "basic" window manager.  Meh.

I did some more improvements to my ATmega8 library.  The wireless / light sensor now reacts to any pulses of light.  Whenever the light is de-asserted the counter will increment.  Basically I have a function / method for detecting positive edges (sensor is active low).  I also added a reaction to the length of time that the wireless sensor is asserted.  When the period exceeds a threshold, a status light is asserted and remains asserted until the wireless sensor does not detect the light anymore.  I managed salvage the Intel Pentium !!! CPU from the old Compaq desktop.  It's a Coppermine revision.  I also took the fan and heat sink used to cool the CPU and I've now attached it to my dumb ATmega8 project.  It's got three inputs; ground, Vcc and a tachometer output.  Since it's only a three terminal fan, the tachometer output is distorted for any PWM input signal.  Basically the ideal tachometer output is AND-ed with the input PWM since the tachometer will output a low whenever the PWM is low regardless of whether the tachometer should be outputting a high or low; Tachometer output = (Ideal tachometer output) AND (PWM).  I have yet to write a library for abstracting the tachometer output and PWM output and control.

Started photoshopping some cards today.  Got a birthday card and two good-bye cards to make.  I'm having a photoshopping block.  I've run out of ideas for making good-bye cards.  Getting harder and harder each year because you can't exactly give someone a card they've seen before . . .

Tuesday, November 18, 2008

|-| @< |< ! |\| 7 0 5 |-|

Wow, I finally did it again.  Though with a different DVD.  Frustrates me how I couldn't use my hacked version to make it work.  I had to change the order of my SATA HDD and DVD drives so that the DVD drive had "higher priority" over the hard drive.  I was amazed when I got to the set up screen.  Hit a small issue when the installation finished.  I had forgotten to bless the partition.  That fixed the blank / black screen that I had.  Got internet working but no video acceleration.  Back on old VESA 3.0 so I'm maxed out at a resolution of 1280 x 1024.  Looks pretty damn ugly on a widescreen monitor.  But any way, good enough for me right now.  Going to try installing on a virtual machine.  See what happens.

Sunday, November 16, 2008

Google Code, Compaq, Blog, Parallels

Made a few improvements to the Python repository for Open Flash Chart.  Added in a Wiki page showing a quick overview of how to make the data strings.  It gives a superficial comparison between the Python method and PHP method.

Pretty much finished doing maintenance work on the Compaq laptop and another desktop.  Frustrating how particular "users" complain of running out of disk space without thinking about where they're putting all their crap.  Perfectly fine partitions for "programs" and "documents" yet they're ignored.  It amazes me how people manage to screw things up.  Well I guess, not everyone's born as a computer user.  I wouldn't be surprised if the wireless adapter gets KO-ed within the next couple of weeks.

Finally decided to re-link the images I use for this blog.  The webhost I've been using has lately been very unreliable.  Hopefully my crusty geocities account will be better.

Decided to install Parallels Desktop 4.  As unlikely as I had hoped, the hard disk conversion to the new format screwed itself over.  So now I'm left with a truly POS installation of Windows.  Yet another reinstall that I have to do . . .

Saturday, November 15, 2008

Open Flash Chart 2 - Python API

Made my first code repository.  It was for the Python library I wrote for Open Flash Chart 1 and 2.  It's on Google Code.  Look.  Download.  Use.  Enjoy.  Improve.

Compaq Presario 2116AH + Wireless

Managed to fix an old DSE wireless 802.11g adapter.  Basically two contacts of the USB port lost contact with the pads on the PCB boards.  Probably due to too the port being bent up and down too many times.  I basically did a hacked job at re-soldering the pins with an absolute shocker of a soldering iron.  The tip doesn't even exist.  It's shaped like a flat head screw driver.  If you've done any soldering on PCBs made for IC you'd understand that a lot of the pads are tiny, thin or clustered very close to each other.  I must have immersed a few components in globs of solder before I managed to make a "connection".  As an Engineer, I feel the responsibility to self-regulate my work and declare the work of poor quality and lacking professionalism!!!!  But the wireless adapter works and that's all I care.

I decided to reinstall the Windows on the Presario laptop since everything was running slowly and Internet Explorer was having issues connecting to the internet.  The internet settings must have screwed themselves up because the an IP address was being allocated to a hidden device; Yay!  Reinstall went well.  Legitimate copy.  No activation issues.  Yet.  Got Service Pack 3 installed with IE7 and WMP 11.  Running out of disk space though which ain't too good...  Hmm have yet to order parts for a new desktop.

Thursday, November 13, 2008

Ruby

After taking a break from my dumb ATmega8 project by looking at some stuff to buy for a gaming project, I decided to start looking at Ruby and ultimately Ruby on Rails today. Just did an apt-get for the packages and what not. Everything seems to be going well apart from needing to install minor prerequisites.

Ruby seems easy enough. Just went through a tutorial that demonstrated some of the basics. Behaves similarly to Python and shares a structure like any other scripting language though everything is an object in one way or another. This is different to the languages which have integers, characters and booleans as primitives. Getting Rails to run was easy. Rails has a tool that allows you to create a ready-to-go skeleton of a website. The Model-View-Controller organisational thing is something I'll need to understand properly. I'll probably need to spend some time on my website to make it easier to manage and maintain. Right now it's a few folders with a lot of files in each.

A new version of Cherrypy is out and seems to be compatible with Python 2.6 which is nice.

Wednesday, November 12, 2008

The start of a dumb ATmega8 project

I've continued to extend my C code for my ATmega8. It now does more than count from 0x00 to 0x0F. Every time it counting overflows, the speed of the counting gets changed. All this is done using my fancy time struct and functions. I've implemented "optical wireless communication" using a single LED as the receiver. It's very crude but works. I've got it to reset the counting every time light is shone on it. Hopefully I'll be able to make an "event based" controller. So I'll have it recognise light patterns and act on them. Wonder if I can use some sort of software exceptions (interrupts produced by running code). Code size is getting too big though for what seems to be a small amount of functionality. I shall document my System library later on.



Tuesday, November 11, 2008

AVR ATmega8 madness

Now that I've finished writing the Python API for Open Flash Chart 2, I decided to start working on some ATmega8 coding.  Got a free ATmega8 a while back so I decided to put it into use.  I found a seven segment LED display so I ended up making a simple one digit hex counter. I should really use a 3-bit decoder to address my LED display.  Taking too many ports up.  I'm using the decimal point as a blinking indicator so show that my timer is actually ticking.  I'm writing in C and I've started making my own "System" libraries.  I've got a timer struct and a single digit seven segment driver.  I also have an 2-bit Flip-Flop but I haven't got any plans to use it right now.  Might use it as a 2-bit memory storage device?  That would be silly though.


Sunday, November 9, 2008

Open Flash Chart 2 - Python API


Finally finished the (re)writing of the Open Flash Chart API library for Python.  Only too three whole days to understand what was going on with the JSON.  I think the hardest thing to understand was the use of x_axis_labels and x_axis_label objects to store the labels of the x-axis labels which is then assigned to the label variable in set_x_axis.  It feels a little convoluted because in the JSON, you have an entry called "label" and inside that you have an entry which is also called "label".  With the rewrite, some of the objects/functions are different places and they don't have the same interface as the PHP implementation.  The fact that the axes do not come together at (0, 0) bothers me because when the axes have significant thickness it looks like one giant pixel has been taken out of it.  Anyway, onto the actual changes.

Filenames:
  • Filename ofc2.py changed to openFlashChart.py
  • Filename ofc2_element.py changed to openFlashChart_varieties.py
  • New file created called openFlashChart_elements.py
The original names were confusing and contradictory in my view.  This was due to the way the key word element was used on the Open Flash Chart website and in the JSON strings.  On the website, Chart Elements is used to describe elements or properties of the charts that are independent of the chart type being drawn.  However in the JSON string, the entry elements contains a list of charts to draw.  Hence, ofc2_element.py was changed to openFlashChart_varieties.py to better reflect the purpose of the file to create different chart types.  Classes describing the properties of the chart were taken from ofc2.py and placed into a new file called openFlashChart_elements.py.

Accordingly, openFlashChart.py imports the chart elements defined in openFlashChart_elements.py.  The only files required to use Open Flash Chart is openFlashChart.py and openFlashChart_varieties.py.  The only inconsistency with this is that x_axis_labels and x_axis_label are defined in openFlashChart_varieties.py when they should really be defined in openFlashChart_elements.py.  Having them defined in openFlashChart_elements.py was not ideal as the file should be hidden from the programmer.

Example of importing all the required classes to make charts:


import openFlashChart

from openFlashChart_varieties import (

       Line,

Line_Dot,

Line_Hollow,

Bar,

Bar_Filled,

Bar_Glass,

Bar_3d,

Bar_Sketch,

 HBar,

 Bar_Stack,

 Area_Line,

 Area_Hollow,

 Pie,

 Scatter,

 Scatter_Line

 )


from openFlashChart_varieties import (

       hbar_value,

 bar_value,

 bar_3d_value,

 bar_glass_value,

 bar_sketch_value,

 bar_stack_value,

 pie_value,

 scatter_value,

 x_axis_labels,

 x_axis_label

 )


So what exactly has been implemented?  Well below is a list of features that have been implemented.  Those already existing in the Python library are denoted by a ( - ).  Those that have been added by myself are denoted by a ( + ).  This list has been compiled by taking the menu lists from the Open Flash Chart website.


Chart types/varieties:

-  Line

+ Line Dot

+ Line Hollow

-  Bar

+ Bar Filled

+ Bar Glass

+ Bar 3D

+ Bar Sketch

+ Bar Horizontal

-  Bar Stack

+ Area

+ Area Hollow

+ Pie

+ Scatter

+ Scatter Line

+ Radar


Chart elements:

-  Title

-  X axis legend

-  Y axis legend

-  X axis

-  Y axis

+ Y axis (right)

+ X axis labels

-  Background colour

+ Click events

+ Floating bars

-  Tooltip


To elaborate a bit more, individual data points can be customised for all charts.  The same goes for tooltips.  This was achieved through the creation of data value objects like bar_value, hbar_value, bar_stack_value, etc.  Some of the existing classes were also modified.  For example in tooltips, specifying the behaviour of the tooltip with mouse location was added in. Some bugs were spotted in the process.  For example, in some functions that accepted boolean values, the conditional evaluation for setting a dictionary value was incorrect.  The original test was for the truth of a value rather than the existence of a value.  This meant None and False were treated as the same which meant some settings were unable to be set as false.  As mentioned before, the interface for adding x axis labels is in the "wrong" place.


I also wrote my own demo.py programme to show off the additions I made.  I also got some of the javascript features going as well.  Like the calling of a javascript function using on_click and loading new JSON data using load() defined in the ActionScript.  (Uses cherrypy)


Differences:

  • Instead of using separate functions (set_hover and set_proximity) set the same "mouse" value for tooltip, only one function is implemented that takes in the mouse behaviour as a string. This function is called set_behaviour() and is found in the tooltip class.
  • Because the element classes were written to allow the necessary JSON strings to be created, little attention was drawn to make the elements as objects.  So an element is defined in one go on creation and adjustments to its properties after creation cannot be made.
To-Do:
  • Write classes and functions to implement the shape and shape_point objects to allow shapes to be drawn onto the chart canvas.  These will probably be written into openFlashChart_varieties.py even thought it's more suited for openFlashChart_elements.py given its independence of the chart type being drawn.
  • Make the API more elegant to use.  Particularly the exposure of chart elements to the programmer so that it works more like the PHP implementation.

I'm pretty happy with what I've been able to achieve in the last 3 days.  Apart from the first to-do item, I think I have implemented all the functionality that Open Flash Chart 2 offers.  I've set myself up well to upgrade my use of Open Flash Chart from version 1 to 2 for StockShaping.  The only other complaints I'd make (in addition to axes intersection) is the loss of the reload() function defined in ActionScript which would make its own call to fetch new data.  Instead, you have to fetch the data yourself and then pass it into Open Flash Chart through the load() function. Also, the file size of Open Flash Chart has ballooned up to about 256 kb from 64 kb which may be of concern for those wanting to view charts on a slow connection.  It's just the first request for Open Flash Chart that is important.  Subsequent calls should be a lot faster with caching turned on.  The last thing is the use of "val" and "value" in the JSON as keywords to mean the same thing.  Entries for both keywords are values to plot on the chart.  This discrepancy is unnecessary and added to the implementation time and increase in code usage to cater for it.


Friday, November 7, 2008

openSUSE and Open Flash Chart

Finally reinstalled openSUSE and yet again, the UUlD changed.  The boot loader manager in openSUSE is pretty infuriating because it overwrites the menu.lst file with its own crap even if you use it to modify it.  For example, changing the location of the root device will get changed back to the original value.  Dumb manager.  In the end I updated menu.lst through the shell.  Managed to get all the fstab entries working so all my drives across all the Linux operating systems automount.

I started on using the Open Flash Chart 2 API.  Not much has changed with the html business. Still have to specify flashvars but the name of the variable that points to the data has changed to either ofc or data-file.  OFC2 now expects data formatted as JSON so that's where most of the work is going to be.  The included python library isn't in the style I want it to be so I'll be basically doing a rewrite.  Since not a lot of features have been implemented by the library, a rewrite should be fine.  Hopefully it'll be as easy as the work I did for adding to the Python library of OFC1.

Wednesday, November 5, 2008

Operating systems

Spent the day finding non-Linux operating systems to try out.  Found AROS and FreeBSD. Unfortunately, I couldn't install AROS because I didn't have a CD that could fit a 750 MB image... Do CDs greater than 700 MB even exist?  Couldn't install FreeBSD because it couldn't detect the repositories on the CD.  I didn't bother finding out why.  Probably because of the SATA connection or that I was so stupid I downloaded the wrong image?  Oh yeah, openSUSE is broken once again.  Complains of not finding the root device (/dev/root) when booting up.  I may try reinstalling grub but I think I'll just end up doing a clean reinstall.  I decided to try a new window manager so I settled with XFce since it's different and thus, I installed Xubuntu 8.10 on the old Compaq PATA 40 GB drive.  I want to try and get the dock going.  I have to say, all the major window managers all look the same.  I really want to try something that is built on a totally different philosophy; well excluding command line!  In between all the partition, installing, sudo-ing, I managed to read more on Python.  Going through the pdf describing the Python library.

I've decided to fix my fstab as well so that they'll be auto-mounted on boot.

Hackintosh

Spent the whole night trying to get back my hackintosh on my PC rig but keeps failing.  Either because it's waiting for the root device or it's just hanging before waiting for the root device.  I've basically given up now.  I've changed as many of the drive settings as I can.  IDE/AHCI, boot order, flagging my PATA drive as boot and active ...  I have no idea how I did it the first time.  I remember having the same problems but it worked after changing the hard drive to AHCI and flagging the primary partition as boot.  Meh ...

I think I'll just find some obscure OSes to install.

Tuesday, November 4, 2008

Compaq Presario 5BW472

Started salvaging the parts to the Compaq and noticed the different headers coming from the motherboard.  Quite a few looked proprietary like ones for the status lights, front panel usb ports, and power button connector.  So I decided to check out the motherboard layouts from the one I might buy and the one of my current rig and found out that the connectors were proprietary and the Compaq power supply was missing the 2x2 pin power connector.  So, that basically means I can't reuse the case or the power supply.  I know have a few choices.  One is to find a new Micro ATX case.  Second is find a new ATX case and/or find a new ATX sized motherboard.  Third is to just get a stock standard base unit so we can get the standard shop warranty that my parents like so much.  Fourth is that we just get a laptop.  Hmmm

Vista Ultimate virtualisation; openSUSE 11.0; Open Flash Chart; Down Across and Up

While searching for an answer to my reactivation issue with Windows Vista Ultimate after a BIOS upgrade, I found a nice *thing* to allow me to use Vista without having to authenticate with Microsoft's web servers.  It does a nice job to trick the operating system in thinking the BIOS of the computer is from an eligible company for pre-activation.  So now I have a copy of Vista running in virtualisation.  Not sure what I'd want to do with it though...

While looking for computer parts to retrofit into the now deceased Compaq, I noticed that the prices of parts I used to build my PC rig (hackintosh) have increased quite a bit.  It now costs more to buy the parts now than a year ago.  Just shows how fast the online stores change their prices based on the FOREX.

With the help of a friend, I managed to get openSUSE 11.0 up and running with wi-fi.  After upgrading Ubuntu from 8.04LTS to 8.10, the UUID of the openSUSE partition changed or something about the partition changed and the bootloader couldn't find the root device.  I ended up reinstalling openSUSE because I didn't know better and I had already wasted 1 day changing the menu.lst file and grub.  After getting openSUSE booting, I had the same wi-fi problem.  I couldn't get it to make a connection to the wireless access point.  In the end, my friend found a link that basically told me to extract the firmware (rt73.bin) of the wireless adapter (ASUS WL-167g) into /lib/firmware/ and then restart the wireless module.  After that, I was able to connect to the access point but I only had intranet access.  Couldn't access the internet.  The problem I found was that the DNS server wasn't resolving the namespace correctly.  Retardly, this was probably because of my fetish for static addresses.  Once I started using DCHP, I could access the internet and pull down some updates for openSUSE!

I looked at Open Flash Chart (OFC) for a brief period.  Pulled down version 2 and had a little play around with the Python library and demo.  It seems to work quite well and feels more light weight than version 1.  I noticed that the point where the x and y axis come together is missing.  It's almost as if it's a bug in how the origin is drawn and just looks wrong.  Version 2 requires an ActionScript 3 compatible interpreter so that's basically version 9 and above of Adobe Flash Player.  So the consequence of upgrading StockShaping to use OFC is that people need to have one of the latest Flash Players from Adobe.  I guess it won't be too much of a problem since the ubiquity of version 9 is quite high given the popularity of youtube and the like which require Flash Player.

Just came back from a private screening of a movie made by a couple who are my sister's friends.  The movie was called "Down, Across & Up" and documents the couple's trek around New Zealand on horse back.  It was made possible by sponsorship, family and friends who supported them throughout their journey using horses.  Unfortunately it was shown that the phrase "Animals were not hurt during the production of this movie" couldn't be used but all the animals used seemed to have come out fine in the end.  They had a nice journey around farmland and lots of random people coming out to help them along the way; even if they had never met them.  All in all, it was quite a fun movie and they did a good job of taking us around New Zealand, quasi-horse back style!  Hmm also my first movie premiere XD

Monday, November 3, 2008

Compaq Presario 5BW472

Further to yesterday's achievements of borking the Compaq, I decided to turn it on this morning and to my surprise it POSTed and started booting Windows ME.  I decided to restart the comptuer and I was able to get into the BIOS and change some settings around.  I restarted the computer, placed the Windows ME setup CD into it but it fuxored again.  Took the CD out and restarted but remained fuxored at POST.  So in conclusion, it's still fuxored.  I'm going to wait a few hours before I try booting it back up.  If it fuxors after a few restarts then there's probably some hardware component with a half-life of a mayfly.

Sunday, November 2, 2008

Compaq Presario 5BW472

Looks like the end of the road for our *trusty* Compaq Presario 5BW472.  Ever since Windows ME was reinstalled on it, the mouse went crazy.  Every time you'd move the mouse pointer it would move off in a different direction.  It was like moving the mouse over a slippery terrain and never knowing what the terrain was like.  Other times the mouse pointer would just freeze into place and the only way to navigate around Windows was through keyboard shortcuts.  Well today I decided to take a look at it and unfortunately I broke it even more.  I repeat, I broke it even more.  The machine won't even get past POST.  Stuck at the Compaq boot up screen.  Tried clearing the CMOS BIOS using jumpers and taking out the backup battery.  That made it worse as it now has to count up the RAM before fuxoring.  Tried unplugging all the I/Os but still fuxoring so it's nothing to do with the devices stopping the POST.  Trying to do a BIOS recovery flash but Compaq seems to have cleverly disabled that feature ...

Yay for 4 years of Computer Systems Engineering!

Python / Cherrypy goodness

Got stuck into some python and cherrypy madness.  Been looking back over my code for my peer-to-peer project for CompSys 302.  Made quite a few improvements to it but I think I can still make some more if I finish reading the Python manuals.  There's a few fundamental things I'd like to change as well but I'm not going to make those changes yet.  I'd like to change the way the server and user information gets handled.  The classes right now for them are quite repetitive and not very "object orientated".  Worked a bit more on StockShaping as well.  Since I wrote the code for that a year after learning Python, the code base is a bit more solid and more "pythonic".  It would be good to experiment with generators and iterators.  Templating is also another issue I should sort out since I've basically made my own that does basic string substitutions.  Works all right but not every extendable.  Wonder when Cherrypy will be written to be Python 3k compliant... Might play around with Ruby on Rails; another pair of scripting tools for use in web development.

Saturday, November 1, 2008

The end of lectures

Well, no more lectures for me ... ever ... well unless I'm the one taking the lecture XD.  Since this blog has mainly been about lectures for the last semester of Engineering at the University of Auckland its use as a scratch pad for random thoughts during lectures and note taking are all but gone.  So, I'm basically going to convert it into a *real* blog where I just blog about things beyond academia, if that makes sense.