Saturday, June 14, 2014

My Spiffy (not so) new Wrist Watch - Casio's FTW100D-7V

Update - I originally wrote this back in 2008.  I am still wearing the watch, and still have not needed to set the time or replace the battery.

I did have to take it to a jeweler to re-attach the band after it was struck by a falling tree branch and popped off.  I was wearing the watch at the time, and fortunately neither I nor the timepiece were injured.

From the picture, you can see that it is holding up pretty well.  There are some scratches on the crystal, but nothing very bad.  The black enamel in the letters on the bezel have worn away in the N, S, and W positions. The silver coating on the plastic case has worn away on some of the high spots, but it is nowhere near as bad as it was on the FT-200. (mostly because of the protection provided by the steel bezel)

Helpful Hint -- before shelling out for a watch, or any piece of technology for that matter, it is always a good idea to download and read the owners manual. Casio's watch manuals are available in PDF form on their watch support page. The manuals are organized by "Module" (movement) number, as the same movement is often used in several watch models (with different cases, bands, etc.). The FT200 uses module 1879, and the FTW100D-7V uses module 2628.

The Casio FT-200
My last watch was a Casio FT-200 that I received as a gift around 1998. I had been lusting for a G-Shock (to replace the DW5200 that I had worn in high school and college) at the time, but I was quickly won over by the geeky astronomical features of the FT-200. It also didn't look like I was wearing a brick on my wrist - which I think is what she-who-gave-it-to-me liked about it. I didn't start to get watch envy again until Casio came out with the Solar Atomic G-Shocks a few years later.

Here is my FT-200 after nearly a decade on my wrist. It still works, although it is showing its age. Here is a link to a nice shiny new FT-200 (in Brazil) for comparison.

I went through several bands and batteries during the time I have had this watch. The resin band has always been the first thing to go on the watches I've had - even on the supposedly indestructible G-shock. Sunshine and oxygen just attack the plastic until it gets brittle and deteriorates. The watch takes a standard CR2016 battery, and is easy to replace by removing the 4 small screws that hold the stainless-steel back onto the body of the watch. Batteries typically lasted a little less than 2 years, although I didn't keep any detailed records.

The crystal has only minor scratches on it, as it was protected by the raised bezel area around the face of the watch. That area is polished smooth from years of wear, and the original silver finish has given way to the greyish-beige plastic underneath. IIRC, the silver finish wore away rather quickly in all the high spots. The "Forester" logo at twelve o'clock has been worn away completely. Fortunately, the button labels were better protected, and are still legible.

The most recent battle scar on this watch is a literal one. The light button took a direct hit during a paintball game, and cracked. The button still functions, although it is not as easy to press, and the waterproofing has held up while doing dishes and showering since then.

Astronomical Features
The most obvious "special" feature on the FT-200 is the moon phase indicator, and (up to four) fish-shaped icons on the watch face. The fish icons correlate to times of increased fish and wildlife activity according to Solunar Tables. Personally, I found that the times I go fishing or hunting are determined by my work schedule, and/or the local game laws. Trying to schedule around the sun and moon just complicated things for me.

I did use the moon phase indicator, however. Knowing the moon phase helps one figure out if the night will be pitch dark (new moon) well-lit (full moon), or somewhere in between before planning an outdoor activity at night. The moon phase is also useful information for the diehard NetHack player.

My favorite special feature of the FT-200, and the one I was least willing to give up in a watch upgrade, is sunrise/sunset time. Having solunar table information on my wrist was only marginally useful, but knowing when I needed to wake up in order to get in the woods before sunup (or how much longer I had until dark) was very handy indeed.

The FT-200 can calculate solunar data, moon phase, and sunrise/sunset time for arbitrary dates. Current Casio watches with all these features include the PAS400 and the AMW700

The Casio FT100D-7V

Dealing with the band
The folks at XCelwatches were quick. I ordered the new watch on a Thursday, and it arrived on the following Monday. The only thing standing between me and near-instant gratification was the stainless-steel band. The band was too large for my scrawny little wrists. I wound up paying a jeweler to remove 4 links from it when none of the blunt instruments I had at my disposal proved worthy of the job. If I had known I would need one, I would have bought a watch band tool and done the job myself.

The links on the stainless steel band are held together by tapered pins, and those pins are held in place by tiny rings (which would otherwise be called "roll pins" except that they are short, and meant to go around the outside of an even narrower solid pin). The links are marked with a small arrow, which shows the proper direction for knocking the tapered pins out.

Don't lose those tiny rings! (or "roll pins") The tapered pins will not stay in place without them, as the lady at the jewelry store found out when the watch band spontaneusly disassembled as she was placing it on my wrist.

