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.


Features
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/squish.cron.sh
*/5 0 * * * root /usr/local/squish/squish.cron.sh
2 1 * * * root /etc/squid/squish_clear_night.sh
55 5 * * * root /etc/squid/squish_clear_morn.sh


squish_clear_night.sh  un-squishes users, and saves Squid usage data for usage in the morning
#!/bin/bash
#
#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/squish.cron.sh

squish_clear_morn.sh restores the previous night's Squid data, and begins running Squish again:

#!/bin/bash
#
#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
/usr/local/squish/squish.cron.sh


/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
192.168.1.100 25h/day 100Mb/day

#Kid2
#wired
192.168.1.101 25h/day 100Mb/day

#wireless
192.168.1.102 25h/day 100Mb/day

#
#Dad
#wired
192.168.1.201 25h/day 171Mb/day

#Wireless
192.168.1.202 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 = 1.3.6.1.4.1.18.3.4.1.1
wfCSMACDAutoNegEntry = 1.3.6.1.4.1.18.3.4.16.1.1
wfFddiEntry = 1.3.6.1.4.1.18.3.4.4.1
wfFddiSmtEntry = 1.3.6.1.4.1.18.3.4.15.1.2.1
wfFddiSmtExtEntry = 1.3.6.1.4.1.18.3.4.15.1.3.1
wfFddiSmtActionEntry = 1.3.6.1.4.1.18.3.4.15.1.4.1
[SNIP]
wfIpBase = 1.3.6.1.4.1.18.3.5.3.2.1.1
wfIpBaseRtEntry = 1.3.6.1.4.1.18.3.5.3.2.1.2.1
wfIpBaseHostEntry = 1.3.6.1.4.1.18.3.5.3.2.1.3.1
wfIpInterfaceEntry = 1.3.6.1.4.1.18.3.5.3.2.1.4.1
wfIpStaticRouteEntry = 1.3.6.1.4.1.18.3.5.3.2.1.5.1
wfIpAdjacentHostEntry = 1.3.6.1.4.1.18.3.5.3.2.1.6.1
wfIpTrafficFilterEntry = 1.3.6.1.4.1.18.3.5.3.2.1.7.1
wfIpForwardEntry = 1.3.6.1.4.1.18.3.5.3.2.1.16.1
wfRdiscIntfEntry = 1.3.6.1.4.1.18.3.5.3.2.1.17.1
wfIpNetToMediaEntry = 1.3.6.1.4.1.18.3.5.3.2.1.18.1
wfIpAccCtrlFilterEntry = 1.3.6.1.4.1.18.3.5.3.2.1.19.1
wfIpAccCtrlNetworkEntry = 1.3.6.1.4.1.18.3.5.3.2.1.20.1
wfIpAccCtrlUserHostEntry = 1.3.6.1.4.1.18.3.5.3.2.1.21.1
wfIpAddrEntry = 1.3.6.1.4.1.18.3.5.3.2.1.22.1
wfIpInternalHostEntry = 1.3.6.1.4.1.18.3.5.3.2.1.23.1
wfIpIntfCfgEntry = 1.3.6.1.4.1.18.3.5.3.2.1.24.1
wfIpIntfStatsEntry = 1.3.6.1.4.1.18.3.5.3.2.1.25.1
wfIpIntfStatsIcmpEntry = 1.3.6.1.4.1.18.3.5.3.2.1.26.1


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  = 0.0.0.0.0.0.0.0.1
            172.16.10.0.255.255.255.0.1
            192.168.1.0.255.255.252.0.1
            192.168.2.0.255.255.255.0.1
            192.168.3.0.255.255.225.0.1
            192.168.4.0.255.255.255.255.10
            192.168.5.0.255.255.255.224.1


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 172.16.10.0/24 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.*.172.16.10.0.255.255.255.0.1
wfIpStaticRouteEntry.wfIpSrCreate.172.16.10.0.255.255.255.0.1 = 1
wfIpStaticRouteEntry.wfIpSrEnable.172.16.10.0.255.255.255.0.1 = 1
wfIpStaticRouteEntry.wfIpSrIpAddress.172.16.10.0.255.255.255.0.1 = 166.35.219.0
wfIpStaticRouteEntry.wfIpSrIpNetMask.172.16.10.0.255.255.255.0.1 = 255.255.255.0
wfIpStaticRouteEntry.wfIpSrCost.172.16.10.0.255.255.255.0.1 = 1
wfIpStaticRouteEntry.wfIpSrNextHopAddr.172.16.10.0.255.255.255.0.1 = 10.1.143.2
wfIpStaticRouteEntry.wfIpSrNextHopMask.172.16.10.0.255.255.255.0.1 = 255.255.255.252
wfIpStaticRouteEntry.wfIpSrPreference.172.16.10.0.255.255.255.0.1 = 16
wfIpStaticRouteEntry.wfIpSrIpAddressRt.172.16.10.0.255.255.255.0.1 = 1
wfIpStaticRouteEntry.wfIpSrValid.172.16.10.0.255.255.255.0.1 = 1
wfIpStaticRouteEntry.wfIpSrUnnumCct.172.16.10.0.255.255.255.0.1 = 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.172.16.10.0.255.255.255.0.1 0

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


