The Technical Adventures of Adam Weigert
-
I <3 PowerShell
This blog author has moved to iheartpowershell.com
-
dynamic? I'll never use that ... or then again, maybe it could ...
So, I don't know about you, but I was highly skeptical of the dynamic keywork when it was announced. I thought to myself, oh great, just another move towards VB compliance.
-
The WaitForAll Roadshow
OK, so I took for granted some imaginative uses of WaitForAll but lacking that, here is how I am using. First, I have a nice little class called Parallel that allows me to spin together a list of tasks (actions) and then use WaitForAll, so here it is, WaitForAll's 15 minutes of fame ...
-
Reinventing the Paged IEnumerable, Weigert Style!
I am pretty sure someone else has done this, I've seen variations as PagedList<T>, but this is my style of a paged IEnumerable collection. I just store a reference to the collection and generate the paged data when the enumerator is needed, so you could technically add to a list that I'm referencing and the properties and results would be adjusted accordingly.
-
PLINQ Adventure Land - WaitForAll
PLINQ is awesome for getting a lot of work done fast, but one thing I haven't figured out yet is how to start work with PLINQ but only let it execute for a maximum amount of time and react if it is taking too long. So, as I must admit I am still learning PLINQ, I created this extension in that ignorance. It behaves similar to ForAll<> but takes a timeout and returns false if the threads don't complete in the specified amount of time. Hope this helps someone else take PLINQ further, it definitely has helped for me ...
-
Overriding Inheritance for IIS 6.0 Virtual Directories
If you have an IIS site that has a mixture of ASP.NET 1.1 and 2.0 virtual directories below it, changing the root site ASP.NET settings could affect the virtual directory ASP.NET settings as well since IIS inherits except for explicit overrides. This little PowerShell script will take each setting and persist it to the virtual directory so you are able to freely change the root site settings without affecting the applications below it.
-
ASP.NET PowerShell Data Source Control
Extending on the small proof-of-concept I mentioned yesterday I created this simple data source control that lets you bind a Repeater or DataGrid to it like an ObjectDataSource control but it executes a PowerShell script to retrieve the results.
-
ASP.NET PowerShell Runspace Control
This is just a little concept project I am working on so I can run PowerShell scripts within my ASP.NET applications. As I am a server administrator, I love PowerShell + WMI, and bringing this power into ASP.NET my automation capabilities are being greatly simplified. I'll build on this solution as I play around with actually implementing this as a primary source of automation from support a Windows Server environment.
-
LINQ: Expressive Html Tag Building
I hate building HTML tags in code, but it needs to be done. I just wanted to make it a little cleaner. So I came up with this method that utilizes LINQ expressions to generate the attributes for the tag. This is really only clean with simple tags, but I use it with my other tag building methods to keep them clean as well. I've seen others look for something like this and thought it'd be helpful posting it here. I haven't deeply tested this code but it shows the general concept and I'm sure it needs cleaned up a little. The following is an example calling the Tag method:
-
PowerShell: Install-Gac (GACUTIL for PowerShell)
So, I don't know about anyone else, but it is a pain to use GACUTIL on systems without the .NET SDK. So, I found out there is a .NET API for GACUTIL, so now I just wrapped it in PowerShell to make it easier to use. :)