Main

Tech Archives

February 11, 2002

MovableType

I've decided to start a Weblog. I started out looking at Userland Radio. Although it had a large number of features, I found that I liked having everything on my server. This includes the data entry screens and the database. The biggest reason was the database. I didn't like the idea of my weblogs being stored on someone elses server where I couldn't keep track of it.

With MovableType, the database, forms, scripts etc are all on my server. Yes this is a hosted server, but I can easily make ftp based backups on my schedule and move the whole site to another server with the weblog intact.

February 12, 2002

Christmas video

Well, Alan just confirmed it. The 8mm tape we used for Christmas is blank. This is a real bummer since this means we don't have the video of Trey opening his presents at home.

February 13, 2002

CSS

Cascading Style Sheets: Because of this weblog I'm beginning to look at CSS. It looks like a promising way of handling my web pages. I'm intrigued by the thought of being able to change the look of my web site with the change of a single file. It is also a promising way of keeping a consistent look for the entire web site. We will see. Maybe I can get the web site done.

February 19, 2002

Cool site for Web sites

ACME License Maker PHactotum-license.jpg This site is so cool. I first saw the candy heart maker on A Day Late. I then saw the link to this. Give it a try, I did. Also try the candy heart maker. Here is one for Trey

Mozilla - Give it a try

I've decided to give Mozilla a try. For those of you who don't know Mozilla is the open source that the latest Netscape is based on. The great thing is that it doesn't contain all the rest of the applications that make Netscape such a beast. I installed Mozilla with only 8MB. The only thing I dropped was the Mail and News reader. This is really refreshing since IE 5.5 SP2 takes up to 17MB just in the download. Also, Mozilla supports everything I've been playing with lately, CSS, Weblogs, Moveable Type, etc.

Mozilla and Flash

Okay, maybe I spoke too soon. Mozilla just crashed on me. I had gone to Bebsland to test out Mozilla and I needed Flash to view her pages. Well I let Mozilla look for the plugin and it didn't find it. It did have a list of plugins so I chose the Flash viewer for Netscape, downloaded it, clicked on the button to show location and boom boom out go the lights. It seems that Flash doesn't see Mozilla as Netscape, it isn't. And they don't have a Mozilla pluggin. Now why the crash? I don't know. I think it had something to do with the button I pushed. Also, two things bother me right now. Mozilla doesn't word wrap in a form entry text box. Maybe there is an option somewhere that would change this. The other is that the MT buttons to boldface, italize, underline or enter a URL don't work. They are calling Javascript (javascript:insertLink()) Maybe I have to install something else? I'll have to ask Kirk at work. He has been using Mozilla for a while now and has probably run up against all the problems I'm having now.

February 22, 2002

Update on Mozilla

In my previous post on Mozilla, I complained about some problems with MT and Mozilla. For the word wrapping problem I found that Mozilla is working as designed and that there is a work around with MT that needs to be made. I'm too new at MT, CSS and these templates to apply the fix right now. Give me some time and I will. As for the buttons, I haven't yet found a solution. And I won't for a while. I've removed Mozilla from my machine. Seems that after I installed Mozilla, Internet Explorer was slow or not working. I un-installed it and IE is back to normal, almost. If I use the Address tool bar in my start bar it no longer works. It launches IE, but doesn't load anything. Strange.

March 7, 2002

Thinkpad A31P

I like IBM Thinkpads. Some of that may come from working for IBM, but some may come from a dislike for the prevalence of the glidepoint mouse pointers in other laptops. I can't stand the things. Tom's Hardware Guide has a review of the latest laptop to come from IBM. I wish I had the estimated $4,000 to spare for this bad boy.

May 17, 2002

Pronounceable Password Generator

I was writing a simple password generator program today. Actually I was finally debugging it. I had started several months ago. The program generates passwords of a given length by generating random characters until the length is reached. Problem is these passwords are very hard to memorize. The work great for system accounts that you want to be hard to remember. But don't work well for everyday passwords.

A friend of mine pointed me to two password generators available on the web that make pronounceable passwords. Now this is a good idea as long as it doesn't use words in the dictionary. Dictionary words tend to be easy to crack because their are programs that will throw the dictionary at the system until a match is found.

The first generator, Java Password Generator, is free. This does generate pronounceable passwords. They aren't necessarily secure passwords. The author does suggest you change the case of some of the characters, substitute numbers etc.

The second generator, Masking Password Generator 2, is shareware. If you buy the Pro version, you get pronounceable passwords, that can also conform to your company standards. This looks interesting. I may download it and try it, just to see how well it works. Of course, I'd have to pay the $20 to get the pronounceable passwords.

The first generator's author also referenced documents that describe how this is done. He also offers the source code as long as you follow his simple and reasonable guidelines. I may have to look at that as well, of course I don't know Java.

By the way, if you want you can try my program. I offer it with no support, assurances, or anything else. If it breaks something, then all I can say is I'm sorry. I can't fix it. You will need the VB6 runtime (Thanks to Karen for the VB6 runtime package).

pwdgen.gif

June 12, 2002

Testing Please

I've liked my hosting provider since I started with them. Easy start up. Very little service interruption. Everything going along fine.

Then all of a sudden they get the idea to make some changes. Only this time they left out two very significant parts of change management: testing and customer communications.

They did have customer communications, but it was only the day before the change was implemented. Always, always give the customer plenty of time to properly prepair himself for the impending change. One day is not enough.

As for testing. The evidence I've seen leads me to believe that testing was either non-existent, or very minimal.

The change in question, a new email system, changed the basic functionality of a system. It also offered two new features. The basic functionality part went fine, but the two new features took more than a week to introduce, and then there were problems.

The first implemented feature gave me an error when it first ran, but not there after. The second a web based email system, is fine to read the mail, but I can't send mail.

Since my laptop is being repaired I can't access my normal email software and the webmail won't let me send email. Thus I can't even send a request for help.

I will probably amend this entry depending on how this is resolved. I don't want to disparage the company, and it would be easy to find my hosting company, but I really needed this to work tonight.

We'll see what happens tomorrow.

Continue reading "Testing Please" »

July 12, 2002

New Toy

