I’m Joining Tech-Recipes!

I’ve been a small contributer to Tech-Recipes for a little while now, but now I’ve decided to become more of a part of the community by blogging here too.

I’ll be the guy writing recipes about Subversion, Ubuntu, Ruby on Rails, and well… anything I feel like =)

Debate on Social Bookmarking; Removal of Bling

Over the last week or so, there’s been a debate about all of the “Digg This” and “Furl that” type of links that have started showing up on everybody’s blogs everywhere on the planet. The premise of the argument is that nobody uses them, and they are just cluttering up the place.

Let’s be honest… if somebody is a dedicated del.icio.us user, they will already have the browser plugin or bookmarklet already installed. If they aren’t, then even if they click on the icon, they probably aren’t going to sign up for an account just to bookmark your article.

Another issue is that most of the “digg this” links point to the digg submission page, not to the vote page. This is more likely to create duplicates on digg than get your vote count up. There’s only a 24 hour window in which to hit the front page to begin with, so for hours 25 through infinity, there’s a pointless digg link taking up space.

The only one that works, and only for that 24 hour window, is the digg count plugins that show the little digg box and let you vote directly from the article. But I haven’t found a mechanism that works well enough with a WP-Cache site to install a plugin, and I haven’t had the time to make one myself. And of course there’s the fact that submitting a link to digg is a lot like buying a lottery ticket, unless you are in the “inside crowd”.

I’ve decided to officially voice my opinion on the matter by removing the icons from my site.

Windows Live Writer Error: blogger.getUsersBlogs method received from the weblog server was invalid

This was really irritating me today. I set up a new Wordpress installation (more on that another day), tweaked it up a little bit, and then couldn’t get it working with Windows Live Writer, which is my blogging tool at the moment. (It really is one of the better Microsoft products).

So I go through the add new blog wizard, and then I get this obnoxious error:

So irritating! Naturally I googled, and came across a solution. All I had to do was add these lines to my .htaccess file:

<Files xmlrpc.php>
SecFilterInheritance Off
</Files>

But that didn’t solve the problem. It actually made it worse…. now I was getting an apache error even getting to the blog page through a browser.

After doing some Http proxy snooping using Fiddler, I figured out that the error was this:

Warning: Cannot modify header information - headers already sent by (output started at /home/testdomain.com/html/wp-content/plugins/recent-posts.php:2)

Ah! Now we are getting somewhere. When I opened up the offending plugin file, I found blank lines at the top and bottom before the <? , which is what caused the whole problem… the xmlrpc.php in Wordpress couldn’t change the headers because the blank lines had already been sent down to the client. This then caused the XML to be invalid, which gave me that error.

Minor Wordpress Annoyances (Double Dashing)

I just recently realized that Wordpress automatically converts a double dash — into an em-dash, which looks like a double dash without a space between them. So irritating, especially when you are showing source code or command line examples in your post.

The solution is to open the SITE_ROOT/wp-includes/functions-formatting.php file and comment out these two lines:

$curl = str_replace(’ — ‘, ‘ — ‘, $curl);
$curl = str_replace(’–’, ‘–’, $curl);

The ironic thing is that you wouldn’t even see the double dash in those lines if I hadn’t already commented them both out.

But now, I can double dash away.

PHP: Disabling Adsense on All Posts Within the Last Week

I’ve always disliked having Adsense on my blog, but like many bloggers, I really need to recoup the costs of hosting my site. And since I personally dislike slow loading websites, I’ve tried to keep my website running as fast as possible with a quality hosting provider like MediaTemple… which isn’t exactly the cheapest hosting out there.

I’ve decided that a nice compromise to reward the faithful readers of my blog is to disable the ads on blog posts newer than one week. This means that if you are reading my blog via a feed link, or even from a current link posted on a social site like dzone, you won’t have to see any annoying ads on the page. At all.

So how to go about this? Turns out it’s pretty simple… It took me a minute of googling to remember how to subtract days from a date object in PHP.

This gives you a date object from exactly one week ago:

$lastweek = time() - (7 * 24 * 60 * 60);

Then, all I needed was to open up the single.php file in my theme directory, and change my adsense deluxe code to look like this:

<?
$lastweek = time() - (7 * 24 * 60 * 60);
if(get_the_time(’U') < $lastweek){
    adsense_deluxe_ads(’largerect’);
}
?>

If you aren’t using Adsense Deluxe, you can always just substitute your own ad code in there. Also, if you want to set a longer or shorter date range, just substitute the 7 for whatever amount of days you want.

Another note, if you are using WP-Cache to cache your content, is that the ads won’t start showing up after a week unless you whack your cache every so often. Not a huge deal, but something to keep in mind.

And just like that, no more ugly ads on “current” blog posts.

Figure Out Which Dirty Rotten Thieves Are Stealing Your Content

The ability to make a living off your blog content has attracted thieves and scammers. With the advent of social bookmarking and news sites like Digg, Reddit and Dzone, the scammers have not only content to steal, but a way to quickly get a zillion visitors to their stolen content site and view their ads, put money in their pockets so they can buy penis enlargement pills.

As a blogger, I have to worry about people stealing my content. It’s difficult to catch them since you won’t know about the stolen content unless you happen to come across it.

That’s where CopyScape comes in. Copyscape helps you find out who has stolen your content. They use the Google Web APIs to locate pages with a large number of the same words as your content. Sure, there are some false positives, but it’s worth it.

Just drop the URL to one of your articles into the box, and hit Go.

I chose the URL to my Subversion Quick Reference guide and just like that, I’ve found a person that copied my article:

 

So now we’ve determined that some jackass has stolen our content… what do we do now? 

The first option that you can pursue is contacting the site owner. Chances are it won’t work, but you can try it. Otherwise, you can contact Google to try and get the content removed from the search engines, which will probably get them banned from Adsense and remove their reason for stealing your content in the first place.

Your best bet is to ignore what I said, and check out the Copyscape Responding to Online Plagiarism page, which lists out your different options. I’d copy the list here, but that would be copyright infringement, wouldn’t it?

Update: removed the mean spirited comment. Probably should take my meds… 

Open Bloglines as a "Separate Application"

I’ve always preferred using desktop applications wherever possible just for the speed of using them, but I’ve made an exception for Bloglines, because the keyboard shortcuts just work so well.

Sure, I’ve tried the new Google Reader, but it’s just a little too slow for my taste.

In order to give me the feeling of using a separate application, I’ve created a bookmarklet to open up Bloglines in it’s own window.

 

First, you drag the bookmark for http://www.bloglines.com/myblogs to your links toolbar, and it will look like this:

Now you click on it once, and Firefox will load up the favicon for it, so now it looks like this:

Now we can modify the bookmark. Right click, properties, and replace the Location with this javascript code:

javascript:void(window.open(’http://www.bloglines.com/myblogs’,'new’,'width=800,height=600,location=0,menubar=0,personalbar=0,status=0′));

You can also rename the bookmark here to something better, like just “Bloglines”. I also added a keyword so I can open it up with just the keyboard if I want.

Now we’ve got an icon in our links bar that looks like this:

When you click on this link, you will get a new window just for bloglines:

You can modify the arguments in the javascript code if you want it to open with a different size, or if you want the address bar to show up.

The only issue with this approach is when you want to go to a link, it opens in the same window. I usually subscribe to full feeds, and so I don’t open links a whole lot, but when I do I just drag the link from the “Bloglines” window to firefox.

Would be nice to have an extension that let you choose to open links in the main firefox window. Perhaps I’ll create one.

Handling the Digg Effect with Wordpress Caching

Last week, I was very proud to have my Subversion Quick Reference guide hit the Digg front page, which was a first for me! I’ve been on the del.icio.us frontpage a number of times, but nothing else compares to being dugg.

Even though my article hit the frontpage during a non-peak time, I still received over 3,000 hits within a fairly short period of time. Sure, I didn’t get the huge digg effect, but I was still very surprised that my little wordpress blog hosted on dreamhost handled the digg effect with no problems whatsoever.

I have since come to the conclusion that the reason my blog held up to the traffic because I very aggresively use the Wordpress caching module. Here’s the list of things I’ve done that helped me keep my blog afloat.

(Continued)

Printable View of Quick Reference Guides ( finally )

I’ve been contacted a whole bunch of times over the last week or so about my quick reference guides by people complaining that they can’t print them. To all of you that asked, let me answer everybody together: Making a PDF version isn’t in the immediate future (cause I won’t use it, hence I don’t care).

What I have provided as an alternative, thanks to the suggestion of one reader, is a printable view via CSS. I don’t know why I didn’t think of it before, since I almost always have a print.css in my web projects for work. I never realized before how similar blogging can be to work. =P

So you can now print without the left menu showing…. much more helpful.

Tech Recipes Super Swag!

Today I came home to find a delivery notice in my mailbox… I went over to the office to pick up my package, and to my surprise, it was a set of t-shirts from my good friends over at Tech Recipes. I’ve been itching for a good reason to use the camera on my RAZR phone (overrated phone, btw)… so here’s some close-ups, in all their grainy pixelated low resolution excuse for a camera goodness…

This one is so cool. On the back it says “obedience training for your computer”.


I tried to get a close-up of the logo on the Polo shirt so you could see the quality of the stiching on the polo shirt, but I guess I’m not very skilled with this crappy camera phone yet…

I’m very impressed. I’ve gotten shirts and other gear from a bunch of other websites that I’ve done work with or for, but these are the highest quality that I’ve gotten. The little things make such a difference…  speaking of which, why on earth did Verizon remove the normal menu button from this V3C phone? You have to hit the little button in the middle of the navigation pad, which is annoying, because I keep hitting the wrong button and going to a different menu. Ack!

So head on over to Tech Recipes, and grab their RSS feed, because I’m going to be posting recipes over there. What more reason could you need?  ;-)