Thursday, April 14, 2011

Direct network connection to APC PDU's

Some of this information is scattered around the web, but I thought I'd put in all in one place.

In order to schedule an event on the PDU's, one has to use the web interface -- this functionality is not replicated in the serial interface.  First, I set the PDU's to request addresses on via DHCP via the serial interface, though I didn't test if that was necessary.

To connect (in my case, a MacBook) directly to the ethernet port on a PDU, one has to run a DHCP server on the laptop.  You'll need to set the ethernet port to a static IP address, in this case something along the lines of 'ifconfig en0 192.168.1.1/24'.

First, download the DHCP server source from ISC: http://www.isc.org/software/dhcp  Do the usual './configure'.  There is a compile error at this time requiring editing 'dhcpctl/Makefile' to remove the -Werror from the CFLAGS macro.  Then one can 'make'.  Do not 'make install' as it will overwrite your DHCP client config.  Instead, cd to each of server, dhcpctl, and opamip, and do 'sudo make install' in each.  The APC PDU's require a very specific portion of the reply; use the following /etc/dhcpd.conf
option vendor-encapsulated-options 01:04:31:41:50:43;

subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.150 192.168.1.200;
    default-lease-time 300000;
    max-lease-time 350000;
}

Run 'sudo /usr/local/sbin/dhcpd -d en0' and watch for the DHCP requests and responses.  You will see a lease given out; point your browser to that IP address.

Monday, April 4, 2011

Linux external USB hard drive

It appears a well-known problem that when an external USB hard drive sleeps to save power, Linux becomes very confused.  I tried modifying the drive's settings to no avail.  My cheesy answer is to not let the drive sleep using a cron job.  Do "sudo crontab -e" and put a line like:
0,10,20,30,40,50 * * * * echo "junk" > /mnt/steve/keepawake
in the crontab, with the correct path to the file on your machine of course.  You don't have to be root of course, if you have permissions to write to a partition on the drive.

Wednesday, March 30, 2011

Adjusting band on Rado ceramic watch

I didn't find any instructions on the web on how to do this, so here are some. It wasn't obvious to me at first, but in the end, there really is only one thing to do: remove the one visible pin near the clasp:
I recommend you take pictures, just like I did...  Once the pin (well, pins if you adjust both sides) is/are removed, one can  slide the outer link off the inner link:
Note that there are two sizes of outer and inner links; keep track in order to put them back correctly.
One has to allow the inner links to bend over in order to remove the outer links.
Here's a picture illustrating the different sized inner and outer links.  Assembly is the reverse as they say.  All in all, a clever system.

Friday, February 18, 2011

7 +- 2

The issue with computer science (well, and all other engineering disciplines) is complexity.  We can't deal with how complex our "artifacts" are.  Our brains are built with a working memory size of about seven objects.  Maybe hunting parties, or family sizes, were seven?  Using any more of our brains to track more things was a waste and would lead to a loss of efficiency?  Is this why telephone number are seven digits long?  Don't know.  What I do know is that once something we're looking at has more than seven objects, we are incapable of understanding it.  More than seven visible variables, nesting levels, etc., and we can't understand what we're looking at.  Hence functional decomposition and object-oriented programming.  Most people whom claim to do OO, don't, but that's a post for another day.  For today, check out http://coloradmin.com/circle.html for a visual demonstration of the property.  Most people can only count to 7 (+-2) without having to "chunk" (group and then count).  See: http://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two for a more rigorous treatment of this.

Tuesday, February 8, 2011

dd surprise

I was testing the speed of external USB harddrives and ran across something that surprised me.  I have assumed for a while that increasing the block size while doing a dd improved throughput but I tested anyway, and it didn't.  Here are the figures for not specifying block size, and then using 500k, 1m, and 500m:
 10,460,172 bytes/sec
 10,385,009 bytes/sec bs=500k
 10,529,657 bytes/sec bs=1m
  9,573,095 bytes/sec bs=500m
Looking at the overall speed of USB 2 (it's 480Mbps or 62,914,560 bytes/sec), it appears that it's USB that is the limit in this case.  We're getting not quite 20% of theoretical.  This on a MacBook Pro running Snow Leopard.

Tuesday, February 1, 2011

Applescripting notes

I wish i had more time to learn about Applescript as there are a bunch of things i'd like to do with it...  One thing i've done is create this small script to unmount volumes and put my MacBook Pro to sleep:
tell application "Finder"
    eject (every disk whose ejectable is true)
    sleep
end tell
I have a Hendge dock for it (http://www.hengedocks.com/) to save all the plugging and unplugging, but at the end of the day, i wanted something to unmount and sleep.
So, run the AppleScript Editor and develop or paste what you want.  Click "Compile".  Do a "Save As" and save it to your home directory's Library/Scripts directory with a name such as "Eject and Sleep".
Then, you can also map a key to it: System Preferences, Keyboard, Keyboard Shortcuts.  Choose Application Shortcuts, click '+'.  Choose All Applications, Menu Title: Eject and Sleep, or whatever you typed before, and end the key combination you'd like...
Another thing one can map are "Services" on object such as directories.  So, if you can left click on a folder and there is something listed under Services, you can create a keyboard shortcut for it.  Here are two images demonstrating that.