Well, I finally updated my PDA. I've had the Palm Pilot 128 since Palm was owned by US Robotics. I've used this for contact management and password management . At one time I synchronized it with Outlook and Lotus Notes for Calendar and task items in addition to the contacts.

Today I updated my PDA to a Pocket PC 2002 device, the Toshiba E740. This is a really sweet toy, err tool. With the right software, PDA Sync from LapLink, I can synchronize Lotus Notes, everything that is on my Palm, Outlook, and many other programs.

Take a look:
Toshiba e740

October 7, 2002

Neat toy to go with my E740

I saw this over at Pocket PC Thoughts: www.pocketop.net. It is a key board that works through the infraed port on the Pocket PC or Palm.

If someone wanted to by this for me I wouldn't complain.

November 11, 2002

Retro CDs

I saw this in W2Knews a good newsletter. Verbatim has Retro CDs. The CDs look like vinyl records.

VinylCD.jpg

February 6, 2003

Need to generate a WEP key?

Found this link while pursing Pocket PC Thoughts.

WEP Strong Key Generator version 2.1 by Warewolf Labs and Kraix.com Basically, this web page lets you generate either a random WEP key in 64, 128, 152, and 256 key lengths, or generate one based on a given custom key.

I know I had some problem a while back getting a new key inserted into my lap top so that it would work with my new key I created for the access point. I wrote a small vb program to convert the ASCII to HEX. This site takes it one step further and generates the ASCII text to begin with.

Pretty cool.

February 9, 2003

Interesting programs

HTML Image Page Builder and DBTray are two interesting programs I found at Sulaco - Software I have written.

The first program converts an image file to an html text file. Replacing the pixels in the image with colored text to match. Pretty neat effect.

The second program, DBTray, puts a Icon on your clock tray that does most of what MS SQL Enterprise Manager does, database info, SQL scripts, SQL query analyzer, etc.

There is another program simular to HTML Image Page Builder called BG_ASCII. It is a stand alone program that converts image files to ASCII art.

March 9, 2003

New PC

Well, it is time to start thinking about building a new PC. I've had the bug since we got the new Digital Camcorder. I'd like to build a PC just for video editing. This means it will need a high end video card, a firewire connection, large hard drives, fast CPU lots of memory and a DVD/CD burner. I'd also like to make it as quite as it can be.

Our office (the one at home) is much too noisy. The first thing to reducing that noise will be fixing the fish tank. Listen to the office noise as I unplug the tank pump: speaker.bmp

As you can hear there is a lot of noise coming from the aquarium. Topping up the water helps, but it is still noisy. The rest of the noise comes from my laptop and my desktop.

Ideally, I would have a few quite PCs in the office, with a server or two in my non existent basement. The servers housing as much storage space as I can afford. I need space for MP3s, videos, etc. I also need backups of some sort.

We are also getting close to the time to start putting in filters on the internet. Need to keep Trey from getting to sites that aren稚 appropriate for him, as well as those where he can buy things.

Silent PC Review

I found a good site on silencing your PC: SilentPCReview.com

They have sections on:


  • Cases & Damping
  • Power Supplies
  • Cooling
  • Fans & Controls
  • Storage
  • Projects
  • and many more

March 22, 2003

New Server

Well I'm waiting on my first server for the home. Dell, yes Dell for those of you who know I work for IBM, had a great deal on their 600SC. The deal was you got a P4 2.4GHz for the price of a Celeron 1.8GHz. I upped the server to 512MB of memory, a second nic, 120GB of disk space and a CDRW/DVDROM. Now, why did I do the last? Well, backups for the CDRW part, and as for the DVD portion, many products are now coming in that form. An example is MS Studio .Net. I plan on getting that soon, so I can improve my programming skills.

Dell600SC
MS Studio .Net

August 28, 2003

SharpMT and Pocket SharpMT

I found two really cool programs. SharpMT and Pocket SharpMT. Both allow you to create entries offline, for posting to Movable Type based weblogs, like PHactotum Wheneverly. SharpMT runs on http://www.microsoft.com/windows/default.mspx with the .NET Framework and Pocket SharpMT runs on Pocket PCs with the Compact .NET framework. So far I am liking both products.

You can read more about it at The EpiCenter Blog

September 7, 2003

System BIOS settings can make a big difference

Well today I was trying to capture video from the camcorder and I wanted to use one of the two new 120GB drives I had installed. I use Pinnacle Studio version 8. When choosing a location to store the captured video, Pinnacle Studio first tests the drive to see if it is fast enough to read and write to. Both of my new drives failed.

Hmm, why is this. The short story is that I went into BIOS and noticed that the drives weren't configured in there. I also noticed that the fastest UDMA speed was set to ATA 33. All three drives in my system are ATA 100 drives. I tried the UDMA speed setting first. No luck. I then configured Primary IDE Drive 1 and Secondary IDE Drive 0 and 1 to Auto. Low and behold, the read and write times are 20-25 times faster than before.

Moral of this story...double check your configuration after you add new hardware. Simple things like letting your BIOS know what is installed can make a big difference.

September 19, 2003

What's in your utility box?

Scott Hanselman's posted what he includes in his list of utilities, what's in yours?

Scott Hanselman's Weblog : Scott Hanselman's Ultimate Developer and Power Users Tools List

October 25, 2003

Object of Desire

PowerMac G5

I am in love with the new Apple G5 and Mac OS X Panther. You need to see their Developers conference keynote to understand why, but this would be one of my first purchases after a lottery win.

December 15, 2003

Have you ever seen a Gigapixel Picture?

Max Lyons has produced an amazingly detailed picture using a 6 Megapixel camera, software and skill.
Gigapixel Images

July 6, 2004

SANSFire Day 1

I'm spending the next 8 days in at SANSFire 2004 in Monterey, CA. I'm taking Track 5, Securing Windows by Jason Fossen.

So far the first session was introductory. We looked at AD and DNS. It took half a day to get over the 50,000 foot view of AD. Tomorrow we discuss Group Policy Objects, so it should get more detailed.

In the evening there was a session entitled "A conversation with Dorothy Denning." This was an interesting conversation. Dr. Denning discussed some early history of Security, the difficulty of security for end users, and Diversety of systems.

