Thursday, December 31, 2009

Learning Guitar

Recently I've begun listening to the blues again.

I've always had a liking for the blues ever since I first saw The Blues Brothers, which was when I was around 13. In the beginning I only ever watched the car chases, but slowly I saw the rest of the movie and realized I liked the music better. The car chases are epic, but something about the music drew me in. It is now one of my favorite movies, and I am planning a trip to visit most of the filming locations, but that's a different story.

I've spent a lot of time in the car listening to B.B. King's Bluesville on XM radio, and even more time on Pandora listening to the blues. My interest hasn't always been steady, but I always seem to come back to it. There is something about it that makes me feel at home.

The fall semester of college has ended, and I am back at home. Suddenly I've found my self listening once again, but this time something was different. Something about it felt more appealing. As I thought about it more, it hit me: I want to learn to play the blues.

That thought hit me pretty hard. I've had little experience with making music, and none turned out well. The closest I've come is trying violin way back in elementary school, but I was terrible and didn't enjoy it.

What if my heart was in it? Could I learn play the blues? And where do I begin?

Those are the thoughts that have been racing through my head. One thing is certain though; I need to get a guitar. That opens a whole other can of worms. Acoustic or electric? What brand and model? Where do I buy it from? How much will it cost? Add to this the fact I need to learn to play it and I have a confusing mess.

As of now, I think I've decided to get an acoustic, but no particular brand or model yet (suggestions?). But other thoughts are going through my mind as well. Why do I want to learn to play? Will I be able to handle other people listening to me play?

After talking with a friend for a while, I think I'm starting to see me playing guitar as a way to express myself. I'm not sure if thats true yet, but it feels right as of now. As for people listening to me, I guess I will have to get used to it if I really want to learn. Putting all this aside, I have a desire to just get my hands on a guitar and start strumming.

Within the next few days I will go out exploring music shops and playing with some guitars. I have no idea what I'm looking for yet, but I am very excited to get started. If you have any tips on guitar buying or getting started playing, I would love to hear from you!

Saturday, March 14, 2009

Technological Marvels

You know what's always impressed me? How much storage space we have, and at such a small spacial cost. I found 3 great examples of this.

First, an old IDE harddisk I had lying around.

Date: 1998 (11 years)
Storage capacity: 3.2GB
Size: 2.5cm x 10.1cm x 14.5cm = 366.125cm^3
Storage density: 366.125 / 3.2 = 144.41cm^3/GB

This anchient machine was manufactured in 1998, and has less space than some thumb drives. Scary, isn't it? Plus this thing needs an external 12v power supply, and has an IDE interface.

Next, a Sony Micro Vault Tiny

Date: ~2006 (~3 years)
Storage capacity: 1GB
Size: 0.2cm x 1.4cm x 3.2cm = 0.896cm^3
Storage density: 0.896 / 1 = 0.896cm^3/GB

Speaking of thumb drives, heres a fully functional USB thumb drive. Even though it has only ~1/3 the space of the IDE drive, it is also an amazing 408.7 times smaller. Hmmm...

Last, a MicroSD card

Date: 2008 (1 year or less)
Storage capacity: 2GB
Size: 0.1cm x 1.5cm x 1.1cm = 0.165cm^3
Storage density: 0.165 / 2 = 0.0825cm^3/GB

I got this with the purchase of my phone in December. This tiny wonder has 2GB of space, in a very tiny package. Its over 5 times smaller than the thumb drive, and has over 10 times the storage density.

Just to give you some ideas, if the IDE drive had the same storage density as the USB drive, it could store 403.6GB of data. And if it had the storage density of the MicroSD card? 4437.9GB, or 4.3TB of data.

Monday, February 23, 2009

Using the Archos 605 browser without the plugin

I've owned an Archos 605 Wifi for several years, but have always been bugged that you need to buy plugins for such things as playing some file formats, and the web browser. The cinema plugins cost ~$20, while the broswer plugin costs the most at $30. I've been avoiding needing the cinema plugins by re-encoding my videos into a valid format, but I've been stuck for a way to get a working browser.

You can purchase these plugins either on your computer and install them onto the device, or you can buy them right on the device. To do that, you have to connect to a wireless network, then access the archos store through one of many links in the device's firmware.

The device opens the store, using opera...the browser you supposedly have to buy a plugin for. I've never actually seen a device with the browser plugin, so I don't know what kind of functionality you get with it, but if you can live without such things as bookmarks the built in browser seems fully functional. The trick is, Archos only allows you to visit certain pages (the archos store, several video pages specifically designed for the device), and these don't allow you to visit any other pages besides themselves. Also, the URL bar is missing. Essentially, you are stuck with these pages unless you buy the plugin.

To break out of this, I had to find a way to redirect traffic the device makes from to somewhere else, perhaps my own webserver. I had previously read a page that showed how to prank your neighbors who connect to your wireless network by flipping all their pictures on websites upside-down, or by directing all their traffic to using iptables. Since my router is running dd-wrt, I can enter iptable commands directly into the firmware to achieve the same results.

