Translate:          

Thursday, March 18, 2010

VBScript Find and Replace in File Names - fnfindandreplace.vbs

I have found, lately, that updating file names for large numbers of files to be tedious and time consuming. Lots of times I'll find myself going through hundreds of files changing the underscore character to space, or removing some tag.

Finding this really annoying and time consuming, I decided to write and share another script with you guys.

I packaged this all up nicely so that you can test what you're doing before you decide to commit your changes, check for case sensitivity and some other nice features.

I took some functions from from previous articles I wrote and wrapped it all up into one nice script.

Here is the output from the -? switch:

This script must be run with cscript.exe.
Syntax: cscript.exe fnfindandreplace.vbs [options] <StringToFind> <StringToRepla
ce>
Options:
         -v = Verbose
         -cs = Case Sensitive
         -x = Commit
         -r = Recursive
         -q = Quiet
         -? = Displays This Message

As always, questions and comments are welcome!

...

Read More...

Send this to:                          

Tuesday, December 01, 2009

ASP Verify Credentials Against a Domain - IsAuthenticated

A few months ago I ran into a bit of a problem. I was programming a front end for web application, and in that web application I wanted to prompt for the users username and password, and then verify that that user was, in fact, a user in the domain.

I then wanted to pull the user's information, like the DistinguishedName property, and it's CN or CommonName. This was surprisingly hard to figure out. There was lots of information out there on how to do IIS impersonation, which is not what I wanted to do, but I did want to verify the users credentials to see certain information.

After quite a bit o ...

Read More...

Send this to:                          

Tuesday, November 24, 2009

More Really Useful VBScript Array Functions - ArraySort and DoubleArraySort

A while back I wrote an article about VBScript arrays and their various shortcomings entitled "VBScript Array Functions - DeleteFromArray, InArray". I love these functions because they really simplify the manipulation of arrays and directly address some of the obvious flaws with the initial implementation of arrays in VBScript.

At the end of that article, written almost a year ago, I also mention writing sort functions for VBScript. Well I finally go around to it today and decided that these two functions were just way to handy not to share.

The first one, which will probably be the one most commonly used is a simple sort function, where you can sort ascendingly or or descendinglying depending on which value you pass for sOrder. The nice thing about this, is that it will sort your array simply by calling it as a normal sub.

The second sub works exactly like the first one, except that it will sort 2 arrays relationally. For example, lets say you have Array1 and Array2 who's indexes are related. Lets say now you wish to sort Array1 but also maintain the 1:1 relationship you have between Array1 and Array2. This sub will do exactly that by passing Array1 as the first parameter, Array2 as the second parameter and the order, descending or ascending as the final parameter.

I think these are pretty slick and many of you will find them immensely useful in your own scripts and projec ...

Read More...

Send this to:                          

Thursday, August 06, 2009

Yes, this blog is still alive...

Oh hai!Hi guys! It's been a while, huh?

I just wanted to post a quick note and let you guys know that I have not abandoned this blog. I have received a few emails about code or projects wondering if I still check this blog or my email address and the answer is, "Yes!"

I just haven't had any the time or inclination to post anything new. When I get some time or have another great code snippet to share, as usual, I'll be sure to post it up.

If you have an suggestions on a particular project I should tackle, please feel free to let me know. You know how to contact me!

Please keep in mind I'm not going to write a complex script or teach you how to do things that are clearly documented other places. I'll only be considering simple tasks (in VBScript, no I won't do your PHP or whatever other language either) that aren't covered in a concise way somewhere else.

Anyway, thanks for all the nice email and words of support! I'm not gone, I'm here to stay and I'll see you soon! ...

Read More...

Send this to:                          

Monday, November 17, 2008

SQL Server 2005 Database Mirroring Limitations and Gotchas

I have been working pretty extensively with SQL Server Mirroring in Microsoft SQL Server 2005. It seems to work pretty effectively, though setup outside a domain configuration is convoluted to say the least.

I have posted in the past about some problems I have had setting it up. My difficulties with the configuration aspect actually generated KB940254. The writeup for this particular KB seems kind of convoluted but the long and short of it is that you must use the actual machine name and not arbitrary DNS or Host file entries for mirroring configuration.

SQL Sever 2005 Mirroring Gotcha - Expiring Certificates

Well as we have plugged away with more of our clients using SQL Server Mirroring we have approached 2 more interesting issues. The first one is that, by default, when using SQL Server mirroring with certificates for authentication and encryption, SQL server certificates will expire after one year.

After your certificates expire SQL Server Mirroring will fail, rather ungracefully, if either the principal or mirror instance fails for any reason. And, if the server that fails happens to be the principal instance, your whole mirror instance dies and all your mirror databases go offline, the mirror does not recover even if you have configured a witness. ...

Read More...

Send this to: