Google Ads
2008.08.26 [Tue] | 12:51 PM

I would not have figured out all this if it hadn’t been for someone on the #linode channel with the patience to walk me through the steps.

At any rate, when I moved abettergeek from Dreamhost to Linode, mail quit working in the forums. PHP has a built in mail() function, but it requires some server config to work - apparently, Dreamhost took care of that, while Linode’s default Linux install doesn’t have sendmail installed by default.

This makes sense - Linode basically allows you to select from a number of Linux distros, and they drop a very barebones image onto your VPS. It’s up to you to install the things you need. This is better than, say, installing everything by default and leaving a bunch of ports and vulnerabilities open from the start.

sendmail, however, is a bit pickier than Apache when it comes to making it work properly. These steps are using Ubuntu 8.04 LTS, but they’ll be similar for any Linux distro.

First, you’ll want to actually install sendmail:

apt-get install sendmail

That part was easy…however, the default Ubuntu config did not have my hostname information configured properly. You’l need to update your hosts file and your hostname file:

sudo nano /etc/hosts

if you have a line that looks like 127.0.0.1 ubuntu, remove it. The top two lines of the file should look like this:

127.0.0.1      localhost
72.14.177.31   abettergeek.com

Then, you need to update your hostname file:

sudo nano /etc/hostname

This needs just one line for your domain

abettergeek.com

Restart your server for the changes to take effect, and you should be able to now send mail using the mail() function in PHP.

2008.08.23 [Sat] | 01:45 AM

In the unlikely event that anyone is reading this blog, things are going to go offline sometime in the near future, once GoDaddy finishes transferring my domain to my new registrar (aplus.net).

Lesson learned from this experience: GoDaddy sucks. A lot. Their interface is terrible, they only have long-distance phone support, the level of communication involving even doing this transfer was unbelievably bad, and I am never going to use them for anything again.

2008.08.22 [Fri] | 12:18 PM

Not too long ago, I wrote a short tutorial on using ColdFusion to identify the user’s browser and add extra browser-specific CSS files. Today, I found myself in need of similar functionality for PHP. The code isn’t quite the same - PHP doesn’t have a direct clone of CF’s contains decision operator; you have to use the strstr string function instead. The general idea, however, is the same.

The following script will identify between Firefox, IE6, and IE7. Like my last post, I’ve added an extra piece that will include an ie.css file before including an IE version-specific stylesheet.

<?php
  $thePath = "/css";
  $absPath = $_SERVER['ABSOLUTE_PATH'] . "css";
  $theBrowser = $_SERVER['HTTP_USER_AGENT'];
 
  if(strstr($theBrowser, "Firefox")) {
    $browser = "firefox";
  }
  elseif(strstr($theBrowser, "MSIE 7.0")) {
    $browser = "ie7";
  }
  elseif(strstr($theBrowser, "MSIE 6.0")) {
    $browser = "ie6";
  }
 
  if(file_exists($absPath . '/' . $browser . '.css')) {
    $css = '<link rel="stylesheet" href="' . $thePath . '/' . $browser . '.css" />';
  }
 
  if(strstr($browser, "ie")) {
    if(file_exists($absPath . '/ie.css')) {
      $css = '<link rel="stylesheet" href="' . $thePath . '/ie.css" />' . $css;
    }
  }
?>

The ABSOLUTE_PATH server variable tells us where our site is actually stored on the server; I added the name of the directory where my stylesheets are stored to the end of the variable and stuck it in a string called $absPath. You’ll need this absolute path to determine if a CSS file exists in the given directory. The relative link to my CSS directory is stored in $thePath and is used to link to the CSS file in my HTML.

When the code is done, I’m left with two variables I can use anywhere in my application: $browser is the short identifier for the user’s browser; $css contains the HTML to link to the additional stylesheet(s).

It’s the same concept with a slightly different implementation. Happy coding!

2008.08.15 [Fri] | 08:58 PM

I’ve been hosting A Better Geek on someone’s DreamHost space since I started the site. I’ve since discovered that, while free hosting is nice, having control over everything is worth a little cash every month.

Server virtualization has started to really revolutionize the web hosting industry. Now, instead of sharing resources with thousands of others on a single box, you get a little mini-server all to yourself, complete with godlike control (aka root access).

