Archive

Archive for the ‘General’ Category

What I Learned Today While Reading Wikipedia

March 31st, 2010 Eric Silva No comments

I learned that Fryderyk Chopin, the composer, had his heart removed before burial because he had a fear of being buried alive.

I also learned that Thousand Island dressing did not originate in the Thousand Islands area of the St. Lawrence river. It originated in New Orleans before 1900.

Categories: General, Observations Tags:

Windows Bulk File Move Script

October 13th, 2009 Eric Silva 1 comment

We have some applications that leave files sitting in a folder location out on some file server.  Eventually the disk space gets used up, or Windows starts choking because there are too many files in a directory, etc.  To delete the ‘old’ files, a support technician will try to connect to the file share, sort the files by date, and delete the files within a date range, e.g., older than a year.

What can happen, especially on a Window server, is that the operating system will attempt to load all the file information into memory, so that you can see it, and then tell it to sort all those files by date, which in turn, increases the time and memory needed by the OS to accomplish this.  If the file size/quantity is too great, the problem that caused you to want to clean up the disk space will reappear and choke Windows once more.

After going through this more than twice, I decided to write a JavaScript and execute it using the Windows Scripting Host (WSH).  The script performs very well and was able to iterate through a directory of 700,000+ files in a matter of an hour.  This was including the log statements from being enabled.  Disabling the ‘Echo’ statements may increase performance.

Here is the script:

var fso = new ActiveXObject('Scripting.FileSystemObject');
var argArray = new Array(WScript.Arguments.Named("src"), WScript.Arguments.Named("s"), ".");
var inSrcDirName = coalesceArray(argArray);

argArray = new Array(WScript.Arguments.Named("dest"), WScript.Arguments.Named("d"));
var archiveDir = coalesceArray(argArray);

argArray = new Array(WScript.Arguments.Named("year"), WScript.Arguments.Named("y"));
var beforeYear = coalesceArray(argArray);

if (archiveDir != null) {
	if (!fso.FolderExists(archiveDir)) {
		fso.CreateFolder(archiveDir);
	} else {
		fso.CreateFolder(archiveDir + "1");
	}
}

var gfldr = fso.GetFolder(inSrcDirName);

ArchiveFiles(gfldr);

function ArchiveFiles(fldr) {
	var i, bias;

	WScript.Echo("Loading all files...");
	for (files = new Enumerator(fldr.files); !files.atEnd(); files.moveNext()) {
		f = files.item();
		dt = new Date(f.DateCreated);
		bias = dt.getTimezoneOffset();

		dt.setMinutes(dt.getMinutes() - bias);

		fileYear = dt.getFullYear();
		//WScript.Echo(f.Name + ":" + fileYear);
		if (beforeYear > fileYear) {
			WScript.Echo("Moving \"" + f.Name + "\" with year " + fileYear + " to " + archiveDir);
			f.Move(archiveDir+"\\" + f.Name)
		} else {
			WScript.Echo("Skipping \"" + f.Name + "\" with year " + fileYear);
		}
	}
	WScript.Echo("Done loading files.");

}

function coalesceArray(arr) {
	var i;
	for (i = 0; i < arr.length; i++) {
		if (arr[i] != null) {
			return arr[i];
		}
	}
	return null;
}

Executing the script is performed by passing a source directory, destination directory (to move the files to), and a year to mark the year that all files must be equal to or younger than to not be moved as parameters.

Example:

cscript movefiles.js /s:c:\myapp\data /d:c:\backup\archive_2006 /y:2007

This will move all files from the c:\myapp\data folder that were created before January 1, 2007 to the c:\backup\archive_2006 folder.  The script can be easily modified to use the ‘modified’ or ‘accessed’ date instead.

Hope this helps someone else as much as it helped me.

Budweiser American Ale

November 21st, 2008 Eric Silva No comments

After seeing the advertisements, and going back and forth in my mind about wanting to spend money on a case of Budweiser, I decided to finally pull the trigger and go for it. I have tried Budweiser beers before and have not cared for them. This beer has changed my opinion of Budweiser.
This beer has a nice amber color with a white head. There is a bit of hops and malt in the aroma, and the same is true for the taste. The beer has a medium body and a pleasant finish. I truly enjoyed this beer. So much so, that it has become my “typical beer”, and at just around $20 a case, it doesn’t pinch the wallet like most microbrews do.

Here’s the review from RateBeer.com.

Maybe next I will try those new Michelob styles and see if they aren’t half bad.

Categories: General Tags:

Lovely Weather Today

December 16th, 2007 Eric Silva No comments

