Archive for May, 2008

Windows PowerShell Execution Policies

Wednesday, May 28th, 2008

Windows Powershell sets its Execution Policy to Restricted by default, which states that PowerShell can only be used in interactive mode (no scripts will run.) Use the Get-ExecutionPolicy cmdlet to check which execution policy is currently in-force.

$ Get-ExecutionPolicy

The following execution policy definitions are from Microsoft’s website:

  • Restricted – No scripts can be run. Windows PowerShell can be used only in interactive mode.
  • AllSigned – Only scripts signed by a trusted publisher can be run.
  • RemoteSigned – Downloaded scripts must be signed by a trusted publisher before they can be run.
  • Unrestricted – No restrictions; all Windows PowerShell scripts can be run.

To change the execution policy, use Set-ExecutionPolicy. The following will enable you to execute all PowerShell scripts.

$ Set-ExecutionPolicy Unrestricted

2008 Jamis Nova Pro

Tuesday, May 27th, 2008

2008 Jamis Nova Pro
Friday I purchased a 54cm 2008 Jamis Nova Pro from The Bike Shop in Houghton. I’ve been shopping for an all-purpose bicycle since March, and believe the Nova Pro best suits my wants and needs. I plan to ride to work, and attempt at least one cyclo-cross race in the fall.

The Nova Pro has the following attractive selling points:

The Bike Shop threw in caged pedals, a water bottle, bottle holder, a free tune-up after 30 days, free “adjustments” for the lifespan of the bike, and 15% off MSRP.

Update: I wrote a brief 2008 Jamis Nova Pro Review.

Windows PowerShell - Recursively delete files and directories modified more than ‘n’ days ago.

Thursday, May 22nd, 2008

I was recently tasked with writing a script that recursively deletes files and directories modified more than ‘n’ days ago - here’s the kicker - using Windows. Many people have accomplished this with long VB Scripts. I was hoping for a much cleaner solution, and decided to try Windows PowerShell . I am quite impressed with Windows Powershell’s capabilities.

The following script recursively deletes files and directories modified more than 16 days ago.

# prune.ps1
$sticky = (Get-date).AddDays(-16)
$backupDir = "B:\backup"
echo "Recursively deleting files and directories written before $sticky"
Get-ChildItem $backupDir -Recurse | Where-Object { $_.LastWriteTime -lt $sticky } | Remove-Item -Recurse

Note that you can change Remove-Item -Recurse to Remove-Item -Whatif to “pretend” to delete files, and display potential deletes on STDOUT. You can also specify Remove-Item -Confirm.

I created a scheduled task that runs a .bat file containing the following:
powershell.exe c:\scripts\prune.ps1 >> c:\scripts\logs\prune.log

To watch and or view the output of the script, specify the -noexit switch on the command line.
powershell.exe -noexit c:\scripts\prune.ps1

How to install NVIDIA drivers with Fedora 9

Tuesday, May 20th, 2008

Update: The current (173.14.09) stable NVIDIA driver works with Fedora 9. The following information is outdated and kept for archival purposes.

The latest stable NVIDIA drivers will not install when using the version of X.org that is distributed with Fedora 9. I was able to use NVIDIA’s beta 172.08 display drivers after a few manipulations.

Version 172.08 does not support ABI, so I placed the following in /usr/bin/startx

defaultserverargs="-ignoreABI"

I also commented the following from /etc/X11/xorg.conf

# Load "glx"

Fedora 9 and NVIDIA Drivers x86_64 Instructions

Download the appropriate beta driver

$ wget http://us.download.nvidia.com/XFree86/
Linux-x86_64/173.08/NVIDIA-Linux-x86_64-173.08-pkg2.run

Run the installer

$ sh NVIDIA-Linux-x86_64-173.08-pkg2.run

Edit /usr/bin/startx (for runlevel 3 users) and add the following:

defaultserverargs="-ignoreABI"

Edit /etc/X11/xorg.conf and comment the following:

# Load "glx"

Upgrade to Fedora 9

Friday, May 16th, 2008

I upgraded my primary workstation to Fedora 9 this week. Although the upgrade was mostly uneventful, I did struggle with a few annoyances.

The latest revision of openbox lacks a specific functionality that’s vital to my coherent work flow. It lacks the ability to hold down the left mouse button on the title bar, and use the scroll wheel to migrate the currently held window to the next or previous desktop. It was easy to roll back to a previous version from the Fedora Core 6 Extras repository.

Another annoyance is that konsole removed the –noxft switch in their latest revision, this allowed me to prevent my terminals from having anti-aliased fonts. I use the font Terminus (highly recommended, by the way) within my terminals, and having that anti-aliased is just unacceptable. I could just disable anti-aliasing across all applications, but then my browser and mail client would look terrible. I was able to solve this issue with ~/.fonts.conf.

The last issue I had was with pulseaudio. Sound was very soft, even with the speakers and alsamixer set to 100%. I removed alsa-plugins-pulseaudio, and things started functioning normally.

I tried KDE again this week, and was dissapointed (as usual.) It was quite sluggish, and seemed very kludged together. Maybe someone will develop a feature-full window manager that doesn’t require big iron to run before I’m a gray-beard. They would then have to convince me that it is indeed better to have all that eye candy, yeah right.