How to Convert Strings into a URL Friendly Format Using PHP

This function converts strings into a format that can be used in URLs. For example, the string “Mike’s Karate School” would be returned as “mikes-karate-school”. This function is recommended to be used on non-multibyte character sets. So this is not recommended for UTF-8, since certain PHP functions (like strtolower) should not be used on multibyte strings.

1
2
3
4
5
6
7
8
9
10
11
12
13
/**
 * Returns a string in a URL friendly format.
 * @param string $str The input string.
 * @return string The URL friendly string.
 */
public static function getUrlFriendlyString($str)
{
   // convert spaces to '-', remove characters that are not alphanumeric
   // or a '-', combine multiple dashes (i.e., '---') into one dash '-'.
   $str = ereg_replace("[-]+", "-", ereg_replace("[^a-z0-9-]", "",
      strtolower( str_replace(" ", "-", $str) ) ) );
   return $str;
}

Joimo’s Expansion into New Activities

In 2011, Joimo took a big leap and started offering a variety of different sports and recreational activities.  I’m happy to say that we now offer bowling, dodgeball, indoor soccer, outdoor soccer,  and kickball!

Joimo Dodgeball

Photo from San Diego Co-ed Dodgeball!

Log Manager: COM Port Card Logging Software Written in Visual Basic

In October of 2004, I decided to take on a new project at college.  I was determined to write software that could be used in the Computer Science Major’s Lab to monitor who came in and out.  I originally began the project in an attempt to learn how to write software that could interpret the data that was received from a card-scanner via a COM port.  Then my interest grew and I decided to write a fully functional Log Manager.  I knew a variety of other labs wanted a way to log who was coming in and out of their lab, so I figured it was a good project to take on.


Download Log Manager Version 1.3:

Installer
| VB 6 Source Code

Log Files:
A new log file is created each day. Log Manager writes the log information to text files in the specified Log Destination.  It’s capable of saving the log files to a certain folder on a server if necessary. By default Log Destination is set to “C:\INSTALL_PATH\LogDestination\”. Here is an example of the automatic file creation:

Below is an example of the contents of a log file.  It is a comma delimited file,  so it can easily be opened in Excel or similar program.

My Original Thoughts, Before Joimo Came Along

Before Joimo.com came to be, here were a couple of my other concepts..

How to Convert URL’s in Text to Links Using PHP

The function below takes in a string of text and converts all URL’s that start with "http://" to an HTML link.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
 * Returns the string with URL's replaced with actual HTML link tags
 * @param string $string The string to parse for URL's
 * @param boolean $noFollow Whether or not to add the rel="nofollow" 
 * attribute to the tag
 * @param boolean $newWindow Whether or not to make the link open in a new
 * window
 * @return string
 */
function getStringWithUrlLinks($string, $noFollow = true, $newWindow = true)
{
	$pattern = '/(http:\/\/[^\s]+)/';
	return preg_replace_callback($pattern,
		create_function('$matches',
			'return \'<a href="\'.$matches[0].\'" '
			. (($noFollow) ? ' rel="nofollow"' : '')
			. (($newWindow) ? ' target="_blank"' : '')
			. '>\'.$matches[0].\'</a>\';'
		), $string);
}

Here is an example usage:

21
22
23
$string = 'This is my website: http://www.jesterwebster.com/';
$stringHtml = nl2br(getStringWithUrlLinks(htmlentities($string)));
echo $stringHtml;

The example above would output:
This is my website: http://www.jesterwebster.com/

Firefox Extensions You Need For Web Development

When it comes to Firefox, these are my top 5 favorite extensions that aid in development:

ColorZilla – An advanced eyedropper, color picker, and page zoomer
Html Validator – Adds HTML validation to the View Page Source window.
Split Browser – Splits the browser window so that you can view multiple pages at once.
Web Developer – Adds a menu and toolbar that’s packed with web development tools.
YSlow – Helps determine how a page is performing.

robots.txt vs meta tag. Which has precedence?

Question:
If you have a robots.txt file and a meta tag within an HTML web page, that contradict each other, which has precedence?

Answer:
If there is a conflict between the directive in robots.txt and the meta tag directive (e.g. if your robots.txt allows spidering but your page meta tag does not) the robots.txt directive has precedence.

How to stop people from viewing directory content on an Apache web server

Let’s say you have the following files in your root directory:

/public_html/
- FileA.txt
- FileB.jpg
- FileC.doc

By default, Apache will look for an index.htm or index.php to serve the the user if they navigated to:

http://www.example.com/

If those default files do not exist, Apache will end up showing the contents of the directory.  If you want to stop Apache from doing that, you can add an .htaccess file in the directory. The .htaccess file should contain the following line:
Options -Indexes

This will stop users from being able to view contents of directories. This will work for all subdirectories as well.

This is How All Schedules Should Be Designed!

In college, I got bored of seeing the same old black-n-white, Courier, 12pt schedule. So I decided to spice it up.  Twice.

Dual Screen Fractal Backgrounds created in Gimp and Photoshop

A couple years ago I created some fractal artwork to use as the background for my dual monitor setup.  I figure it was about time I shared it with the world…