While working with Outlook email using Windows Powershell, I noticed that Outlook did not close. This is because Windows will not close the Outlook process until all programs are done with it. This blog post has a nice discussion about it as well as the method for forcing the COM object to close.
Upgrading XAMPP
Upgrading XAMPP from ver 5.5.19 to 5.63 was easier than I could have imagined. I wanted to take advantage of the new PHP 5.6 ‘argument unpacking‘ feature using the splat operator. I was afraid that the process of transferring test websites, including a full WordPress installation, and command line scripts would be painful. It was not. Here are the steps I took.
- Renamed the old xampp folder from \xampp to \xampp Old
- Unpacked the new xampp package to \xampp
- In the new installation, renamed the following files and folders by appending “Old” to their names:
- /apache/conf/httpd.conf, apache configuration file where the virtual host settings reside;
- /mysql/data/, the entire mysql data folder
- /php/php.ini, the php initialization file where there have been many customizations over time.
- Copied the files and folders in step 3 to the corresponding location in the new installation.
- Copied the website folders I wanted to transfer from /htdocs/
Fired up the new installation, and everything worked perfectly! Even the WordPress site picked up right where it left off on the old installation without a hiccup.
PHP IMAP Functions
The first user submitted response in this php manual entry warrants further study.
Store array to file as JSON String
The accepted answer to this StackOverflow question shows how to save multiple json strings to a text file.
Directory structure to nested array
Here is an interesting method for creating a nested array based on the directory structure of a list of URLs.
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.
Nonce Implementation in PHP
Pass Success Callback Function into AJAX
Javascript Modular Design Patterns
Some resources explaining the modular design pattern in javascript, for future reference.
- Stackoverflow
- Definitive Module Pattern
- Learning Javascript Design Patterns
- How Do You Structure JavaScript? The Module Pattern Edition, by Chris Coyle
- Javascript Module Pattern: In Depth
- Mastering the Module Pattern
- JavaScript Design Patterns – The Revealing Module Pattern
- Everything You Ever Wanted to Know About Scope