Friday, March 11, 2011

Headplosion

Pictures are worth a thousand words here, needless to say, a new head is going on this weekend!  (Luckily, the cylinder wall is perfectly fine and the piston top just needs a little grinding to smooth out.)





Update:  Yay, new head in and running great:


Thursday, February 3, 2011

CLEAR - CLEARly Dissapointing

Tired of constant outages with my current ISP, I chose one of the few alternatives available - CLEAR.  CLEAR is a purely wireless high speed internet service that provides both internet service and home phone service.  I opted for the internet/phone bundle.  I ordered the service on Thursday and was very excited to receive my equipment via FedEx the next day.  Setup couldn't have been any easier, since the service is wireless I just had to position the CLEAR modem/router to get the best signal.  (I'm right between two CLEAR towers, so getting 4-5 bars of signal hasn't been a problem, even in heavy rain.)  For the first week, I couldn't have been happier with the service (actually, just the first 5 days.)  Apparently I hit their usage threshold after 5 days which resulted in my speeds being throttled to about 30-250kbps (yes, slower than a modem at times...)  I logged in to the customer portal and saw that I had only used about 8 Gb of data during that time.  That's not a lot these days with Netflix, Hulu Plus, etc.  Luckily I'm still within my 14-day return period so I'm definitely cancelling my CLEAR service and sending the equipment back.  It's a shame really, because the experience had been so positive up until the point I hit their data cap or whatever they call it.

UPDATE 2011-02-10:  Last friday (Feb 4,) I called to cancel the service.  The rep said she would "reset my account and equipment" and extend my 14 day trial period by 7 more days.  I decided to give it another try.  It's been fine since, but I am just now reaching the 8-9GB usage since the account reset, so the big test will be if things work well over this weekend.

UPDATE 2011-02-19:  I wound up cancelling the service a few days ago and sending everything back. After the account reset, the service worked fine for a few days then slowed to a crawl again.

Monday, December 27, 2010

See USB/SD Card Files on CR-48 Chrome OS Laptop

One of the first things I tried when I received my CR-48 laptop from Google was to pop in a SD card and try to send a jpeg image via Gmail.  This didn't work at all since Chrome OS doesn't support that functionality (yet.)  I did manage to find a work-around though.  First, the CR-48 must be put in developer mode by removing the piece of black tape next to the battery connector and flipping the switch under that tape.  (When you do this, the CR-48 will re-initialize on your first boot after you flip the switch which will take about 20 or so minutes.  Also, you will have to hit CTRL-D every time you boot the CR-48 to bypass the error screen that you get when the machine is in developer mode.)  Now, do the following to allow easy access to USB drives or SD Cards from the Chrome OS file picker (the one that comes up when you need to upload a file via a web page.)

1.  Enter "about:flags" (without the quotes) in the Chrome address bar.
2.  Enable the "Advanced File System" experimental feature.  (This will require a Chrome restart.)
3.  Open a terminal on the CR-48 by entering the CTRL-ALT-t key sequence.
4.  At the crosh command prompt, type in "shell" (without the quotes) to get a bash shell.
5.  Enter the command "cd /home/chronos/user/Downloads/" (without the quotes.)
6.  Enter the command "ln -s /media" (without the quotes.)
7.  Use the ALT-TAB key sequence or the window switcher button to return to Chrome.

That's it - now if you plug in a SD Card or USB drive, you can now attach a file to Gmail (or upload via any other web form) by choosing the "File Shelf" directory which will now let you go to Downloads->Media where you will see your SD Card or USB device mounted.  This seems to work well for most USB storage devices/SD cards, but it appears that Chrome OS will only find the first partition on such devices.  (It even came in handy for uploading the picture for this post!)

Saturday, August 21, 2010

PHP Script for Adding Entries to ConnectBot

