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.
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.
Replace new lines with “x newline”
This is useful if you need to edit text that appears at the end of a line.
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
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.
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/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
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
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.
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:
Open a text file (e.g. index.php),
Click File -> Save As
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 PHP.net 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.