About Alan

Hi!  I’m Alan Hogan.

This is my old personal website.  The new one is AlanHogan.com.

I am a web developer.  If you would like to inquire about my web services, please contact me here.

Archived Thoughts

The following are old bits and pieces I threw together.  You can find my more recent thoughts on AlanHogan.com.

Simpler Testing

With all the recent talk and buzz surrounding the unsurprising Ruby programming language, I couldn’t help but think about other ways to simplify programming.  Consider the following:

if (foo == bar, baz, "faz")

Why not use syntax like that featured above to mean "If foo equals bar or baz" as it would be understood in spoken languages?  This would be equivalent to the common way of testing one item against multiple values:

if (foo == bar || foo == baz || foo == "faz")

I think such a syntax would jive perfectly with Ruby's DRY (Don’t Repeat Yourself) principle, which essentially prefers as little code repetition as possible, and with its parallel assignment.

⇓ CSS :before with a character reference

If you do CSS, you may be familiar with the :before (::before?) pseudo-element.  Have you ever tried using it to insert an unusual character?  I did today, and it took about 20 minutes to figure it out.

See, you can’t use an HTML/XHTML entity like this, because it actually inserts the ampersand and all:

#metaInfo::before {
  content: "⇓";
  display: inline;
}

Turns out you have to put in an escaped reference to the hexadecimal (base 16) Unicode character value.  Whew!  That’s even quite a mouthful.

#metaInfo::before {
  content: "\21D3"; /*Hexadecimal for Unicode down arrow (⇓)*/
  display: inline;
}

That you are not allowed to use entities does not seem to be spelled out in the W3C specs, though it is hinted at in the section on generated content.

Gmail

I’ve been using Gmail [more info] for almost a year now. These are my stats:

[Date]Total Storage in UseSent Messages ConversationsApprox Received Messages Conversations
Sept. 15, 200527 MB (1%)367 (More than 1 per day)1600+ (About 5 per day)

Also, my favorite new feature is decidedly the ability to send from multiple email addresses. This is particularly useful for unsubscribing from various newsletters sent to an account that forwards to my Gmail account.

Links

What I've Been Up To

These days, you'll find me around these sites.

What I've Found Interesting

Projects

“Taming Lists” Standards-Mode Hack

My contribution to the famed Listamatic collection was a version of the “Taming Lists” list navigation model compatible with Internet Explorer's Standards Mode.

The Green Trillian Microscopic Theme

Screenshot

I love Trillian.  It’s a chat client compatible with AIM, ICQ, Yahoo IM, IRC, and MSN IM. My favorite skin is the minimalistic Microscopic [download].  And now, my favorite theme is 'Green', which is of my own creation.  To install it, download green.zip and unzip it to C:\Program Files\Trillian\skins\Microscopic\themes\, or wherever you have Trillian and Microscopic installed.  Note: My theme does require both Trillian and Microscopic in order to work.

PHP: chopOffLastDir()

I wrote this funtion to help avoid 404 errors when a user asks for something like /my/site/section/doesntexist/.  I use it to help bump users “up” to /my/site/section/. Feel free to use/modify/share it.

/* chopOffLastDir v1.2
   by Alan Hogan (alan.pixelsandpages.com)
   This function, formerly known as allButLastBit,
   is meant to chop off the last directory in a GET request.
   Ex: chopOffLastDir("/about/website/php/")
   returns "/about/website/"
   Note: Accepts dirs in any of the following
   forms (not including quotes):
   "a/b/c"
   "/a/b/c/"
   "a/b/c/"
   "/a/b/c"
   However, it will always return this:
   "/a/b/" 
*/

function chopOffLastDir($string,$separator='/')
{
  if ($string[0]!=$separator)
  {
    $string=$separator.$string;
  }
  if (substr($string,-1)!=$separator)
  {
    $string.=$separator;
  }
  $exploded = explode($separator,$string); 
  $numValues = count($exploded)-2;
  for($n=0;$n<$numValues;$n++)
  {
    $output.=$exploded[$n].$separator;
  }
  return $output;
}

This page looks and loads best in Firefox or Opera.  Of course, you'll also be safer than if you were using IE.  “Come on – Everybody's upgrading!”  Get Firefox!

1&1

I'm happily hosted on 1&1.  I recommend 1&1 if you are looking for a host.

“Si es nuevo e interesante – ¡dime todos!”