Category Archives: Web Authoring Links

Simulate domain in test environment

I converting a website to WordPress in a test environment, accessing the server on localhost. But I want to simulate the ultimate domain.

First, in the apache httpd.conf file, set up a virtual host by adding the following lines:

<VirtualHost *:80>
DocumentRoot /xampp/htdocs/wordpress
 ServerName www.clarkperdue.com
</VirtualHost>
<VirtualHost *:80>
 DocumentRoot /xampp/htdocs
 ServerName localhost
</VirtualHost

This redirects the domain name to the correct directory on the local host server. It also resets the local host so other websites on the server can be accessed.

Second, use the hosts file to redirect windows when it encounters the domain. On Windows 7, the host file is located at: C:\Windows\System32\drivers\etc\hosts

Simply add the following line:

127.0.0.1  www.clarkperdue.com

Send Calendar Invitations with PHP

The first problem is sending mail from PHP from a smpt server that requires authentication. The standard php.ini file does not allow that. Fortunately, there is fake sendmail for windows which is included in the xampp installation. This requires modification of both the php.ini [mail function] section as well as the sendmail.ini file where the server authentication information is stored. With these modifications, the php mail function will work!

The primary problem is how to configure an e-mail attachment with a proper calendar invitation. This was kindly explained at Exchange Core. This seems to work not only with messages sent to an Exchange server, but also when sent to standard imap servers when viewed with a client that understands what to do with .ics attachments, such as the iPad. Awesome!

See also, iCalendar on Wikipedia and the iCalendar specification at the Internet Engineering Task Force.

Javascript phone number validation script

/*Validate Phone No*/
$('.valPhoneNo').blur(function(){
 var phone = $(this).val();
 phone = phone.replace(/D/g,'');
 if(phone.length == 7){
  var dispPhone = phone.slice(0,3) + "-" + phone.slice(3);
  $(this).val(dispPhone);
 } else if(phone.length == 10) {
  var dispPhone = "(" + phone.slice(0,3) + ") " + phone.slice(3,6) + "-" + phone.slice(6);
$(this).val(dispPhone);
 }
});

RegEx Example

Needed to replace

<p>Regulatory Taking:

with

<p><b>Regulatory Taking</b>:

where text between <p> and : were undetermined. The following RegEx find/replace in Notepad++ does the job:

Find: <p>(.+):

Replace: <p><b>$1</b>:

$1 is the ‘Backreference’ to (.+)