Friday, May 12, 2006

It's all in the GetProcessesByName method of System.Diagnostics.Process.  I have included a sample below.  This sample is the kind of code you may have in Sub Main() if you are staring an application with a Sub Main().  In the sample, "MyApplication" is the name you have given your project in Project Properties. 

NB: GetProcessesByName can throw InvalidOperationException when it cannot retrieve the process information.



Dim ThisIsTheOnlyRunningInstance As Boolean

'Try to get the list of running processes to determine if to continue in this thread
Try
    ThisIsTheOnlyRunningInstance = (Diagnostics.Process.GetProcessesByName("MyApplication").Length = 1)

Catch ex As InvalidOperationException
    'GetProcessByName can throw and InvalidOperationException when for any reason it cannot complete.
    MessageBox.Show("Could not determine if this is the only copy running."), _
                              "Starting my application", _
                              MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try


If ThisIsTheOnlyRunningInstance Then
    'Enable XP Visual Styles
    Application.EnableVisualStyles()
    Application.DoEvents()
    'Start the app
    Application.Run(
New MainForm)

Else
    MessageBox.Show("There is already another copy running on this computer.", _
                    "Starting my application", _
                    MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Friday, May 12, 2006 12:24:06 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 

Even embracing its manifold faults, I'm still a fan of Microsoft Exchange server.  It has been a tempestuous relationship of the years but I'm still there. 

However I have recently had cause to look at MailEnable and I have to say I am very impressed. The web mail is better than I expected and I think it's a keeper.  There are still a couple of configuration items I need to get straight but initial impressions are good.
Friday, May 12, 2006 9:20:17 AM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, May 09, 2006

Something more we can all do:  Sender Policy Framework.

http://www.openspf.org/index.html

also

http://www.ietf.org/rfc/rfc4408.txt


The gist of it is the SPF record in the DNS identifies all the valid hosts that are allowed to send mail for that domain.  Mail should not be accepted for domains with an SPF record if the originating host is not in the SPF record.

Anything that reduces spam gets my vote!

You can check your domain for this and related details at DNS Report.

Tuesday, May 09, 2006 5:22:11 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Monday, May 08, 2006
I posted before about trying to determine if a SQL Server trigger is enabled or disabled.

The answer came via SQLJunkies and of course comes to us by way of OBJECTPROPERTY function.  The property is: ExecIsTriggerDisabled.

I learnt all this back in the SQL 7.0 days and my fav trick is to dive into the sysobjects & syscolumns tables for all kinds of metadata.  I never caught the OBJECTPROPERTY and the Information Schema views. 

My homework is to now get busy learning the OBJECTPROPERTY function so I can keep up with being 1 version behind :-(

Monday, May 08, 2006 11:50:31 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
Richard and his guest Kent Alstad of MCW Tech talked on ep174 of DNR about their new venture Strange Loop.

While details are scarce what we are talking about is a hardware appliance that implement managing state and compression in a router.  This means the ASP.Net View State is managed by the appliance.  The way this need to be seen is in light of the problem of scaling a web app from one server where inproc state management is OK to a multi-server web app where a SQL Server is used to hold the state in order to avoid problems arising from afinity: subsequent page requests need not hit the same server but that implies a trip to the SQL Server for each page view.

What Strangeloop are promising is the scalability of using SQL Server session state with the performance of Inproc state.  Oh so cool.

So the question I have is:  Where's my SQL Server appliances?  Great example is protocol encryption for SQL Server.  It's obscure and far from intuitive.  TDF is understood, as is SSL.  Someone give me a sexy 1U rack gizmo that glows blue and makes it all happen :)

Monday, May 08, 2006 11:23:11 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Friday, April 28, 2006


I was listening to DNR last night, the guest was Kim Cameron and they were talking all about Identity.  The topic of the let me get my work done button came up.  This is the digital version of the boy who cried wolf story. 

When the user is bombarded with endless security dialogues that they don't understand they blur into one big let me get my work done button.

I thought I'd represent it graphically :)


Friday, April 28, 2006 9:51:32 AM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [1]  |  20060428-What-Non-technical-users-see.jpg (64.61 KB)
 Thursday, April 27, 2006

When you think you have found all the places to set exchange server's data stores and moved them to a data disc you should re-check! 

There is always one that is still set to log to your system drive and the gods of pain and irony will find a way to fill it.

...with apologies to the hundred of thousdands of people trying to read this blog between midnight and 10:00am...
Thursday, April 27, 2006 10:04:58 AM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Wednesday, April 26, 2006

So I mentioned earlier that I am excited about using XPath against XML data stored in SQL Server (v2000 at the moment) but I keep coming up against the same problems, like text/ntext data types are invalid for local variables in a batch and I can't fit the documents I want inside varchar(8000). 

The result with the most Google Juice on this points to the solution we all want.  There needs to be a version of sp_xml_preparedocument that accepts a pointer to a text/ntext column.  There are various solutions around, none of which are kind on server resources (like creating an undetermined number of varchar(8000) variables in scope) and none of which are pretty.

The chances of getting this went from slim to none last Nov.  Oh well.  I've yet to sink my teeth into SQL Server 2005 and I know they have done a lot with XML in that release, but Microsoft:  Do you think every system and team cuts over to the new version of your products the day after launch?  I understand you're excited but the same happened to VB6 when VS.NET 1.0 came out.

The project I have in mind involves taking the XML out of Excel documents and working with it using XPath and XSLT.  So for now this dosen't live in the data tier.  Oh well.  The sun will rise on the morning.

Oh and a nod to the brainy and beautiful Anina for "google juice" links. 


Wednesday, April 26, 2006 9:41:25 AM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [2]  | 
 Wednesday, April 19, 2006
I've been a fan of Crypto-gram for ages.  Blogged about it too.  It's author, Bruce Schneier, really knows his stuff.  It's a welcome reminder each month than when dealing with information security -as everyone employed in tech really is- paranoia is a very healthy emotion.

He asked bloggers to help spread the word of a proposed contest on Movie-plot terrorist threats.  These are the kind where (in my words) someone has a maybe valid/maybe invalid idea about how a terrorist can go about their aims, then removes the doubt around their own stupidity by trying (often including proposing great expense) to mitigate the risk.  Sigh.

I'll be tracking the Technorait results for this too :)

I have reprinted Mr Schneier verbatum from this month's Crypto-gram below.


Movie-Plot Threat Contest



NOTE: If you have a blog, please spread the word.

For a while now, I have been writing about our penchant for "movie-plot
threats": terrorist fears based on very specific attack scenarios.  Terrorists with crop dusters, terrorists exploding baby carriages in subways, terrorists filling school buses with explosives
-- these are all movie-plot threats.  They're good for scaring people, but it's just silly to build national security policy around them.

But if we're going to worry about unlikely attacks, why can't they be exciting and innovative ones?  If Americans are going to be scared, shouldn't they be scared of things that are really scary?  "Blowing up the Super Bowl" is a movie plot to be sure, but it's not a very good movie.  Let's kick this up a notch.

It is in this spirit I announce the (possibly First) Movie-Plot Threat Contest.  Entrants are invited to submit the most unlikely, yet still plausible, terrorist attack scenarios they can come up with.

Your goal: cause terror.  Make the American people notice.  Inflict lasting damage on the U.S. economy.  Change the political landscape, or the culture.  The more grandiose the goal, the better.

Assume an attacker profile on the order of 9/11: 20 to 30 unskilled people, and about $500,000 with which to buy skills, equipment, etc.

Post your movie plots here on this blog.

Judging will be by me, swayed by popular acclaim in the blog comments section.  The prize will be an autographed copy of Beyond Fear.  And if I can swing it, a phone call with a real live movie producer.

Entries close at the end of the month -- April 30.

This is not an April Fool's joke, although it's in the spirit of the season.  The purpose of this contest is absurd humor, but I hope it also makes a point.  Terrorism is a real threat, but we're not any safer through security measures that require us to correctly guess what the terrorists are going to do next.

Good luck.

Post your entries, and read the others, here:

http://www.schneier.com/blog/archives/2006/04/announcing_movi.html

Movie-plot threats:
http://www.schneier.com/essay-087.html

http://www.time.com/time/nation/article/0,8599,175951,00.html
http://www.schneier.com/blog/archives/2005/10/exploding_baby.html
http://www.schneier.com/blog/archives/2006/02/school_bus_driv.html
http://www.imdb.com/title/tt0075765

There are hundreds of ideas here:
http://cockeyed.com/citizen/terror/plans/terrorwatch.html


Wednesday, April 19, 2006 2:22:56 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [1]  | 

Since I was doing nothing else on Monday, after the blog post below I spent a couple of hours going through the work in Visual Studio.

While I am still not sold on the concept of the tests driving the development process, it does make you consider your class design from the point of view of it's consumers.  Also the screencast did help bring some clarity to practical test design with NUnit, which is something I strugled with earlier.

My next problem with it:  How do we manage the problem that arises from programmers testing their own input validation for example?

Also the MVP pattern was easier to implement than it looked on DNR TV.  I look forward to watching the episode dedicated to it.
Wednesday, April 19, 2006 9:00:07 AM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  |