August 16, 2004

Inkable Type

December 17, 2004

How to Boot Windows XP off a Compact Flash Card

eHomeUpgrade | How-To: Boot Windows XP Off a Compact Flash Card

Just putting this here so I can find it again.

How-To: Boot Windows XP Off a Compact Flash Card

January 8, 2005

How Nerdy are you?


I am nerdier than 66% of all people. Are you nerdier? Click here to find out!

January 9, 2005

What's your Digital IQ?

DigitalIQ.jpg

January 31, 2005

Virtual Keyboard

I just don't get the Virtual Keyboard. I don't look at my keyboard when I type. I'm a touch typist and I don't see how trying to type on a flat surface with no tactile feedback as to hitting a real key would work. Sure it is small to carry, but I don't think it would be very functional to me.

May 11, 2005

MySpeed

Neat bandwidth tester. Here is what my system showed.


MySpeed.PNG
MySpeed

January 13, 2006

Ego Surfing

EgoSurf20060113.png

Well I guess it helps to post more frequently than once every 7 months. And probably posting on subjects that interest people would help as well.

I think I need to figure out what I want this place to be.

March 29, 2007

LDAP: Active Directory errors

I was helping someone debug logging into Active Directory with LDAP.  I had performed a network trace and the reply to the BIND request stated:

resultCode: invalidCredentials (49)
errorMessage: 80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 525, vece.

A little Google search turned up the following:

Here is a list of Active Directory errors:
525 - user not found
52e - invalid credentials
530 - not permitted to logon at this time
532 - password expired
533 - account disabled
701 - account expired
773 - user must reset password

LDAP: error code 49.

Hmm, looking at the LDAP bindRequest, which was a simple bind, found that the user had passed domain/userid for the login account.  I hadn’t noticed before, that he had used a forward slash (/) instead of a back slash (\).  I had him retry and sure enough all was well.

 

March 30, 2007

IBM Widget

Just found this today.  There is now an IBM widget that runs on the Yahoo Widget engine.

It appears to have been made by IBM.  The gallery list David Leip but the about page list several others:

IBMWidgetAbout

 

What I found interesting is that this widget allows you to search for IBMers.  I know we have the search page somewhere on the public IBM site, but this just makes it so much easier, provided you have the widget of course.

In all it is a nice looking widget.

Tags: ,

July 18, 2007

Speed Test time again

Due to an entry by Karl Fisch, I’ve decided to test my bandwidth speed.

The numbers vary quite a bit.

SpeedMatters.org
SpeedMatters.org

Looks like Indiana is ranked 24th for downloads, and 16th for uploads.  I really did not think we’d be that high.  I wonder about the statistical viability of this report.  I wouldn’t think many dialup users would end up at a speed test site.  This tends to be a broadband user thing.  Thus, the real averages, would be much lower due to the number of dialup users.

Here in Indiana, there are a lot of areas where dialup is all you can get.

 SpeedTest.Net

WugNet SpeedTest
WUGNET-SpeedTest

February 15, 2008

Directory Experts Conference 2008

Is anyone else going to the Directory Experts Conference this year?  I just got approval to registerOpen-mouthed, let's hope it isn't too late.  The conference is March 2-5.

If I do get in, I'll do my best to update my blog with what I learn as I go.  It's been a while since I've been to a conference, but from what I remember, I'll be dead tired at the end of the day.

I'll tag all my post with DEC2008.

February 18, 2008

Microsoft Scripting Olympics

Sounds like fun.  I think I'll try this.  I've looked over the events and they look doable.  The schedule might be tight, as the last entries are due on the first day of DEC2008, but we'll see.

I may even post my submissions here.

February 20, 2008

Event 1: Could I get your Phone Number?

Here is my submission for the Advanced Event 1 in the Microsoft Scripting Games 2008

   1: '*********************************************************************

   2: ' Script Name: Event1.vbs

   3: '     Version: 1.0

   4: '      Author: Perry Harris (PHactotum)

   5: '     Updated: 12:04 AM Wednesday, February 20, 2008

   6: '     Purpose: Solves the 2008 winter Scripting Games Advance Event 1: Could I get your Phone Number?

   7: '              

   8: '       Usage: cscript Event1.vbs [phone number]

   9: '       Notes:

  10: '    Keywords: 

  11: '  versioning: 1.0    Original release

  12: '*********************************************************************

  13: Option Explicit

  14: Dim strNumber

  15: Dim colMatches

  16: Dim objRegEx

  17: Dim Nums

  18: Dim objFS

  19: Dim objFile

  20: Dim strAll

  21: Dim i

  22: Const ForReading = 1

  23:  

  24: ' Retreive our phone number

  25: if WScript.Arguments.Count < 1 then

  26:     WScript.StdOut.Write "Please enter a 7 digit phone number: "

  27:     strNumber = WScript.StdIn.ReadLine

  28: else

  29:     strNumber = WScript.Arguments(0)

  30: end if

  31:  

  32: 'Verify our phone number is 7 digits and only uses the digits 2 - 9

  33: Set objRegEx = CreateObject("VBScript.RegExp")

  34: objRegEx.Pattern = "[2-9]{7}"

  35: Set colMatches = objRegEx.Execute(strNumber)

  36: if colMatches.Count <> 1 then

  37:     WScript.StdOut.WriteLine "I'm sorry, we only accept 7 digit numbers using the numbers 2 - 9."

  38:     WScript.StdOut.WriteLine "Please try again."

  39:     WScript.Quit

  40: end if

  41:  

  42: 'Convert our phone number to a regular expression

  43: set Nums=CreateObject("Scripting.Dictionary")

  44: Nums.Add 2, "[aAbBcC]"

  45: Nums.Add 3, "[dDeEfF]"

  46: Nums.Add 4, "[gGhHiI]"

  47: Nums.Add 5, "[jJkKlL]"

  48: Nums.Add 6, "[mMnNoO]"

  49: Nums.Add 7, "[pPrRsS]"

  50: Nums.Add 8, "[tTuUvV]"

  51: Nums.Add 9, "[wWxXyY]"

  52:  

  53: for i = 2 to 9

  54:     strNumber = replace(strNumber,i,Nums.item(i))

  55: next

  56:  

  57: objRegEx.Pattern = strNumber & "\r\n"

  58:  

  59: 'Open and read our WordList

  60: Set objFS = CreateObject("Scripting.FileSystemObject")

  61: Set objFile = objFS.OpenTextFile("C:\Scripts\wordlist.txt", ForReading)

  62:  

  63: strAll = objFile.Readall

  64:  

  65: 'Now let's see if there is a match in our word list

  66: Set colMatches = objRegEx.Execute(strAll)  

  67:  

  68: If colMatches.Count > 0 Then

  69:     Wscript.StdOut.WriteLine colMatches(0)

  70: else

  71:     WScript.StdOut.WriteLine "Sorry, no Matches were found"

  72: End If


