Archive for April, 2008

Lake County .NET Users Group is Here!

I want to take a few moments to announce the formation of a .NET Users Group in Lake County, Illinois. Our first meeting will be at CLC in Grayslake, IL. I’ll be the inaugural speaker giving a beginner level talk on Windows Workflow. For details, please visit www.lcnug.org. If you plan on attending, are interested in sponsoring, or have questions, feel free to contact me (scott at scottseely.com).

Leave a comment

Setting the proxy for all users

Today, I had to debug a strange problem. We have a web application that does some fancy printing. The main application server is a Unix machine, the print component lives on Windows. The network between these two has all sorts of fun firewall rules that HTTP type requests can navigate so long as the proxy on the machine is setup correctly. Unfortunately, the Windows test box didn’t have the proxy setup correctly and I didn’t have easy access to the one account that runs the service. To make the proxy set for all users, I had to ask my good friend, Google, how to do this. Google answered “Change the default connection policy for all users.” Google didn’t explain how to do this very nicely (what a jerk!).

I then thought that maybe Google didn’t have the whole answer in one place. (not a jerk!) So, I asked Google “How do I set the local policy on a Windows 2003 server?”

Google answered, “Start–>Run–>gpedit.msc”. Cool, gpedit.msc is the name of the Group Policy Editor and it is a Microsoft Management Console plugin (yeah, you can get all that info from the filename if you live in Windows long enough– I’ve in some sort of Microsoft DOS/Windows mode since 1984).

From there, I just figured things out. So that you too can benefit from my digging, here is the info:

  1. Navigate to User Configuration–>Windows Settings–>Internet Explorer Maintenance–>Connection
  2. Double click on ‘Proxy Settings’
  3. Set your proxy.

These settings then get applied to all users, including those whose passwords you can’t recall:) For what it’s worth, this also works on Windows XP. I haven’t tried Vista, but I bet the results are the same there too.

Leave a comment

Got a ViewSonic VX2235wm– nice!

I was checking out the ads for the local office supply and electronics stores during my lunch hour and I saw that Office Depot was selling the ViewSonic VX2235wm for $259– the same price as I paid for the hunk of junk Samsung. I plugged it in to my laptop and IT JUST WORKED! Everything is crisp, clear, perfect!

The installation experience went like this: I plugged in the monitor to power and my laptop. Vista asked me if I wanted the display on the left or right of my primary display (right) and then I was in business. This is NOT what happened this weekend with the Samsung.

So far, I’ve adjusted nothing on the monitor. I’m so HAPPY that this thing works. ViewSonic is just a better monitor manufacturer.

 

Leave a comment

System.Transactions, interesting tidbit

Florin Lazar has an interesting post on using C# 3.0 to make writing transaction blocks a little ‘pithier’. In ‘A Simpler TransactionScope‘, he suggests using a delegate and a lambda expression to accomplish his goals.

transacted(()=>
{
   using (SqlConnection connection = new SqlConnection(connectionString))
   {
      connection.Open();

      SqlCommand command1 = new SqlCommand(commandString1, connection);
      command1.ExecuteNonQuery();

      SqlCommand command2 = new SqlCommand(commandString2, connection);
      command2.ExecuteNonQuery();
   }
});

delegate void TransactedCodeDelegate();
void transacted(TransactedCodeDelegate txCode)
{
   using (TransactionScope ts = new TransactionScope())
   {
      txCode();
      ts.Complete();
   }
}

The thing that bothered me about this is, can’t I approach this using C# 2.0? And, yes, I can!

transacted(delegate()
{
   using (SqlConnection connection = new SqlConnection(connectionString))
   {
      connection.Open();

      SqlCommand command1 = new SqlCommand(commandString1, connection);
      command1.ExecuteNonQuery();

      SqlCommand command2 = new SqlCommand(commandString2, connection);
      command2.ExecuteNonQuery();
   }
});

In case you are missing the change, Florin suggests using ()=> (4 characters) and I suggest using delegate() (10 characters). Otherwise, these are identical. They both use an anonymous delegate to get the job done.

I’m not suggesting that Florin’s method is flawed. I’m just suggesting that folks who still use VS 2005 in their day to day job can pick up this trick without an upgrade.

 

Leave a comment