It has been ages since I last had a watch with a steel band, and I wasn't sure I would like it. It turns out that I do like it. Despite the fact that it makes the watch heavier, it looks very good and should last longer than the rubber/resin bands I was used to.

The FTW100D-7V occupies a unique niche in Casio's current lineup. Casio only makes a handful of "Forester" models, as opposed to a wide variety of G-Shock variants. The FTW100D-7V is the only Solar/Atomic watch I could find that had Sunrise/Sunset time, without stepping up to the more expensive Pathfinder series. It is the lowest price Solar/Atomic Casio watch that I could find. (at the time of this writing, the Solar/Atomic G-Shocks seem to start in the $80 range).

In addition to the sun-powered/self-setting goodness, the watch has 5 alarms (one of which has a "snooze button"), World Time (which I set to GMT for convenience in deciphering log files), a Time Recording feature that allows me to "timestamp" up to 30 events, a stopwatch (of course) and a "Bearing" mode.

Getting your bearings That "Bearing" mode requires some explanation. Some advertisements even call it a "Bearing sensor" -- but this watch does not have a digital compass. It is more like the Boy Scout trick of finding North with an analog watch. "Bearing mode" calculates the position of the sun relative to true north. Read the number from the face of the watch, then line up the (tiny and difficult to read) degree markings around the face of the watch. The big "N" on the non-moveable steel bezel will then be pointing toward true (not magnetic) North.

This is clever, but probably the least-likely-to-be-useful feature on this watch. If the nice folks at Casio really wanted to add a feature that didn't require any extra LCD screen elements, they should have added a countdown timer.

The Watch that takes care of itself
Working around NTP-synchronized computers has spoiled me. Likewise with the new "Atomic" alarm clocks that have replaced all the clocks in my house. I now expect clocks and computers to tell me what time it is, and not the other way around. The old FT-200 was rated to be accurate to +/- 20 seconds per month, which was very good in the days when setting my watch involved calling 555-1212 and listening for "At the tone, the time will be..." . But +20 seconds per month (my old watch was consistently fast) meant noticing that my watch was out of sync, and re-setting it every 2 weeks or so.

The FTW100 automatically sets itself every night, and the time on my watch now matches the time on my clocks, computers and routers - period. Here in Mississippi, if I try to do a "manual sync" during the daytime, it usually fails -- but the watch has consistently synchronized itself to WWVB every night since I received it.

Sunlight is abundant in Mississippi, too. After I initially charged the watch by setting it in the sun for a few hours, the battery indicator has not gone below "high" during weeks of normal use. It might be too early to tell, but I'm looking forward to going a long time before I have to change the battery.

Wednesday, June 11, 2014

Satellite Internet -- Squishing the FAP and taming the wild Bandwidth Hogs

This one is a little dated, I am using Gargoyle  for this purpose now.  It handles HTTPS (and other non-HTTP traffic) much better.

Note: I wrote this about 2 years ago, but didn't post it, as I thought the instructions were woefully incomplete. I didn't feel like re-installing Squish again just so I could write a more accurate article. However, about a month ago I had a hard drive crash on the Squish-O-Matic box and had to reinstall ClearOS and Squish again.  

One of the first things I did when I got laid off (from SkyTel in 2009) was procure new Internet service.  DSL and cable are not available at Casa Mike (until recently known as "the place where cell phone signals go to die") , so the only choices I really had were satellite and dialup.  I went with HughesNet service, and opted for a pole mount over a roof mount, partly because I anticipate needing a new roof someday.  Installation went very well.  The installation crew was prompt and courteous, and did a neat and professional job.  I ran some speed tests after the install, and the new connection seemed quite zippy.  There was much rejoicing in the McArthur household -- for about 2 hours.  That is how long it took for the household teenagers (experiencing their first Internet "fix" in weeks) to hit HughesNet's infamous FAP.
Below is the whole saga of how I (eventually) managed to ration precious satellite bandwidth using Linux, the Squid proxy and something called Squish.

As a "network guy", I have done my share of prioritizing traffic with QOS, filtering SPAM and other unwanted traffic, and using content-filtering to keep users away from "inappropriate" sites.  One would think that I would have had a ready-made remedy to this situation in my bag of tricks -- as it turns out, I didn't and had to do much Googling and trial-and-error to put together a workable (but not perfect) bandwidth rationing scheme.

I quickly found that there wasn't much I could do on a Cisco 851, or even a WRT54G running OpenWRT/DD-WRT to fix this.  In the WRT's case, there just wasn't enough flash or RAM to install everything needed.  QoS wasn't much help.

