Foiled by Procrastination.

Monday, 5th July, 2004 :: 05:50 EDT - Tech

I’ve been looking for a new webserver for a while now and had pretty much decided what I was going to get. The process is the careful balancing between cost and features along with room for future expansion. Transfering clients from one server to another is a very time and cost hungry endeavor, so one doesn’t want to do it very often of course. As I said, I’d pretty much decided which one, and I almost ordered it lastnight, but decided to wait. I almost ordered it again earlier this morning, but again decided to wait. I wanted to double check with a colleague of mine that hosts with the same company to make sure I wasn’t making a mistake.

I sort of decide that I should just do it, because I wanted to have plenty of time to get it running to full efficiency and move everyone nice and slowly. I go to order it and behold, they’re now sold out. Damn that procrastination!

Of course, I have more options, I don’t absolutely need the particular webserver I had in mind. I could go for one slightly less powerful than the original choice (of course it is still infinitely better than the current one) or I could go for one that I think is excessively powerful for the current and forseable future needs. The problem with the latter choice is that the cost is rather high, which decreases the profit margin enough to make it questionable. Of course, though, having all that raw power would be very nice and would allow for nearly indefinite future expansion, hmmm…. Dual XEON processors, yum! I just don’t think it is necessary.

The less powerful one from the original choice is a Celeron, I just don’t like the idea of using that sort of processor in a webserver, the cache isn’t good enough in my opinion. In the same general pricerange as the Dual Xeon there’s a 3+GHz P4 option, but I think the Dual Xeons would be better.

I think I’m going to end up procrastinating even more, because I just don’t know the best direction to go right now.

Make it a Strong One.

Saturday, 3rd July, 2004 :: 13:32 EDT - Sidenotes

I’m going with Patrick to this wedding today, some people he works with or one of his bosses or something. He’d sort of been on my ass for the last couple of weeks to make sure that my suits still fit, to which I procrastinated a lot about. I basically decide to not bother with the suits and just wear a shirt, tie, dress pants, etc, which I figured wouldn’t be much trouble.

Just for the hell of it I decided to try on the suits anyway. Both jackets are large enough to hold two of me, and the pants are large enough to hold one and a half of me. It’s almost one of those weight-loss commercials come true, lol. It’s astounding to realize that I actually fit into them at one point in time approximately two years ago.

When I’d asked my brother Matt to return the suits I sort of assumed that my ties would be in the garment bag too, I was wrong. I figure, oh well… I can stop on the way and get a tie, no biggie. I at least had a pair of very nice black pants and a similarly nice shirt.

So, on my way up to Harrisburg I stop in Carlisle and find myself a nice Kenneth Cole tie among other things that were more toward the line of impulse buying, but none the less problem solved without wasting too much time along the way.

Wrong.

I very carefully lit a cigarette once I returned to the car from the store, very carefully being because cloves have a tendency to spark/explode, etc, when being lit… hell, they do it the entire time, but lighting is the worst. I start to drive out of the shopping centre and feel this intense and horrible burning on my chest, I look down and see that I’ve burnt a hole through my shirt. I also figure that it went right through the undershirt as well considering the level of pain.

So, stop, turn around, back to the store. With some irony I did look at shirts while I was there originally, but didn’t really see anything spectacular. I then go to the store nextdoor to look. Hmm, plenty of nice shirts, plenty of them not my size either! You see, I have a very big neck as far as dress shirts go, it’s somewhere between 17.5 and 18. A size 18 shirt is VERY, VERY, BIG. My body is much more like a size 16, of course I’d choke to death if I tried to wear one that small. It’s such a pain in the ass having a non-conventional body! I’ve already convinced myself that my next suit will be hand-tailored, I just do not fit into stock at all correctly.

They didn’t have any 17.5 shirts, a few 17’s and a few 18’s… I opted for the 18 and granted it is a very nice shirt, Kenneth Cole’s “Reaction” line, but as I figured it is VERY, VERY, BIG. I just didn’t want the 17 to end up choking me, lol. I guess I’m going to need to go in for hand-tailored dress shirts also.

At this point though I’m totally stressing… I really didn’t need to be, I had plenty of time to get to Harrisburg, but, bugger, I just spent $60 I didn’t really need to spend and ruined a very nice shirt.