Event 2: Skating on Thin Ice

Here is my submission for the Advanced Event 2 in the Microsoft Scripting Games 2008

   1: '*********************************************************************

   2: ' Script Name: Event2.vbs

   3: '     Version: 1.0

   4: '      Author: Perry Harris (PHactotum)

   5: '     Updated: 1:25 AM Wednesday, February 20, 2008

   6: '     Purpose: Solves the 2008 winter Scripting Games Advance Event 2: Skating on Thin Ice

   7: '              

   8: '       Usage: cscript Event2.vbs [phone number]

   9: '       Notes:

  10: '    Keywords: 

  11: '  versioning: 1.0    Original release

  12: '*********************************************************************

  13: Option Explicit

  14: Const ForReading = 1

  15: Dim objFS

  16: Dim objFile

  17: Dim strLine

  18: Dim aScore

  19: Dim i

  20: Dim ScoreMax, ScoreMin,ScoreTotal,ScoreAvg

  21: Dim GoldScore, GoldName

  22: Dim SilverScore, SilverName

  23: Dim BronzeScore, BronzeName

  24: GoldScore = 0

  25: SilverScore = 0

  26: BronzeScore = 0

  27: GoldName = ""

  28: SilverName = ""

  29: BronzeName = ""

  30:  

  31: 'Open and read our WordList

  32: Set objFS = CreateObject("Scripting.FileSystemObject")

  33: Set objFile = objFS.OpenTextFile("C:\Scripts\Skaters.txt", ForReading)

  34:  

  35: Do until objFile.AtEndOfStream

  36:     strLine = objFile.ReadLine

  37:     aScore = split(strLine,",")

  38:     ScoreMax = aScore(1)

  39:     ScoreMin = aScore(1)

  40:     ScoreTotal = 0

  41:     for i = 1 to ubound(aScore)

  42:         If aScore(i) > ScoreMax then ScoreMax = aScore(i)

  43:         If aScore(i) < ScoreMin then ScoreMin = aScore(i)

  44:         ScoreTotal = ScoreTotal + aScore(i)

  45:     next

  46:     ScoreTotal = ScoreTotal - ScoreMax - ScoreMin

  47:     ScoreAvg = ScoreTotal / (uBound(aScore)-2)

  48:     

  49:     If ScoreAvg > GoldScore then

  50:         BronzeName = SilverName

  51:         BronzeScore = SilverScore

  52:         SilverName = GoldName

  53:         SilverScore = GoldScore

  54:         GoldName = aScore(0)

  55:         GoldScore = ScoreAvg

  56:     Else If ScoreAvg > SilverScore then

  57:         BronzeName = SilverName

  58:         BronzeScore = SilverScore

  59:         SilverName = aScore(0)

  60:         SilverScore = ScoreAvg

  61:         Else If ScoreAvg > BronzeScore then

  62:             BronzeName = aScore(0)

  63:             BronzeScore = ScoreAvg

  64:             end if

  65:         end if

  66:     end if

  67:     

  68: Loop

  69: Wscript.StdOut.WriteLine "Gold medal: " & GoldName & ", " & GoldScore

  70: Wscript.StdOut.WriteLine "Silver medal: " & SilverName & ", " & SilverScore

  71: Wscript.StdOut.WriteLine "Bronze medal: " & BronzeName & ", " & BronzeScore


February 22, 2008

Event 3: Instant (Runoff) Winner

Here is my submission for the Advanced Event 3 in the Microsoft Scripting Games 2008.

 

   1: '*********************************************************************

   2: ' Script Name: Event3.vbs

   3: '     Version: 1.0

   4: '      Author: Perry Harris (PHactotum)

   5: '     Updated: 9:49 PM Thursday, February 21, 2008

   6: '     Purpose: Solves the 2008 winter Scripting Games Advance Event 3: Instant (Runoff) Winner

   7: '              

   8: '       Usage: cscript Event3.vbs [phone number]

   9: '       Notes:

  10: '    Keywords: 

  11: '  versioning: 1.0    Original release

  12: '*********************************************************************

  13: Option Explicit

  14: Dim Politicians, Losers, Candidate

  15: Dim Done

  16: Dim objFS, objFile

  17: Dim strLine

  18: Dim aVote

  19: Dim i

  20: Dim LowestVote

  21: Dim LowestName

  22: Dim TotalVotes

  23:  

  24: Const ForReading = 1

  25: 'We'll be using two Dictionaries to keep track of our Politicians and our Losers.

  26: set Politicians=CreateObject("Scripting.Dictionary")

  27: set Losers=CreateObject("Scripting.Dictionary")

  28:  

  29: 'Open and read our Voting File

  30: Set objFS = CreateObject("Scripting.FileSystemObject")

  31: 'Just to be clear, We're not done yet

  32: Done = False

  33:  

  34: Do 

  35:     Politicians.RemoveAll

  36:     TotalVotes = 0

  37:     Set objFile = objFS.OpenTextFile("C:\Scripts\votes.txt", ForReading)

  38:     Do until objFile.AtEndOfStream

  39:         strLine = objFile.ReadLine

  40:         aVote = split(strLine,",")

  41:         i = 0

  42:         Do until not(Losers.Exists(aVote(i)))

  43:             i = i + 1

  44:         loop

  45:         

  46:         If Politicians.Exists(aVote(i)) then

  47:             Politicians.Item(aVote(i)) = Politicians.Item(aVote(i)) + 1

  48:         else

  49:             Politicians.Add aVote(i), 1

  50:         end if

  51:         TotalVotes = TotalVotes + 1

  52:     Loop

  53:     'Debugging statement

  54:     'WScript.StdOut.WriteLine "============================="

  55:     'We set LowestVote to 100%, or 1.00 so that as we find lower numbers we bubble down to the lowest result for possible extra passes.

  56:     LowestVote = 1

  57:     LowestName = "" 'Just to make sure it doesn't affect the outcome in future passes

  58:     For each Candidate in Politicians

  59:         'The following line was used for debugging purposes

  60:         'Wscript.StdOut.WriteLine Candidate & ": " & FormatPercent(Politicians.Item(Candidate)/TotalVotes,1)

  61:         If Politicians.Item(Candidate)/TotalVotes > 0.5 then

  62:             WScript.StdOut.WriteLine "The winner is " & Candidate & " with " & FormatPercent(Politicians.Item(Candidate)/TotalVotes,1) & " of the vote."

  63:             Done = True

  64:             Exit For

  65:         else if LowestVote > Politicians.Item(Candidate)/TotalVotes then

  66:             LowestName = Candidate

  67:             LowestVote = Politicians.Item(Candidate)/TotalVotes

  68:             end if

  69:         end if

  70:     next

  71:     Losers.Add LowestName,LowestVote 'Really don't need the vote but the Dictionary add method requires an item.

  72:     objFile.Close

  73: Loop Until Done


Event 4: Image is Everything

Here is my submission for the Advanced Event 4 in the Microsoft Scripting Games 2008.

   1: '*********************************************************************

   2: ' Script Name: Event4.vbs

   3: '     Version: 1.1

   4: '      Author: Perry Harris (PHactotum)

   5: '     Updated: 1:30 AM Friday, February 22, 2008

   6: '     Purpose: Solves the 2008 winter Scripting Games Advance Event 4: Image is Everything

   7: '              

   8: '       Usage: cscript Event4.vbs

   9: '       Notes:

  10: '    Keywords: 

  11: '  versioning: 1.0  Original release

  12: '              1.1  Modified to put lines in our calendar using + - and |

  13: '*********************************************************************

  14: Option Explicit

  15: Dim intYear, i, intMonth

  16: Dim strText

  17: Dim StartDate, EndDate, CurrDate

  18: Dim intLeft, intRight

  19: Dim a

  20:  

  21: 'Get the desired Month and Year for the Calendar

  22: WScript.StdOut.Write "Please enter Month/Year using numeric digits: "

  23: strText = WScript.StdIn.ReadLine

  24:  

  25: 'Assuming the user used a / as the separator

  26: a = split(strText,"/")

  27: intMonth = a(0)

  28: intYear = a(1)

  29:  

  30: 'Start our Calendar on the first day of the given month and year

  31: StartDate = DateSerial(intYear,intMonth,1)

  32: EndDate = DateSerial(Year(DateAdd("m",1,StartDate)),Month(DateAdd("m",1,StartDate)),1)

  33:  

  34: 'Write Top border

  35: WScript.StdOut.Write chr(43)

  36: WScript.StdOut.Write string(41,chr(45))

  37: WScript.StdOut.WriteLine chr(43)

  38:  

  39: 'Write out our Month and Year

  40: WScript.StdOut.Write chr(124)

  41: intLeft = (41 - Len(MonthName(intMonth) & " " & Year(StartDate))) /2

  42: intRight = 41 - Len(MonthName(intMonth) & " " & Year(StartDate)) - intLeft

  43: WScript.StdOut.Write space(intLeft)

  44: WScript.StdOut.Write MonthName(intMonth) & " " & Year(StartDate)

  45: WScript.StdOut.Write space(intRight)

  46: WScript.StdOut.WriteLine chr(124)

  47: WScript.StdOut.WriteLine chr(124) & space(41) & chr(124)

  48:  

  49: 'Yes, we could have used a function for these three lines seeing as we use them repeatedly

  50: WScript.StdOut.Write chr(43)

  51: WScript.StdOut.Write string(41,chr(45))

  52: WScript.StdOut.WriteLine chr(43)

  53:  

  54:  

  55: 'Write out our days of the week tab separated and in abbreviated form

  56: For i = 1 to 7

  57:     WScript.StdOut.Write chr(124) & space(1) & WeekDayName(i,True) & space(1)

  58: next

  59: WScript.StdOut.WriteLine chr(124)

  60: 'And again these three lines

  61: WScript.StdOut.Write chr(43)

  62: WScript.StdOut.Write string(41,chr(45))

  63: WScript.StdOut.WriteLine chr(43)

  64:  

  65:  

  66:  

  67: 'Pad the first week

  68: i = 0

  69: While i < Weekday(StartDate) - 1

  70:     WScript.StdOut.Write chr(124) & space(5)

  71:     i = i + 1

  72: wend

  73:  

  74: 'Print The Days

  75: CurrDate = StartDate

  76: While CurrDate < EndDate    

  77:     If Weekday(CurrDate) = 7 then 

  78:         WScript.StdOut.WriteLine Chr(124) & LeftPad(Day(CurrDate),4) & space(1) & chr(124)

  79:     else

  80:         WScript.StdOut.Write chr(124) & LeftPad(day(CurrDate),4) & space(1)

  81:     end if

  82:     CurrDate = DateAdd("d",1,CurrDate)

  83: Wend

  84:  

  85: 'Pad the last week

  86: If Weekday(CurrDate) > 1 then ' If we are at 1, we don't want to print a blank row

  87: While Weekday(CurrDate) < 7

  88:         WScript.StdOut.Write chr(124) & space(5)

  89:     CurrDate = DateAdd("d",1,CurrDate)

  90: wend

  91: WScript.StdOut.WriteLine chr(124) & space(5) & chr(124)

  92: end if

  93:  

  94: 'One more time

  95: WScript.StdOut.Write chr(43)

  96: WScript.StdOut.Write string(41,chr(45))

  97: WScript.StdOut.WriteLine chr(43)

  98:  

  99:  

 100:  

 101: 'This is used to right justify the dates under the three letter abbreviations for the days of the week.

 102: Function LeftPad(strText,intWidth)

 103:     LeftPad = Space(intWidth - Len(strText)) & strText

 104: end function


 

