Bike Travel

The bulk of my vacation time the past few years, has been spent with me driving to a city with my bike and then biking around the city. Sometimes this has been to go on official bike rides with thousands of other people on closed streets and others it's just me riding around town on bike paths or in the street. I absolutely love doing this. The big rides are fun because the towns usually route the ride through interesting neighborhoods and past important landmarks. And the individual rides are fun because it's neat to learn your way around a new town. It's also easy. I can put a destination in google maps and have it tell me directions best for biking.

As the weather gets chillier and I'm riding a little less (though not much as I want to ride through as much of winter as I can), I'm looking for other events or just fun places to ride. I'll probably set up a regular webpage with information when I have more, but I just wanted to put down what I've found so far. One thing I've noticed when I searched for rides is that it's a little difficult to determine if a ride is car-free or not. Since some people who I have biked with will only ride on closed-streets, it's something I have to take into account.

Car-free Rides on the Road

  • Bike The Drive - Chicago
    My hometown ride that I've been doing for years. It's always on the sunday before Memorial Day. Beautiful Lake Shore Drive is closed to traffic from around 6am to 9:30. It's 30 miles of road that you can ride as many times as you want in the morning.
  • Five Boro Bike Tour - New York
    I've done this ride the last three years. It's fun and you get to go to all five boroughs of New York. Two drawbacks for me. One is that the end of the ride is on Staten Island and you have to take a ferry back to Manhattan. There's usually a pretty long wait for the ferry, though the free ride is pretty cool, since you can see the Statue of Liberty. The other is that there are a lot of people on this ride and it gets so congested in spots that you have to walk your bike. A third drawback for me personally is that it crosses a number of really high bridges and I'm slightly afraid of heights. Other people will probably not mind this at all. Total ride is around 40 miles, though you can take the Brooklyn Bridge back to make it shorter. This ride is the first weekend in June.
  • Tour de Troit - Detroit
    Just did this ride for the first time this year. Loved it. It's around 28 miles all over Detroit. You get to see all sorts of different neighborhoods. It was a little crowded at the beginning, but then it turned into a lovely ride, even if it was lightly raining when we did it. I will definitely be going back next year. It's in September.
  • Tour de Ille - Montre├íl
    I signed up for this ride this year, but couldn't go. For me, this will be a little difficult to get to, but it looks to be an awesome ride. It's 50km (31 miles) all over Montreál. It's around the end of May/start of June. Definitely on my list.
  • Minneapolis Bike Tour - Minneapolis
    I just found out about this one and it looks like a good ride. Sadly, it also appears to be on the same day as the Tour de Troit. I will have to check the date for 2016 as I'd definitely like to do it. They have different lengths of 16, 25 and 32 mile routes. And I know Minneapolis is a very bike-friendly town, so I'd assume this would be a great ride.
  • Ride for the Arts - Milwaukee
    I'm not sure that this is 100% car-free as the map shows some roads as closed, but I can't tell if they all are. This ride also has routes of various lengths. Drawback, for me, is that I think it's the same day as Bike the Drive, but will have to double-check.
  • Pedal Pittsburgh - Pittsburgh
    This is another ride that I'm not certain is 100% car free. I have biked in Pittsburgh before (I love Pittsburgh) and one thing I should note is that it's not flat. I rode up the steepest hill I've ever ridden here and while that was quite the challenge, I think the more terrifying part was the ride down. Note that I'm used to riding in the flat midwest, so hills are always a little crazy for me. Routes of various lengths and it's usually at the end of August.
  • Tour de Nash - Nashville
    Again, not totally certain that the ride is 100% car free. The pictures on the website don't show any cars, which makes me think it is, but I'm not sure. This ride is in May and they look to have three routes of different lengths.
  • Ride the Drive - Madison
    This is a closed road event, though it's not just for bikes. The streets are closed from 8:30am to around 3pm for people to use the road for whatever they want. I can't really tell how long the ride would be from end to end, but my guess is about 10 miles. For 2016, it'll be on July 31st.
  • Hub on Wheels - Boston
    This ride is not completely car-free, though the 10 mile ride is. For the longer routes, you'll share the road with cars. I have biked around Boston once and it was a lot of fun. I didn't have any problems on the road, so I think this ride would be pretty good, even if you have to share the road with cars.
  • Acadia National Park Car-Free Mornings - Maine
    Two days in 2015, Acadia National Park closed the roads to cars. Don't know if they'll do it again in 2016, but that could be fun.
  • Ciclavia - Los Angeles
    Another place where they close the roads to allow people to do all sorts of things in the street. I haven't gone to one of these, but they look like fun. One drawback that I've heard is that so many people come out, it can get very crowded in some places, which would make riding your bike difficult.

