- Wednesday, January 6th, 2010 at 1:04 am
But A Breach Ain’t One.
No, seriously though. When was the last time I made a blog post? I would wager it was some time in June. Too many pages of “Daily Tweets” to sift through. Does this mean I’m not posting Daily Tweet digests anymore? Absolutely not. Deal with it.
I did discover today, however, that someone tried (unsuccessfully) to hijack my Wordpress installation, and I have since upgraded to the latest version. It seems all they did was change the formatting for my permlinks. I searched the posts table in my database for anything fishy, and didn’t find anything. No new administrator accounts, but I did change my password just to be sure. So if you haven’t updated your Wordpess install lately, I would suggest it. Not like they could make it any easier for you.
I installed the hard drive in my LaCinema last night after work. It shipped driveless, and I’ve been watching stuff via the USB host on the front from a flash drive. It is now packing a 1TB SATA drive, along with nearly 250 hours of video. May transfer some music on there too to see how it plays back and see what it displays on the screen.
I am not even going to attempt an update on life, because there have been literally hundreds of tweets to take the place of that. But I will try to update more. No matter how many times I say that, it never seems to work.
To all of you on the Livejournal, I apologize for not reading my Friends List for several months. I hope you are all doing well, feel free to comment and let me know how you’re doing. You might even be able to trick me into reading your updates again. LJ folk, or anyone really, feel free to prompt with with a topic to write about. It would be a great way to get Blog Block going again.
Also of note, it’s officially 2010, and baseball season is now only 3 months away. Which also means that Target Field will be opening in just under 100 days, and outdoor baseball will return to Minnesota.
Filed under: life — Tags: baseball, blog block, life, lj, twins, twitter, update, wordpress —
- Sunday, February 22nd, 2009 at 10:10 pm
As I wrote yesterday, I recently upgraded my Wordpress install to 2.7.1. I stated at that time that all was running smoothly, and it was. Until my daily digest of tweets posted. I had discussed this with @mrheadrick briefly and never even realized that the reason he had the issue and I didn’t while we were using nearly the same code to process and post our tweet digest, we were not using the same versions of Wordpress. He was on 2.7.1, and I was only running 2.6.3.
When my latest digest of tweets posted, the time stamp was off by 12 hours. The post should have been created at midnight, and it was posted 12 hours later, at noon. This was the exact same problem that Mark was having. He had complained that he had to manually edit each post’s post date in order to display correctly. My initial thought was an error in the code of the script that creates the post, but that wasn’t the case. It was the new version of Wordpress!
I took a peek at wp-mail.php and discovered that there is some strange formatting of the time stamps. Basically, there is a lot of code used to rip the timestamp from the email apart and recompile it into the format that the Wordpress post database uses. This gets tricky when dealing with servers across different timezones so they use gmdate() instead of date() to create the stamps in GMT time. This timestamp is then converted to your local time and saved in both local time and GMT in the post database.

As you can see here, two tweet digests were posted, however, the local time is wrong on the lower one (this is the post that is 12 hours later than it should be). The GMT time is correct. The post is created at midnight (00:00) CST, which is GMT-6. So, the GMT time would be 06:00. The GMT time on both posts is the same, but the upper is 00:00 local, and the lower is 12:00 local. So what causes this?
On line 16 of wp-mail.php, there is a piece of code that looks like this:
$time_difference = absint(get_option('gmt_offset')) * 3600;
I looked into the absint() function, and found that it is used to always return a positive intiger. The problem with this is that is later on in the file, $time_difference is used to convert the timestamp to your local time. One line 130, you see this code:
$post_date = gmdate('Y-m-d H:i:s', $ddate_U + $time_difference);
Do you see the problem yet? This creates a timestamp and adds in the offset, in seconds, as defined by $time_difference on line 16. However, if you are like me and you are in the United States, your GMT offset is a negative number. This means that when you add $time_difference (a negative value) it is the same as subtracting it. But, since absint() is used to make this a positive value, so it mucks things up. Instead of subtracting the difference (6 hours) it adds the difference, creating a difference of 12 hours (midnight my time is -6 from midnight GMT, and it’s adding 6 MORE hours, totaling a difference of 12).
So, how do you fix it? Well it’s quite easy, actually. A simple edit to line 16 to remove absint() and you’re in business with the proper post times. Just replace the existing line 16 with this one:
$time_difference = get_option('gmt_offset') * 3600;
Save the file, and you’re done! Now all of your posts will have the right times, and you can go back to not the good old days of pre-2.7.1.
Filed under: php, site, tutorial — Tags: code, php, site, wordpress —
- Saturday, February 21st, 2009 at 6:56 pm
I decided to finally upgrade my Wordpress install to the lastest version, 2.7.1, today. I was still running 2.6.3 because I got annoyed that even when the dashboard said “Your install is outdated, please upgrade now!”; when I installed Wordpress with Fantastico, it told me to only do updates via Fantastico. Not sure how necessary that is, but that’s how I’ve always done it. Problem is, new versions are released, but Fantastico isn’t updated right away. But I decided to check it today and saw that it finally had 2.7 in there. However, once I updated, there was still a nag message saying I had 2.7.0, and the newest was 2.7.1. So I used the automatic upgrade option which is now built in.
It will take me some time to get used to this new layout and the new look and feel of the dashboard, but it seems more organized and more powerful. And as far as I can tell all of my plugins still work.
So far so good!
Filed under: site — Tags: site, software, wordpress —
- Thursday, November 27th, 2008 at 10:07 pm
Thanks to a handly little plugin called WP-PDA, the blog now has a mobile version. You can access it on your web enabled device (phone, PDA, iPhone, iPod Touch, etc.) by hitting the plain old URL into your browser (no fancy “m.” or /mobile/) and it does the rest for you :) If you have any questions, let me know.
Filed under: site — Tags: code, mobile, pda, phone, plugin, site, wordpress —
- Sunday, October 5th, 2008 at 12:03 am
After trying unsuccessfully a few times, and sort of giving up, I decided to give it another go to get my sidebar from Wordpress integrated to the rest of the site. Turns out I was just using the wrong keywords when I was searching on the Google.
It’s actually really easy, and useful to include just about any piece of Wordpress code into any page that isn’t a part of Wordpress. Since all the pages used the same header, footer and CSS, I just used a little snippet I found here to allow individual components from WP into any page with only two lines of code. A few clicks later, and it all looks great.
The Super Cache plugin is still bothering me though. I really like the idea of it and it would work well if except for the fact that it caches stuff from the sidebar (my current status (fed from my Facebook status) and recently watched movies) that updates more often than the cache. It’s a little annoying when you surf from page to page and see different bits in the sidebar on each. From what I can tell, the cache only refreshes after a specified number of page views, where I would rather have it go by time. I’ll see if I can find a way around it or maybe a different plugin. If you know of one, let me know!
Filed under: site — Tags: code, site, wordpress —
- Monday, September 1st, 2008 at 8:48 pm
I decided today that I am no longer interested enough with Livejournal to keep using it. I like the flexibility and freedom of Wordpress much better, so I’ve decided to switch. I will be testing a system that will automatically crosspost items from Wordpress to Livejournal, so we’ll see how that goes. There are a few scripts out there to do it.
In the time being, have a look at this and let me know what you think. I tried to copy over my theme to Wordpress, and it looks pretty good. Not perfect, but pretty good. I still have to figure a few things out like how to keep some of my existing stuff running (music stats, movies, Netflix queue, etc.) so be patient with those.
More later.
Filed under: site — Tags: blog, change, livejournal, site, wordpress —