[ ClunkyBayRouter]$commit

[ ClunkyBayRouter]$show ip routes 172.16.10.0
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.172.16.10.0.255.255.255.0.1 2

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

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

[ ClunkyBayRouter]$commit

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

All gone....

[ ClunkyBayRouter]$list instances wfIpStaticRouteEntry
inst_ids  = 0.0.0.0.0.0.0.0.1
            192.168.1.0.255.255.252.0.1
            192.168.2.0.255.255.255.0.1
            192.168.3.0.255.255.225.0.1
            192.168.4.0.255.255.255.255.10
            192.168.5.0.255.255.255.224.1



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. 

Saturday, May 31, 2014

If you work in IT, you need one of these things - the Kill-A-Watt meter

A colleague recently called me to ask about a server he was planning to install.  The box had dual power supplies, and he wanted to know if would draw an equal amount of AC current for each power supply, or if one PS would supply the machine and the other one would be in a "backup" state, ready to take over if the primary failed.

I didn't know diddly-squat about the make and model of server he was contemplating, and I was unwilling to waste precious minutes of my life Googling for that information -- but I told him what I do in his situation:  Go get two Kill-A-Watt P4400 power meters and plug one into each power supply.

If you work in IT, or in any job that depends on electrical devices, you will eventually need something like this.  I'm kind of surprised at how many IT professionals I meet who don't know that such devices exist and are inexpensive.




The Kill-A-Watt says my laptop is using 54 watts of power.


The P4400 meter is available online and at hardware stores for $20-30 US.  It measures instantaneous power in watts, cumulative power in KWH, current, voltage, frequency, and power-factor.  It is useful for choosing a proper size UPS and estimating runtime, figuring out what a device is costing you in electricity, finding out if dirty power is causing problems with your network gear,  finding heavily loaded circuits before you start blowing breakers, and lots of other things.
It isn't the "perfect" power meter, but it gets the job done, cheap.  Some of its limitations:
  • Only works with standard (15-amp) plugs.
  • Does not keep maximum/mimimum/peak data. (which would be really useful for measuring the start-up load of an air conditioner or refrigerator)
  • No graphing or data-export function.
  • Does not keep data if the power goes off.

One clever person has published a "Tweet A Watt" mod, which makes a standard Kill-A-Watt wirelessly monitorable and provides graphing and Twitter functionality.  It looks like fun, but i haven't tried it yet.

Example CME SIP Trunk configuration for Bandwidth.com



I recently helped a friend move his Cisco 2811 from analog lines to a SIP trunk through Bandwidth.com.

This was my first time dealing with a VOIP trunk that I didn't control both ends of, and my first time dealing with Bandwidth.com. I didn't think it would be all that difficult -- After all, I can't be their first customer to use Cisco gear, and there's bound to be lots of examples of how to do this that I can just Google up... right?

Well, it turns out that there wasn't much information available There was much more trial-and-error involved than I anticipated.