I spent a little extra time on this one.  I had a calendar that looked just like their example:



C:\scripts>cscript Event4-1.vbs
Please enter Month/Year using numeric digits: 2/2008
February 2008

Sun Mon Tue Wed Thu Fri Sat
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29
C:\scripts>


 

But I thought I'd like to take it up a notch.  I like calendars with grid lines:

C:\scripts>cscript Event4.vbs
Please enter Month/Year using numeric digits: 2/2008
+-----------------------------------------+
|              February 2008              |
|                                         |
+-----------------------------------------+
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
+-----------------------------------------+
|     |     |     |     |     |   1 |   2 |
|   3 |   4 |   5 |   6 |   7 |   8 |   9 |
|  10 |  11 |  12 |  13 |  14 |  15 |  16 |
|  17 |  18 |  19 |  20 |  21 |  22 |  23 |
|  24 |  25 |  26 |  27 |  28 |  29 |     |
+-----------------------------------------+

February 26, 2008

Event 5: You Call that a Strong Password?

I'm not sure how well this one went.  I ran out of time and I'm not very good with regular expressions. Advanced Event 5 for the Microsoft Scripting Games 2008.

   1: '*********************************************************************

   2: ' Script Name: Event5.vbs

   3: '     Version: 1.0

   4: '      Author: Perry Harris (PHactotum)

   5: '     Updated: 10:45 AM Tuesday, February 26, 2008

   6: '     Purpose: Solves the 2008 winter Scripting Games Advance 

   7: '              Event 5: You Call That a Strong Password?

   8: '              

   9: '       Usage: cscript Event5.vbs

  10: '       Notes:

  11: '    Keywords: 

  12: '  versioning: 1.0  Original release

  13: '*********************************************************************

  14: 'Option Explicit

  15: Const ForReading = 1

  16: Dim strPassword

  17: Dim intPassScore

  18: Dim objRegEx

  19: Dim objFS, objFile

  20:  

  21: Set objRegEx = CreateObject("VBScript.RegExp")

  22: intPassScore = 13

  23:  

  24: if WScript.Arguments.Count < 1 then

  25:     WScript.StdOut.Write "Please enter your password to test: "

  26:     strPassword = WScript.StdIn.ReadLine

  27: else

  28:     strPassword = WScript.Arguments(0)

  29: end if

  30:  

  31: 'Open and read our WordList, we'll need this for some of the tests.

  32: Set objFS = CreateObject("Scripting.FileSystemObject")

  33: Set objFile = objFS.OpenTextFile("C:\Scripts\wordlist.txt", ForReading)

  34:  

  35: strAll = objFile.Readall

  36:  

  37: ' Test one: Make sure that the password is not an actual word.

  38:     objRegEx.Pattern = ucase(strPassword) & "\r\n"

  39:     Set colMatches = objRegEx.Execute(ucase(strAll))  

  40:     

  41:     If colMatches.Count > 0 Then

  42:         Wscript.StdOut.WriteLine "Password is found in the dictionary"

  43:         intPassScore = intPassScore - 1

  44:     End If

  45:  

  46: ' Test two: Make sure that the password, minus the last letter, is not an actual word.

  47:     objRegEx.Pattern = ucase(left(strPassword,len(strPassword)-1)) & "\r?\n"

  48:     Set colMatches = objRegEx.Execute(ucase(strAll))  

  49:     

  50:     If colMatches.Count > 0 Then

  51:         Wscript.StdOut.WriteLine "Password, minus the last letter, is found in the dictionary"

  52:         intPassScore = intPassScore - 1

  53:     End If

  54:  

  55: ' Test three: Make sure that the password, minus the first letter, is not an actual word.

  56:     objRegEx.Pattern = "\r\n" & ucase(right(strPassword,len(strPassword)-1)) & "\r\n"

  57:     Set colMatches = objRegEx.Execute(ucase(strAll))  

  58:  

  59:     If colMatches.Count > 0 Then

  60:         Wscript.StdOut.WriteLine "Password, minus the first letter, is found in the dictionary"

  61:         intPassScore = intPassScore - 1

  62:     End If

  63:  

  64: ' Test four: Make sure that the password does not simply substitute 0 (zero) for the letter o (either an uppercase O or a lowercase o).

  65:     if instr(strPassword,"0") then

  66:         objRegEx.Pattern = ucase(replace(strPassword,0,"o")) & "\r\n"

  67:         Set colMatches = objRegEx.Execute(ucase(strAll))  

  68:     

  69:         If colMatches.Count > 0 Then

  70:             Wscript.StdOut.WriteLine "Password is found in the dictionary after replacing zeros with ""o"""

  71:             intPassScore = intPassScore - 1

  72:         End If

  73:     end if

  74:  

  75: ' Test five: Make sure that the password does not simply substitute 1 (one) for the letter l (either an uppercase L or a lowercase l).

  76:     if instr(strPassword,"1") then

  77:         objRegEx.Pattern = ucase(replace(strPassword,1,"l")) & "\r\n"

  78:         Set colMatches = objRegEx.Execute(ucase(strAll))  

  79:         

  80:         If colMatches.Count > 0 Then

  81:             Wscript.StdOut.WriteLine "Password is found in the dictionary after replacing ones with ""l"""

  82:             intPassScore = intPassScore - 1

  83:         End If

  84:     end if

  85:  

  86: ' Test six: Make sure that the password is at least 10 characters long but no more than 20 characters long. 

  87:     If Len(strPassword) < 10 then

  88:         Wscript.StdOut.WriteLine "Password is two short"

  89:         intPassScore = intPassScore - 1

  90:     else if Len(strPassword) > 20 then

  91:             Wscript.StdOut.WriteLine "Password is two short"

  92:             intPassScore = intPassScore - 1

  93:         end if

  94:     end if

  95:  

  96: ' Test seven: Make sure that the password includes at least one number (the digits 0 through 9).

  97:     objRegEx.Pattern = "\d"

  98:     Set colMatches = objRegEx.Execute(strPassword)  

  99:     

 100:     If colMatches.Count = 0 Then

 101:         Wscript.StdOut.WriteLine "Password must contain at least one number (0-9)"

 102:         intPassScore = intPassScore - 1

 103:     End If

 104:  

 105: ' Test eight: Make sure that the password includes at least one uppercase letter.

 106:     objRegEx.Pattern = "[A-Z]"

 107:     Set colMatches = objRegEx.Execute(strPassword)  

 108:     

 109:     If colMatches.Count = 0 Then

 110:         Wscript.StdOut.WriteLine "Password must contain at least one upper case letter"

 111:         intPassScore = intPassScore - 1

 112:     End If

 113:  

 114: ' Test nine: Make sure that the password includes at least one lowercase letter.

 115:     objRegEx.Pattern = "[a-z]"

 116:     Set colMatches = objRegEx.Execute(strPassword)  

 117:     

 118:     If colMatches.Count = 0 Then

 119:         Wscript.StdOut.WriteLine "Password must contain at least one lower case letter"

 120:         intPassScore = intPassScore - 1

 121:     End If

 122: ' Test ten: Make sure that the password includes at least one symbol.

 123:     objRegEx.Pattern = "[^A-Za-z0-9]"

 124:     Set colMatches = objRegEx.Execute(strPassword)  

 125:     

 126:     If colMatches.Count = 0 Then

 127:         Wscript.StdOut.WriteLine "Password must contain at least one symbol"

 128:         intPassScore = intPassScore - 1

 129:     End If

 130:  

 131: ' Test eleven: Make sure that the password does not include four (or more) lowercase letters in succession.

 132:     objRegEx.Pattern = "[a-z]{4,}"

 133:     Set colMatches = objRegEx.Execute(strPassword)  

 134:     

 135:     If colMatches.Count > 0 Then

 136:         Wscript.StdOut.WriteLine "Password contains 4 or more lower case letters in succession"

 137:         intPassScore = intPassScore - 1

 138:     End If

 139:  

 140: ' Test twelve: Make sure that the password does not include four (or more) uppercase letters in succession.

 141:     objRegEx.Pattern = "[A-Z]{4,}"

 142:     Set colMatches = objRegEx.Execute(strPassword)  

 143:     

 144:     If colMatches.Count > 0 Then

 145:         Wscript.StdOut.WriteLine "Password contains 4 or more upper case letters in succession"

 146:         intPassScore = intPassScore - 1

 147:     End If

 148:  

 149: ' Test thirteen: Make sure that the password does not include any duplicate characters.

 150:     objRegEx.Pattern = "(.)(.*\1)"

 151:     Set colMatches = objRegEx.Execute(strPassword)  

 152:     

 153:     If colMatches.Count > 0 Then

 154:         Wscript.StdOut.WriteLine "Password contains duplicate characters"

 155:         intPassScore = intPassScore - 1

 156:     End If

 157:  

 158: 'Final Score

 159: WScript.StdOut.WriteLine

 160: WScript.StdOut.Write "A password score of " & intPassScore

 161: Select case intPassScore

 162:     case 11,12,13

 163:         WScript.StdOut.WriteLine " indicates a strong password."

 164:     case 7,8,9,10

 165:         WScript.StdOut.WriteLine " indicates a moderately-strong password."

 166:     case else

 167:         WScript.StdOut.WriteLine " indicates a weak password."

 168: End select