Other Places

  • Washington DC - I was in DC for the Cherry Blossom Festival last year and it was great fun riding my bike around town. There are lots of bike paths there and it's easy to get around.
  • Philadelphia - I've heard that Philly is a nice place to bike because the roads are all pretty narrow so cars can't travel that fast. They also just put in a new bike trail that I've heard is a really nice place to ride.
  • Maine Lighthouse Ride - Maine
    This is an organized ride where you share the road with cars. I'm looking into it because Maine is beautiful and I have a friend who lives in Canada not too far from there. So we could meet up to do the ride. It's in September.
  • Tour de Lou - Louisville
    I signed up for this ride last year, but didn't go because the weather looked really bad. It's the start of Kentucky Derby Festival and looks to be an interesting ride. The road are not all closed, so that's one drawback. It's on May 1st, 2016.
  • Tour de Donut - Staunton, Illinois
    The only reason I'm including this is that it combines two of my favorite things in life, riding my bike and eating donuts. In general, I like riding in cities more, just because there's more to look at. And this is partially a race and not just a leisurely ride, so it's not high on my list of things to attend. But it has donuts...
  • Indianapolis - I've ridden the Cultural Trail and the Monon trail and they're really nice. It was raining pretty hard when I rode them and I still had a great ride. There are plenty of places to stop and eat if you'd like. I'd definitely like to do this again.
  • Atlanta - Heard about a trail called the BeltLine. Could be nice
  • Portland - Everyone always says Portland, so I'll have to get out there someday
  • Prince Edward Island - I'd think this would be really pretty.
  • Winnipeg - They have a pretty active biking community and a big bike week in June. They also have a ciclovia.

That's all I have for now. I'll try to make a more permanent page as I get more information.

Could I Live without My Car?

A couple of days ago, I hit 2000 miles of biking for the year. It wasn't a goal to do this at the start of the year, but I'm rather pleased with myself. I actually thought it was a bit of an accomplishment until I read a blog post somewhere about a woman with MS who rode like 6000 miles for the year. I have a long way to go to reach that. But this got me thinking, do I really need to own my own car?

One of the big plusses in buying my house was that I didn't want to be dependent on a car. While I mainly bike to work, if that's not an option, I can also take public transit. I absolutely do not need my car to get to work. I live approximately four blocks from a grocery store, four blocks from a library and maybe six blocks from Target. And I'm less than a mile from a train station that can get me downtown in around 10 minutes. For my day-to-day life, I really don't think I need a car.

Are there times when I do need a car? Absolutely. I can't easily get to my Mom's house without a car. And I have plenty of other family members and friends who live out in the suburbs that are much easier to get to with a car. It's also really nice to have the car when I go to get supplies from Home Depot for working on my house. Could I replace these drives with using a rental car instead? One of the most-brilliant things I did years ago was purchase a lifetime membership in, then startup, I-Go Cars. In Chicago, this by-the-hour car rental is now part of Enterprise. And I've just found out that there's an I-Go car parked about a mile from my house. It's not as convenient as my garage, but it's pretty close. So using the rental more is definitely an option.

Since this year I've been trying to use my bike over my car, I have found that when I do drive my car...it's more fun. It's kind of like a treat to take out the car. I know a lot of people dread driving, but I'm not one of them. The other thing I like about having a car is that it's a complicated piece of machinery. And learning how it works is really interesting to me. There's a small part of me that enjoys doing maintenance on the car. Yes, I know this makes me an oddity, but it's also an argument for keeping the car. And I do have to say that driving my car to a new city with my bike, has been my major source of relaxation for the past year.

I think I'm going to use this winter as a test. I want to see how many times I just go to my car without thinking about it. Or I'll see if I can plan all my trips so that it would be like I'd be planning on getting an I-Go car. Now I'm just curious about this. A few years ago, I would have never thought this was a possibility. But now I'm thinking that it might be.

