Cyprich.com

Occasionally Relevant Insights from a Software Builder

By

Using XPS Documents in Windows XP and 2003

Adobe’s PDF document format finally has some serious competition for market share. Microsoft XPS (XML Paper Specification) is a new electronic document format that can be generated from any application and then distributed without requiring that application to view it. XPS essentially does the same thing as PDF. Windows Vista has a native viewer, but viewers can be installed in Windows XP and 2003.

Installing on Windows XP and 2003

Free XPS viewers can be found at the View and Generate XPS page from Microsoft’s Windows Hardware Developer Central site. There are two options, the Microsoft XPS Viewer, which Vista already has, and Microsoft XPS Essentials Pack. The Microsoft XPS Viewer only integrates XPS with Internet Explorer, but the Essentials Pack installs a stand-alone viewer. All users, including Vista, should install this for viewing documents outside of a web browser.

Once either application is installed, you can generate an XPS document with the Microsoft XPS Document Writer by printing to it in the same way that a PDF is made. One thing that you’ll notice is that an XPS file can be created much faster than a PDF. This is probably due to the more limited functionality that it has as opposed to PDF, but over time this will change as more is added to it.

The Future

Will XPS replace PDF? More and more companies are starting to use it, notably Autodesk as a replacement for their DWF format. As Vista and Windows 7 are increasingly used, we’ll see more documents shared in XPS. There are free PDF generators, but they’re not being widely used. Eventually, printers will be able to use XPS directly which will give an alternative to Postscript.

By

Fixing a CD or DVD Drive that Windows Doesn’t Recognize

I recently was unable to access my DVD drive on a Windows XP machine. At first I thought the drive must be bad, but I booted the computer with Windows through Bart PE and found that the drive was work properly. So the problem was software based which lead me to reinstall the DVD driver. This didn’t restore access to the DVD drive, however.

Microsoft Fix it

After some research, I discovered the Microsoft Fix it wizard. These are small utilities that Microsoft created to fix minor problems like this. The drive could also be fixed with a manual solution that was published. The knowledge base article with this information and a link to the utility can be found at support.microsoft.com/kb/314060.

After running this utility, the problem was fixed and the DVD drive was working.

By

Deleting a Folder in Windows that is Not Accessible

I recently merged two drives that were in separate partitions on a hard drive with Partition Magic. Hard drive F would be copied into the a folder called F on hard drive E. Unfortunately, an error occurred and the operation failed. The two drives were merged together, but the contents of drive F: were lost.

This wasn’t the only problem. I tried to delete the F folder, but when I clicked on it, I would get the following message:

Folder is not accessible. Access is denied.

I couldn’t access this folder or delete it. I tried rebooting the computer and the folder could not be deleted. It wouldn’t even work when rebooting into safe mode. The Unlocker application couldn’t delete it either.

The reason why this folder could not be deleted is that my security ID didn’t match the security ID of the owner of the folder. Partition Magic made changes to the security ID when it was merging the drives and didn’t restore the permissions when it failed.

Changing the Security ID of a Folder

The following steps need to be done before you can delete folders with different security ID’s:

  1. Right click on the Start menu and select Explore to run Windows Explorer.
  2. Open the Tools menu and select Folder Options.
  3. Open the View tab and scroll down to the bottom in Advanced Settings and turn off Use simple file sharing.
  4. Right click on the folder that you want to delete and select Sharing and Security.
  5. Click the Security tab and press the Advanced button.
  6. Open the Owner tab and click Administrator in the Name list. If you are logged in as an administrator, click Administrators.
  7. Click the Replace owner on subcontainers and objects box so that it is on.
  8. Press the OK button.
  9. You’ll get an error message saying that you don’t have permission to read the contents of that folder. Press the Yes button.
  10. Click OK to apply the changes you made to the folder.
  11. Delete the folder.

By

Using MySQL on Another Server

Many web servers have a database server on the same machine. A problem with this type of configuration is that it puts too much of a load on the server and overall performance can be poor with a high traffic web site. Database servers work best when they are on their own computer apart from the web server. The database can then use all of the computer’s resources to run more efficiently.

Finding the hosts File

Accessing a database such as MySQL on another server requires the use of the hosts file. This is used to connect to the database server by redirecting a hostname to the server’s IP. On Windows, you can find hosts in the operating system directory in the system32\drivers\etc\ folder. If your not sure where it is, use the file search function in your operating system.

In the hosts file, move to the bottom and enter the IP of the database server and hostname that you will use in your code to use the database. The following example shows the IP of the database server (74.208.28.228) and the hostname that is defined as mysql.database.

74.208.28.228    mysql.database

Connecting with PHP

An example of connecting with PHP:

$link = mysql_connect ('mysql.database', 'mysql_user', 'mysql_password');

A user account in MySQL to access the database needs to be created. You can’t use the root account when connecting to another server.

Once connected, you can perform functions on the database just like as if it was a local server on your computer. This procedure can also be used to connect to other database servers such as Microsoft SQL Server and PostgreSQL.