Event 6: Prime Time

This one was fun.  Although, I knew what a Prime number is, I don't think I've ever learned methods to find them.  The method I used is fine for a small number, but really wouldn't scale.

Advanced Event 6 in the Microsoft Scripting Games 2008.

   1: '*********************************************************************

   2: ' Script Name: Event6.vbs

   3: '     Version: 1.0

   4: '      Author: Perry Harris (PHactotum)

   5: '     Updated: 8:45 AM Tuesday, February 26, 2008

   6: '     Purpose: Solves the 2008 winter Scripting Games Advance 

   7: '              Event 6: Prime Time

   8: '              

   9: '       Usage: cscript Event6.vbs

  10: '       Notes: 

  11: '    Keywords: 

  12: '  versioning: 1.0  Original release

  13: '*********************************************************************

  14: Option Explicit

  15: Dim StopPoint,StartPoint,i,j

  16: Dim Primes

  17: StopPoint = 200

  18: StartPoint = 2

  19: redim Primes(StopPoint + 1)

  20: For i = StartPoint to StopPoint

  21:     Primes(i) = True

  22: Next

  23: For i = StartPoint to StopPoint

  24:     If Primes(i) = True then

  25:         WScript.StdOut.WriteLine i

  26:     End If

  27:         for j = i to StopPoint

  28:             If i*j <=StopPoint then Primes (i*j) = False

  29:         Next

  30: Next

  31:  

  32:     


February 28, 2008

Directory Experts Conference 2008 Agenda

Below you will find my schedule for Mon - Wed at DEC 2008.  The sessions I've decided to go on are in light turquoises.  If I haven't decided, there will be two white squares.

I am concentrating on the AD aspects of the conference and ignoring ILM and Federated Identity.

DEC2008Mon-Wed

There is also a Welcome reception on Sunday.

March 17, 2008

Guess I'm addicted to blogging

74%How Addicted to Blogging Are You?

December 20, 2008

Number of days of events in Windows Event Logs

I've been working on code to figure out how many days of events are in an each event log on a given system.  I started out by using two articles from Microsoft's Hey, Scripting Guy!:

How Can I Find the Date of the Oldest Event in an Event Log?

How Can I Retrieve Information About the Latest Event Added to an Event Log?

 

The Oldest Event seemed to work:

   1: strComputer = "."

   2: Set objWMIService = GetObject("winmgmts:{(Security)}\\" & strComputer & "\root\cimv2")

   3:  

   4: Wscript.Echo "System"

   5: Set colEvents = objWMIService.ExecQuery _

   6:     ("Select * from Win32_NTLogEvent Where Logfile = 'System' " & _

   7:         "AND RecordNumber = 1")

   8:  

   9: For Each objEvent in colEvents

  10:     Wscript.Echo "Time Written: " & objEvent.TimeWritten

  11: Next