Here's a quick little script that lets you add entries via a PHP script to your ConnectBot Android application.  This really helps if you are like me and have over 50 hosts that you want to add.  Using this is easier if you have root, but it is still possible to use even if you don't have root.  First you'll have to either hardcode your connections into the connection_entries array in the script, or modify the script to load your entries rom a csv, database, etc.  For best results, make sure ConnectBot isn't running when you update the hosts database or your changes might not be saved.  The Connectbot hosts database has the following columns:
  • username
    • Self explanatory, your username on the host.
  • port
    • 22 for ssh, etc.
  • hostkeyalgo
    • ssh-rsa, ssh-dsa, etc.
  • color
    • Row color for this new entry (different colors don't seem to work to well when you have a large number of hosts though.)
  • usekeys
    • true or false based on whether you are using a ssh key to login or a password.
  • use authagent
    • yes or no based on whether or not you want to enable the auth agent forwarding (yes, strange it isn't true/false also.)
  • pubkeyid
    • integer representing the key from "Manage Pubkeys" (if any) - is in the same order as the keys are displayed in "Manage Pubkeys", starting with 1.
  • delkey
    • 'del' or other key to use as delete key.
  • fontsize
    • 10 or other integer.
  • wantsession
    • true unless you are using this entry for port forwarding.
  • compression
    • false (use true if you are on a slow network.)
  • encoding
    • 'UTF-8' or any of the others supported by ConnectBot.
  • stayconnected
    • 0 or 1 based on if you want ConnectBot to attempt to reconnect when disconnected.
Instructions with root:
  • Run "php connectbot_hosts_update.php get hosts" to retrieve the ConnectBot connections database.  (Must have adb.)
  • Run "php connectbot_hosts_update.php view hosts" to view the existing connection entries.
  • Make a backup of the hosts file :-).
  • Run "php connectbot_hosts_update.php update hosts" to update the database.
  • Run "php connectbot_hosts_update.php put hosts" to add the new entries to Connectbot.  (Must have adb.)
Instructions without root:
  • Via terminal on Android device or adb, run the command "cat /data/data/org.connectbot/databases/hosts > /sdcard/hosts" then "adb pull /sdcard/hosts hosts".
  • Run "php connectbot_hosts_update.php view hosts" to view the existing connection entries.
  • Make a backup of the hosts file :-).
  • Run "php connectbot_hosts_update.php update hosts" to update the database.
  •  Run the command "adb push hosts /sdcard/hosts" then (via terminal on Android device or adb,) run the command "cat /sdcard/hosts > /data/data/org.connectbot/databases/hosts".
OK, if that hasn't scared you off yet, then here's the code!

#
# connectbot_hosts.php - manage connectbot hosts from PHP
#
# 2010 - Alex Shillington
#
# Note: doesn't support port forwards (yet)

$action     = $argv[1];
$dbfile     = $argv[2];

if ($action == 'view' && $dbfile != '') {
    viewData($dbfile);
} else if ($action == 'update' && $dbfile != '') {
    updateData($dbfile);
} else if ($action == 'get') {
    getHosts($dbfile);
} else if ($action == 'put' && $dbfile != '') {
    putHosts($dbfile);
} else {
    print "Usage:\nphp connectbot_hosts.php view|update|get|put HOST_DBFILE\n";
    print "(HOST_DBFILE will default to 'hosts' if not specified for get and put options.)\n";
}

function updateData($dbfile) {
    # change defaults as desired (view existing database to see current values)
    $defaults = array(
        'username'       => 'myusername',
        'port'           => '22',
        'hostkeyalgo'    => 'ssh-rsa',
        'color'          => 'gray',
        'usekeys'        => 'true',
        'useauthagent'   => 'no',
        'pubkeyid'       => '1', #note: this is in the same order as they are displayed in "Manage Pubkeys", starting with 1
        'delkey'         => 'del',
        'fontsize'       => 10,
        'wantsession'    => 'true',
        'compression'    => 'false',
        'encoding'       => 'UTF-8',
        'stayconnected'  => 0
    );

    $entries = array();

    # define connection entries
    $connection_entries = array();
    $connection_entries[] = array('username'=>'alex','nickname'=>'server1_remote','hostname'=>'server1.example.com','port'=>22,'pubkeyid'=>3);
    $connection_entries[] = array('username'=>'alex','nickname'=>'server1_local','hostname'=>'10.0.0.9','port'=>22,'pubkeyid'=>3);
    # etc...

    # add any other code here that you want to add to connection_entries array from other csv files, db, etc.
    # ...

    # populate entries from connection_entries and default entry values
    foreach ($connection_entries as $connection) {
        $entry = $defaults;
        foreach ($connection as $var=>$val) {
            $entry[$var] = $val;
        }
        $entries[] = $entry;
    }

    # connect to hosts db
    $dbh = connect($dbfile);

    # add entries to hosts db
    foreach ($entries as $entry) {
        $sql = "SELECT _id,hostname FROM hosts WHERE nickname = '{$entry['nickname']}'";
        if ($sth = $dbh->query($sql)) {
            $results = $sth->fetchAll(PDO::FETCH_ASSOC);
            $_id = $results[0]['_id'];
            # overwrite existing entry with same nickname
            if ($_id != '' || $entry['force'] == 1) {
                $sql = "DELETE FROM hosts WHERE _id = $_id";
                try {
                    $dbh->exec($sql);
                } catch(Exception $e) {
                    print "ERROR: " . $e->getMessage() . "\n$sql\n";
                }
            }
            $sql = "SELECT _id,hostname FROM hosts WHERE hostname = '{$entry['hostname']}'";
            if ($sth = $dbh->query($sql)) {
                $results = $sth->fetchAll(PDO::FETCH_ASSOC);
                $_id = $results[0]['_id'];
                if ($_id != '' || $entry['force'] == 1) {
                    $sql = "DELETE FROM hosts WHERE _id = $_id";
                    try {
                        $dbh->exec($sql);
                    } catch(Exception $e) {
                        print "ERROR: " . $e->getMessage() . "\n$sql\n";
                    }
                }
                if ($_id == '' || $entry['force'] == 1) {
                    print "{$entry['nickname']} is new {$entry['hostname']}\n";
                    $keystring = implode(',',array_keys($entry));
                    foreach ($entry as $key=>$val) {
                        $entry[$key] = "'" . sqlite_escape_string($val) . "'";
                    }
                    $valstring = implode(',',array_values($entry));
                    $sql = "INSERT INTO hosts ($keystring) VALUES ($valstring)";
                    try {
                        $dbh->exec($sql);
                    } catch(Exception $e) {
                        print "ERROR: " . $e->getMessage() . "\n$sql\n";
                    }
                } else {
                    print "{$entry['nickname']} is new {$entry['hostname']}, but has an existing entry with a different nickname - not adding\n";
                }
            }
        } else {
            print "Error in query:\n$sql\n";
        }
    }
    $dbh = null;

}

