Creating CSS3 Rounded Corners For All Browsers

To add rounded corners to an element using CSS, just add the following code to your CSS
[cc lang=”css”]/* 4 rounded corners */
-webkit-border-radius: 10px; // for Safari and Chrome browsers
-khtml-border-radius: 10px; // for Konqueror browser
-moz-border-radius: 10px; // for Firefox browser
border-radius: 10px; // for browsers that support CSS 3
Of course, change the values (10px) to whatever value you want to change the corner radius.

If a browser doesn’t support rounded corners, it will just show square corners.

For more information, visit

Batch Processing / Automation Tips

Text Processing

Dreamweaver Find and Replace (w/ Regular Expressions)

Finding and replacing text is pretty straightforward. For example, you can find all text matching “car” and replace them with “cars”. Other types of find and replace are not so obvious. Here are some examples.

  • Replace “x” with “x followed by a tab”
    This is useful when you want the text to be tab delimited so you can copy and paste it all into Excel so that each column (separated by a tab) will appear in its own column for further processing.
    FIND: x
    REPLACE: xt
    REGEX: checked
  •  Replace new lines with “x newline”
    This is useful if you need to edit text that appears at the end of a line.
    FIND: n
    REPLACE: xn
    REGEX: checked
  • Wrap multiple values (one on each line) with single quotes (‘x’)
    This is useful when you’re building a long drop down list of options in the format
    <option value=’a’>a</option>
    <option value=’b’>b</option>
    <option value=’c’>c</option>

    FIND: n
    REPLACE: ‘n’
    REGEX: checked

Continue reading Batch Processing / Automation Tips

Windows Command Prompt Shortcuts

Recently I had to do some Recently I had to do some stuff in Windows Command prompt. I got tired of having to type everything out letter by letter so I found these shortcuts.

Copy Text To Clipboard

Highlight  the text you want to. It will be copied to your clipboard.

Paste Text Within Windows Command Shell

Right-click your mouse to paste

Auto-Complete Entering Commands

Type the first few letters of a command or file / folder path and then hit TAB

Cancel The Currently-Running Program


How To Set Up SSL on Multiple Sites / Virtual Hosts on Apache

This example uses Apache that comes with Bitnami’s WAPPStack (Windows, Apache, PHP, Postgres) installer.

Create your SSL certificate keys. Instructions on creating a self-signed SSL certificate are available in chapter 8.5 Creating a Self-Signed Certificate Key in O’reilly’s Website Cookbook. It uses openssl to create the certificate keys. If you are on Windows, you can install Cygwin and add the openssl package to follow the instructions.

Once you’ve created your SSL certificate keys, do the following: Continue reading How To Set Up SSL on Multiple Sites / Virtual Hosts on Apache

Configuring 404 File Not Found Error Handler in Apache

I recently needed to configure how 404 file not found errors were handled in Apache. This was easily done by editing httpd.conf (search for “404” to quickly find where the relevant directives are) and changing a line of code. Here’s what it looks like by default

[cc lang="php"]# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/"
#ErrorDocument 402

Continue reading Configuring 404 File Not Found Error Handler in Apache

Unicode Regular Expressions in PHP

Recently I wanted to perform a regular expression match in PHP to match all printable characters. I used the character class [:print:] to do this. My PHP test code was

[cc lang=”php”] preg_match(“/^[[:print:]]*$/”, “abcde”)[/cc]

Although this worked, it didn’t work for non-ASCII characters, e.g. French characters with accent marks like réseau. What I needed was the ability for preg_match to match all unicode printable characters. It turns out there is a modifier (/u) that supports this. But, I also had to use a special unicode character class so my test code became

[cc lang=”php”]preg_match(“/^P{C}+$/u”, “réseau”)[/cc]

P{C} basically matches everything EXCEPT control characters in any language.

You can find more info in the Regular Expressions Cookbook by O’reilly in chapter Unicode Code Points, Properties, Blocks, and Scripts.

How to Create a Windows Keyboard Shortcut

Recently I have needed to convert web pages saved in non-UTF-8 encoding into UTF-8 encoding. I was using Windows Notepad to open files and then save them with the same file name (using the Save As command) but selected “UTF-8” in the encoding field (It defaults to ANSI). I noticed, however, that I needed to close Notepad and reopen it every time I wanted to do this, otherwise weird characters would appear when I try to view the converted file. So, instead of looking for and clicking on the Notepad icon for each file, I created a keyboard shortcut key to do this.  This works for any program. Here’s how:

1. Go to Windows Notepad and right click and select “Properties” as shown below.

windows shortcut Continue reading How to Create a Windows Keyboard Shortcut

Find Out a File’s Encoding On Windows

Recently, I needed to know whether a file was encoded in UTF-8 or not. Since everything is international nowadays (especially websites), you might as well encode everything in UTF-8 so no funky characters appear. Although there are many encoding schemes, Notepad was pretty easy to use to see whether a text file was encoded in UTF-8 or not. Here’s what I did:

  1. Open a text file (e.g. index.php),
  2. Click File -> Save As
  3. Look as what is selected in the Encoding field. If it’s not UTF-8, then it’s not UTF-8, and you can select UTF-8 and save it as UTF-8.
If anyone finds a simple way to automate this in a loop to convert a batch of files, let me know in the comments. I read many posts on automating this in comments but they didn’t seem reliable.
Actually, I just found out you can use the free Notepad ++ to convert from ANSI to UTF-8 and to other character encodings.