Below the "read more" link is the result of that trial-and-error, for anyone stuck in the same situation.



Bandwidth.com's support forums have only a single thread about getting their service to work with Cisco Call Manager Express.  It also features a rather intimidating disclaimer:

 Note: Bandwidth.com does not provide support for these configurations and they are not guaranteed to work. The above config is also very old and possibly out of date. It would be best to contact the PBX vendor - Cisco - for help with getting this to work with the bandwidth.com service.

Bandwidth.com wasn't kidding about not helping to configure your router.  Their tech support people were polite and knew plenty about SIP, but the only Cisco specific information I was able to get out of them was a link to that forum thread.

The suggested remedy of contacting Cisco for help was also a non-starter, as the maintenance contract on the router we were using was long expired.

And now for a disclaimer of my own:  The configuration below worked for me, but may not be correct or complete for your application.  IP addresses and phone numbers have been changed to protect the innocent.  This information is worth exactly what you paid for it, and I do not intend to provide free tech support for it or even answer any questions about it.

First define some voice service parameters.  The "no supplementary-service sip" commands are necessary to get transfers, call-forwarding, and voicemail to work with Bandwidth.com.
!
voice service voip
 allow-connections sip to sip
 no supplementary-service sip moved-temporarily
 no supplementary-service sip refer
 fax protocol cisco
 sip
  bind control source-interface FastEthernet0/1
  bind media source-interface FastEthernet0/1
!
!
Define codecs to negotiate.  Calls to some area codes did not work until I added the g729br8 codec.
!
voice class codec 1
 codec preference 1 g711ulaw
 codec preference 2 g729r8
 codec preference 3 g711alaw
 codec preference 4 g729br8
!
!
!
Rule 2 translates outbound calls before they are sent to the SIP trunk.  The local area code is 906.
!
voice translation-rule 2
 rule 1 /^9(.......)$/ /+1906/
 rule 2 /^9(..........)$/ /+11/
 rule 3 /^9(.*)$/ /+1/
 rule 4 /^9(...........)$/ /+1/
 rule 5 /^9011(.*)$/ /+1/

Rule 3 translates inbound SIP calls to local 3-digit extensions.  Ext 380 is the CUE AutoAttendant, 400 is an extension or hunt group.
!
voice translation-rule 3
 rule 1 /+19065551212/ /380/
 rule 2 /+19065551213/ /400/
 rule 3 /+19065551214/ /400/
 rule 4 /+18005551212/ /380/
Apply the translation rules to translation profiles
!
voice translation-profile SIP-IN
 translate called 3
!
voice translation-profile SIPCALL
 translate called 2
!
You are going to need a transcoder, so define dspfarm services
!
voice-card 0
 dspfarm
 dsp services dspfarm
!
!
!
There is nothing special about the interfaces.  For simplicity, I am not showing any NAT.


192.168.10.1 is the local LAN

192.168.10.2 is the Cisco Unity Express (CUE) voicemail

10.10.100.88 is the "outside" WAN interface that connects to Bandwidth.com
!
interface FastEthernet0/0
 description $FW_INSIDE$$ETH-LAN$$INTF-INFO-FE 0/0$
 ip address 192.168.10.1 255.255.255.0
 no ip redirects
 no ip unreachables
 ip virtual-reassembly
 duplex auto
 speed auto
!
interface Service-Engine0/0
 ip unnumbered FastEthernet0/0
 no ip redirects
 no ip unreachables
 ip flow ingress
 service-module ip address 192.168.10.2 255.255.255.0
 service-module ip default-gateway 192.168.10.1
!
!
interface FastEthernet0/1
 ip address 10.10.100.88 255.255.255.0
 ip access-group WAN-SIP in
 ip verify unicast reverse-path
 no ip redirects
 no ip unreachables
 no ip proxy-arp
 ip virtual-reassembly
 duplex auto
 speed auto
 no cdp enable
 service-policy output SDM-Pol-Ethernet1
!
Some basic static routes
ip route 0.0.0.0 0.0.0.0 10.10.100.1
ip route 192.168.10.2 255.255.255.255 Service-Engine0/0
!
!
A simple WAN access-list that allows SIP connections from the Bandwidth.com peers, and RTP (UDP >1024)

