Klondike Challenge Conquered

After months of adding up walking and hiking mileage, I surpassed the 500 mile mark to complete the Klondike Challenge. The challenge is sponsored by Jack London State Historic Park to commemorate the 100th anniversary of the death of author Jack London. The 500 miles of walking or hiking reflect, roughly, the distance he traveled in the Klondike during the gold rush years, an experience which greatly shaped his writing career.

Jack London Centennial Banner

I would rather be ashes than dust!
I would rather that my spark burn out
in a brilliant blaze than it should be stifled by dry rot.
I would rather be a superb meteor every atom of me
in magnificent glow, than a sleepy and permanent planet.
The proper function of man is to live, not to exist.
I shall not waste my days in trying to prolong them.
I shall use my time.

The hike Penny and I took in Vallejo a few days ago pushed me over the 500 mile mark for the year. Penny surpassed the 500 mile mark months ago since she logs a number of miles before and/or after work each day. We’ll be be eligible for the “graduation ceremony” for participants to be held in January.

We’ll probably get another walk or hike in before New Years, but I doubt that I’ll be able to add substantially to my mileage.

Posted in Uncategorized | Leave a comment

Pomodoro One

Since November 2015 I’ve been working from home.  Though working from home has been a theoretical option for years, this is the first time I’ve taken the plunge and done it exclusively.

So far, things have turned out well, despite some initial fears.  Would I mix up personal and work spaces?  Would I too easily gravitate toward the TV or a frivolous website?

It’s generally accepted that a bit more than average self control may be called for when people work from home.  But I don’t consider myself above average in this regard.  To compensate for this I try to surround myself in practices and habits that facilitate focused activity around work.

One of standard tools I’ve come to use the Pomodoro Technique.  By breaking up the work day into small bits of focused activity I’m able to both concentrate when I need to and also break things up to avoid boredom and feelings of endless toil.

The original Pomodoro Method called for a kitchen timer to keep track of 25 minute sprints of activity.  Any mechanical kitchen timer would drive me crazy with its ticking, so instead I opted for the Pomodoro One app on my company’s MacBook Pro laptop.

When starting the app, some indicators are added to the Status Menu that show how many minutes and seconds remain in the next pomodoro.


Right click on the status and select “Show” to display the simple main dialog that shows dots for each pomodoro completed today and VCR-like controls to start, pause and stop the pomodoro.
Screen Shot 2016-03-08 at 9.59.45 PM

Press the cog wheel button to configure things such as the number of minutes in a pomodoro and in the break times between them.

Screen Shot 2016-03-08 at 9.59.50 PM

The name of the game with Pomodoro is to focus when working and acquire as many pomodoros in a given day as you can.  A summary shows the number of pomodoros completed for this week and last:

Screen Shot 2016-03-08 at 9.59.11 PM

There’s a lot more involved with the Pomodoro Technique than merely using a tool like Pomodoro One, but it’s a very useful, easy to use and free tool to get you started on being more productive at home, or wherever you happen to work.

Posted in Uncategorized | Leave a comment

The Klondike Challenge

I’m a bit of a sucker when it comes to checklists and challenges.  One of my favorite things about hiking (other than the hike itself) is logging my hikes on one of my websites and seeing yet another trail marked as hiked.  Another checkmark.

Challenges, like other goals, are pretty motivating too.  The Bay Area has a couple of challenges that are sponsored by park districts each year that attempt to get citizens to visit and walk through the large number of natural areas they provide.

Late last year I stumbled upon the Klondike Challenge.  The year 2016 marks the 100th anniversary of Jack London’s life.  Jack lived in Sonoma Valley and he’s left a large impression on the area.  In commemoration of this milestone the Jack London State Historic Park folks have organized a hiking and walking challenge to get people outdoors and channel the spirit of London’s adventurousness.

This time I was ready to really act upon a challenge.  My intention is to meet, or exceed, the challenge’s 500 mile goal.  As of Jan. 4 Penny and I have already covered a bit over 10 miles.  On Jan. 2 that included an 8.5 mile trek through Sugarloaf Ridge State Park.

The 500 mile goal of the challenge is based on the rough distance travelled by London during his trip from the Yukon to the Klondike during the Alaskan gold rush around the dawn of the 20th century.

Overall, I’ve logged close to 1,000 miles on my websites.  But that was spread out over several years.  Five hundred miles in one year will definitely be a record.  Walks around town don’t really have a place on my sites so I’ll keep track of them on something like MapMyHike.  I already have about 1.5 miles there.

