msgbartop
If you love wealth more than liberty, the tranquility of servitude better than the animating contest of freedom, depart from us in peace. We ask not your counsel nor your arms. Crouch down and lick the hand that feeds you. May your chains rest lightly upon you and may posterity forget that you were our countrymen.
msgbarbottom

20 Feb 11 Linking Facebook and my Blog

I just added two new pluggins that integrate my blog with Facebook. The first one updates my Facebook profile every time I make a blog post (and this post is the test to see if it works). The second pluggin allows people who are currently logged into Facebook to use their Facebook IDs to post comments (single-sign-on at its best).

So, this was just meant to be a quick test. Did you all see the linked FB post? Can you comment using your FB credentials?

-BB

01 Oct 08 Google’s Chrome – Why do you care?

Jason Spence has written some disparaging remarks about Google’s new browser named “Chrome” recently. Now I am not a “Google fanatic” (despite the theme of my blog) or web browser expert, but I would like to counter Jason’s article because I think he missed what Google was after. Jason seems to feel that Google created their browser to compete with Microsoft’s Internet Explorer and as such picked a name for their browser that was less than marketable.

But in order to understand what Google is after, you have to read what they say about their own browser.

We search, chat, email and collaborate in a browser. And in our spare time, we shop, bank, read news and keep in touch with friends — all using a browser.

On the surface, we designed a browser window that is streamlined and simple. To most people, it isn’t the browser that matters. It’s only a tool to run the important stuff — the pages, sites and applications that make up the web.

Under the hood, we were able to build the foundation of a browser that runs today’s complex web applications much better. By keeping each tab in an isolated “sandbox”, we were able to prevent one tab from crashing another and provide improved protection from rogue sites. We improved speed and responsiveness across the board. We also built a more powerful JavaScript engine, V8, to power the next generation of web applications that aren’t even possible in today’s browsers.

Now Jason was right about one thing: Google is trying to compete with Microsoft. But he missed the application they are looking to compete against. Google isn’t out to compete with Microsoft’s IE, Google is going to compte with Microsoft’s Office, Microsoft’s Instant Messaging, and Microsoft’s product line in general. Google is looking to build the browser that is capable if utilizing a web site that publish all of those product lines from the Internet instead of the desktop.

Its a briliant move *if* they can quickly follow that up with that “killer app” online. Google already has Wrightly, but they need to have more of an online presence with a more robust interface if they expect to compete in the application wars, and that is precisely why they build Chrome, to give them that edge.

So Jason, I agree that their name could have used more time in a conference room at Google headquarters before being chosen, and I agree that Google is trying to “stick it” to Microsoft, but I think its about the online application market, not the Internet browser wars.

01 Jul 06 Google’s Writely

Google just re-released their Writely service to the general public. It is an on line MS-Wordish editor. You can open, modify, and create MS-Word documents, or RTF, plain-text, or export it out as PDF.

You can set the document up to be collaborative with other people, you can publish directly from the Writely site, or even use its blog posting abilities to create / edit a document in Writely, and then post it to your blog. (This is what I am doing right now.) If you haven’t tried it, it is a very neat idea. Give it a whirl at http://www.writely.com

-Z

09 Feb 06 How to create 100,000 "undeletable" directories

Ok, I am in a generous mood, so get ready for an evil trick you can play on your co-workers.

Before I give you the code, and tell you why it works the way it does, I need to explain some functions of Windows. For backwards compatibility with older MS-DOS type applications Windows has a few system files named things like “com1″, “com2″, “lpt1″, etc. Since these are reserved system file names, you cannot create any file or directory named after any of these files. Try it! Make a directory called “com1″. I bet it didn’t work. Conversely, you cannot delete any file named after these system files.

Now suppose for one minute that there was a “secret” way to create a file called com1. If you could place this file into a directory of your choosing, you could render the directory itself undeletable. This works because in DOS and just about any other file system out there, you cannot remove a directory unless it is empty. If you don’t have access to delete all the files in a directory, you cannot remove the directory itself even if you have permissions to delete the directory.

So even if you are a local administrator to the machine itself, you could not remove any directory that had a com1 file located within it. Even if you had full control over the com1 file, you couldn’t delete it because it is a system file and windows won’t let you.

I am about to give you the code, but before I do, let me just brag a little that I used this against a friend who was having “pissing-matches” with me about being the more technically inclined person. Needless to say, he never figured out how to delete the 40,000 “undeletable” directories I placed in the root of his C: drive.