I started by researching iptable commands, and found a page right on the dd-wrt website which demonstrated a list of commands. I wrote a single command to redirect traffic to my own personal webserver,

iptables -t nat -I PREROUTING -p tcp -d -s
-j DNAT --to

(note: is the ip my archos gets on my personal network, is/was the ip of my webserver)

Success! Any time I tried to go to the archos store, I ended up at a 404 page on my server.

The next step was to figure out what document the archos is trying to access when it connects. Apparently the starting page is I mimicked this on my server, and had a new homepage for my archos.

Next step was to solve the problem of not having an address bar. I added a simple form, and used javascript to load the page you enter. Problem solved. Check out the source for my page if you're interested:

I now have a "fully" functional Opera browser, which I can actually access other webages with. Time to see what this thing can do.

First, YouTube: Fail. Apparently flash is not enabled in the built in browser, or without the plugin.

Next, Facebook: Partial Pass, It worked, but terribly slow.

How about the Acid 2 and 3 tests?

Acid 2: Full pass! Surprising, but it is Opera after all.

Acid 3: Fail, as the test so kindy told me.

A few other pages showed this browser isn't too bad. One thing that interested me was the "home" button on the right. This button used to take you to the archos content portal, where you could read news or watch videos. However, it stopped working after my iptables redirect.

After checking my webserver's access log, I saw the device is also trying to access a seperate xml file in addition to redirect.html. Apparently the "home" button is setup by the xml document, which allows me direct it anywhere I please.

The redirect page was even more interesting. It loads a javascript document, This code accesses what seems to be an archos specific javascript object, and allows you to read data from the device, including firmware version, remaining space, language and country. I've made a proof of concept html page to demo this: This page does nothing harmful to your device, but feel free to look at the source on your computer before loading it on your own device. If you apply this hack as shown, this is the page which will load when you click on the "home" button.

Among other things I have tried with this browser, I am able to upload any file in the filesystem, assuming I know its full path. Maybe this can be useful for further hacking, who knows. I am interested in hearing from people who do have the browser plugin, and knowing whats different from what I've done. Also if you get this working too, let me know!

Wednesday, February 18, 2009

Auto-pausing Virtual Machine

I've been using VirtualBox for a while to run Windows-only programs without restarting into one of my Windows installs. Lately I've been playing games (especially NES) in the virtual machine, with a result of high CPU usage, and plenty of heat.

I've started scaling back my CPU to half speed while using the virtual machine which solved the heat problem, but I was still at a loss about the CPU usage. I knew I could pause the machine when I'm not using it, but there are plenty of times where I go do other things and forget. I decided to find a way to make it automatically pause.

The best way I could think of to detect when I'm not using the virtual machine was to use the screen saver in Windows. A simple test confirmed it was possible to run any exe as a screen saver. I have directories from my host machine mounted inside Windows, so with a simple C program I could edit (or create) a file on my host machine that signals I'm not using the machine.

The next part is to make some kind of script check the file on a regular basis and pause the machine when needed. This script should also only run when the machine is running.

First the C code:

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
FILE *outfile;

outfile = fopen("G:/virtual_box_pause.txt", "w");
if (NULL == outfile)
printf("ERROR: Cannot open (output) file)\n");

fputc('1', outfile);
fputc('\n', outfile);



This code writes a "1" into a file on the host machine, "virtual_box_pause.txt" when run. I compiled the code, renamed it with a .scr extension, and installed. That was step one.

Step two, a perl script to monitor the same file for changes:

use warnings;
use strict;

print "CPU scaling to 1.6GHz\n";
`cpufreq-selector -f 1600000`;

print "Starting Windows XP\n";
`VBoxManage startvm "Windows XP"`;

sleep 20;
my $state = `VBoxManage showvminfo "Windows XP" | grep State`;

print "Monitoring for paused state\n";

while ( !($state =~ /saved/) )
open PAUSE, "<", "~/virtual_box_pause.txt"; my $pause_value = <PAUSE>;
close PAUSE;
chomp $pause_value;

if ($pause_value == 1)
`VBoxManage controlvm "Windows XP" pause`;
open PAUSE, ">", "~/virtual_box_pause.txt";
print localtime() . " Pause command Sent\n";
print PAUSE "0";
close PAUSE;

sleep 5;
$state = `VBoxManage showvminfo "Windows XP" | grep State`;

print "Virtual machine no longer running\n";
print "CPU scaling to OnDemand\n";
`cpufreq-selector -g OnDemand`;

print "Exiting\n";

This code automatically scales back the CPU, watches to see if I shut down the machine, and pauses when need. When I shut down the machine, it brings the CPU back to regular speed before exiting.

After making these, I simply had to run the perl script when ever I wanted to use windows. I made a launcher on my desktop to do just that:

gnome-terminal -t "Windows XP" -x ~/

Now I have a virtual machine which automatically pauses when not in use. To adjust the time delay, simply adjust your screen saver settings.

First post

Hey everybody. I finally decided to make a blog! I'm gonna mix computers with anything else I feel like throwing up. I'll put up ideas and projects I'm working on. Feel free to comment or help out!