Through the challenge Jack London State Historic Park also hopes to raise some money for much needed trail restoration.  California’s parks are unbelievably gorgeous.  But they have suffered severe budgetary cutbacks during the last few years.  Some parks now operate under the control of entirely volunteer organizations which stepped in to avoid having the parks close altogether.  Combined with my hiking goal, I’m also hoping to help raise some money for the cause through a new crowd funding campaign.

I’d appreciate it if you could contribute a couple of dollars to the campaign to help give this wonderful park a needed boost.  I intend to cover all of the credit card costs of any donations and provide a check for the total amount of contributions.

See you on the trails!


Posted in Uncategorized | Leave a comment

Mount Robert Barron

Penny and I play a little game whenever we go on vacation.  At any souvenir shop we come across that features the typical display of personalized trinkets, such as keychains with names on them, we look to see if we can spot one with “Penny” on it.  Thus far we have not spotted a single item.

During a recent cruise to Alaska, Penny and I visited the Mendenhall Glacier outside of Juneau. While perusing the displays about glaciers and the area’s natural wonders a familiar sight caught my eye on a relief map on the wall.

Wait. What is that?  My own personalized mountain?

Yes, there’s a summit bearing my name on Admiralty Island not too far from the state’s capital. I’m not sure what I’d done to deserve such accolades, so of course I did some research to find out the true story.

This Robert Barron was the son of James Barron who helped develop the Funter Bay region.  James for a time was the President of the Thlinket Packing Company. Robert graduated from Boston University and would serve as Vice President of the company. Years prior to that young Robert’s face was apparently used on the “Buster Brand” labelling for the company.  “Buster” was a nickname that applied to both Robert and his father.

Young Robert Barron

When the US entered World War I Robert joined the Aviation Training Corps at MIT and was killed during training while trying to rescue some fellow pilots who had fallen into the Delaware River in Pennsylvania.  His father received a personal letter from President Wilson.

Cadet Robert Barron

In 1919 the US Geological Survey named the peak on Admiralty Island in his honor.  One last image, of his gravestone, offers up one more interesting fact:

Grave Marker

He also had my middle name.  Or is that the other way around?

I know of no relationship between these Barron’s and us, but it made for an interesting find nonetheless.

Posted in Travel | 3 Comments

Locking files for testing

Getting errors when trying to access locked files is a common situation that must be addressed by programs.  On Windows machines it’s fairly easy to replicate the scenario of a locked file using a simple technique that I picked up recently.  Simply run the following command with notepad.

notepad >> filename.txt

The file will remain locked until Notepad is closed.  No need to an additional tool or utility to apply a lock to a file.

Posted in Programming | Leave a comment

HTML escape characters in Azure app settings

Windows applications can make use of XML nodes in appSettings to pass configuration information into a program.  Because the app.config (or web.config) file is XML some characters need to be escaped so that they are not improperly parsed as part of the XML markup.

In a recent project I ran into a problem with the following setting:

John Doe <address@foo.com>

This represented the email address from which email was to be sent on behalf of the application.  The less than and greater than characters needed to be escaped:

John Doe &lt;address@foo.com&gt;

So now the app ran fine on my development box with the escaped characters properly converted to ‘<‘ and ‘>’ respectively.  Upload the app to an Azure web job and configure the app settings with the same value as above and this results in …..  errors.  The email program complained about invalid semi-colons.

Note that the Azure app settings values are not represented in an XML file and thus should not be HTML escaped.  Changing the Azure app setting to the original value:

John Doe <address@foo.com>

and the email code now works as expected.

Posted in Programming | Tagged | Leave a comment

Blank lines in Jinja2 Templates

When working with the Jinja2 templating engine on Python I’ve been bugged by blank lines that got inserted into the resultant XML when an optional node was excluded from the output.  Though Jinja2 sports some support for controlling whitespace I had never happened upon an answer on how to ensure that no needless blank lines ended up in the XML output.

Given the following template:

{{ name }}
{% if age_value %}
{{ age }}
{% endif %}
{{ title }}

If age is supplied to the template then the output looks great:

John Doe
Software Engineer

The problem occurs when this optional value is not available. We end up with a blank line where the age node would be:

John Doe

Software Engineer

Jinja2’s templating markup provides for the use of the ‘-‘ character before or after code blocks to strip out whitespace. So modifying the template ever so slightly to look this like:

{{ name }}
{%- if age_value %}
{{ age }}
{%- endif %}
{{ title }}

results in clean output that excludes the blank line when the optional node is left out:

John Doe
Software Engineer
Posted in Programming, Python | Tagged , | Leave a comment

TP-Link Wifi Extender Light Woes

My new TP-Link wifi extender works great at extending the range of our home wifi setup. The home office downstairs unfortunately resides in a wifi dead spot given where our AT&T wifi access point had to be located. It’s inexpensive and easy to set up.

