Sonntag, 26. April 2009


The sql-server part of poshcodegen is nearly complete. And I'm using it in daily work.

The oracle part is a bit harder. Revisiting some old code I stumbled too often about #ToDo Comments. So its going on a little slower than expected.

Thinking that you prefer viewing at some real code, I post one of the Orcale test functions in Poshcode. Perhaps someone finds it there, just as I found the orginal from Steven Murawksi.

If your daily job is running ad hoc queries and stored procedure calls against SQL-Server Databases you may find something useful.

If you know how to access another RDBMS please join the project.

If you find a bug please send feedback. This is a complex area and it was too easy to introduce faults. We don't have automatic testing yet, but there is a rather complete set of test stored procedures for SQL-Server and for Oracle.

The second pitfall: too often the functions run perfectly too hours, but starting a fresh PowerShell I get errors. Often this is causes by the need to keep our own connection strings secret.

But now something useful, as far as you use ORCLE:

download | new post

Dienstag, 21. April 2009


If you are interested in accessing databases and want to access stored procedures you might have found New-StoredProcFunction from Steven Murawski at

Meanwhile it became a real project an you find it at

As concrete object, it is as generator that produces wrappers to calls to stored procedures as PowerShell functions and those are really useful. Taken an abstract you it is just one example of a generator. Perhaps soon we will see many more.

At the moment the focus lies on SQL-Server and Version 2005 or later is required. I'm just testing a way to use it with SQL Server 2000 too.

Next I'll create an Oracle twin. (Bye bye ref cursor hide under the layer thinking runs better without you).

The first target are pure procedures, not packages. When you want to create application that run as well on SQL-Server as on Oracle you better forget creating your own packages at ones.

Procs in packages come later.


Sonntag, 5. April 2009

Get-Childitem an recursive comparing two directories part II

Same theme again. Here extended with some demo data. Now the $path parameter can either be absolute or relative.

Sorry Shay I found no way to do it using Split-Path, I wished Split-Path could do it. The substring solution shows pythonic influences. But I prefer a solution in time.

I did start extending this with some automatic copying of files, but I do not include those code here yet. There is some risk to spoil ones file by replacing the new by old ones.

Samstag, 4. April 2009

Get-Childitem an recursive comparing two directories

First let me tell you that I do my work from two different locations: the office and my home and I even spend some some hours in train without connection to the Internet.

Using offline files seems a good idea. Setting up folders for off-line use is easy and it works good while unconnected to the Internet.

The problems arise when connect to the office from home via VPN. You have no control whether synchronizing folders should happen or not, it just does. Sometimes the offline files stayed offline and inhibited me from connecting to my shares using the usual drive letters. Worst there is simple way to throw away offline files when they are in offline mode. I requires taken ownership of a lot of CSC files an deleting them.

Instaed of throwing bloody curses my final decision is not to use this halfbreed feature any more.

Copying some folders to my local disk is rather easy, but now I have to track somehow which files I changed and in which location .

I know of a tool WinMerge, which gives me all the control I need to sync folders, but it uses too much bandwidth. When the files at both locations have the same size an LastWriteTime then I have no need to compare the content.

One of the properties I missed when looking at the result from Get-ChildItem when using the recursive switch is, that it doesn't return the relative pathes and itherefore doesn't feed its results into Compare-Object in a simple way.

But PowerShell wouldn't be PowerShell, if there isn't a way to overcome the situation.

function Get-ChildItem2 ($path)
$PathLength = $path.length
gci $path -rec | % {
Add-Member -InputObject $_ -MemberType NoteProperty -Name RelativePath -Value $_.FullName.substring($PathLength+1)

this small little wrapper does the trick and all the fileobjects in the result are enhanced by a relativePath property.

Having two pathes $path1 and $path2 to folders you want to campare

Compare-Object (Get-ChildItem2 $path1) (Get-ChildItem2 $path2) -prop RelativePath, LastWriteTime, Length |
Sort RelativePath, LastWriteTime -desc | % {
if ($last -ne $_.RelativePath)
{ $_ }
$last = $_.RelativePath
} | sort RelativePath

gives a nice result telling which files are different and where you find the newer version.

The only thing, that me realy astonishes, is the fact, that I have to write this myself. It is so basic.