Bastard of a mouse

Bastard of a mouse OR how my mouse tried to commit suicide on a shiny day.

I got an MS-IntelliSense Optical Mouse about two years ago.
Recently, it decided to sorta stop working. It didn’t just stop all of a sudden, it worked fine for ten minutes, stopped for short 3 seconds break, and so forth.

That’s the kind of behavior that tests your nerves, and when your nerves are tested every 10 minutes, it can’t be good. You see, you’re working on something, and all of a sudden BOOM… NOTHING, so you have 2-3 seconds to contemplate ‘what’s wrong, why is it not working, what could be wrong, WHOOPS its back again, lets continue working.

Sort of like a distorted reality, you only get to think about the damned mouse for a few seconds every ten minutes, it takes time to reach conclusions that way.

Nevertheless, conclusion struck this afternoon. I kept thinking it was the USB connector but alas I found that the part of the cable coming out of the mouse was very sensitive to bending. Once you bent it too much, BOOM the mouse goes away, this time you can sit and think about it because you need to bend it back for if you want to start working again.

Took apart the damned mouse, thanks Microsoft for hiding the screws under glued plastic parts, and THANK YOU FOR SCREWING THEM SO HARD that I broke a screwdriver trying to screw them out.

I had to cut the USB cable in that part and re-attach it, I put the re-attached part into the mouse itself so that it doesn’t get any movement, let’s see how long this holds…

To top things up with some jelly and peanut-butter, once I closed things up the left button started acting strange, didn’t feel that responsive… Now what are you suppose to do ?
It’s like when something’s broken, and you fix it, only to discover that your understanding of what went wrong was comparable to your knowledge of Indian bureaucracy (this doesn’t apply to the 1 Billion Indian ppl out there, sorry). I just went in to cut/attach the cable, how in the world am I suppose to know why the Left button is starting a mutiny on me ?
I just hit it pretty hard and it looks like it works… for now.

This is what I like to call ‘A Bastardization of a Mouse’

Sudoku Solver/Generator Source-Code


Here’s some straight-to-the-point source-code for solving and generating Sudoku boards.
It’s targeted at embedded systems, so stuff will run fast and memory consumption is rather low.

I’m putting it here mainly so that people can find it through google and have some of the Sudoku programming-problems solved. The source-code is heavily commented, so hopefully it’ll do some good.

Here we go:

common.h, os.h (just common stuff)
Board.h, Board.cpp (The core stuff)
SudokuZen.cpp (Usage example)

A package that may compile: SudokuZen.zip
The picture was drawn by my brother, for a game we never released.

Hacking the EasyHotel TV (incomplete)

I found myself at the London EasyHotel. Don’t book a room there if you’re claustrophobic :-)

The room has a nice Phillips FlatTV, but it has no visible buttons and no remote… If you want a remote it’s for 24 hours, yeah you read it right.

Unwilling to shell out that money for 5 consecutive days and letting out the real me, I decided to give it a shot.
We went over to one of these everything for 1£ shops and got ourselves a universal remote-control.

We got back to the room, gulag-cell is a better name, and tried out the remote. Use codes 027 or 003 to match the ‘IR Codes’ of EasyHotel’s Phillipsps FlatTV. This enabled us to turn on the TV and get to a nice channel that shows us the channel-selection and plays music-radio at the background.

The TV has many inputs, Coaxial, AV, RGB, S-Video. We managed to jump between all of them but didn’t manage to move between channels :-(
It seems like Coax and AV broadcast the same channel-selection, the latter only doing it in Stereo instead of Mono.

We tried all of the ‘IR Code Sets’ that match Phillips but not one of them managed to switch the channels.

To me it still looks like the correct ‘IR Code’ will solve the problem, but I’m ready to hear from other people, as there’s no other place on the web I could find information on hacking this specific TV-Set.

It’s still nice though, the 1£ remote is worth having some background music as that’s about the only dynamic thing about the room (no window, ouch).

Comments ?

PyIE: Easy Screen-Scraping with Python and IE

I always like it when information I’m interested in just flows over to me.


The first thing I did about this was start sending myself daily reports about my investment-account. I wrote a script that logged into the bank, fetched the info I wanted, and spat it out. A simple batch file was all it took to pipe this into another tool that simply sms’s the data over to me. This essentialy makes any worthy piece of data instantly deliverable to me wherever I am.

This just sound like you’re typical Matrix-hackerish style paragraph, but if you’re a moderate computer programmer, the next few paragraphs will clear it all up ;-)
If you’re not a programmer, The Matrix stuff is comming in masses.


Screen scraping is the act of capturing data from a system or program by capturing and interpreting the contents of some display that is not actually intended for data transport or inspection by programs

source: wikipedia


The first thing you’ll want when you’re scraping for data is an easy way to control and fetch data from, let’s say, a browser.

I picked IE. I know it sucks but it’s easy to automate.

Anyways, any web-page is easily accesible through what’s called the DOM. To find out where in the DOM lyes the piece of data you’re after, use the priceless DOM-Inspector, a click here and a click there and you suddenly know that you’re daily loss/gain is neatly located at :
document.frames.middle.document.frames.IFrames.document.
getElementById(“QTable2″).childNodes.item(0).childNodes.
item(0).childNodes.item(0).childNodes.item(0).childNodes.
item(2).innertext
I would have never guessed this myself.

Now how do we automate all this process ? I mean we need to load up the page, fill in the form with our username/password, click ‘login’, click a few more buttons, fetch data, etc…
This is where Python + win32com + PyIE come to the rescue.

Python is fun and easy for scripting. PyIE is a small component I’ve written that simply loads up an invisible IE page (or visible if you want to debug stuff), and just does whatever you tell it to do. It handles lots of annoying issues like ‘click here, now wait for the stuff to come up’. Most components I tried to use required you to manually timeout the requests and handle things yourself, which is tiresome.

PyIE solves almost all of the tedious work of timing, error-handling and stuff like that.

PyIE provides a single method that safely fetches data or fills forms with your data, and is thus called safely.

Download: PyIE.py
Examples: send_sms.py (send an SMS in IL-Orange), stat_counter.py (fetch info from your account at statcounter).

The two examples are most likely outdated (that’s the bad thing about screen-scraping), but use them to learn how to use PyIE.

Did I mention Python is beautiful ?