Oatmeal Update

I had posted my recipe for oatmeal a while back. As it's getting chilly, I've started having it for breakfast again. This time though, I had whole milk in the house because I had been using it for baking. I think this improves the taste a lot. So my new recipe for oatmeal is:

1 cup water
1 cup whole milk
1/3 cup oatmeal
pat of butter
pinch of salt

Heat up the water, milk, salt and butter, not necessarily to a boil, but get it a little warm. Add the oats and put on low for about 1/2 hour. I always use a nonstick pan because I've been known to put this on and go back to bed for a bit. Sometimes things burn a little and it makes cleanup easier. Though, even with a little burning, the oatmeal tastes ok. I used to toast the oatmeal before adding it in. I haven't been doing that because I just don't feel like cleaning another pan.

I Love Fall

Autumn is my favorite time of year. My birthday is in October. The weather is usually nicely cool. The leaves on the trees turn giving beautiful colors to both the city and rural landscapes. I also usually start cooking again in earnest as the weather cools. In summer, when it's hot, I don't like to use my stove or oven. This limits meals to uncooked food, like salads. As I get older, I am getting better at eating salads regularly. But I have to admit, a salad is, in general, not a meal I'm going to love.

Cooler weather, though, allows me to make bread and soups. These are meals which I greatly enjoy and feel very filling. (Salads never give me that feeling.) This past week, I made rolls and minestrone soup. Both of these are things that freeze without any problems, another plus. I took a roll and a thermos of soup to work every day for lunch and loved it. First, I enjoyed my lunch more than if I bought something. Second, I saved money. Third, I think I ate healthier.

Even though I'm no longer in school, I like how fall is the start of the school year. While I am always trying to learn new things, official and unofficial classes start again in the fall. This year, I signed up for a class in basic car repair at a local park. This has been a wonderful experience. I'll be honest that I first thought I'd attend a couple of classes and then just stop going if I got bored. But that hasn't happened. Mainly because I'm the only person in the class. Also because it's really fascinating to see all the details of how a car works. Will I become a mechanic? Probably not. But I have already learned a few maintenance things that I can do for myself that will definitely save me money. I've easily learned more than the $60 I paid for the class.

In recent years, I've also found that there are many fun bike rides in the fall. I should note that there are also a number of good ones in the spring. This year, I went to Detroit in September. That ride was a lot of fun. Next year, I plan to return. And in looking around, I've found other rides that are in the fall. Next year, I'm looking at going to Maine for the Maine Lighthouse Ride or to Minneapolis for the Minneapolis Bike Tour.

Yes, there are some drawbacks to fall. It's still dark when I'm biking in to work. But I have lights on my bike to help out. And it gets dark earlier in the evening, which just makes me sleepy earlier. I thankfully don't have to cut the grass, but I do have to rake leaves. With the cooler weather, I have to turn the heat on in the house, so my gas bill goes up. I also have to wear different clothes on my ride into work. Fortunately, after biking for so long, I have the proper clothing. These drawbacks are all minor and you can find things to complain about in any season. All I'm noting here is that I love fall.

Ruby Iconv to Strings#encode

I wrote a script in Perl, years ago, that lets users update their unix and samba passwords at the same time. This keeps them in sync so that people will have the same password whether they're logging in via linux or at a windows computer. I thought it would be a good idea to rewrite it in ruby, since that's the language I'm most comfortable with these days. Along with Google, the book that was most helpful was Programming Ruby 1.9 & 2.0 from the Pragmatic Programmers, which fortunately, I had.

We have a server running openldap and samba. It serves as our primary domain controller for the windows cluster and authenticates linux users as well. Each user has an entry that looks like this:

dn: uid=art,ou=people,dc=top,dc=example,dc=com
uid: art
cn: Art Treatcher
objectClass: posixAccount
objectClass: top
objectClass: person
objectClass: inetOrgPerson
objectClass: sambaSamAccount
loginShell: /bin/bash
uidNumber: 1632
gidNumber: 200
homeDirectory: /users/art
gecos: Art Treatcher
mail: [email protected]
sambaAcctFlags: [UX]
sambaLogoffTime: 2147483647
sambaKickoffTime: 2146473647
sambaSID: S-1-5-21-3639540563-330460068-1655887120-4264
sambaPrimaryGroupSID: S-1-5-21-3639540563-330460068-1655887120-1401
sn: treacher
sambaLMPassword: DE8F9826FE3ACDB8D8F7F5860820ED3F
sambaPwdLastSet: 1358449419
sambaNTPassword: 880AAD1DE8956477793C417928DE4C25
userPassword:: e1NTSEF9YnJSQXB4TXlLN3lVUEVuaFBhU3Y0aUhHMDBOano5THcK

The two fields that my script is concerned with are at the bottom of the entry. The field userPassword is the encrypted linux password and sambaNTPassword is the encrypted password that windows looks at to login. Getting the linux password is easy because openldap ships with the slappasswd command. Simply running slappasswd -s password will generate the value to put in userPassword.

The complicated one is sambaNTPassword. After googling around a bit, I found this page. It basically says you should use the following to generate the value for sambaNTPassword.

OpenSSL::Digest::MD4.hexdigest(Iconv.iconv("UCS-2", "UTF-8", pass).join).upcase

That probably worked fine in 2008 when that page was written, but Iconv has been deprecated. A bit more googling told me that I should instead use strings#encode to change the encoding. Now the Programming Ruby book has a whole chapter on character encodings. They also include a little script to generate a table of known encoding names. Running that script gave me a big table, but the interesting part was here:

UTF-16
UTF-16BE (UCS-2BE)
UTF-16LE
UTF-32
UTF-32BE (UCS-4BE)
UTF-32LE (UCS-4LE)
UTF-7 (CP65000)

I had tried something like

OpenSSL::Digest::MD4.hexdigest(pass.encode("UCS-2").join).upcase

but found there wasn't a UCS-2 encoding. However, there was a UCS-2BE. I tried that and found that I didn't need the join anymore, so I tried this:

OpenSSL::Digest::MD4.hexdigest(pass.encode("UCS-2BE")).upcase

That gave me something, but not the right thing as I couldn't login to my windows domain. Then I remembered reading this page that's written in perl, but also says what's going on. "The NT hash uses the MD4 algorithm, applied to the password in UTF-16 Little Endian encoding". I figured that UTF-16BE was Big Endian and UTF-16LE was Little Endian. So I changed the code to this:

OpenSSL::Digest::MD4.hexdigest(pass.encode("UTF-16LE")).upcase

And that works perfectly! I was able to login to the windows domain and the linux computers. I still have a little more checking to do. And I'm trying to learn how to write tests for ruby code, so I'd like to do something with that. But right now, I'm really happy with this.

And here's the script on github.

Multiple Authentication Methods with Authlogic

I have a website where users need to login to be able to comment on pictures. For the most part, users will use their university credentials to login. However, I've found a few recently retired people who would be able to help us identify people in the pictures. But since they are retired, their university credentials are no longer valid. So for these people, I'd like to be able to make a local account for them to login. My rails app uses authlogic to check credentials. And I've been authenticating against the university ldap server for a while without any problems, but mixing in local accounts is going to require a few changes.

Normally, I'd just edit the user model with the following.

	acts_as_authentic do |c|
		c.validate_password_field = false
		c.crypto_provider = Authlogic::CryptoProviders::SCrypt
		c.logged_in_timeout				= 2.hours
	end

	def valid_password?(password)
		ldap_settings = YAML.load_file("#{Rails.root.to_s}/config/ldap.yml")[Rails.env]

		ldap_settings[:host] = ldap_settings['host']
		ldap_settings[:port] = ldap_settings['port']
		ldap_settings[:encryption] = { method: :simple_tls } if ldap_settings['ssl']
		ldap_settings[:auth] =
			{ method: :simple, username: "uid=#{self.username}, #{ldap_settings['base']}", password: password }

		ldap = Net::LDAP.new(ldap_settings)
		ldap.bind
	end

And the fields that my user model has are:

  create_table "users", force: :cascade do |t|
    t.string   "username",          limit: 255
    t.string   "firstname",         limit: 255
    t.string   "lastname",          limit: 255
    t.string   "persistence_token", limit: 255
    t.datetime "last_request_at"
    t.string   "role",              limit: 255
    t.datetime "created_at",                                    null: false
    t.datetime "updated_at",                                    null: false
  end

