Hardlinks in Windows (junctions)

November 15th, 2006

Hardlinks are something that I always thought were not supported in windows. Now with the NTFS file system hard links can be used.

In dos the fsutil command can be used to create a hardlink from a specific file. Using a command like the following:

fsutil hardlink create newFile.txt originalFile.txt

From what I can tell this does not support hardlinking a directory. In order to hardlink a directory you would have to purchase the windows 2000 resource kit and use the linkd program to do this.

Although, now there is another program created by Sysinternals/microsoft called junction which gives the functionality to hardlink a file or directory.

To top it off for everyone who likes gui programs there is a shell extension which also gives this ability which can be found here.

Force No Cache on a Webpage

November 6th, 2006

Sometimes it is usefull to force a web page to not be cached. One example where this could be used is on a form that takes credit card information. Once the user submits their data you may not want someone to be able to hit the back button and be able to view the users credit card information. Microsoft has an article explaining how to force the browser to not cache the page but when I tried their method it did not work. Instead with a little trial and error I came up with the following solution:

In ASP (vbscript):
<%
Response.AddHeader "Expires", "Mon, 21 Jul 1979 01:00:00 GMT"
Response.AddHeader "Cache-Control", "no-store, no-cache, must-revalidate" ' HTTP/1.1
Response.AddHeader "Cache-Control", "post-check=0, pre-check=0" ' HTTP/1.1
Response.AddHeader "Pragma", "no-cache" ' HTTP/1.0
%>

In PHP:
header("Expires: Mon, 21 Jul 1979 01:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false); // HTTP/1.1
header("Pragma: no-cache"); // HTTP/1.0

Character Encodings

November 1st, 2006

A text document can be saved with many different types of character encodings. The question is which one is correct? Is there a best encoding for web development or to use in the <meta http-equiv="Content-Type"?

A great guide to understanding the different encodings can be found here.

Dos Prompt Modifications

October 26th, 2006

As I tend to use a dos a lot I decided it might be nice to modify the way dos looks. Below is the result of my modifications. I basically just changed the font color to green and made the working directory appear one line higher than normal.

Dos

Here are the steps if you would like to modify your dos prompt:

  1. To change the color of DOS go to /HKEY_CURRENT_USER/Software/Microsoft/Command Processory/ in your registry and modify the DefaultColor to be 0a
  2. To make the working directory appear one line higher, right click on “My Computer” go to “Properties” and then select the “advanced tab”. Now, click the “Environment Variables” button. Under “User variables” click the “new” button and put “PROMPT” (without the quotes) in the “variable name” text box and “$P$_$+$G” (without the quotes) in the “variable value” text box. This change will not take effect until the computer has been restarted.

ftp with 2 connections transfer from remote server to remote server

October 24th, 2006

Every so often I need the ability to transfer files directly from one server to another. Now this could be done by using a standard ftp program like filezilla and first copying it from a remote computer to the local computer and then again copying it back to another remote computer. Although, sometimes it is nice to go the more direct route and use a program that supports fxp which allows connecting to 2 remote servers and transfering directly from one to the other. Wikipedia has a nice list of programs that support this.

Time to switch to Internet Explorer 7

October 23rd, 2006

If your a web developer and you haven’t yet switched to internet explorer 7 (ie7) then now might be a good time. Microsoft has announced that they plan on distributing ie7 via automatic update by November 1st.

Since many computers are set to automatically update. It might be a good idea to start checking sites in ie7. So you can be prepared for sites that ie7 might break.

As people start transitioning to ie7 you may still want to test sites in ie6. This can be done by installing ie6 as a standalone application. The ie6 standalone version can be found here.

Below are a few css items that should not be used to hide the css from ie:

If you want to target IE or bypass IE, you can use conditional comments.

Portfolio

September 25th, 2006

For those that are looking for my portfolio I have moved it. It is now located at the following location (the link can also be found in the right navigation bar):  http://brett.batie.com/portfolio/