PowerShell Here

This great little utility from Scott Hanselman allows you to right-click a directory to start up PowerShell prompt rooted at that directory.

Scott Hanselman's PowerShell Here INF

And here is Microsoft's PowerShell scripting web site.

Windows PowerShell MSDN Docs

Working with files and folders with PowerShell

Here are some starter command for working with directories...

/* Search for text in files within a directory */
dir | select-string "my search string"

/* Search based on object properties such as LastWriteTime */
$dt = Get-Date
dir *.msg | where { $_.LastWriteTime.Hour -gt $dt.AddHours(-1).Hour }

/* Or use Slect-String to search by file contents */
$list = dir *.doc | where { $_.LastWriteTime.Hour -gt 15 -and $_.LastWriteTime.Hour -lt 18 }
$list | where { $_.LastWriteTime.Hour -lt 17 } | select-string "foobar"

/* Select First 3 */
$list | Select-Object -first 3

/* Sort by LastWriteTime */
$list | Sort-Object LastWriteTime -descending 

Tags:

 

Nice Javascript Uploader Control

I already built my own, but this looks like a nice upload control for the next time I need a file upload dialog...

http://fineuploader.com/

Tags:

 

Chunkify a String with Extension Method

Here's a dandy little string extension to help split strings into smaller chunks.

public static string[] Chunkify(this string source, int chunksize)
{
    List set = new List();
    int chunklength = chunksize;
    int stringlength = source.Length;
    for (int i = 0; i < stringlength; i += chunksize)
    {
        if (i + chunksize > stringlength)
            chunksize = stringlength - i; // factor in the last chunk

        string tmp = source.Substring(i, chunksize);
        set.Add(tmp);
    }

    return set.ToArray();
}

Use it like this...

string mystring = "This is a sample string";
string[] chunkified = mystring.Chunkify(4);
Console.WriteLine(chunkified[1]);    // output is  "This"

Tags:

 

Interesting IDE for building iOS apps using C#

Interesting IDE for building iOS apps using C#...

Xamarin...  http://xamarin.com/

Tags:

 

Run 32-bit SSIS package on 64-bit

I have been working on creating SSIS packages using Sql Server Data Tools in Visual Studio 2012.

I was running into a problem where I could run a package in Visual Studio, but it would not run when deployed to Integration Services on the same machine.  What's the difference?

My package is using an ODBC connection using a Data Source setup on my machine using a 32-bit driver.

Behind the scenes SSIS runs DTExec.exe to execute the packages.  The trick is that on 62-bit installations there are two different locations for DTExec.exe; one for 32-bit version and another for 62-bit version.

So to summarize... I've got an SSIS package that uses a 32-bit ODBC data source.  When I run in Visual Studio all is fine because Visual Studio uses 32-bit.  When I run in SSIS, I get errors because SSIS is calling a 64-bit version of DTExec which is then looking for my ODBC connection in the 64-bit Data Sources setup on the machine, which does not exist.

SO... I need to tell Sql Server SSIS to use the 32-bit DTExec even when running under 64-bit.

Don't worry, I am confusing myself at this point!  But let's just get to the solution...

The Fix

The fix for me was to edit the Registry settings for Sql Server and point the DTS path to the location of the 32-bit version of DTExec.

The registry setting for Sql Server 2012 is located in...

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\110\SSIS\Setup\DTSPath

Note: Edit registry at your own risk!

The default value is...

C:\Program Files\Microsoft SQL Server\110\DTS\

I changed it to...

C:\Program Files (x86)\Microsoft SQL Server\110\DTS\

Summary

There can be platform conflicts between data sources and the environment they eventually are called in.  This little trick helped me get my SSIS packages running again.  I hope it helps you, too.

 

Tags:

 

Month List

About

Martin is a .NET programmer in Western Pennsylvania.