Archives

All posts for the month December, 2007

Do you need a reason to watch the Orange Bowl this year? I mean other than the fact that VT is #1 in the computer polls and, obviously, that is the way to determine a National Champion. Here is a video to help convince you:

“Help! Kansas ate all the easy cookies and choked on Missouri!”

3 other videos are here.

Hat Tip: Lions in Oil via The Big Lead

Ain’t this Internet thing grand?

One of the Word Press plugins I use is wp-shortstat. It is a handy stat tracker that allows me to look at keyword searches and referrers right at the Dashboard level within WP.

One of the drawbacks of this stats system is the country code lookups. For my setup it was not working at all, so I was getting a lot of unknown countries. That does not make it very useful. I did a bunch of research and decided that rolling my own lookup into wp-shortstat and using a free data source was the way to go.

Being the holiday season and being a fairly generous guy (don’t laugh, please), I am going to make the changes available to my reading public. All three of you. I can say that because I now have working stats 🙂

In order to do this update/upgrade you will have to be comfortable with your database, editing PHP files, and some basic UNIX text processing commands. There are no expert tasks here, by any stretch.

First step, download some data. I got my data from Software77. It is a ZIP file that contains a CSV file. Unfortunately, a small amount of conversion needs to be done on the CSV file. The first is to strip off the comment lines. Every comment line they use starts with a “#” so it is pretty easy to do:
[[email protected]]$ grep -v "^#" IpToCountry.csv > IpToCountry.nohash.csv

Next, I needed to remove all of the quotes from the CSV file. If I tried to import with the quotes, the data in MySQL would not be in the right format- the quotes get imported along with the data I wanted. Easy enough to strip them off:
[[email protected]]$ sed "s/"//g" IpToCountry.nohash.csv > IpToCountry.clean.csv

Now we have a bunch of data (about 4.5 meg) that is ready for the database.

Next we need to get the data into the database which requires two things: a new table in the wordpress database and running an import command. To create the needed table, connect to you blog’s database. Remember I am using MySQL, you will need to season these commands to taste if you are using Postgres or Oracle or whatever else. Here is the SQL to create table I used. It has the same naming convention as the other WordPress tables:
DROP TABLE IF EXISTS `wp_hostip`;
CREATE TABLE `wp_hostip` (
`ip_from` bigint(20) default NULL,
`ip_to` bigint(20) default NULL,
`registry` varchar(50) default NULL,
`assigned` int(11) default NULL,
`ctry` char(2) default NULL,
`cntry` varchar(10) default NULL,
`country` varchar(256) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Simple enough. Now you need to import the data into that table. Luckily MySQL has a really simple import from CSV command called LOAD. Here is the usage:
LOAD DATA LOCAL INFILE 'IpToCountry.clean.csv'
INTO TABLE wp_hostip
FIELDS TERMINATED BY ','
LINES TERMINATED BY 'n'
(ip_from, ip_to, registry, assigned, ctry, cntry, country);

Now you have all of the data you could possible need (for awhile anyway). The trick is getting wp-shortstat to use it. Time to modify some PHP code. You only need to modify one function in one file.

Find your wp-shortstat.php file, it is in the wp-content/plugins directory. Open that file in your favorite editor and find the determineCountry function. Modify the function to look like the following. You can comment out the current code if you don’t feel comfortable deleting it.
function determineCountry($ip) {
global $wpdb;
list($a,$b,$c,$d) = split ('[.]', $ip);
$calc_ip = $d + ($c * 256) + ($b * 256 * 256) + ($a * 256 * 256 * 256);
$query = "SELECT ctry FROM wp_hostip where $calc_ip >= ip_from AND $calc_ip <= ip_to"; $country = $wpdb->get_var($query);
return $country;
}

That is it. Once the file is saved, the next time a non-admin connects to your blog wp-shortstat will log their arrival with the country code working.

I tested it by firing up the dusty IE on my box and connecting to my blog. I then looked in the wp_ss_stats table to see the newest entries and sure enough the stats are being updated with complete data. Sweet.

That is Part 1. If you got some value out of this let me know. I like to be complimented 🙂

Part 2: Automating the update of the wp_hostip data. The download site claims data should only need be updated every week at the most. I won’t even say it needs to be updated that often. I am going to update it monthly. Part 2 will explain how I go about doing that. Part 2 will also show how to fix the country data in wp_ss_stats that is currently marked as “unknown”.

Happy Holidays Everyone!

Ran across this today on Best of Craigslist. This is what rants should look like. Instant classic.

I see this question posted with some regularity in the personals section, so I thought I’d take a minute to explain things to the ladies out there that haven’t figured it out.

What happened to all the nice guys?

The answer is simple: you did.

See, if you think back, really hard, you might vaguely remember a Platonic guy pal who always seemed to want to spend time with you. He’d tag along with you when you went shopping, stop by your place for a movie when you were lonely but didn’t feel like going out, or even sit there and hold you while you sobbed and told him about how horribly the (other) guy that you were fucking treated you.

At the time, you probably joked with your girlfriends about how he was a little puppy dog, always following you around, trying to do things to get you to pay attention to him. They probably teased you because they thought he had a crush on you. Given that his behavior was, admittedly, a little pathetic, you vehemently denied having any romantic feelings for him, and buttressed your position by claiming that you were “just friends.” Besides, he totally wasn’t your type. I mean, he was a little too short, or too bald, or too fat, or too poor, or didn’t know how to dress himself, or basically be or do any of the things that your tall, good-looking, fit, rich, stylish boyfriend at the time pulled off with such ease.

Eventually, your Platonic buddy drifted away, as your relationship with the boyfriend got more serious and spending time with this other guy was, admittedly, a little weird, if you werent dating him. More time passed, and the boyfriend eventually cheated on you, or became boring, or you realized that the things that attracted you to him weren’t the kinds of things that make for a good, long-term relationship. So, now, you’re single again, and after having tried the bar scene for several months having only encountered players and douche bags, you wonder, “What happened to all the nice guys?”

Well, once again, you did.

You ignored the nice guy. You used him for emotional intimacy without reciprocating, in kind, with physical intimacy. You laughed at his consideration and resented his devotion. You valued the aloof boyfriend more than the attentive “just-a-” friend. Eventually, he took the hint and moved on with his life. He probably came to realize, one day, that women aren’t really attracted to guys who hold doors open; or make dinners just because; or buy you a Christmas gift that you mentioned, in passing, that you really wanted five months ago; or listen when you’re upset; or hold you when you cry. He came to realize that, if he wanted a woman like you, he’d have to act more like the boyfriend that you had. He probably cleaned up his look, started making some money, and generally acted like more of an asshole than he ever wanted to be.

Fact is, now, he’s probably getting laid, and in a way, your ultimate rejection of him is to thank for that. And I’m sorry that it took the complete absence of “nice guys” in your life for you to realize that you missed them and wanted them. Most women will only have a handful of nice guys stumble into their lives, if that.

So, if you’re looking for a nice guy, here’s what you do:

1.) Build a time machine.
2.) Go back a few years and pull your head out of your ass.
3.) Take a look at what’s right in front of you and grab ahold of it.

I suppose the other possibility is that you STILL don’t really want a nice guy, but you feel the social pressure to at least appear to have matured beyond your infantile taste in men. In which case, you might be in luck, because the nice guy you claim to want has, in reality, shed his nice guy mantle and is out there looking to unleash his cynicism and resentment onto someone just like you.

If you were five years younger.

So, please: either stop misrepresenting what you want, or own up to the fact that you’ve fucked yourself over. You’re getting older, after all. It’s time to excise the bullshit and deal with reality. You didn’t want a nice guy then, and he certainly doesn’t fucking want you, now.

Sincerely,

A Recovering Nice Guy

Well I made it back. I’m in one piece and my bankroll did not get decimated.

I’m going to try not to make this too long- but if it rambles let it be known that I had a great time hanging with the blogger crew for the short time I was in the tourney. I’m sorry I didn’t get to meet most of you and I’m sorry I could not hang out more. This was a timing trip where you all were in Vegas and I had some other friend obligations at the same time. I’ll make it a point of making the next event more dedicated.

We had a 8am flight on Saturday and the trip was painless. Into Vegas and headed to the new car rental plaza. First victory was ours where we got the pimped out PT Cruiser Convertible. The top was down, but we didn’t even make it to the Crown and Anchor. 50s and sunny is not, surprisingly, convertible weather. Also the Crown was packed because of the Champions league. So we went to our second favorite local haunt for lunch. I recommend making it to the Stake Out as a cool little shitter with good food and decent booze costs. Say hey to Shelley for the Texas boys if you see her.

Off to the Sahara which keeps getting worse every time I stay there. The room is a room, but the damn tub would not drain so taking showers is like taking a dirty bath.

