Latest Entries

Disabling Those Annoying Blue HP Hotkeys

I have never used a É character in my entire life. I doubt you have either. HP on the other hand, apparently sees things a little differently. In fact, it is quite likely they think you need this “bilingual caps lock” about once a day. I sure don’t.  Around once a day, I was running into an annoying little problem: I found my self typing these characters at the worst possible times. When there is 10 minutes left in a Computer Science lab, and your struggling to complete all the tasks, the last thing you need is this annoying problem.

Judging from a quick Google Search, hardly anyone knows how to fix this problem (besides from rebooting) and judging from my call to HP tech support last night, they don’t know how to solve it either. Fantastic! (Even though they had absolutely NO IDEA how to fix it, they DID want to sell me an extended warranty, but that’s another story!)

Either way, I did figure out how to disable these annoying hotkeys after accidentally pressing some mystery key combination in the bottom right corner of the keyboard. The solution is simple. Press:

Ctrl + Left Shift + Right Shift

Validating Binary Search Trees In Python

This is a quick project I was working on to determine if a tree is a valid BST. The solution is quite elegant.  Suppose you are given a tree with the following nodes:

{'data': data, 'right': next right node, 'left': next left node}

In order to determine if the tree is a BST, we simply examine the left and right data portions of each sub node in the tree.

A recursive solution is very simple

def tree_is_bst(tree):

result = tree_is_bst_aux(tree['root'])

return result

This first function calls a helper function by changing the parameters of the given tree, to that of the individual nodes of the tree, beginning at the root.

def tree_is_bst_aux(node):

if node == None:

is_bst = True

elif node['left'] > node['data'] or node['right'] < node['data']:

is_bst = False

else:

is_bst = tree_is_bst_aux(node['left'])

is_bst = tree_is_bst_aux(node['right'])

return is_bst

This second function recursively examines the left and right node returning False early if the BST properties are violated, otherwise recursively continuing.

An alternative method would be to traverse the tree inorder, placing the values in an array. If the array is sorted, the tree was a BST.

I apologize for the lack of indentation in the code above, WordPress is being… you know :)
I am working on that.

A little bit of Python

I made a quick game of hangman while studying for my university finals, and I thought I would post it for download. Feel free to try it out, modify the code and make changes as you wish. Most of all, don’t be afraid the leave a comment below. After downloading, simply unzip the file and import the project into eclipse (or your choice of IDE)  and run the ‘main.py’ pydev module. Take a look in the ‘word_to_guess.txt” file, where you can add words to the game.

Python Hangman Game

As you can see,  its nothing special,  but demonstrates the incredible power of Python, and the standard library alone. More interesting projects to come.

Kinda cool :)

Eclipse and Infinite While Loops

It’s 2AM. I’ve been programming all day. My laptop was acting up, and I am blaming it all on Eclipse. Ahhhhh Eclipse, its one of those love hate relationships, ya know?  Turns out I did not properly set a condition on a while loop, and my CPU got caught up in infinite loop. This, combined with the simple fact my desk can barely be seen amongst the Mountain Dew cans and miscelanous math homework, should indicate I should be getting to bed. After all, I have to do it all again tomorrow!

Edit: Apple Wireless Keyboard In Ubuntu 11.04

Way back I did a quick tutorial showing how to pair the Apple Wireless Keyboard with Ubuntu 9.1. Yikes the releases go by fast. That post had some serious loopholes and did not allow for automatic pairing on start up and after sleep mode. This new method includes all of this, but is slightly more complicated, although more solid than my previous post. First, upgrade/install your machine to Ubuntu 11.04. Everyone (including myself) seems to have the most luck with this release. This solution is also great as it does not depend on non existant Bluetooth files in earlier packages.

Start by making a copy of your Bluetooth script located in /var/lib/bluetooth

Now remove all Bluetooth packages:

sudo apt-get purge bluez blueman gnome-bluetooth bluez-utils

Now install Blueman and Bluez from source. You can look these packages up online. Compile (you have to do this for both packages separately of course) by unzipping these packages and typing the usual:

./configure
make
sudo make install

Copy your old Bluetooth script to /etc/init.d  (with premissions 755)

Then add Blueman to your startup programs and reboot. The keyboard should now auto pair on sleep and boot. Pretty Cool.

YAY! For Gmail Keyboard Shortcuts. Not

Here is a brilliant idea: put the easiest to accidentally press keyboard shortcuts with the most “dangerous” commands. It appears as though the developers at Gmail have done exactly this. A few days ago, I sent my first Gmail message! (Well I technically sent only one sentence due to someones temporary wave of brilliance) but that is just a technicality. Truth be told, it doesn’t take much skill to send a message, as I learned firsthand. One sentence into a (thankfully) unimportant email, my message magically sent itself off. BAM just like that. You get the point. Well, to my surprise, it turns out that <Tab> then <Enter> sends the message. Just brilliant! Like most people who have the misfortune to use Gmail, I indent my paragraphs. I guess I mistakenly hit the enter key after indenting my first paragraph. A simple mistake, but apparently a big one. I am sure I am not the first, or last person to do this. Next time I use Gmail, I will be sure to watch out for that. Either way, this shortcut has to be the worst idea ever. I wonder if the developers at WordPress used such a dumb shortcut… (presses <Tab> then <Enter> multiple times). Nope! My faith in WordPress is not lost! It is still mind boggling to imagine who could ever have thought this shortcut was “intuitive”. Comments? Leave em’ below.

DesiCrypt – Super Simple Encryption

