The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

Archive for September, 2013

SQL query to get the deadlocks in SQL SERVER 2005 and up

Posted by jpluimers on 2013/09/05

Darren Davies answered via SQL query to get the deadlocks in SQL SERVER 2008 – Stack Overflow a while ago listing a great SQL statement by Mladen Prajdić that shows how to do without the deprecated SP_LOCKS and SP_WHO2 (which is undocumented, and slightly different from SP_WHO) or the good old SP_LOCK2.

It is the textual equivalent of the Deadlock Graph, which is part of the SQL Server Profiler.
I like that profiler a lot (read this step-by-step intro if you haven’t used it), but some environments consider it too much power for a developer to use.

The SP_LOCKS documentation directs you to the sys.dm_tran_locks documentation, which is the base of the SQL below. It requires the mostly harmless VIEW SERVER STATE permission.

Finding out what to join in order to get some readable results suited for quick troubleshooting is quite an undertaking.
Mladen did all that, and this is his SQL: Read the rest of this entry »

Posted in Database Development, Development, SQL Server, SQL Server 2000, SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012 | Leave a Comment »

Prepping for Delphi XE5 beta blogging; PasCon / RAD Studio In Action discount

Posted by jpluimers on 2013/09/04

You will see a few Delphi XE5 pre-release related updates here soon. That is part of the Delphi XE5 beta blogging permission I have been given so I can show new Delphi XE5 features. Those updates are from a pre-release version of Delphi XE5 and will be replaced with a final update when Delphi XE5 is being released.

For more information about Delphi XE5 and the Android support, please visit http://embt.co/RADAndroid.

Though not as fast as I hoped (I’ve slept most of the past days), I’m already preparing my Mercurial repositories at https://bitbucket.org/jeroenp, and preparing for the PasCon / RAD Studio In Action in Leiden, The Netherlands next saturday so stay tuned.

About this event: there are a few seats left, and a last-minute discount recently launched. Book your tickets through the on-line links for EUR 35 excluding VAT (normallu EUR 49 excluding VAT): Read the rest of this entry »

Posted in Delphi, Delphi XE5, Development, Software Development | Tagged: , , | Leave a Comment »

.net – What is the difference between SqlCommand.CommandTimeout and SqlConnection.ConnectionTimeout? – Stack Overflow

Posted by jpluimers on 2013/09/04

Lots of people are confused about the different time out options you can set in ADO.NET.

Thanks NinethSense for explaining this well for the SqlClient DAL. Other DALs work in a similar way.

  • SqlCommand.CommandTimeout = timeout limit for your SQL query. Means, how much time a (eg: SELECT, UPDATE) query can take for its execution. If it exceeds SqlCommand.CommandTimeout, then it stops execution. A command timeout error will occur.
  • SqlConnection.ConnectionTimeout = timeout limit for your connection. Means, how much time your connection object can try to connect. If it exceeds the specified time, it stops connecting. A connection timeout error will occur.

–jeroen

via: .net – What is the difference between SqlCommand.CommandTimeout and SqlConnection.ConnectionTimeout? – Stack Overflow.

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, Development, Software Development | 1 Comment »

Exceptions handling in the EnterpriseLibrary and the “SecurityException: The source was not found, …”

Posted by jpluimers on 2013/09/03

A while ago, I inherited a .NET project that used the EnterpriseLibrary, the original developers (it got developed around 2003) were gone, and every exception would end up in this:

SecurityException: The source was not found, but some or all event logs could not be searched.  To create the source, you need permission to read all event logs to make sure that the new source name is unique.  Inaccessible logs: Security.

Searching for the combination “EnterpriseLibrary” “The source was not found, but some or all event logs could not be searched. To create the source, you need permission to read all event logs to make sure that the new source name is unique. Inaccessible logs: Security.” revealed only 1 result:

patterns & practices – Enterprise Library – View Discussion: Logging Error of FormattedEventLogTraceListener in Win7.

Even though I didn’t want anything to be logged in the EventLog, I wanted text logs, and looking at the .config files in the main project, the Enterprise Library logging setup was correct (right sinks, etc).