Next stop the Venetian for the tourney. I got to meet Pauly, Al, GCox, Waffles, Johnny Hughes and a host of other people. I did not get to meet nearly enough people though. That is my regret. I also got to catch up with Scott, Aaron, Carmen, and Don (amongst others). I got bumped out pretty early when my AK caught a K on the turn with two jacks on the flop. Yep, I’m a donkey 🙂 A few people got to meet Jason with the Texas hat. He is the buddy I came on the trip with- hopefully he wasn’t too much of an ass.

We ended up making it to the Crown for dinner. I recomend their Lancashire Hot Pot as one of the best meals in Vegas. And to our lovely waitress Amber: You put up with our shit amazingly well, congrats. Then we headed to the House of Blues were we got busted accidently crashing a holiday party. We intended to see Unwritten Law. We did make it there and had a good time. The mosh got a bit intense, but the concert was a lot of fun. After that I made it to the tables rather than go clubbing. I did OK making a small amount of cash and got comped 1/2 a breakfast. Yippee. Some married lady was giving me eyes all night, but her husband was there- so that was awkward. Probably more for him than me. And the Sahara now has dancing girls in one of their table game pits, what is up with that?

Sunday morning we headed up to Mt. Charleston and had some foo foo bailys drinks that were damn tasty. I have pics on my camera somewhere. We had dinner at a casino in Green Valley with some of Jason’s friends and associated family. The 8.99 prime rib and shrimp is worth, well about 9 bucks. The intent was to go clubbing that night, but Mike and Jason crashed out. I went to the tables. I also hit my first live Royal and got paid a bit. There is no high-hand at Sahara so no bonus cash for me. I broke exactly even.

I slept in a bit on Monday because there was no sleep happening later that night. We hit the Stake Out for lunch and met up with Mike’s college friend Lisa who just moved back into town. We made it to dinner at Del Friscos and I had one of the best bone-in rib eyes I have ever had. Great restaurant if you are looking for a fantastic steak house. The Saints were building their lead as well. Off to the Crown to hang with the gang and play some pool. Plans were made for a return trip in March- we’ll see. Saints win (and cover)! More table time where I knew I would be until it was time to head to the airport. We had a 6am flight.

There was snow in Denver yesterday so my flight though there was canceled. We ended up getting re-booked on US Air though Phoenix. Apparently everyone who got re-booked got tagged for “special security”. SSSS is the key. If you have that on your boarding pass be prepared to be probed. They have this air puffing walk in machine that must do a drug or explosive sniff. Then they do a slower x-ray scan then finally a hand search of your carry-ons. It sucked, but we made our flight.

I then fell into a coma at the house and got my first good night’s sleep in a week.

Overall this was a fantastic trip with very cool people. Once again I am sorry I missed hanging with the crew more. I will make it a point next time.

Keep me on any other WPBT lists and I will do my best to get away. And if I make it back to Vegas in March and anyone is around…. I’m just saying…

Oh, and this is *way* too long. Sorry about that.

I ran across the cool AIM Bot “SmarterChild” on LifeHacker today. Basically you just ask it questions and it looks it up for you. For example, I just sent:

What is the weather in Las Vegas?

And it sent me:

Current weather conditions for Las Vegas, NV:

Currently: 66 F
Condition: Clear
Dewpoint: 31
Humidity: 27 %
Visibility: 10 mi
Wind: SSE/5 mph

Next time, just type weather las vegas, nv.

Very cool. Then I sent:

forecast

It responded:

Weather forecast for Las Vegas, NV:

Wednesday: Partly to mostly cloudy. High 64F. Winds SW at 5 to 10 mph.
Wednesday evening: Some clouds. Low 47F. Winds light and variable.
Thursday: Mostly cloudy. High 63F. Winds SE at 5 to 10 mph.
Thursday evening: Rain showers along with windy conditions. Low 48F. Winds SW at 15 to 25 mph. Chance of rain 80%.
Friday: Showers (High:54 Low:41)
Saturday: Showers (High:50 Low:38)
Sunday: Showers (High:45 Low:35)
Monday: Showers (High:44 Low:35)
Tuesday: Mostly Sunny (High:52 Low:38)

>>> Want to write a crazy story together? Type manicdotes.

Not a big fan the rain while visiting, but it tells me to bring a jacket and ditch the shorts.

Now I need to wonder what that manicdotes thing is?

Oh yeah, since GMail integrated AIM as well as GChat, You don’t need Trillian or AIM installed to use this either.

Hat Tip: LifeHacker