What I did on my vacation from reality

Home About RTL8187B Laptop Cam Quotes Login

November 26, 2007

Tips: Google adsense

10:14 pm — Code, tips

One of the recent improvements to my little blog has been moving Google ads from the sidebar to every third post on the main page. In attempting to detect whether a full-size leaderboard ad would fit, versus a banner ad, I’ve found that loading a responseText object from createXMLHttpRequest doesn’t parse Javascript.

Since there really isn’t any good way to get window resolution from PHP, I hacked around it a bit. See, I have one adsense.php that serves up all the ads. I just do a global $adtheme; ‘checkres’ is a special case that includes some Javascript to detect the window’s internal area.

It basically works like this.

if (window.innerWidth >= 980)
{
  google_ad_width = '728';
  google_ad_height = '90';
  google_ad_format = '728x90_as';
}
else
{
  google_ad_width = '468';
  google_ad_height = '60';
  google_ad_format = '468x60_as';
}

And then the rest of the Google adsense variables.




November 25, 2007

Why Linux is ftw

7:09 am — Geek, Linux, fanboy mode

Since my router crashed (about as hard as I could throw it), I’ve been minus a gateway/firewall for the house, and since it had the wireless access point on it, I’ve been minus wireless.

A couple of newlywed friends moved in with us for a while, and they brought with them one Toshiba laptop with one PCMCIA and one ExpressCard slot.

The solution was to boot up their laptop with the Ubuntu 7.10 live CD, pop in the Prism2 card from the old router, scp over the backups of the firewall scripts, and ifconfig stuff everywhere. Not only is there wireless again, but I’ve turned them on to Linux, and maintained the house’s freedom from Microsoft.




November 24, 2007

Changes

2:11 pm — meta

I’ve made a couple quick changes to the site. The first and probably most noticeable is that Google ads went from the sidebar to the content; the idea was to make it a bit less intrusive, and a bit more likely that readers will actually see stuff they’d want to click.

The other change was the addition of the two donation buttons. One goes to my Thinkgeek wishlist (I’m not expecting anyone to buy me a $299 RFID door lock), and one to a PayPal donation page — Morph said it’s actually possible to make a couple bucks off of it.

So, if you feel like supporting my hacking habits, well. :-)