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 Use | Sent | Approx Received |
|---|---|---|---|
| Sept. 15, 2005 | 27 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.
- Pixels&Pages – The ol’ web-design business, and we mean busy-ness. I haven’t updated for awhile, as I have been working on infrastructure for this site and GHSCC.com.
- GHS Computer Club – I’m the first webmaster of GHSCC.com, and I firmly intend to be the best, too. It’s frustrating, though, because I'm putting a lot of work into the site now, so people won't have to work twice as hard later.
What I've Found Interesting
- The Apple ‘1984’ Super Bowl commercial – said to be a very successful commercial even though it never mentions the product it was selling, a new Apple computer. The ad was based on Orwell’s novel 1984, and ran in that year. [Alternate Video Location]
- Wikipedia – A huge, free online encyclopedia. The cool part is that you can write and edit the articles. Wikipedia can be fun to just click around.
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
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
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!”
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!”