I call Patrick and wake him up, lol, I expected him to be awake though, which was the funny thing about the fact I woke him up. I tell him that it’s after five in central Europe and ask him to please have a very strong alcoholic beverage waiting for me when I get there, which would be in about eight minutes. Sure enough a vodka tonic was waiting for me on the porch, I start to guzzle that…err, sip that, and explain to him my little bits of fashion disasters and emergencies that had befallen me all morning.

He then says to me that he’d checked with the people getting married and they said that it was going to be a ‘business casual’ kind of event. AHHHH!!!! I’m the king of business casual, lol, practically everything I own fits into that category with the exception of, err, two pairs of jeans(since I only have two pairs of jeans that actually fit these days, lol)! All of this ‘dressy’ business being totally unnecessary was the little drop of extra icing on my fashion hell for the day, lol.

Oh well, I’m still dashing, perhaps more so than I originally intended. If only I’d worn my Kenneth Cole pants I’d be practically drenched in his stuff, but no… I wore DKNY pants instead, haha. …and yeah, when it comes to wearing something less than casual I do tend to be quite the label whore it seems.

I Should Have Known.

Saturday, 3rd July, 2004 :: 13:11 EDT - Site

I did this simple website redesign a couple of days ago, never really bothered to check it in Windows… It looks perfectly fine in mozilla, firebird, safari, mac ie, etc. I’m here at Patrick’s and randomly decide that I perhaps should see if it looks right, haha! Well, it looks okay, but it’s still screwy. The margins and paddings on the .entry class look a bit off, more precisely the white of the entry class extends quite a bit below the actual box than it should. Bleh… I guess I should have known that winIE would fuck it up. ;)

MySQL Success!

Saturday, 3rd July, 2004 :: 07:08 EDT - Code

I should be sleeping right now, especially considering that in 3 hours I’m supposed to get up and prepare for joining Patrick in Harrisburg at noon, super big oops. OCD took over though, because I knew I was just so very close to figuring out this mood crap.

I talked with Michel briefly and he said that he couldn’t see why my code wouldn’t work, and indeed it did work, as I mentioned below. I totally forgot that it was throwing an error when I talked to him though. The error was the typical invalid resource kind of thing, but I’d also forgotten what that really meant.

I finally realize that the reason it isn’t looping through is because I mistakenly called all of my MySQL queries “$query” and all of the results “$result” instead of giving them unique variable names. That was causing the invalid resource error upon trying to process the second row, super dig “duh” on that one. I didn’t even think of that until just now because it’s very common to always refer to them using the same name, it just won’t work right if they’re all in the same loop, lol. Upon making those variable names unique it suddenly looped through all 621 rows and did exactly what it was supposed to do.

So, yay! Wordpress will now recognize all of my b2moods data as WP meta data for each entry. :) That just leaves eMotif and Brainfeed to go… should be a lot easier, I hope.

Addendum, eMotif and Brainfeed were both very easy to get working, two minor issues such as the lack of specific functions I used to use, but once I corrected that, huzzah, they work.

MySQL Trauma.

Saturday, 3rd July, 2004 :: 03:39 EDT - Code

When Wordpress 1.2 was released I decided to give it a try, just to see what it is like, how it compares to B2, etc. It now has all of the features that I’d been adding to my B2 install for the last, errm… I guess it’s been a very long time since I’d done eMotif, hasn’t it?

I installed it, took a look around after copying my ‘real’ database into it, then I sort of let it sit there abandoned. Most of the stuff I’d added to my B2 install was with the help of Michel, making slight changes to the core code so that all the stuff like private entries, password protected entries, etc, would actually work. I didn’t know if the WP dev team would follow with those or take different and possibly better directions, so I needed to find out just how difficult or easy it would be to actually transfer over to it.

Sam asked me what WP can do that my modified B2 can’t. Realistically, it doesn’t do much more extra, it just does things differently. It adds a thousand layers of complication though, which in a way is nice because it brings a lot more flexibility, but it also, I’m not sure, the interface lacks the simplicity that I’ve always liked about B2. I like WP though, it would just take some time, as one would expect, to really embrace it.

I used to know B2 like the palm of my hand, as they say. Since it has been so very long since tinkering around with the code I’ve forgotten quite a lot of how it works. This poses a problem because that also means I’ve forgotten how a lot of ‘my’ code works too.

This installation uses category zero to keep posts from being published. It never was the most elegant way to go about things, but it is very effective at the task regardless. Wordpress uses the much more elegant and flexible way of allowing a tag to represent the post status, be it private, draft, or published… this allows for many more possibilities in the future too. So, that’s one ‘conversion issue’ that would need to be tackled, easy enough with a line of MySQL:

