Sunday, July 22, 2012

Howard Miller Accuwave DS Manual

Here's an operating manual for a Howard Miller Accuwave DS "radio-controlled" clock.

Of particular note is the fact that the device does not work very well in California. As such, you must be patient to set these clocks manually -- they seem to need to "struggle" for an hour or so before you can manually adjust them.

Update 3/13/2014: Since the daylight savings time switch, my clock reset itself about four times, frequently setting itself 20 minutes behind the correct time. I determined that the issue was caused by a low battery.




A great way of shrinking image-heavy PDF files

I recently had to cut a huge PDF file down to a reasonable size; the images that were included in the original document were huge. I found the following GhostScript commands to be very helpful. They downsample the images without changing any of the associated text.

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -sOutputFile=output.pdf -f input.pdf

One can get images to be smaller with a few tweaks:

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dDownsampleColorImages=true -dColorImageDownsampleType=/Average -dColorImageDownsampleThreshold=1.0 -dColorImageResolution=36 -sOutputFile=output_smaller.pdf -f input.pdf
 UPDATE: For e-ink readers, often times, color images are a waste. Here's a way to convert color to grayscale (greyscale?):
gs -q -dNOPAUSE -dBATCH -sOutputFile=grayscale.pdf -sDEVICE=pdfwrite -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray -dCompatibilityLevel=1.4 -f color.pdf

Saturday, July 21, 2012

Beer Review: New Belgium La Folie Sour Brown

I'm a fan of sour beers. I find them to be exceptionally easy to drink; they settle my stomach and leave me feeling relaxed and very comfortable. That stated, I had some La Folie at Lucky Baldwin's last night, and I was extremely impressed. The flavor evolves from a pungent sweet-sour cherry, and then mellows on the palate to form a creamy, rich, nutty aftertaste that lingers deliciously. I think this beer is probably the best offering that I have sampled from New Belgium -- even better than their excellent 1554. Find it on tap at Lucky Baldwin's in Old Town Pasadena!

Tuesday, July 17, 2012

LibreOffice's "Automatic" text color isn't black in Ubuntu 12.04 Precise!

After using Ubuntu 12.04 Precise Pangolin for some time, I noticed that one of the applications that I use all of the time -- LibreOffice -- was not using black (#000000) as the "Automatic" (default) text colour for new documents that I created. This is extremely annoying because I like to copy and paste text into documents and use the "Clear Formatting" feature. Unfortunately, this causes the text to revert to a light grey (gray) colour: #3C3C3C. Yuck!

There is a solution, however. Benjamin Drung (bdrung) wrote Ambiance," and change the default colour to black. To fix the problem:

  1. Open the gtk theme for Ambiance
    (/usr/share/themes/Ambiance/gtk-2.0/gtkrc)
  2. Search for ntext_color
  3. Replace #3C3C3C with #000000
Re-load LibreOffice; problem solved.

Why LibreOffice uses the GTK theme system to determine its "Automatic" colour is beyond me; this seems like a very irritating "feature."

Wednesday, May 16, 2012

Dynamic DNS update Python script, for use with a home gateway device

I use the free ZoneEdit service to keep a dynamic DNS entry up-to-date. I also now use a Netgear WNDR4000 wireless router to connect to the Internet through my cable modem.

I have authored a script that uses HTTP basic authentication to grab the IP address from my router, compare it to the last polled IP address, and update ZoneEdit with the new IP if it has changed. I have this script set to run every minute.

#!/usr/local/bin/python

import urllib2, re, tempfile, os

# User variables - change these to fit your router
debug=False

router_user=""
router_passwd=""
router_webpage="http://192.168.0.254/RST_st_dhcp.htm"

zoneedit_user=""
zoneedit_passwd=''
zoneedit_host=""

# Returns a string containing webpage contents
def fetch_webpage(location, username, password):
  passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
  passman.add_password(None, location, username, password)
  authhandler = urllib2.HTTPBasicAuthHandler(passman)
  opener = urllib2.build_opener(authhandler)
  urllib2.install_opener(opener)
  return urllib2.urlopen(location).read()


s=fetch_webpage(router_webpage, router_user, router_passwd)
pattern = re.compile("IP Address.*?([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})", re.DOTALL)
m = pattern.search(s)
newip = m.group(1)
if debug: print "Current IP Address: " + newip

filename = tempfile.gettempdir() + "/router_ip"
flags = "r+"
if not os.path.exists(filename):
  flags = "w+"
f = open(filename, flags)

oldip = f.read().strip()

if (cmp(oldip,newip) == 0):
  if debug: print "Old IP is the same (" + oldip + ")"

else:
  web_result = fetch_webpage('https://dynamic.zoneedit.com/auth/dynamic.html?host='+zoneedit_host, zoneedit_user, zoneedit_passwd)
  if debug: print web_result

  f.seek(0)
  f.write(newip)

Monday, February 6, 2012

Make your GeForce GT 520 (or any Nvidia) video card sip power

I recently acquired an HP ProLiant Microserver N40L to replace my old giant mid-tower RAID box. Now that FreeBSD 9.0-RELEASE has integrated ZFS v28 for several months, I decided to migrate away from OpenIndiana 151a and enjoy FreeBSD's Linux binary compatibility, more up-to-date software selection, and a broader install base.

I imported my GeForce GT 520 video card into my new ProLiant microserver. The video card can be adapted to a "low profile" PCI slot by replacing the bracket in the front of the card. I disconnected the card's fan because it was loud, annoying, and making the dreaded "my bearings are out" screeeeeeeeching noise.

The GT 520 supports two digital monitors -- one connected via HDMI, and one via DVI. After enabling the commercially supported 'nvidia' driver by adding nvidia_load="YES" to /boot/loader.conf and generating a suitable xorg.conf file by running nvidia-xconfig, I was able to run nvidia-settings and watched my card idle at 85 degrees C. My power meter measured my system's idle consumption in X11 to be 80 watts. I also noticed that the PowerMizer showed that my card was operating at the maximum performance level.

After a bit of research, I discovered how to force the card into low-power mode. I added the following boldfaced lines into my /etc/X11/xorg.conf file:

Section "Device"
  Identifier     "Device0"
  Driver         "nvidia"
  VendorName     "NVIDIA Corporation"
  BoardName      "GeForce GT 520"
  Option  "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerDefaultAC=0x3"
EndSection
This tells the card to enable PowerMizer; 0x2222 stands for "fixed frequency on battery and on AC" (byte 0x22 is for fixed frequency, 0x33 is for adaptive frequency, MSB is for battery), and the default power profile on AC is the lowest level (0x3 is lowest power, 0x2 is medium power, and 0x1 is high power).

I rebooted, and measured my card's idle temperature at 48 degrees C and idle power consumption in X11 to be 70 watts. This is a ten-watt power savings -- and remember, I disconnected the GT 520's fan.

The GeForce GT 520 is a great choice for anyone wanting to attach one or more DVI monitors to a low-power or passively cooled workstation.

I do not recommend ATI cards because configuring them to dual-head in Solaris or BSD environments has been nothing but a headache for me.