Monthly Archives: February 2009

Using Python to replace spaces with underscores in filenames.

Python can be used on Window, Linux and Mac. It just a simple install.

download code

#!/usr/bin/python

import string
import os
import re

# task:
# loop thur input directory
# look for .pdf
# replace space with underscore
# rename/move to output directory

inputDir = "./" # Current directory
outputDir = "./new_location"

for filename in os.listdir(inputDir):
    if filename[-4:] == ".pdf":
        tempName = filename
        tempName = tempName.replace(' ', '_')
        os.rename(inputDir + "/" + filename, outputDir + "/" + tempName)

Microsoft Certified Professional Developer (MCPD)

How to earn your MCPD certification on Visual Studio 2008

Each MCPD certification on Visual Studio 2008 requires that you pass two to four Microsoft Certified Technology Specialist (MCTS) prerequisite exams and one Professional Series exam, as shown in the following table. When you pass all the exams in a specific MCPD path, you earn the related MCTS certifications as well as the relevant MCPD certification.

I will be focusing on this particular track: MCPD: ASP.NET Developer 3.5 so I’ll need to pass the following exams: 70-536, 70-562 and 70-564.

Exam 70-536: Microsoft® .NET Framework 2.0 Foundation

Just purchased a book to pass Exam 70-536.

MCTS Self-Paced Training Kit
MCTS Self-Paced Training Kit

Exam 70-562: TS: Microsoft .NET Framework 3.5, ASP.NET Application Development

Exam 70-564: PRO: Designing and Developing ASP.NET Applications Using Microsoft .NET Framework 3.5

Linux and Apache commands

Here are some commands that we use at the Gazette on our Linux web server.  It is running Red Hat Enterprise Linux 5.2.

Reload Apache Conf file
/etc/init.d/httpd reload

Restart Apache
apachectl -k graceful (didn’t work on Rackspace)

Restart Apache from ssh
/etc/rc.d/init.d/httpd restart

Modify Apache conf file
vi /etc/httpd/conf/httpd.conf

vi commands
i enter edit mode
esc to exit edit mode (command mode)
:wq to write changes and quit (in command mode)
:!q quit without saving

Memory Use

free -t -m

Friday the 13th 404 Error

Friday the 13th after work panic call. Three sites had 404 error pages on their homepages. A quick Google search for this WordPress post

PROBLEM: My wordpress homepage (www.satvatovecommunity.com) displays the “Page not found (404)” error. This error is there no matter what I set my homepage to display (either latest posts or any static page).

I found out that one of my plug-ins “redirection” was causing the problem.

Deprecated innerHTML

This is a JavaScript example of how to use the createTextNode instead of the deprecated innerHTML. There is also an example of how to use the removeChild function if the node you want to add to has child nodes.