DesiCrypt (named after my cat in case anyone was wondering) is an encryption project I have been working on for a little while now. It’s not extremely powerful, but defiantly gets the job done for simple encryption tasks. Probably not something you would use for anything serious, but great if you want fast, on the go encryption. The software can be downloaded below and it totally 100% open source. Source code is included, along with a precompiled executable. DesiCrypt is only available to a few lucky Linux users for now, but I hope to port the project over to Windows (as soon as I get Code::Blocks configured on my Windows machine).

Downloads:
Linux – Click Here
Windows – As soon as I overcome my extreme laziness
Mac – Never happening! (evil laughter goes here)

Ubuntu “Checking Battery State” Fix

OK guys, I want to get in a quick blog before dinner. The “checking battery state” problem seems to affect a large amount of Ubuntu users, usually after an upgrade of some sort. Basically the computer boots fully but gets stuck on “checking battery state”. This happens on both desktops and laptops alike. There is many reports of this problem online (some dating back to around 2008) but few (if any) solutions.

The problem has to do with Xorg and not with some sort of “battery state” issue. I had this problem before and was forced to reformat my machine and was faced with it again last week. The fix is surprisingly simple. Press ctrl+alt+f1 to drop to a shell prompt, and type:

sudo apt-get install gdm

Problem solved.

Why I Hate Acer

I have always hated Acer Computers. Always. Every time I buy an Acer computer, they always end up screwing me over. I own a lot of budget computers. Acer, Compaq, eMachines, you name it. I have never had any problem with any other budget brand of computers, except for Acer, and they seem to be on a roll…

Lets flash way back to the first time I was unfortunate enough to purchase an Acer computer. I bought a new mid-end desktop last year, complete with Windows Vista. Since Windows 7 had already been released for Beta testing, and was scheduled for release in less than a month, Acer guaranteed a free copy of Windows 7 for anyone who purchased a new machine for a limited time. I met all the requirements necessary to be eligible for my free copy of 7. When I finally went to redeem it, it was not meant to be (no surprises here).

When I went to register online to have the CD sent directly to me, my model number was not included on the list of eligible computers, and “was not eligible to receive my copy”. It was stated that all computers shipped with Vista premium were eligible… yes, that means me. After a few calls to Acer I was flatly told “no, you do not qualify” (even though I met every single requirement). When I explained this to them, they did not really listen. Many emails later, I had came to the conclusion that no one at Acer had even the slightest clue. I only have a limited supply of time and energy and I prefer to not waste it chasing after Acer all day. I still have not gotten my copy of Windows 7

Flash forward one year. I just purchased a new Netbook. I made the mistake (against my better judgment) to purchase another Acer. Of course Acer couldn’t help themselves and had to screw up yet again. It came preloaded with Windows 7 (how ironic) and I decided to dual boot it with Arch Linux. After partially completing the setup, the time came to partition my hard drive. The partition manager, cfdisk would not even look at it: Overlapping Partitions. You have got to be kidding me. So I searched this issue. After reading a few threads, this problem started to smell slightly fishy. The more I searched, the more strange this got. I have a feeling (just a feeling) that some clever developer overlapped the partitions slightly (probably a few kilobytes) in order to prevent me from installing Linux on it. That’s what I like to call TERRIBLE. I purchased this computer, I can put whatever OS I like on it. Apparently not. I eventually ended up settling for Ubuntu, whose GUI partition manager did not complain about the strange partitions. That’s the end of my rant, how does it feel that I did succeed in installing Linux on my Netbook Acer? By the way, I am still waiting for my copy of Windows 7.

IronKey Personal 1 Gigabyte Flash Drive Review

Today, I just received my new IronKey USB flash drive. I have been looking at this flash drive for a while and I finally decided to purchase one. For those of you who have not heard of the IronKey before, it is a super rugged, super secure USB drive. I won’t go into detail about all the features here, as they are all available on the IronKey website. I have also included some pictures with this review, as there are not too many good pictures of this device on the web. After unboxing the IronKey and trying it out for a couple of days, I have nothing but good things to say about it. It feels excellent, not like your typical USB drive. Very, very solid. The inside of the cap is rubber coated which allows it to slide on and off very nicely. It definitely does not feel like your normal Chinatown flash drive.

The performance is also excellent. The read/write speed of this drive is a blazing fast 27mbp/s read and 24 mbp/s write. WOW. The drive is also waterproof to military standards. It will most likely never get it wet, but it’s always good to know you have that protection. The interface is also very nice and the drive set up quickly and without a hitch (it has to generate the encryption keys the first time you use it). My favourite feature of this drive has to be the portable, secure FireFox. While a little slow, it encrypts your connections and allows you to browse anonymously. It also includes a virtual keyboard, a great tool against keyloggers. This will become very useful on public computers (school, library, etc).

The IornKey is supported on Windows, Mac and of course Linux – how can you go wrong with that! I think the IronKey software beats truecrypt, as you do not have to have administrator privileges on the computer you are using it with. My only concern, is that since the decrypting program is a .exe file, it will not be able to run on computers controlled by an over zealous IT department (Example: my school). I will have to test that. The same issue also applies to the on board FireFox. Apart from that, I love this flash drive, it is secure, rugged and looks great. What more can I ask for?

On another unrelated side note, What the hell happened to Google Docs!? C’mon Google, what are you doing? It seems every time I sign in to type something up, Docs has somehow changed. Mostly for the best, but today for the worse. This is the most unintuitive interface I have ever seen (except for iTunes maybe, but that’s another story). I like Google Docs because it is simple, but now I might as well be using Word.



Copyright © 2012. All rights reserved.

RSS Feed. This blog is proudly powered by Wordpress and uses Modern Clix, a theme by Rodrigo Galindez.