An unexpected feature of the device was its blindingly bright “night light”.  The blue LED status indicators on the face of the unit filled a darkened room with an spooky blue glow.   My wife kept unplugging the unit from the wall at bedtime because it was bright enough to disturb her sleep.

The location chosen was ideal from a networking perspective. Moving it to another location where its light would not be troublesome was not an option.  I could find no source of information on how to dim or turn off the lights.  So what to do?

When all technical solutions fail it’s time to turn to the simple, mechanical responses. I cut out part of a business card and covered the LED’s. Success? Not really. The light was still too bright! An application of two additional business card layers taped over the light now lets us sleep in peace.  And now I can also use the computer downstairs to get nearly the same throughput as I would upstairs.

Posted in Uncategorized | Leave a comment

DateTime Intervals Versus DateTimes

I had wondered why some websites displayed date intervals (i.e. “5 days ago”, “4 hours ago”) for user posts instead of printing actual dates and times. Doing some new website work recently caused a revelation about that choice and how it solves many problems all at once.

Displaying a real date and time opens up a can of worms about what to display and how to display it. Date and time is fairly trivial as long as all users of a system are located in the same place. Each user thus shares a common timezone and expectation of what a date and time should look like.


What time is it?

Creating and maintaining a site for users across multiple timezones and borders is more problematic.  Should a date look like one of the following?

  • 12/5/2014
  • 5/12/2014
  • 2014/12/5
  • 2014-12-5
  • Dec. 5, 2014
  • On and on and on

Then there’s the problem of time.  What timezone should be stored and displayed?  The timezone of the user who submitted the content being viewed?  The timezone of the web server?  The timezone of the user viewing the content?

If you insist on displaying a proper local time to every user on your site will have to geolocate every user and then convert the stored time to their local representation.  The timezone is only part of the problem.  You also have formatting:

  • 1:45 PM
  • 13:45
  • 13:45:05

Using date intervals solves all of these problems.  All dates stored in the database are in UTC.  All displayed date and time references are expressed as the amount of time that has elapsed since that time.  It’s a simple date diff calculation between the current UTC time and the UTC time stored in the database.

The exact same display is shown to all users, anywhere on the planet.  No user or locale-specific computation must be done.

Posted in Programming | Leave a comment

Code First Foreign Keys With Different Names

The Entity Framework’s Code First scheme is handy way to do quick development of new websites. I recently had an issue with a foreign key relationship between a table I created and the ASP.Net Identity user table AspNetUsers. Typically, EF intelligently maps foreign key columns back to their parent key names. For example:

public class First
    public int FirstID;
    public int SecondID;

    // ...

    public virtual Second second { get; set; }

public class Second
    public int SecondID;

will properly result in a database schema where a foreign key relationship is set up between First and Second with SecondID as the foreign key field.

ASP.Net Identity presents a problem in that the primary key for the AspNetUser table is simply “Id”. I didn’t want a foreign key in my table simply called “Id” because this would not be very descriptive when looking at the code later. What happens when you don’t include a foreign key column but do add the reference to the code? Here’s the code:

    public class First
        public int FirstID {get; set; }
        // I'd like this to be the foreign key to the AspNetUser table.
        public string UserID {get; set; }

        public virtual ApplicationUser AspNetUser { get; set; }

And here’s a part of the resulting SQL database schema:

CREATE TABLE [dbo].[Firsts](
    [FirstID] [INT] IDENTITY(1,1) NOT NULL,
    [SecondID] [INT] NOT NULL,
        // Points TO nothing.
    [UserID] [nvarchar](MAX) NOT NULL,
    [AspNetUser_Id] [nvarchar](128) NULL

Note that EF does create a foreign key as is necessary, but it prefixes the “Id” name with the table name, in this case “AspNetUsers_Id”. It’s nice that it works, but that’s not the name I wanted to use as the foreign key. There had to be some way to employ a foreign key whose name was not the same as the primary key. A Google search showed a couple of examples on how to do this. Unfortunately, many suggested using the EF fluent interface to update the entity context at create time. The code in some cases looked extremely hard to follow.

Eventually I stumbled upon a much simpler solution. By simply adding the ForeignKey attribute to the foreign key declaration EF will be able to properly associate the foreign and primary keys even if their names are not the same. All that’s required is that you spell out the table which the key references:

[Required, ForeignKey("AspNetUser")]
public string UserID { get; set; }

With this simple one line fix I was able to use the foreign key column name that I thought was easier to read, UserID.

    ADD CONSTRAINT [FK_dbo.Firsts_dbo.AspNetUsers_UserID]
REFERENCES [dbo].[AspNetUsers] ([Id])
Posted in Programming | Tagged | 1 Comment