Bike maintenance update

For the last two nights I’ve worked on my bike. I bled my rear break and serviced the rear shock.

The rear break is now really great; better than ever; better than the lame ass job Canyon Bicycles did when they bled it for me. It totally had an air bubble inside.

The rear shock maintenance was really just preventive. I replaced the outer seals, the seal kit was just $8.

I also noticed a loose spoke in the front wheel and the cable housing for the rear derailleur is busted close to the bottom bracket. So those are more things to add to the maintenance list.

And I finished servicing the front suspension but the damping leg is not working at all. It was working before so I’m not doing something right. I need to research and fix this.

Getting Data from an Excel File in ASP.NET

Let’s say I have a FileUpload control for the user to select an excel file. I then want to access the data in the excel file and be able to do stuff like row[“column”] to access the value of a specific item within a row.

This solution does not rely on MS Excel to be installed on the server. It uses the Microsoft.Jet.OLEDB.4.0 data source. Which I think is the same one that is used to access a MS Access database.

Now to the code. This is how the UI would look like:

image

And the C# code:

protected void btnContinue_Click(object sender, EventArgs e)
{
    string tempFileLocation = Path.GetTempFileName();
    this.fuCSV.SaveAs(tempFileLocation);
    string connString =
        @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
        + tempFileLocation
        + @";Extended Properties=""Excel 8.0;HDR=YES;""";

    OleDbConnection conn = new OleDbConnection(connString);
    conn.Open();

    // Get the name of the first Excel worksheet
    string worksheetName =
        conn.GetSchema("Tables").Rows[0]["TABLE_NAME"] as string;
    OleDbCommand cmd =
        new OleDbCommand(@"SELECT * FROM [" + worksheetName + @"]", conn);
    OleDbDataAdapter da = new OleDbDataAdapter(cmd);

    DataTable dt = new DataTable();
    da.Fill(dt);

    // Do cool stuff here

}

The “HDR=YES” part of the connection string enables you to access the fields inside a row using the column header as an index. For data like:

Name

Email

Pedro

pedro@somewhere.net

Bob

bob@somewhere.net

 

you could do dt.Rows[0][“Email”] to get pedro@somewhere.net . How cool is that!

All of this works on CSV files as well, you only have to tweak the connection string a little bit.

Finally Some Sun!

On the weekend (I think Sunday) it started raining/snowing from about 4pm and it kept going into the freezing night. For cars with old locks like mine, this means opening your door in the morning will be a pain. You see, the water goes into the door locks and into the space between the door and the door frames and when night comes, it freezes.

To open the locks I have mastered the “blow through a straw into the lock” technique, I have found this is the best of all techniques. It’s even better than the “heat your key with a lighter” technique that I used for many years. After a minute or two of doing that, you’re able to open the lock. Some people might think you could blow into the lock without the straw but BE WARNED, your lips will get stuck to the lock.

dumb-and-dumber-tongue-stuck

And unlocking the door is just half the battle. After that you need to find a door that is not frozen shut; but since there are four of them, one of them usually opens after a tough pull. Once you’re in the car, you can push open any door as long as the actual lever that grabs the door frame is not frozen (which has happened to me twice on the driver’s door).

Once you’ve regained access to your car you need to remember to leave a door unlocked because the frozen water in the locks will not get out until the weather get’s well above freezing point. And your locks will get back to being frozen shut after the heat from your breath goes away.

So I’ve been with my car unlocked since the weekend. And I actually forgot to leave it unlocked last night! But  I was lucky enough that it was sunny this morning and some rays were able to hit the passenger door through the trees.

Weather Randoms

So this morning I went out the door with my usual two layers, a light sweater to carry around the office and my coat for the drive to the office. But when I got out the door I noticed it was not cold at all! What the heck? weather.com said we were at 35F, feels like 31F. But it really felt like 40 or 45F (5C to 7C) to me. My light sweater was enough, this break from the cold felt very refreshing!

Salt Lake City has not had a good wind to blow the smog away for about a week now. The current air quality is terrible, we’re living under a fog of pollution. For those of you that don’t live in SLC: SLC lies on a valley and we rely on moderate winds to take the junky air somewhere else. Hopefully we’ll have some wind soon.

Blackberry upgrade

Since the new Blackberry Storm came out (the one that is similar to the iPhone), several Neumont employees tried really hard to get Neumont get it for them. Neumont did not see the business benefit of the upgrade since it was really not going to make them more efficient at their work, but Neumont allowed them to upgrade at their own expense and some did.

I did not want to pay for the latest and greatest, but I did put in practice some office scavenging.

Scavenger: An animal, such as a bird or insect, that feeds on dead or decaying matter

It’s a funny thing, office scavenging. I’ve been at Neumont for almost 6 years and that is why I have my two 20 inch flat screen monitors, my chair of choice, and now the BlackBerry 8703e. When I was a faculty member, I scavenged my way into the best cube. I had windows with an excellent view all around.

Now that I’m a member of the IT dept, I share a windowless office with 3 other guys. I actually do not miss the glare and brightness that came from the huge windows in my previous cube. It strained my eyes and gave me headaches some times.

Back to the blackberry, i was upgraded from this:

bb-old

to this:

bb-new 

The bigger screen and full keyboard are a humongous difference. Before, I would wait to reply to non-critical emails until I got to my computer but I now use the berry for those as well. Also, I can type in Spanish a lot faster. My old blackberry only “smart typed” well in English. Browsing the internet is faster and more things fit on the screen. Good stuff.

The only thing I envy from the blackberry Storm is that is has a camera. If my berry had a camera I could take pictures of the “daily happenings” and publish them on my blog.

My laptop died =(

It’s been a long time since something really bad happened to my laptop, but last week it froze on me when I was watching a movie on Netflix instant watch. I had to push the power button for 10 seconds to shut it down and it would not boot after that. I get a hard drive error.

I’ll see if I can get my data out when I get to work on Monday but I really think I won’t be able to. I backup my laptop weekly so I’m not too worried. But it is a pain in the butt to get my laptop the way I want it with the development tools, and all.

Swimming Progress

As you probably know, I’ve been swimming for this and the past 2 winters. I usually swim from November until March or April; when I cannot mountain bike.

Since last winter, I’ve been self learning the butterfly style. I think I finally have it going! It really just took a lot of practice and watching some videos on YouTube. I still get pretty exhausted after one lap on the 25m pool (50meters total), so I know I still need to work a lot on the style. But at least I think I don’t look ridiculous any more so I’m practicing it even more.