Redesign and revamp
Jul 5, 2017 - 05 p.m.

A couple weeks ago, I got an email from my lovely web host (webfaction) that they were migrating my account to a new shared server. I've had an account with them for so long that the server I was on was still 32 bit and they were moving me to a 64 bit server. Nice of them, but it meant I needed to do some legwork updating various software.

This blog is written in django, and the version was hilariously out of date. I had been running 1.2, and the latest version is 1.11 (!) The upgrade ended up being suprisingly easy. For the simple functionality of a blog, very little has changed in django over the last nine versions, which was convenient. Most of the original code required little re-working. The biggest hurdle was shaking the cobwebs loose around working on python again.

During the process of upgrading, I was looking at the site more than I had in a while. And what I was seeing was that it was ugly as sin. Web design ages poorly, especially design done by an inexperienced web developer, and this design was roughly eight years old.

So I added the goal of a redesign. I used Materialize, which I also used when building my pointing poker clone, and I quite like how things turned out. I especially like that materialize gives you a set of pre-defined color schemes to work with.

So that's the story of how my blog came back to life and why it looks different. I think my next goal is going to be rewriting it as a single page app in Elm, because I think Elm is a joy to write and it would be nice to build a full application with it.
Tuesday
Apr 26, 2017 - 03 p.m.

Yesterday, the clock was approaching noon, and I was thinking about lunch. I try to bring lunch most days in the interest of saving money. Physically bringing the lunch is the easy part. Gathering everything has become another step in my morning routine, just like feeding the animals or carrying Hildy downstairs.

The struggle comes when it's time to eat and I want something that is not the yogurt/apple/protein bar combo that I brought. Typically pizza sounds like a better proposition.

Like everyone in the entire world, when I do something weak-willed, I do my best to justify it. A great go-to is, "Well, it's been a long week, I deserve a treat". This is what I told myself yesterday as I was thinking about lunch.

Yesterday was Tuesday, in case you were curious.

One and a half days of work hardly rates for the long week justification. I ate my yogurt.

However, Wednesday, depending how you measure, is the start of the end of the week, right? It's almost time for lunch.
Coffee and Tea
Mar 24, 2017 - 12 p.m.

In my life I've experimented with my caffeine intake. Sleep has always been tricky for me and caffeine is a big part of that. When I was still in college, I went through a phase of constant coffee drinking that resulted in a year of non-stop stomach problems. About a year ago, I was drinking no caffeine at all. I don't know what my ideal is, but caffeine has positive affects on productivity in general, so completely cutting it isn't great, and stomach problems are for sure not good.

I don't have the answer and I'm not the best optimizer, but currently, I drink a single cup of green tea a day. Today, I'm drinking a cup of coffee. I had to be up early and didn't go to bed soon enough last night. The coffee has more caffeine and feels like a treat. I've got to be careful though, since coffee and it's higher caffeine (and subsequent sleepless nights) is a very seductive thing. Funny how the stuff that is a treat can so quickly become the norm.
Trying to write more
Jun 5, 2015 - 01 a.m.

So it's been about three years since the last post here. That seems hard to believe, since the post before this recounts a tale from the job that I started right before moving to Buffalo, and it doesn't feel like I've lived here for three years at all. Time, as per usual, has passed more quickly than I'd like.

I don't feel bad about it, since writing hasn't been a priority for various reasons, but lately I've been feeling the itch. A majority of the posts here were the result of challenging myself to write a post a week, and it was surprising how easy it was to come up with at least something every week. I recall them being ok, but I haven't scrolled back and read through any of them in a while. Mostly, I just like the idea of having written.

And that's sort of what this post is about. Since the beginning of this year, I've been making a genuine effort to reprioritize some things that I've been neglecting. The crux of those efforts has been scheduling things and seeing how I do following through. Using Google Inbox reminders I've set myself things that I should be doing. Tonight I had a reminder pop up to "write", so here I am.

Other habits I've been trying to form: yoga, running, meditation, calling friends and making time to finish the book I've been reading for who knows how long. I've had varying success with all of these, and I've been happier, so I'm continuing to try.

Writing feels nice at the moment, so after editing this post I'll set a reminder for next week, and I can write something about the other things I've been trying.
In which python is great
Apr 22, 2012 - 02 p.m.

To me, python's greatest strength is that the syntax is almost identical to the form that programs take when they appear in your mind. This makes the time from the initial thought to final code shorter, and makes it easy for others reading your code to understand your thinking. This makes it ideal for interview problems, but mostly just makes it a joy to work with.

To profile some code that I had written, I was calculating the average of many page loads. My inital approach was to write down the numbers and then plug them into a calculator. Simple enough, but like most pure programming problems, very boring for numbers greater than three or four. Sounds like a good time for some python.

To start, I formatted my numbers as simply as possible. The file looked like this:

Baseline
Wall 130 45 300 312 60 77
CPU 100 50 330 300 60 78
Mem 2000 2121 400 3100 1945 1224


I wanted it to print out the name of the run (Baseline in this case), and then print an average of each measurement. The code I wrote was this:

f = open('runs', 'r')

for line in f:
    parts = line.split(' ')
    sum = 0
    count = 0
    for part in parts:
        try:
            n = int(part)
            sum += n
            count += 1
        except ValueError:
            print part

    try:
        print sum / count
    except ZeroDivisionError:
        pass


Short, and gets the job done. The best part is that it only took about five minutes from inception to working code. I needed to run it twice to get the names of the exceptions correct, but beyond that, it took me almost no time compared to the amount of time it saved, and that's a beautiful thing.

Could I have done it with awk? or excel? Certainly. However, one requires opening up excel (if you even have it. Also, yuck), and the other would require a bit of reading to figure out. Neither is really ideal. Although the awk one might be sort of fun. Perhaps we'll see about that in a future post.