UPDATE wp_posts SET post_status = “private” WHERE post_category = “0″

Formerly “unpublished” posts are now private, score. Of course, another similar line of code would be needed to move those posts back into a ‘real’ category:

UPDATE wp_posts SET post_category = “24″ WHERE post_category = “0″

This installation uses a “private filter” to password protect posts. I used to keep a little box mostly hidden on the page somewhere, those in the know could easily type in the password, it would set a cookie and “decrypt” private entries. The filter worked on a very basic premise, when rendering the page if it caught the particular ‘tag’ writtin in the entry the filter would then engage and ‘encrypt’ it. The password was kept in the actual code of the filter, so one password would work for all entries, any change to it would apply to all entries. Wordpress follows similarly to private entries with having a field indicating the post’s password, if there is one it prevents the entry from being seen, without a password it behaves as normal. Again, a similar MySQL command fixed this ‘conversion issue’ by inserting a password into the column necessary whenever the filter tag appeared in the post’s content:

UPDATE wp_posts SET post_password = “–password–” WHERE `post_content` LIKE “–filter-tag–%”

I considered those to be the most important issues, it at least keeps everything that is supposed to be private actually private. Four more ‘conversion issues’ present themselves though, making eMotif work, making my ‘post moods’ work, making my brainfeed work, and keeping permalinks permanent.

The permalinks ended up being a lot easier than I originally thought. WP uses mod_rewrite to make the urls ‘pretty’ unlike the way I’ve been doing it. There weren’t really any options in WP to do the urls exactly like I’ve been doing them, but I couldn’t just switch to the ‘new’ way otherwise those permalinks wouldn’t work anymore… defeating the whole idea. For the sake of convenience I used the WP mod_rewrite generator to cook up the code to make the ‘old’ permalinks work while also using it to make nice new ones for the future. This solved the problem while also giving me the ability to use the newer, nicer, urls. :)

I’ve not tackled eMotif, which will function standalone if I can’t figure out how to get it to use WP code, so I consider that fairly low priority. Brainfeed is just another B2 install that I publish to via the command line, it’s that little line at the top next to my mood (eMotif) and age, etc. Because two installs of B2 don’t ‘play well’ with each other I wrote a little function to grab the data and display it. I figure that function should work fairly well in WP too, but now I’m not sure.

WP has this ‘meta data’ function, where one can add custom fields to their posts. I don’t like it much, but it is flexible, so I’ve given thought to converting all of my mood data over to it. Since I wrote ‘b2moods’ before eMotif, they use basically the same type of database structure. Whenever a mood is posted it saves an ID number for that mood, instead of the actual mood itself. This saves database space because the actual mood is only stored in the ‘match’ table. In reality it doesn’t save much space, so ultimately it was kind of a dumb way to do it I think, because it means that anytime you want to show the mood it needs to do extra work to match up the ID to the text. One reason I don’t like the meta data way of doing it in WP is that I really like having the mood dropdown box, I tend to choose something more appropriate when I have options, otherwise I’d probably write in rather ordinary things. With those considerations I wanted to see if I could get the mood code to work with WP directly.

Unfortunately I can’t seem to get it to work, there are no errors, it just doesn’t do anything either, lol. It’s clear that the functions pulling up post data have changed just enough to prevent my little ‘addon’ from working properly. I tinkered with this for a while, but never did get it to work. I just haven’t examined the WP code enough yet.

Since I couldn’t get it to work I tried to transfer my mood data into the WP way of recording meta data. Unfortunately this didn’t work either, but I’m so close! Since the process is rather complicated using single MySQL lines wouldn’t work, so I started writing a mood conversion script in PHP. I actually have it working too, it grabs a post ID and its matching mood ID, looks that mood ID up in the mood table and bingo, inserts the post ID, and the mood into the meta table, along with other required bits of meta data. The problem is I’ve screwed up somewhere, it only does one and then stops! Instead of… say, doing all six hundred plus entries. I definitely have a loop or the actual mysql_fetch commands written incorrectly.

Oh well, I’ll get it eventually, I just need to remember how to do all the things I’ve forgotten over the last year or two. If only I can get the little conversion script to repeat through all the rows it’ll work, bugger for not being able to remember how to do it!