Oct 11

Caprock Vector

A thread-safe vector component for use in the Session and Application. I did not write this component. The original author has evaporated, so I have archived it for the betterment of mankind.

The Vector Object is a COM component designed to work with any scripting environment (it also supports native interfaces within Visual Basic and Visual C++). Whether you are using IIS/ASP or you are using the Windows Script Hosting environment, you can use this object to store items in a grow-able array or vector. The items can be any automation compatible data type such as strings, numbers and other automation objects. This object is designed to be a dynamic, growable array or collection. It supports traditional item references by numeric index such as:

for index = 0 to 10
   response.write vec.Item(index)
next

but also item reference by textual index like so:

set foo = vec.Item(“Foo”)

The unique quality about textual or Named items, they are only supported by automation objects that implement the “Name” property. In other words, you can store an automation object in the Vector. The Vector inspects the automation object for a property called “Name”. If the Vector finds this property, it will allow you to reference the item in the Vector by name or numerical index.

Special consideration has been made for the Vector object to work with IIS/ASP’s intrinsic Application and Session objects. You can store a reference to a Vector object in one or both of these objects without affecting the performance of your web application. This is accomplished by marking the Vector COM component as both apartment and free-threaded, aggregating the Free-Threaded Marshaler. This component was developed with VC++ 6.0 and ATL 3.0 for the best performance possible.

Attached File Download the 76k zip file containing the DLL, source code, samples and documentation.

Oct 11

Caprock Dictionary: Thread-safe ASP dictionary component

A thread-safe dictionary component for use in the Session and Application instead of the built-in scripting.dictionary component, which is not thread-safe. I did not write this component. The original author has evaporated, so I have archived it for the betterment of mankind.

The Dictionary Object is a COM component designed to work with any scripting environment (it also supports native interfaces within Visual Basic and Visual C++). Whether you are using IIS/ASP or you are using the Windows Script Hosting environment, you can use this object to store items with an associated key. The key and the item can be any automation compatible data type such as strings, numbers and other automation objects.

This object is designed to be a replacement for the Scripting.Dictionary object. Special consideration has been made for the Dictionary object to work with IIS/ASP’s intrinsic Application and Session objects. You can store a reference to a Dictionary object in one or both of these objects without affecting the performance of your web application. This is accomplished by marking the Dictionary COM component as both apartment and free-threaded, aggregating the Free-Threaded Marshaler. Refer to Don Box’s excellent article, “House of COM”, Microsoft Systems Journal (now MSDN Magazine), September 1998. In the article he explains the impact each apartment model has on the performance of IIS and ASP. This component was developed with VC++ 6.0 and ATL 3.0 for the best performance possible.

Attached File Download the 78k zip file containing the DLL, source code, samples and documentation.

Apr 16

Return the folder of the current ASP file

ASPToday ASP Tip of Day for 17 April 2001, by Ian Vink

Return the folder of the current ASP file being accessed.

set fs = server.createObject("scripting.fileSystemObject")

Full_ASP_FILE_PATH = server.mapPath(request.serverVariables("PATH_INFO"))

PATH_ONLY = fs.getParentFolderName(Full_ASP_FILE_PATH)

response.write "This ASP page is being run in the folder: " & PATH_ONLY