This seems to work.  I duplicated lines 4 through 11, for the event logs Application and Security, all seemed okay. (Yeah I know redundant code, but sometimes it is just easiest.)



C:\Data2>cscript EventLogOldest.vbs
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

System
Time Written: 20081125044952.000000-300
Security
Time Written: 20081125044947.000000-300
Application
Time Written: 20081125045015.000000-300


All of this testing was on Windows XP SP3.  I then tried it on Windows 2003 SP2:



C:\data2>cscript EventLogOldest.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

System
Security
Application


Hmm, what's going on here.  Well, via another script, I figured out that the first event log record isn't always 1.  Well it is, but the oldest event log entry in a given log isn't always record 1.  See, as a system runs, it will remove old entries as the event log fills up.  Thus the oldest record number slowly increments as the old records fall off and new records are added.

The following script, iterates through each event record on a server.  It Looks at the record number and log file name and records the oldest and newest record for each log file.  It then dumps out the desired information.

   1: 'EventLogRecNumbers.vbs

   2: strComputer = "."

   3: Dim HighEvent

   4: Dim LowEvent

   5: Dim HighEventDate

   6: Dim LowEventDate

   7: Set HighEvent = CreateObject("Scripting.Dictionary")

   8: Set LowEvent = CreateObject("Scripting.Dictionary")

   9: Set HighEventDate = CreateObject("Scripting.Dictionary")

  10: Set LowEventDate = CreateObject("Scripting.Dictionary")

  11: ' Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")

  12: Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(Security)}\\" & strComputer & "\root\cimv2")

  13: Set colItems = objWMIService.ExecQuery( _

  14:     "SELECT * FROM Win32_NTLogEvent ",,48)

  15:  

  16: For Each objItem in colItems

  17:     currlogfile = objItem.Logfile

  18:     currlogrecord = clng(objItem.RecordNumber)

  19:     If not HighEvent.Exists(currlogfile) then

  20:         HighEvent.Add currlogfile, currlogrecord

  21:         HighEventDate.Add currlogfile,objItem.TimeWritten

  22:     else if currlogrecord > HighEvent.item(currlogfile) then

  23:             HighEvent.Item(currlogfile) = currlogrecord

  24:             HighEventDate.Item(currlogfile) = objItem.TimeWritten

  25:         End If

  26:     End If

  27:     If not LowEvent.Exists(currlogfile) then

  28:         LowEvent.Add currlogfile, currlogrecord

  29:         LowEventDate.Add currlogfile,objItem.TimeWritten

  30:     else if currlogrecord < LowEvent.item(currlogfile) then

  31:             LowEvent.Item(currlogfile) = currlogrecord

  32:             LowEventDate.Item(currlogfile) = objItem.TimeWritten

  33:         End If

  34:     End If

  35: Next

  36:  

  37: For Each ELog in HighEvent.Keys

  38:     Wscript.Echo "EventLog: " & ELog

  39:     Wscript.Echo "     High Record: " & HighEvent.Item(ELog)

  40:     Wscript.Echo "     Low Record:  " & LowEvent.Item(ELog)

  41:     Wscript.Echo "     Newest Date: " & WMIDateStringToDate(HighEventDate.Item(ELog))

  42:     Wscript.Echo "     Oldest Date: " & WMIDateStringToDate(LowEventDate.Item(ELog))

  43:     Wscript.Echo "     Days:        " & DateDiff("d",WMIDateStringToDate(LowEventDate.Item(ELog)),WMIDateStringToDate(HighEventDate.Item(ELog)))

  44: Next

  45:  

  46: Function WMIDateStringToDate(dtmInstallDate)

  47:     WMIDateStringToDate = CDate(Mid(dtmInstallDate, 5, 2) & "/" & _

  48:         Mid(dtmInstallDate, 7, 2) & "/" & Left(dtmInstallDate, 4) _

  49:             & " " & Mid (dtmInstallDate, 9, 2) & ":" & _

  50:                 Mid(dtmInstallDate, 11, 2) & ":" & Mid(dtmInstallDate, _

  51:                     13, 2))

  52: End Function


 

This works both on my fairly new XP SP3 system, as well as a Windows 2003 SP2 system.  The draw back, is that because the script iterates through every event entry in the logs, it takes a while to come up with the answer.  It isn't the most efficient, and I welcome alternative ways of performing this tasks.  A plus is that it shows all event logs, not just the common Application, System and Security.



C:\>cscript EventLogRecNumbers.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

EventLog: Application
High Record: 1232635
Low Record: 1210462
Newest Date: 12/19/2008 11:24:04 PM
Oldest Date: 12/11/2008 10:02:05 PM
Days: 8
EventLog: Directory Service
High Record: 8142
Low Record: 5336
Newest Date: 12/19/2008 1:51:13 PM
Oldest Date: 2/23/2007 3:15:56 AM
Days: 665
EventLog: DNS Server
High Record: 486
Low Record: 1
Newest Date: 11/10/2008 1:37:02 PM
Oldest Date: 1/18/2004 5:50:52 PM
Days: 1758
EventLog: File Replication Service
High Record: 334
Low Record: 1
Newest Date: 11/10/2008 1:37:41 PM
Oldest Date: 1/18/2004 5:30:46 PM
Days: 1758
EventLog: Security
High Record: 22647817
Low Record: 22455586
Newest Date: 12/19/2008 11:25:49 PM
Oldest Date: 11/27/2008 7:04:18 AM
Days: 22
EventLog: System
High Record: 203041
Low Record: 92196
Newest Date: 12/19/2008 11:23:49 PM
Oldest Date: 10/10/2006 5:28:22 AM
Days: 801


July 13, 2009

My Cyborg Name

Positronic Handcrafted Android Calibrated for Thorough Observation, Troubleshooting and Ultimate Mathematics
Get Your Cyborg Name

About Tech

This page contains an archive of all entries posted to PHactotum Wheneverly in the Tech category. They are listed from oldest to newest.

Politics is the previous category.

Totally Random is the next category.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 4.1