I began by putting the ClearOS Linux distro (formerly known as ClarkConnect) on an old desktop machine with 2 NICs. This machine became the firewall between my Home LAN and the HughesNet device.  I later replaced the desktop  hardware with a salvaged Net Integrator Micro II, which was much more compact and quiet (fanless).

ClearOS was a good distro to use for this purpose, because it is designed to be both a firewall and a general purpose office file/intranet server.  It has a web GUI that makes it a simple task to setup a transparent Squid web cache, and to turn on content-filtering with Dan's Guardian.  These two features helped a great deal -- the Squid cache made it so that if one person in the house viewed a page, it did not have to be downloaded again if someone else in the house wanted to see it.

At first, I used Dan's Guardian to block YouTube and other bandwidth-wasting sites.  This helped, but it turned into a game of whack-a-mole as the kids would find new video/audio intensive sites, mostly videogame reviews and podcasts.  Dan's Guardian was helpful for blocking content that I objected to, but my problem was not so much the "content" of the sites as the sheer volume of data traffic that they generated.
What I needed was a bandwidth quota system, and I finally found one in Squish.  Squish is an add-on for the Squid proxy that runs a cron job to periodically collect usage statistics form the Squid log. When a computer (or user) exceeds its quota for the day, Squish blocks HTTP access until the user's 24-hour usage is back under quota.  Squish isn't perfect, it works on HTTP only, and does not affect HTTPS, FTP, or BitTorrent.  More of its limitations are described in the Squish FAQ.

Installing Squish on ClearOS 5.2 was a bit tricky, and will be the subject of another article. The short version is that you need to install the gd and gd-devel packages, as well as the Perl GD module from CPAN. (ClearOS is derived from Red Hat , so yum can install most of the necessary packages). The Squish FAQ has general build and installation instructions.

Once I had Squish installed, I still had to configure it to work well with HughesNet.  The default cron job provided by the Squish install scripts runs Squish every 5 minutes, 24 hours per day, and does not make exception for the HughesNet unlimited download window (usage between 1 am and  6 am Central Time does not count against the FAP).  I wanted to allow users to take advantage of that period without affecting their squish quota, so I created some bash scripts and modified the cron schedule:
Here are the lines I added to /etc/crontab

*/5 6-23 * * * root /usr/local/squish/
*/5 0 * * * root /usr/local/squish/
2 1 * * * root /etc/squid/
55 5 * * * root /etc/squid/  un-squishes users, and saves Squid usage data for usage in the morning
#Script to reinitialize squid access log and squish db.
#Saves Squish data every night so it can be restored in the morning

mv /var/log/squid/access.log /var/log/squid/access.log.bak
mv /var/lib/squish/userdb.stor /var/lib/squish/userdb.stor.bak
cp /etc/squid/squished.blank /etc/squished
service squid restart
/usr/local/squish/ restores the previous night's Squid data, and begins running Squish again:

#Script to restore squid access log and squish db. 
#Restores the previous day's Squish data so it can be tracked across 
#multiple days

mv /var/log/squid/access.log.bak /var/log/squid/access.log
mv /var/lib/squish/userdb.stor.bak /var/lib/squish/userdb.stor 
cp /etc/squid/squished.blank /etc/squished
service squid restart

/etc/squid/squished.blank is an "empty" squish status file, create it by copying /etc/squid/squished to /etc/squid/squished.blank (while no users are currently squished).

Set appropriate bandwidth quotas for users and/or machines by editing the Squish configuration file: /etc/squid/squish.conf 

#### Squish Configuration File /etc/squid/squish.conf

#Bandwidth-sucking kids
#Kid1 25h/day 100Mb/day

#wired 25h/day 100Mb/day

#wireless 25h/day 100Mb/day

#wired 25h/day 171Mb/day

#Wireless 25h/day 171Mb/day

# Catchall -- people and IP's not matched by the above rules
.* 25h/day 20Mb/day

Bay MIB Magic

There are no less than 3 ways to configure a Bay router:

Via Site Manager
With BCC

and from the TI command-line using manual MIB-sets - Yeeehaaa!

Bay MIB Magic
©2003 Mike McArthur

What follows is a tutorial on the really geeky way to configure a Bay/Wellfleet router.

Some historical background is in order, though...

Long, long, ago -- when the earth was still cooling -- some smart people designed a router that was 100% snmp-driven.  The entire configuration of the device was nothing but a large and excruciatingly detailed SNMP MIB in a binary file.  The Wellfleet router was born.

The router contained some initialization scripts to allow a technician to connect to the console port, put an IP address on an interface, and set an SNMP community string.  The TI (Technician Interface) also had some commands to allow that same technician to view interface status information.  There was also a "menu" command for browsing by the less-clueful. Any *real* configuration or management required an SNMP GUI interface called Site Manager.  (actually the TI is quite capable, is a subset of Tcl/Tk, and can be used with the techniques below to do some cool things)

One problem with Site Manager was that the router MIB would change subtly with each new version, and would require a corresponding new version of Site Manager.  On a network with hundreds of routers, not necessarily running the same version, this could be a nightmare.

The other problem with Site Manager was that it was a GUI.  It was efficient for some tasks, and painfully cumbersome for others.  Also the geeks at ANS+Core systems (one of the first large commercial ISP's) were hard-core anti-GUI bigots who insisted on being able to do things from the command line.

Years later, Bay Networks (who had bought Wellfleet) would come out with the "Bay Command Console" or BCC.  This was an attempt to make their routers command-line configurable in a manner similar to Cisco devices. (Cisco was beating them in the "router wars" at this time, due to their orthogonal command-line and agressive marketing)

In short, there are no less than 3 ways to configure a Bay router:

Via Site Manager
With BCC

and from the TI command-line using manual MIB-sets - Yeeehaaa!

As an example, let's delete a static route on a Bay .

First use the list command to find the proper MIB variable for static routes.  What you are looking for is something that starts with "wf" and has the words "Static Route" in it somewhere:

[ ClunkyBayRouter]$list
wfCSMACDEntry =
wfCSMACDAutoNegEntry =
wfFddiEntry =
wfFddiSmtEntry =
wfFddiSmtExtEntry =
wfFddiSmtActionEntry =
wfIpBase =
wfIpBaseRtEntry =
wfIpBaseHostEntry =
wfIpInterfaceEntry =
wfIpStaticRouteEntry =
wfIpAdjacentHostEntry =
wfIpTrafficFilterEntry =
wfIpForwardEntry =
wfRdiscIntfEntry =
wfIpNetToMediaEntry =
wfIpAccCtrlFilterEntry =
wfIpAccCtrlNetworkEntry =
wfIpAccCtrlUserHostEntry =
wfIpAddrEntry =
wfIpInternalHostEntry =
wfIpIntfCfgEntry =
wfIpIntfStatsEntry =
wfIpIntfStatsIcmpEntry =

There it is!  I've highlighted it in red for you....

Instead of using your eyeballs, you can always use a script.

Ok, now we need to see how many static routes ("instances") are configured on the box.

[ ClunkyBayRouter]$list instances wfIpStaticRouteEntry
inst_ids  =

And we need to see what a typical Static Route entry consists of.

[ ClunkyBayRouter]$list wfIpStaticRouteEntry
wfIpSrCreate = 1
wfIpSrEnable = 2
wfIpSrIpAddress = 3
wfIpSrIpNetMask = 4
wfIpSrCost = 5
wfIpSrNextHopAddr = 6
wfIpSrNextHopMask = 7
wfIpSrPreference = 8
wfIpSrIpAddressRt = 9
wfIpSrValid = 10
wfIpSrUnnumCct = 11

Ok, the static route to is the one I want to delete.  Now I should find out all about that particular "instance" by using the SNMP get command.

The format is "get [mibvariablename].*.[instance identifier]".  If I only wanted a particular element, it would be
"get [mibvariablename].[elementname/number].[instance identifier]".

[ ClunkyBayRouter]$get wfIpStaticRouteEntry.*.
wfIpStaticRouteEntry.wfIpSrCreate. = 1
wfIpStaticRouteEntry.wfIpSrEnable. = 1
wfIpStaticRouteEntry.wfIpSrIpAddress. =
wfIpStaticRouteEntry.wfIpSrIpNetMask. =
wfIpStaticRouteEntry.wfIpSrCost. = 1
wfIpStaticRouteEntry.wfIpSrNextHopAddr. =
wfIpStaticRouteEntry.wfIpSrNextHopMask. =
wfIpStaticRouteEntry.wfIpSrPreference. = 16
wfIpStaticRouteEntry.wfIpSrIpAddressRt. = 1
wfIpStaticRouteEntry.wfIpSrValid. = 1
wfIpStaticRouteEntry.wfIpSrUnnumCct. = 0

The first two elements "wfIpSrCreate" and "wfIpSrEnable" are very important.

If I want to disable a static route without removing it from the config completely, I would set the corresponding "wfIpSrEnable" to zero and then use the "commit" command.

Note that MIB changes do not become effective until the "commit" command is issued.

[ ClunkyBayRouter]$set wfIpStaticRouteEntry.wfIpSrEnable. 0

[ ClunkyBayRouter]$show ip routes
  Destination        Mask       Proto   Age      Cost     NextHop Addr /  AS
--------------- --------------- ----- -------- --------  ---------------------   LOCAL 296235   1
1 route(s) found

[ ClunkyBayRouter]$commit

[ ClunkyBayRouter]$show ip routes
No routes found

This has solved my immediate problem, but what if I want to remove that static route for good? (I do) That is what the wfIpSrCreate is for.  Set it to "2" to delete the object :

[ ClunkyBayRouter]$set wfIpStaticRouteEntry.wfIpSrCreate. 2

Here is the Static route entry in all its glory, right before I blow it away:

[ ClunkyBayRouter]$get wfIpStaticRouteEntry.*.
wfIpStaticRouteEntry.wfIpSrCreate. = 2
wfIpStaticRouteEntry.wfIpSrEnable. = 0
wfIpStaticRouteEntry.wfIpSrIpAddress. =
wfIpStaticRouteEntry.wfIpSrIpNetMask. =
wfIpStaticRouteEntry.wfIpSrCost. = 1
wfIpStaticRouteEntry.wfIpSrNextHopAddr. =
wfIpStaticRouteEntry.wfIpSrNextHopMask. =
wfIpStaticRouteEntry.wfIpSrPreference. = 16
wfIpStaticRouteEntry.wfIpSrIpAddressRt. = 1
wfIpStaticRouteEntry.wfIpSrValid. = 2
wfIpStaticRouteEntry.wfIpSrUnnumCct. = 0

[ ClunkyBayRouter]$commit

[ ClunkyBayRouter]$get wfIpStaticRouteEntry.*.
get: The following number of objects do not exist or are not accessible: 11

All gone....

[ ClunkyBayRouter]$list instances wfIpStaticRouteEntry
inst_ids  =

Sunday, June 1, 2014

The Chump Button (Why your favorite financial calculator is missing something)

Recently, while I was clicking around and watching my meager investments shrivel in the wake of the recession, it occurred to me that certain features of Google Finance (or the lack thereof) annoy the heck out of me.  This came as a shock to me, but shouldn't have.

I have been using Google Finance (abbreviated hereafter as GF) since it was introduced in 2006, and the frustration has been building long enough for me to complain about it.

1.  The chart scale does not start at zero.  

This makes a $3.00 dip in a $300.00 stock look very much like a $3.00 dip in a $30.00 stock.  The little cartoon book How to Lie with Statistics has been around since 1954, and explains this sort of thing quite well.  I can't believe that nobody at Google (or Yahoo) has read it.

(Corrected) 2. The portfolio feature does not allow you to graph the aggregate performance
of your portfolio over time.

To Google's credit, they actually fixed this some time after I started writing this article.  (and put aside for months and months before picking it up again)

and now for the big one:

3.  There is no easy way to meaningfully adjust for inflation in Google Finance.

Investing without accounting for inflation is like trying to fly without considering the effects of gravity.

The Consumer Price Index tables are available (for free) on the web from the Bureau of Labor Statistics. It is a simple matter, using a spreadsheet or a web-based "inflation calculator", to adjust the value of a savings account, stock portfolio, or salary history for the cumulative effects of inflation. This is nothing new to anyone who slept through Econ 101 in college, and is plain-vanilla basic math.

So... why isn't there an "Adjust this for CPI" button prominently featured on Google Finance, and every other financial site on the web?  You can compare your stocks against the Dow or the S&P 500, to see if you are "beating the market" easily enough in GF -- why should it be hard to see if you are beating inflation?

This the "Chump Button" in the title of this rant -- as in "Click here to find out if you are a Chump" by getting nominal "gains" that are less than the rate of inflation, and then paying taxes on those gains.

Ideally, the Chump Button should also allow using an alternate means of inflation, such as the (more realistic, and more pessimistic) alternate CPI produced by John Williams of Shadow Government Statistics, or the Billion Prices Project.

Another way to calculate the gain or loss in the purchasing power of an investment is to calculate its value in terms of a common commodity. (ounces of gold, gallons of gas, barrels of oil, etc...).  The problem is that GF does not track commodity prices.  One can use GLD, SLV, USO, or one of the other commodity-based ETFs as a proxy for your commodity-of-choice -- but it would be much easier if you could compare against standard spot prices.

4.  How about an "After Taxes" button?
that will estimate how much you would net (after capital gains, IRA/401K penalties, income taxes, etc...)  if you cashed out an investment today. This one is a bit trickier (because different investment accounts are taxed according to different rules), but Google should have the horsepower to do it.