function viewData($dbfile) {
    $dbh = connect($dbfile);
    $sql = "SELECT * FROM hosts";
    if ($sth = $dbh->query($sql)) {
        $results = $sth->fetchAll(PDO::FETCH_ASSOC);
        print implode(',',array_keys($results[0])) . "\n";
        foreach ($results as $result) {
            print implode(',',$result) . "\n";
        }
    } else {
        print "error reading from hosts db $dbfile\n";
    }
    $dbh = null;
}

function connect($dbfile) {
    try {
        $dbh = new PDO("sqlite:$dbfile");
    } catch(Exception $e) {
        print "ERROR: " . $e->getMessage() . "\n";
        exit;
    }
    return $dbh;
}

function getHosts($dbfile = 'hosts') {
    if (!`./adb pull /data/data/org.connectbot/databases/hosts ./$dbfile`) {
        print "sorry, you need root to get the hosts file that way\n";
        print "try this from a script instead:\n";
        print "cat /data/data/org.connectbot/databases/hosts > /sdcard/hosts\n";
        print "then adb pull that file\n";
    }
}

function putHosts ($dbfile = 'hosts') {
    if (!`./adb push $dbfile /data/data/org.connectbot/databases/hosts`) {
        print "sorry, you need root to push that way\n";
        print "instead, push $dbfile to /sdcard/hosts then:\n";
        print "cat /sdcard/hosts > /data/data/org.connectbot/databases/hosts\n";
    }
    print "\nIf connectbot is running, don't save any config changes once you've pushed the new hosts database.  Also, you might need to kill connectbot or restart the phone to see the new hosts.\n";
}

?>

Friday, August 13, 2010

Tethering Saves the Day!

Wow, got server updates to do tonight and a storm knocks out our phone and DSL...  Tethering to the rescue!  (In my case, android-wifi-tether - http://code.google.com/p/android-wifi-tether/)  Definitely a must have whether it's a 3rd party app like this one, or one that comes with your phone from the carrier (at extra cost.)

Tuesday, July 27, 2010

Nice New Battery Charger From Apple

Here's a nice little new product from Apple today that you might have missed amongst the other, bigger updates:


Nice, slim AA battery charger that comes with 6 rechargeable AA batteries - not a bad deal!

Monday, July 26, 2010

Quick Volvo A/C Fix

From the quick and dirty hack dept... Many 7xx/9xx Volvos experience the "Fan slows down when accelerating" issue.  What is really happening is not that the fan is slowing down, but that the vacuum servos that control the flaps start leaking.  Since there is little to no vacuum available while accelerating, these cars use a check-valve to ensure that the vacuum available to the climate control vacuum solenoids doesn't leak back out to the manifold during acceleration.  Assuming that the one-way check valve (mounted on the firewall) checks out OK, the most likely culprit is a leaking vacuum servo.  These are located under the dashboard on the drivers side (plus a hard to access one for recirc behind the glove box.)  These are easy to test with a hand-held vacuum pump and gauge.  If the servo doesn't hold vacuum, it's bad.  The one that went bad on mine was the servo with the "double" diaphragm - the only one that has 2 vacuum hoses attached.  This had a orange vacuum hose attached to the side and a blue vacuum hose on top.  The diaphragm that the orange hose connected to was the one that was bad on mine.  All I had to do was plug the hose with a rubber plug, and I'm a happy (and much cooler) camper in this heat.  I did lose the "floor only" fan setting (can only get floor + defrost now,) but for me, that is much better than attempting the extremely labor-intensive operation to replace the vacuum servo.  (Either via the "proper" way that involves removing basically the entire dash, or the "quick" way here: http://www.swedishbricks.net/700900FAQ/Heating-Vacuum%20Servo%20Replacement.htm#Replacing%20Vacuum%20Serhttp://www.swedishbricks.net/700900FAQ/Heating-Vacuum%20Servo%20Replacement.htm#Replacing%20Vacuum%20Servos%20in%20ACC-Equippe%20700/900vos%20in%20ACC-Equipped%20700/900 )  Here's a picture of this quick fix:

...then I just stuck the vacuum line back on the tab on the servo to keep it in place:

Not bad for free and about 30 minutes of testing/removing & replacing panels!