Somehow, the EnterpriseLibrary still insisted on writing to the eventlog, and this particular exception was the only one tricking to the unhandled exception layer…

For logging in the Eventlog, that particular event log must exist. In order to create an eventlog, you need to have administrator access. And here is the crux: apparantly, the original developers were (while working on Windows NT 4) all Administrators. So they never noticed this problem (and maybe never even looked for that log). After having the Visual Studio debugger break on all CLR exceptions, not only the unhandled ones, I could see this one shown below fired deep inside the EnterpriseLibrary. Which means that the original developers:

  1. did add the EnterpriseLibrary V2 (yes, this project still had V2 and part of the config files were V1.1!) configuration files to the main project:
  2. Had forgotten to mark these files as “Copy to Output Directory” to have the value “Copy if Newer” or “Copy Always”

Marking the files as such solved the below exception, and now on my todo list is to make the old V1.1 stuff go away, and migrate to the most current Enterprise Library. Read the rest of this entry »

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, Development, EnterpriseLibrary, Software Development | Leave a Comment »

Resolving base-conflicts installing samba on OpenSUSE 12.x

Posted by jpluimers on 2013/09/02

When installing samba on a “minimal” server openSUSE 12.x can give you a funny error that the install process conflicts with a “patterns-openSUSE-minimal_base-conflicts” package as for instance described in OpenSUSE 12.2 Samba Standalone Server With tdbsam Backend | HowtoForge – Linux Howtos and Tutorials.

The first time I got that message, I was confused, and it took me a while to find out about the meaning of the base-conflicts package, as it was hard to get a Google search query with really meaningful result.

At last I found a Gitorious entry describing the minimal_base-conflicts package:

create a separate minimal_base-conflicts pattern

this allows to keep the minimal_base pattern upon installing a conflicting package. A better solution would be weak-conflicts but we don’t have that atm

From there I found the security request openFATE – #312150: weak conflicts/softlocks/no-recommends for patterns:

Installation of a pattern also draws in packages that are not in the pattern but only recommended by those listed in the pattern. For the “minimal” pattern this behavior is not desirable though as one really wants a minimal installation without the optional stuff.

So basically, the minimal_base-conflicts package allows the minimal_base package to reference package without pulling in a truckload of package (that would basically violate the idea of a “minimal_base” install).

If you want to install one of the truckload (samba is one of them), then you need to uninstall the minimal_base-conflicts package.

–jeroen

via: OpenSUSE 12.2 Samba Standalone Server With tdbsam Backend | HowtoForge – Linux Howtos and Tutorials.

Posted in *nix, Linux, openSuSE, Power User, SuSE Linux | Leave a Comment »

XSD/XML Schemas: resolving `Namespace ” is not available to be referenced in this schema` (via: StackOverflow)

Posted by jpluimers on 2013/09/01

While working on my Delphi: First try on an XSD for .groupproj files, I bumped into an error `Namespace ” is not available to be referenced in this schema`.

I added a targetNamespace attribute to the GroupProj.xsd so the .grouproj files would use the right namespace.

That resulted into two funny errors:

  1. Namespace ” is not available to be referenced in this schema.
    Visual Studio (which I normally use for editing XSD) would only throw this error on these elements:
    <xsd:element ...>
    So it would not throw them on nodes using the empty namespace.
    That was really confusing!
  2. When validating .grouproj files using this GroupProj.xsd, I would get this error for all .groupproj files:
    System.Xml.Schema.XmlSchemaValidationException: Type ‘<type>’ is not declared. (in this case for ‘<type>’  ‘ProjectType’).
    That was odd too: the ‘ProjectType’ was indeed declared, and should be valid.

I could hardly find any information about the latter error, but the former gave a few useful hits.

Thanks User weston – Stack Overflow. for answering this: it made me smack to my head (like usual, a case of EBCAK). Read the rest of this entry »

Posted in Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Software Development, XML/XSD, XSD | Tagged: , , | 2 Comments »