The default way that authlogic checks passwords is to run a method called valid_password? and return true if the password is good and false if not. To check against an ldap server, I just wrote a new valid_password? method (shown above) with the settings for my ldap server in a file called ldap.yml. The ldap.yml file looks something like this:

development:
    host: local.example.com
    port: 636
    base: ou=people,dc=test,dc=example,dc=com
    ssl: true

production:
    host: ldap.example.com
    port: 636
    base: ou=people,dc=example,dc=com
    ssl: true

Now, in order to use local accounts as well, I need to make a few changes to the user model. First, I need to determine if the account is a local or an ldap account. Since by the time I was starting this, I already had about 100 ldap accounts, but no local accounts, I added a field to the user model called local_account. If it's true, it's a local account and if not, it's ldap. This way, I didn't need to change anything on the ldap accounts I already created. Secondly, I needed to add the fields that authlogic needs to store passwords in the database. These were strings: crypted_password and password_salt.

$ rails g migration add_fields_to_users crypted_password:string password_salt:string local_account:boolean

After I migrated these in, I had to change my new user form to accept a username and password for local users. Since I don't anticipate making many of these, I didn't do anything fancy with the form. It looks like this:

<%= form_for(@user) do |f| %>
  Univeristy id: <%= f.text_field :username %>
Firstname: <%= f.text_field :firstname %>
Lastname: <%= f.text_field :lastname %>
Role: <%= f.collection_select :role, User::ROLES, :to_s, :humanize %>

If person doesn't have a University id, use their email address and be sure to fill out the following. Most importantly, be sure to check the local_account box. (The account name doesn't have to be an email address, but since University ids are never email addresses, they'd be safe to use.

Local_account? <%= f.check_box :local_account %>
Password: <%= f.password_field :password %>
Password confirmation: <%= f.password_field :password_confirmation %>
<%= f.submit 'Submit' %> <% end %>

Now, how should I change valid_password? to check locally for the password if the local_account value is true? After reading the code for a bit, I found that authlogic itself calls a method valid_password? to check the password. All I need to do is change my valid_password? to first ask if local_account is true. If it is, call the authlogic valid_password?. If it's not, call my valid_password?. The first problem is obvious in that it's confusing that we're calling the same method, but in different locations. After a bit more searching, I found that authlogic has already thought of this. They have a method called verify_password_method which will let me change the name of my method to something else. So to fix all of this, here's what I changed.

In the user_session.rb file

class UserSession < Authlogic::Session::Base
	verify_password_method :good_password?
end

In the user.rb file, I changed my valid_password? method to good_password? and then call the authlogic valid_password? method if local_account is true.

def good_password?(password)
	if local_account == false
		ldap_settings = YAML.load_file("#{Rails.root.to_s}/config/ldap.yml")[Rails.env]
		ldap_settings[:host] = ldap_settings['host']
		ldap_settings[:port] = ldap_settings['port']
		ldap_settings[:encryption] = { method: :simple_tls } if ldap_settings['ssl']
		ldap_settings[:auth] =
			{ method: :simple, username: "uid=#{self.username}, #{ldap_settings['base']}", password: password }

		ldap = Net::LDAP.new(ldap_settings)
		ldap.bind
	else
		# Here checking local accounts in the database
		valid_password?(password, true)
	end
end

This works exactly as I wanted. I still haven't set things up for people to recover their local password if they forgot it. But since I think that there will be maybe 2-4 people who get local accounts, I can just ask them to email me and I can set it to something manually.

Alternative DNS

My internet connection went down today for a few hours. Technically, I guess it didn't go down, but DNS wasn't working. So I could ping 216.58.216.68, but I couldn't ping www.google.com. I had been using the DNS servers from comcast that I got from DNS. I believe they're 75.75.75.75 and 75.75.76.76. But since these weren't working for me, I changed to the following:

208.67.222.222 (opendns)
208.67.220.220 (opendns)

and now things are working again.

I could also use:

8.8.8.8 (google)
8.8.4.4 (google)

Update:
Found out that in Chicago, the comcast DNS servers are:

68.87.72.134
68.87.77.134

I know these were not the servers that I was assigned. I'll hang on to them in case needed.