As we all know weather persons on TV and meteorologists, in general, are one a the few professions where people are getting a paycheck for failing at their job. Take for example the northwest suburbs of Philadelphia, more specifically the Reading area. We were supposed to get sleet changing over to snow, then rain this morning. They were 66.666666667% right. We got the sleet, which then turned quickly into freezing rain. I took a step onto my front porch last night and almost went head-over-heels. I wake up this morning to a backyard full of broken tree limbs and three inch icicles hanging from everything, plus it’s raining. I guess it’s a good day to stay inside and watch football.

Categories: General Tags:

Nucleus is Dead, Long Live WordPress

December 15th, 2007 Eric Silva 1 comment

As I foreshadowed back in an earlier post, I have chosen to dump Nucleus as my blogging platform in favor of WordPress. So if you came to my site with a 404 Page Not Found error, have no fear, the content you long for still lives. Simply type a simple search query on the sidebar search panel, click Search, and hopefully your quest will be at an end.

For those unfortunate to still be using Nucleus, and wanting to upgrade to WordPress, do not be intimidated by the conversion process. You will lose your comments, but the content, images, categories, etc. is all salvageable. I simply used the RSS feed from my Nucleus site as an export tool, performed some minimal search/replace on the XML file, and then imported it into WordPress. It was very painless. I was lucky enough to use the lessons learned from a fellow convert who has a very detailed explanation of the upgrade process here.

WordPress is so much easier to use, the interface is much better than Nucleus, the administration is far superior, and don’t get me started on the widget, plug-in, and theme selection. Thanks WordPress.

Categories: General Tags:

WYSP Sucks Balls

October 24th, 2007 Eric Silva No comments

While driving to work this morning, I was un-pleasantly surprised to hear only rock playing at 5:55am. Then the song ended, and as I thought to myself “here comes the O&A intro”, I was shocked to hear Tom Petty’s Runnin’ Down a Dream instead. The next thought that went through my head was “Maybe they’re a little late this morning. It’s happened before”, but then Tom Petty ends, and another song starts. Now I’m pissed. Those little cocksuckers over at YSP finally validated the rumors that have been flying around for the past couple of weeks and have pulled the Opie and Anthony show from their station.

If the management over at WYSP had any common sense they would have left Opie and Anthony in place, and let Kidd Chris have is regular afternoon drive show. You can play music the rest of the day, but the morning and afternoon drives in a market where close to a million people commute to work each day are key time slots, and in today’s society if people want to hear music, they are going to listen to a CD, iPod, or XM/Sirius satellite radio, not the “same shit, different day music” that is heard on terrestrial radio. Hell, I’d rather listen to NPR and have to filter out the left-wing bullshit than listen to a radio station that is playing the same fucking music I have been listening to since 1977. If I wanna hear Good Times, Bad Times, I’ll put the CD in or key up the iPod. I am certainly not going going to tune the radio to 94.1 to hear a lame ass, fucking cover by Sully and the rest of Godsmack. I don’t mind a cover of a classic, if it’s done with some taste and respect, but those beat-offs didn’t even try to do anything with the song. It sounds like a no-talent junior high band trying to prove themselves by saying “Hey look, we can play a Zeppelin tune.”

Now the question is: Will WYSP further validate the rumors and move Kidd Chris to mornings, and if so, will he have his normal show, or is it going to be interspersed with music after the breaks. We will have to wait and see. I might listen since I enjoy Kidd Chris’ show, but it is mostly music and it sucks ass, it’s going to be just as bad as Preston and Steve on MMR, the ratings will suffer and someone’s going to get shitcanned. Back to square one.

I could also pony up the cash and buy a XM receiver and subscription, but that is a last resort. I only listen to the radio in the mornings and in the afternoons during the drive. It’s not cost effective to pay for XM. Maybe I’ll just load up the CD changer with some Floyd or NIN and listen to that. Oh wait. I’ve already done that since YSP butchered Kidd Chris’ regular afternoon show back in September.

I wonder what the song lineup will be tomorrow morning, not that I care. I won’t be listening. WYSP: Go fuck yourselves.

Categories: General Tags:

New Site Layout

September 2nd, 2007 Eric Silva No comments

Since I don’t seem to have the time to manage a huge website anymore, and MySpace has turned into “Useless Spam Space” (<– how witty), I decided I would try a simple blogging software package. I am currently using Nucleus, but may switch over to WordPress if Nucleus turns out to be crap.

If you happened to be one of the few that visited my site in the past, have no fear the “How to Reheat Fried Chicken” recipe and wine reviews will be back soon.

Check back for more of my Brain Droppings (thanks George for the euphemism).

Categories: General Tags: