- Home
- About
- Conversations
- Tips
- Amazon MP3: DRM-free music
- iTunes Plus tips!
- Ogg in iTunes
- Show hidden files (.htaccess) in OS X
- Convert FLAC to MP3, WAV, or AIFF to play in iTunes on Mac OS X
- Convert WMA to MP3
- Swap left Alt and Ctrl keys in Windows
- Boot Camp: Delete, Right-Click, Middle-Click
- Creating nice aliases
- CSS generated content special characters
- Default Application in OS X
- Enso (Windows Quicksilver)
- Import Gmail contacts to Mail
- Install RAM: MacBook Pro
- iPhoto: Deleting aliased pictures
- Using Keyboards with Your Mac + the Microsoft Natural 4000
- Aurora - iTunes Alarm Clock
- Delete keys on Macs
- Projects
- Boost and XCode
- Code
- Contact
- create content
Code
Portable PHP code: DIRECTORY_SEPARATOR is not necessary
Submitted by alanhogan on January 6, 2008 - 5:48pm. Tip | Code | PHP | cross-platform | linux | Mac | Programming | Unix | WindowsIn attempting to write cross-platform, portable PHP code, I used PHP's DIRECTORY_SEPARATOR constant to write path strings, e.g. "..".DIRECTORY_SEPARATOR."foo", because the "proper" way to do it on Windows would be "..\foo" while on everything else (Linux, UNIX, Mac OS X) it would be "../foo".
Well, as Christian on php.net pointed out and the guys at Web Design Forums confirmed, that's completely unnecessary. As long as you use the forward slash, "/", you'll be OK. Windows doesn't mind it, and it's best for *nix operating systems.
PHP function chopOffLastDir()
Submitted by alanhogan on July 21, 2006 - 5:07pm. Tip | Code | PHP | Web Design | Programming | Public Domain | User-FriendlyI 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; I'm making it public domain.
Simpler Conditional Testing
Submitted by alanhogan on July 20, 2006 - 11:35am. Conversation | Code | Code | Programming | Ruby
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 foo equals baz, or foo equals the string 'faz'"?
Special characters in CSS generated content (::before, ::after)
Submitted by alanhogan on December 10, 2005 - 6:00pm. Tip | Code | Web Design | CSS | Pseudo-elements | Unicode | W3CIf you do CSS, you may be familiar with the ::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. Here’s here to do it.
Page Outdated! Comments disabled!
As do many people using Drupal to power their website, I get a lot of comment spam, and Drupal's spam filter is horrible! So I have permanently disabled comments on old.alanhogan.com. Try the new version of this page (which may not exist, but should if this page actually has content besides a list of other articles).
Consider using my contact form to get in touch. And remember that AlanHogan.com is live and old.alanhogan.com is here as a backup only, and a stopgap measure because some AlanHogan.com functionality is not implemented yet.



