Mats codemix

Mats codemix

A little c#, a litte .NET and throw in some c++ and you get a nice Spaghetti

Mats codemix RSS Feed
 
 
 
 

Testing geshi

Use Geshi (wp-syntax)

Below should be nice looking colour coded pwoershell code

# Remember to write  pre lang="powershell" NOT posh or something other cryptic....
Add-Content powershell
Add-History

End of Geshi example

SSIS - Deployment utility problem - cannot copy configfile

In a SSIS-project you can set the  property “Create deployment utility” to true. When building such a project you may get the error

“Could not copy file xxx.dtsconfig to the deployment utility output directory. File already exists.”

This was due to two packages using the same config file and Visual Studio wants to copy that file twice and errs on the second attempt.

WORKAROUND:

  1. Manually create a deployment-manifest. Name the file  “ProjectName.SSISDeploymentManifest”. Save the file to the folder Drive:\FullPathToTheSSISProject\Install.
  2. Copy the needed files from the bin-folder to the install-folder

Example manifest-file:


<?xml version="1.0" ?>
<DTSDeploymentManifest GeneratedBy="<Domain>\<UserName>" GeneratedFromProjectName="<ProjectName>"
GeneratedDate="<Date><Time>" AllowConfigurationChanges="true">
<Package>Package1.dtsx</Package>
<Package>Package.dtsx</Package>
<ConfigurationFile>cp.xml</ConfigurationFile>
<ConfigurationFile>cc.xml</ConfigurationFile>
</DTSDeploymentManifest>

See also: http://support.microsoft.com/kb/910419

Problems connecting to SSIS in SQL Management Studio

I tried to conect to SSIS and got the error “SQL-server does not allow remote connections”(rougly from the top of my head).  Turned out that the server i was connecting to needed SSIS to be confugured to run against a specified instance of SqlServer.

SSIS runs as standard at the default instance (i.e localhost). this is configured in the file :”%ProgramFiles%\Microsoft SQL Server\90\DTS\Binn\MsDtsSrvr.ini.xml”.

Change ServerName to the correct instance.


<Folder xsi:type="SqlServerFolder">
<Name>MSDB</Name>
<ServerName>servername\sql2005</ServerName>
<!-- This was the original line
<ServerName>.</ServerName>
-->
</Folder>

Links

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=105166 (at the end of the page)

Get more info on:

http://searchsystemschannel.techtarget.com/generic/0,295582,sid99_gci1248754,00.html

(Good info on deployment)

SSIS - Editing DTSX-project with lots of connections = slow

A DTSX-package with lot of faulty connections can be very hard to edit due to SSIS trying to resolve all the connections.

First try to edit in offlinemode (Note: you cannot test the connections in offlinemode)

If that won’t work you can hand-edit the XML of the package. The way I did it was:

  1. Close the DTSX-package,
  2. Rename it to nnnn.dtsx.xml
  3. Open in visual studio. Select all XML-code and press Ctrl+K+F to format and prettify the code.

At the beginning of the XML-file you find all the connection managers. Usually you only need one or two of these. If all tasks just use one datasource you can exchange all connections to a single one.

1 <DTS:ConnectionManager>
 2 <DTS:Property DTS:Name="DelayValidation">0</DTS:Property>
 3 <DTS:Property DTS:Name="ObjectName">connDBStat</DTS:Property>
 4 <DTS:Property DTS:Name="DTSID">{097BFD2F-AA7F-4C5D-BC91- 3A57D14CE709}</DTS:Property>
 5 <DTS:Property DTS:Name="Description"></DTS:Property>
 6 <DTS:Property DTS:Name="CreationName">OLEDB</DTS:Property>
 7 <DTS:ObjectData>
 8 <DTS:ConnectionManager>
 9 <DTS:Property DTS:Name="Retain">0</DTS:Property>
10 <DTS:Password DTS:Name="Password" Sensitive="1"></DTS:Password>
11 <DTS:Property DTS:Name="ConnectionString">Data Source=SERVER_XYZ;User ID=sa;Initial Catalog=SomeDatabase;Provider=SQLNCLI.1;Persist Security Info=True;Auto Translate=False;</DTS:Property>
12 </DTS:ConnectionManager>
13 </DTS:ObjectData>
14 </DTS:ConnectionManager>

Remember the DTSID for the connection you want to keep. For each component/task that uses a connection, change the GUID in connectionManagerID to the GUID of the connection you want to use.

1 <connections>

2 <connection id=”36″ name=”OleDbConnection”

3 description=”The OLE DB runtime connection used to access the database.” connectionManagerID=”{097BFD2F-AA7F-4C5D-BC91- 3A57D14CE709}“/>

4 </connections>

Testing syntax highlightning - SyntaxHighlighter pro wordpress plugin

SyntaxHighlighter pro wordpress plugin

Plugin csharp

// This is a Comment
function somefunction( string Path="*.txt" ,[string] $pattern="" )
{
select-string $xxxx -patt $pattern | foreach { np $_.Filename}
}

Plugin Powershell

Thanks to Jaykul at HuddledMasses.org!

[sourcecode language='powershell']
# This is a Comment
function Other( [string] $Path=”*.txt” ,[string] $pattern=”" )
{
select-string $xxxx -patt $pattern | foreach { np $_.Filename}
}
[/sourcecode]

Xml-code

Multiline comments doesnt seem to work with this version (Wordpress-plugin)

<!-- Submissions -->
<xf:submission action="A08_Avt_Arbgbesk.xmlc" id="Visa">
<xf:submit logf="no" ignoreValidate="yes"  />
</xf:submission>

Actipro code highlighter

Seems like this one can manage multiline xml comments
1 <Folder xsi:type="SqlServerFolder">
2   <Name>MSDB</Name>
3   <ServerName>servername\sql2005</ServerName>
4   <!-- This was the original line
5   <ServerName>.</ServerName>
6   -->
7 </Folder>

http://www.actiprosoftware.com/Products/DotNet/ASPNET/CodeHighlighter/pastecode.aspx
# Simple comment
function ssHasNot(
[string]
$Path=*.txt
,[string]
$pattern=“”
)
{
$has=[string]@(get-childitem $path | ss $pattern | foreach {$_.Path})
get
-childitem $path| where {$has.Contains($_.FullName) -eq $false}
}

Use poshcode


End poshcode.

Powershell-script to find files not having specified text

I had the need to find files “not containing” a certain text.

I scanned the web and found all and nothing. A few dedicated search tools and editors (some payware and some free).
Since i use powershell a lot in my work i wanted to use that environment. Finding a file based on a certain text is easy with the select-string or combination of get-childitem and select-string.

Maybe there is a solution that does not include scripting? I would be happy to hear what the options are.
I have the feeling that this can be solved as a filter-script (begin,process,end)?

New revised version that outputs results of a get-childitem filtered through a where-object.

# Find all files which does not contains the text in $Pattern
function Get-FilesHasNot(
[Parameter(Mandatory=$true)]
[string] $Path=”*.txt”
,[Parameter(Mandatory=$true)]
[string] $pattern=”"
)
{
$has=(get-childitem $path | select-string $pattern) | foreach {$_.Path}
get-childitem $path| where {$has.Contains($_.FullName) -eq $false}
}

A mix of code

I wanted to have a place to jot down ideas and things i discover working as a software developer.  I hope to expand this blog to something useful if not fore everyone but at least for me.