Untitled

Random thoughts about everything and nothing

Archive for June 2007

OpenUP/Basic and Eclipse Process Framework Project

leave a comment »

The Open Unified Process (OpenUP) is an open-source version of the Rational Unified Process.  Beside the UP base, additional (Agile) techniques and practices have been added (e.g. Scrum and XP ). 

Read the rest of this entry »

Written by Michael

June 26, 2007 at 10:37 pm

UIPAB on MSDN Magazine

with 2 comments

I don’t know if anyone is still (considering) using the User Interface Process Application Block (short: UIPAB), but there’s an article in the MSDN magazine issue of August 2005.

Written by Michael

June 26, 2007 at 10:14 pm

Posted in .NET, Link, MSDN, UIPAB

The underlying connection was closed

leave a comment »

If you ever get the above error message from a (SAP) webservice…this might fix it (at this in the generated proxy).

protected override System.Net.WebRequest GetWebRequest(Uri uri)
        {
            System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)base.GetWebRequest(uri);
            webRequest.KeepAlive = false;
            webRequest.PreAuthenticate = true;
            webRequest.ProtocolVersion = System.Net.HttpVersion.Version10;
            return webRequest;
        }

Written by Michael

June 26, 2007 at 9:43 pm

A severe error occured…SQL Server 2000

with 2 comments

A few weeks ago we ran into the following error in a piece of code: 

System.Data.SqlClient.SqlException: A severe error occurred on the current command. The results, if any, should be discarded.

Wierd…the code was running fine until yesterday! After some investigation (CSI-style) we found that the “XP_CMDSHELL”-commando in our stored procedure was the guilty one.

Background Information
Quote: “When xp_cmdshell is invoked by a user who is a member of the sysadmin fixed server role, xp_cmdshell will be executed under the security context in which the SQL Server service is running. When the user is not a member of the sysadmin group, xp_cmdshell will impersonate the SQL Server Agent proxy account, which is specified using xp_sqlagent_proxy_account. If the proxy account is not available, xp_cmdshell will fail. This is true only for Microsoft® Windows NT® 4.0 and Windows 2000. On Windows 9.x, there is no impersonation and xp_cmdshell is always executed under the security context of the Windows 9.x user who started SQL Server.”

What’s causing?
In our case we were using the xp_sqlagent_proxy_account, which used a domain service account, which migrated to another domain, which wasn’t communicated, which…well, anyway.  We found the problem 🙂

Just this
Ow, just this snippet to set the proxy account:

use master
go

xp_sqlagent_proxy_account N’SET’
                        , N'<DOMAIN>’
                        , N'<PASSWORD>’
                        , N'<PASSWORD>’
And to read the current setting…

use master
go

xp_sqlagent_proxy_account N’GET’

In both cases, logon as sysadmin…

Written by Michael

June 26, 2007 at 9:15 pm

Posted in Exception, SQL

Automating your GAT tests with Recipe Runner

leave a comment »

There is a way to automate your GAT tests, its called Recipe Runner.  I first noticed it when going through the Web Service Software factory. 

Before you start
Be sure to make a c:\tmp folder, which is required by the internal logging mechanism.

Where can I find it?
Recipe Runner is hosted at codeplex (under WSSF)…here

Written by Michael

June 24, 2007 at 8:30 pm

Tip of the week – Format Document

leave a comment »

I see a lot of people still using the backspace, tab and delete to format a piece of text in VS 2005.  There’s a easier way of doing this…

  1. Format Document: for small source files, just press Ctrl+K, Ctrl+D 
  2. Format Selection: for large source files, first select the region that isn’t justified correctly, then press Ctrl+K, Ctrl+F

Both options can be found under Edit | Advanced in VS.

vs-formatdocument

Written by Michael

June 22, 2007 at 10:19 pm

Compiling CodeSmith templates to assemblies

leave a comment »

Introduction

There’s an option in CodeSmith studio to compile your template to an assembly.  This has some advantages over the “normal” way of working like referencing the template in a project, no compilation time when running…

You can find the option under Tools | Compile To Assembly

compileoption

Fill texboxes in the Compile To Assembly window, being:

  • Assembly Name: Output filepath
  • Namespace:  Namespace in which the template class will be placed
  • Type Name:  Class name of the template

compiletoassembly

Press OK to start the compilation.

Using the Codesmith API

Another way to compile your templates is to use the CodeSmith API.  The  CodeSmith.Engine dll contains the CodeTemplateCompile class, which exposes the same properties  as the CodeSmith Studio variant.  Take a look at the following snippet:

 
            string templatePath = @"C:outputCompileThis.cst";
            string outputNamespace = "Demo.CodeSmith.Templates";
            string outputTypeName = "CompileThis";
            string outputAssembly = @"c:outputCompileThis.dll";
 
            CodeTemplateCompiler compiler = new CodeTemplateCompiler(templatePath);
            compiler.Namespace = outputNamespace;
            compiler.TypeName = outputTypeName;
            compiler.Compile(outputAssembly, true);
 
            Console.WriteLine("#Errors: {0}", compiler.Errors.Count);
 
            if (compiler.Errors.Count > 0)
            {
                Console.WriteLine(compiler.Errors[0].ErrorText);
            }
 
 
            Console.ReadKey();

Watch out

No matter how you compile your templates, there are some things you should keep in mind:

  1. More than ones i needed to restart CodeSmith Studio (or use unlocker) when recompiling the template, i.e. a lock might held by CodeSmith Studio
  2. Any dependencies you have in the template must be placed in the ouput directory (except for the typical framework dll’s and the ones placed in the GAC) 

Written by Michael

June 22, 2007 at 9:53 pm

Posted in .NET, CodeSmith