What’s most amazing is how cheap this stuff has become. I ended up going with Linode VPS (virtual private server) hosting. For $20 a month, I get 12GB storage, 360MB RAM, and 200GB bandwidth (which, apparently is a soft cap - not sure what’ll happen if I go over!). But, best of all, it’s all mine. I went with Ubuntu 8.10 LTS, running the ever-present Apache/PHP/MySQL configuration. I have things that your typical shared hosting providers don’t provide without extra fees, like SSH and SFTP. I could run a WoW or IRC server if I wanted.

Needless to say, I’m quite happy with my move. I’ll have to figure out what kind of fun things I want to do with it!

2008.08.14 [Thu] | 10:25 AM

I decided to add a message forum, using punBB.

Feel free to join and post what’s on your mind.

One of my current projects at work has an RSS requirement. I’m redesigning the university’s policies website. My customers are concerned that other departments at Purdue have previously copied the content of a policy and placed it on a different site, which is problematic when policies are revised, superseded, or retired.

Implementing an RSS XML file for each policy will allow anyone else to embed a policy in their own site using any web technology while keeping the policies site owners in complete control of the content, no matter where it’s used.

Unfortunately, I had a pretty hard time finding a clear-cut solution for creating XML files dynamically with ColdFusion and SQL. It turns out that it’s not that difficult; it just took a little time to figure it out. One solution involved creating an actual XML file and writing it to the server. This would work for content that never gets updated, but this is a situation where the user needs to be able to implement the RSS in their site and not worry about it again.

The problem is, the XML specification is quite strict. You must be able to pass the file as XML in the header information, which will allow RSS readers (and embedding codes or scripts) to see it and parse it. This is accomplished quite easily through the cfcontent tag. Once you’ve identified the content as XML, you generate the file just like you would a regular HTML-formatted page.

Some quick Googling got me the information I needed on how to create an RSS feed to current specifications - you can check it out on Pete Freitag’s site here.

This is pretty code-heavy, so hit the jump to read the rest.

Read the rest of this entry »

My freshman year of college, I knew a kid with a Logitech MX700 cordless mouse. The first time I used it, I knew I had to have one. It was only a few months before I bought the Cordless Elite set, with the Elite keyboard and the MX700 mouse.

I have since discovered that this is the number one best mouse in existence. I’m not a gamer, so I don’t need high sensitivity and hair-trigger response. What I do need on a daily basis are the extra mappable keys that the MX700 (and its siblings) provide.

Logitech canned the MX700 several years ago in favor of the (in my opinion, at least) inferior MX1000. They still, however, produce a corded version - the MX518 gaming mouse. This is what I have in my office at work.

I typically map the second button below the scroll wheel to Ctrl+W, so that I can quickly close tabs and child windows in almost any application. There are, however, two applications I frequently use that do not follow the Ctrl+W convention - Outlook 2003 and SQL Server Management Studio. In Outlook, you need to use Esc to close child windows (messages, appointments, etc.). In SQL Studio, Ctrl+F4 is the only shortcut that will close open tabs in the interface.

Today, on a whim, I Googled to see if there was a way to map each of the mouse’s buttons differently for specific applications. Lo and behold, there is! It turns out that the SetPoint software required for Logitech’s newer mice uses XML for the configuration settings, so someone figured out how to enable lots of additional settings via the aptly-named uberOptions.

This application was ridiculously easy to install and use. I didn’t have to restart, or even manually shutdown SetPoint before installing. Once it was installed, I was able to quickly specify mapped keystrokes for Outlook and SQL Server, and was off and running. Changes take effect immediately - you don’t need to restart an application for its specific mappings to work.

If you have an older MX700-like mouse (the MX500, 700, 510, and 310), you can use an application called LogiGamer, although it looks to be a bit clunkier (and requires the .NET 1.1 framework; it’s old enough that it may not be compatible with newer .NET versions).

If you have a Logitech keyboard, uberOptions will allow you to customize all the keyboard’s extra keys on a per-application basis. I’m just glad that I can finally use the same shortcut button for the same purpose in all my applications!

Google Ads