Excessive

Writing Photography Rambling

March 11, 2011 11:55PM

MacGruber to the rescue!


So work was kind of retarded for a few reasons, specifically because the only reason I was in was to put out a test dinner and put out the hot and cold food of a buffet, so that Jeff could go home, however this dude at work... I dunno if he was told to, or did on his own, but came over at 7:30 and just put out the hot food himself, so like... why in gods name was I there in the first place? Why did I have to work late the night before a day I had to work early when obviously there was no reason for me to be there. It was annoying, and kind of felt like some respect and independance was ripped away from me.

When I got home, I wasn't super hungry or anything, as I was starting to get a headache, but I was hungry enough to make some fresh bruschetta and ate the rest of my baguette and one tomato's worth of bruschetta. I find that if I don't do things that require motivation right as soon as I get home, I won't do it, so I jumped on that right away.

We rented the movie MacGruber (well, Michelle rented it last weekend, even though we had it On Demand, hahahah), and tonight was the last night we'd have it, so we decided to watch it. Since I have to work tomorrow early, and I got home at 10pm, we had to watch it right away or I would be up too late, so we put that on pretty much as soon as I got home and that's what I watched while eating.

Once I was done eating, I decided that I wanted to program a little bit, since I have been having a hard time paying attention to just one thing, so.. uhh.. well what the goal was... is that as of right now, every time that an entry is loaded (on a page, or into a form) the word count is calculated at the time of loading and then printed to the screen, which means it's not stored in the database, which means I can't retrieve entries based on word counts, because the database doesn't know that information, so I added a wordcount column to my entry table. However, when you add a column and there are already thousands of rows, the value of that column will be 0 for every row. So, adding the column does nothing, every entry still has a word count of 0. The solution to this, would be to write a script that loads every single entry in the database. Start at the top of the list, load that entry, calculate the word count, and then save that to the database, and move to the next entry, for all 1520 entries, so that's what I wrote while watching the movie.

Now, instead of jumping through loops to figure out how many total words I've written on the website (ie. by loading every entry, and adding each word count together), I can just send to the database SELECT SUM(wordcount) FROM entries and it will show me the total (with is over 500000 words now by the way). While it won't make any difference to you people, it will eventually help with loading times, and make introducing new features that might rely on word counts (such as clicking a link to view the top 10 longest entries would now be super easy to do), those types of things will be very easy to accomplish in the future. These are the types of changes I'm slowly making, things that will make expanding and improving features easier and more natural.

I have to work tomorrow at 8am, and I've yet to figure out if I can get there on time via the bus, but I can't afford a cab, so I guess it doesn't really matter. I'll be checking before I go to bed... Anyway, tomorrow shouldn't be too retarded, however you never know. It's a breakfast buffet for 10, and then a lunch thing for the same 10, and that should be it, so I can just get Sunday stuff ready afterward.

That's all I've got for now, I'm going to try to go to bed even though I'm not that tired yet. It'll regret it tomorrow if I stay up much longer.


752 words

No Tags
Timeline
  • I lived on Langarth St.
  • I worked at Windermere
  • Michelle was my Roommate

Leave a Comment

Your email address will not be published. Required fields are marked *