The RTP traffic can come from anywhere, not just from the SIP peers.
!
ip access-list extended WAN-SIP
 permit tcp host 216.82.224.202 host 10.10.100.88 range 5060 5061
 permit tcp host 216.82.225.202 host 10.10.100.88 range 5060 5061
 permit udp host 216.82.224.202 host 10.10.100.88 range 5060 5061
 permit udp host 216.82.225.202 host 10.10.100.88 range 5060 5061
 permit ip host 75.151.219.185 host 10.10.100.88
 deny   tcp any any eq telnet
 deny   tcp any any eq 22
 permit udp any host 10.10.100.88 gt 1024
 deny   ip any any log
!

Define SCCP
!
sccp local FastEthernet0/0
sccp ccm 192.168.10.1 identifier 1 priority 1 version 3.1
sccp
!
Here is where the transcoder is bound to SCCP
!
sccp ccm group 1
 associate ccm 1 priority 1
 associate profile 1 register XCODER

And here is the transcoder definition.  The 4 codecs here worked for me.
!
dspfarm profile 1 transcode
 codec g711ulaw
 codec g711alaw
 codec g729abr8
 codec g729r8
 maximum sessions 8
 associate application SCCP
!

Dial-peer for all the CUE extensions
!
dial-peer voice 380 voip
 destination-pattern 38.
 b2bua
 session protocol sipv2
 session target ipv4:192.168.10.2
 dtmf-relay rtp-nte
 codec g711ulaw
 no vad
!

Two dial-peers for outgoing SIP calls.  One for each SIP peer IP address.
!
dial-peer voice 101 voip
 description ** Outgoing call to SIP trunk **
 translation-profile outgoing SIPCALL
 destination-pattern 9.T
 voice-class codec 1
 voice-class sip dtmf-relay force rtp-nte
 session protocol sipv2
 session target ipv4:216.82.224.202
 dtmf-relay rtp-nte
 ip qos dscp cs5 media
 ip qos dscp cs4 signaling
 clid network-number 9065551212
 no vad
!
dial-peer voice 102 voip
 description ** Outgoing call to SIP trunk **
 translation-profile outgoing SIPCALL
 destination-pattern 9.T
 voice-class codec 1
 voice-class sip dtmf-relay force rtp-nte
 session protocol sipv2
 session target ipv4:216.82.225.202
 dtmf-relay rtp-nte
 ip qos dscp cs5 media
 ip qos dscp cs4 signaling
 clid network-number 9065551212
 no vad
!
Two dial-peers for incoming SIP calls.  One for each peer address.
!
dial-peer voice 201 voip
 description ** Incoming call from SIP Trunk ***
 translation-profile incoming SIP-IN
 b2bua
 voice-class codec 1
 voice-class sip dtmf-relay force rtp-nte
 session protocol sipv2
 session target ipv4:216.82.224.202
 incoming called-number .%
 dtmf-relay rtp-nte
 ip qos dscp cs5 media
 ip qos dscp cs4 signaling
 no vad
!
dial-peer voice 202 voip
 description ** Incoming call from SIP Trunk ***                           
 translation-profile incoming SIP-IN
 b2bua
 voice-class codec 1
 voice-class sip dtmf-relay force rtp-nte
 session protocol sipv2
 session target ipv4:216.82.225.202
 incoming called-number .%
 dtmf-relay rtp-nte
 ip qos dscp cs5 media
 ip qos dscp cs4 signaling
 no vad
!

Add the lines below to your "telephony-service" config to make the transcoder work.
!
telephony-service
 sdspfarm units 1
 sdspfarm transcode sessions 8
 sdspfarm tag 1 XCODER



Thursday, May 29, 2014

Back from the dead, sort of

It has been a while since hosting problems put the old MikeMcarthur.net website out of its misery.

Now I am playing around with alternative ways to bring it back from the dead -- without shelling out any money.  This will probably involve posting some of the old articles (the ones that aren't hopelessly dated, anyway) as I resurrect them from old GeekLog backups.