FOR /L %%i IN (1,1,100000) DO MD %%i & echo %%i > \\.\c:\%%i\com1

Not that hard is it? If you create a new text file, paste this text in there, and save it as nodelete.cmd then run it, you will create 100,000 “undeletable” directories on the root of your C: drive.

I will leave you to figure out how to remove them. (It really isn’t that hard to figure out considering you now know how to create them.)

Also, it would probably be best if you started the batch file with the “@ECHO OFF” so that the command interpreter doesn’t have to echo back all that data.

Have fun. Let me know how it works.

-Z

08 Feb 06 VBScript – IsNumeric

I ran across this the other day in VBScript while I was working on a web page for the company I work for. It turns out that the “IsNumeric” function will return “True” even if there is a space in front of the field you are trying to validate.

For example:

IsNumeric(12345) = True


Makes sense since “12345″ is a number (and a number only)

IsNumeric(abcdef) = False


Since “abcdef” is not numerical this is as expected.

IsNumeric(" 12345") = True


I don’t that think that this should be true since there is a leading space in front of the number and “IsNumeric” is deciding if the whole field is numeric or not. But VBScript does indeed evaluate that as True.

So I had to create my own function just to get a real answer as to whether or not that field is numeric.

Function NumberMe(byVal toClean)    tmpClean = ""    Do Until Len(toClean) = 0        tmpLeft = Left(toClean, 1)        toClean = Right(toclean, Len(toClean) - 1)        If Asc(tmpLeft) >= Asc("0") And  Asc(tmpLeft) <= Asc("9") Then            tmpClean = tmpClean & tmpLeft        End If    Loop    NumberMe = tmpCleanEnd Function

Now I can just compare the before and after to determine if the field is numeric, like so:

If FieldThatIAmTesting <> NumberMe(FieldThatIAmTesting) Then    'There are disallowed special characters or letters in the field. Make an error    UserError = TrueEnd If

I figure most of the people reading this blog don’t give two cents about this stuff, and most people who don’t read this blog probably have an easier way of dealing with this (like Trim) but it was interesting to me, and since this isn’t your blog, you are outta luck!

-Z

10 Dec 05 Internet Explorer Sux. FireFox Rox

I found this great picture and needed an excuse to post it. All you IE users out there need to upgrade to a real browser!

A special thanks to T.J. (who promises to have a web site for me to link to soon) for letting me know it existed!

-Z

– Post Script

Looks like Jason wants credit for getting me into FireFox to begin with. Well here you go Jason; it’s all thanks to you!

28 Oct 05 Return to Geekdom — How to defrag your Windows XP or Server 2003 box

I just got a crazy hair and thought I would start posting some more of my more geeky content like I used to. Here is a batch file that will defrag all the fixed drives on your machine:

@ECHO OFF
SETLOCAL
REM /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
REM /*
REM /*    This Command File will defrag all the fixed drives on server 2003
REM /*    and Windows XP. It will NOT work on Windows 2000 or earlier
REM /*
REM /*                   Created on 05/17/05
REM /*
REM /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/

SET LOGFILE=DEFRAG_REPORT.TXT
ECHO STARTING DEFRAG BATCH FILE > %LOGFILE%ECHO.>> %LOGFILE%

FOR /F "usebackq skip=15" %%A IN (`MOUNTVOL`) DO CALL :FINDVOL %%A
GOTO END

:FINDVOLECHO %1|FIND /I ":">NUL
IF {%ERRORLEVEL%} == {0} (    
REM /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/    
REM /*    
REM /*    Checking to see if the volume is a fixed drive or not. if it is    
REM /*    then start the defrag. otherwise do nothing. This checking really    
REM /*    isn't necessary as defrag won't even attempt to defragment a    
REM /*    non-fixed drive, but it just seems a cleaner way to impliment    
REM /*    
REM /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/    
FSUTIL FSINFO DRIVETYPE %1|FIND /I "FIXED DRIVE">NUL    
IF {%ERRORLEVEL%} == {0} CALL :DEFRAGME %1)
GOTO :EOF

:DEFRAGME
ECHO Starting defrag of %1 drive >> %LOGFILE%
DEFRAG %1 >> %LOGFILE%
ECHO Finished defrag of %1 drive >> %LOGFILE%ECHO.>> %LOGFILE%
GOTO :EOF

:END
ECHO FINISHED DEFRAG BATCH FILE >> %LOGFILE%
ENDLOCAL

any questions? Just send me an email

23 Mar 05 K.I.S.S. (Keep It Simple Stupid!)

We have a rather large share sitting on an NT4.0 server that pretty much everyone in the company has write access to. We know there is a lot of data that no one has accessed for quite some time and we want to move it off the share and archive it. If anyone screams about missing some file, we will restore them on a case-by-case basis. So I sit down and start to write a batch file to handle it.

Below is my first attempt. Now keep in mind this is not a finished product. It is just as far as I got with this iteration of it. A few notes about it:

  • I am evaluating the file to see if it was last accessed within the years 2003 – 1999.
  • If it was accessed that long ago move the file. However, I hadn’t gotten to that point, so I just decided the script could do a “DIR” of the file in question. Hence the “DIR /TA %1” line.

@ECHO OFFSETLOCAL

FOR /R X:\ %%I IN (*) DO CALL :EVALFILE "%%I"GOTO EXIT

:EVALFILEDIR /TA %1|FIND "/2003"IF {%ERRORLEVEL%} EQU {0} (    DIR /TA %1) ELSE (    DIR /TA %1|FIND "/2002"    IF {%ERRORLEVEL%} EQU {0} (        DIR /TA %1    ) ELSE (        DIR /TA %1|FIND "/2001"        IF {%ERRORLEVEL%} EQU {0} (            DIR /TA %1        ) ELSE (            DIR /TA %1|FIND "/2000"            IF {%ERRORLEVEL%} EQU {0} (                DIR /TA %1            ) ELSE (                DIR /TA %1|FIND "/1999"                IF {%ERRORLEVEL%} EQU {0} (                    DIR /TA %1                )            )        )    ))GOTO :EOF

:EXITENDLOCAL

So the file looks like a good start until I realize that I don’t need to use the “FIND” command to look for these dates individually, I can use the “FINDSTR” command to look for multiple dates at once. So I rewrite the file to look more like this:

@ECHO OFFSETLOCAL

FOR /R X:\ %%I IN (*) DO CALL :EVALFILE "%%I"GOTO EXIT

:EVALFILEDIR /TA %1|FINDSTR "\/2003 \/2002 \/2001 \/2000 \/1999"IF {%ERRORLEVEL%} EQU {0} (    DIR /TA %1)GOTO :EOF

:EXITENDLOCAL

Great. Things are looking up. I have managed to get the batch file to print off every file in this directory tree that is outdated by our standards. Now I just need to figure out how I am going to do the actual moving of the file. So as I am thinking about it, I realized that the utility that I was going to use to move the files also is aware of “last accessed” date stamps. Well crap, a lot of work for nothing! This is what I finally used to accomplish the task:


ROBOCOPY X:\ V:\ /TS /FP /S /COPYALL /MOV /NP /MINLAD:20040101 /R:0 /W:30

And the lesson learned was?! Keep it simple! It would have saved me quite a bit of time if I would have just looked first!

-Z

18 Mar 05 Exchange SMTP Logs

I was going through some SMTP logs, when I noticed that there was a mail administrator with a little too much time on his hands… read below.

3/18/05 9:56:46 AM : <<< 220 Postini ESMTP 11 r5_4_3c1 ready. CA Business and Professions Code Section 17538.45 forbids use of this system for unsolicited electronic mail advertisements.
3/18/05 9:56:46 AM : >>> EHLO (host).(domain).com
3/18/05 9:56:46 AM : <<< 250-Postini says hello back
250-STARTTLS
250-8BITMIME
250 HELP
3/18/05 9:56:46 AM : >>> MAIL FROM:<user@myplaceofwork.com>
3/18/05 9:56:46 AM : <<< 250 Ok
3/18/05 9:56:46 AM : >>> RCPT TO:<user@theirplaceofwork.com>
3/18/05 9:56:46 AM : <<< 250 Ok
3/18/05 9:56:46 AM : >>> DATA
3/18/05 9:56:46 AM : <<< 354 Feed me
3/18/05 9:56:47 AM : <<< 250 Thanks
3/18/05 9:56:47 AM : >>> QUIT
3/18/05 9:56:47 AM : <<< 221 Catch you later

Of course, look at me. Here I am reading SMTP logs and then blogging about it. Ok, so I have too much time on my hands too! What is your point!?!