This blog has, IMO, some great resources. Unfortunately, some of those resources are becoming less relevant. I'm still blogging, learning tech and helping others...please find me at my new home on http://www.jameschambers.com/.

Friday, June 19, 2009

Fat32? Still? Seriously?

Just ran into another deployment problem.

I went to publish a demo project to a live production server that was set up about two years ago.  The machine is fairly mid-level for its era.  It is running Server 2K3.

And its system drive is formatted as Fat32.

So back to the deployment problem.  I went to deploy and, after getting everything setup (host headers, created application, test app memory pool, virtual directory) in IIS I attempted to publish. 

No go.  No Front Page extensions.

So I download the bits and try to install…no go.  Must install on an NTFS partition.  Crap.

Now I’m left with the decision to either try to upgrade the drive to NTFS or setup an FTP account.  Eck.  But it’s a production server and there is exactly zero hit on running FTP.

Username, password, home directory all configured and slamming the project up on good’ole port 21…

Thursday, June 18, 2009

Today.Productivity = ProductivityOptions.BarelyAny

Rough couple of days here.

The legacy application server has been acting up and causing a lot of problems.  Unfortunately that means that I’m tied up for hours at a time trying to track down errors, login problems, server performance issues or helping to debug reports that were written four years ago that no one remembers who or for what purpose the report was written.

</rant>

I have been trying to work through some issues with the TcpClient’s ability to stay connected to a custom device that supports telnet.  I can make the connection just fine, but after I read from the stream, then write back to it, I unfortunately lose the connection. 

Checking the CanRead and CanWrite properties always return true, but reading from the stream was causing an exception.  I later sourced this part out to an IO exception because I was reading past the end of the stream…but I was doing that because I was expecting more text coming down the pipe.

Also, there seems to be a significant performance hit when you start to read from a NetworkStream object.  When I fire up CMD and telnet into the device I receive the data I expect (namely, the login request) almost instantly; there is a 5-7 second delay using the managed wrappers.

I did, however, manange to wrap up development on my background ping library.  This will help the CSRs as they work the helpdesk.  There are currently 3-6 devices that as a matter of process we check for visibility with pings when a customer calls in.  I am this |-| close to having that fully automated and running for any related device between our head end and the client.

Tomorrow is Thursday.  I need visible output for this week’s goals…

Wednesday, June 17, 2009

Box Selection in Visual Studio 2010

An interesting post from the folks on the Visual Studio Editor blog site:

Not only will you be able to make, copy/paste, drag/drop, and delete box selections, but you’ll also have the new ability to insert and edit text on multiple lines.

Box selection is one of those hidden treasures in Visual Studio.  Prior to having it as part of the IDE I used to copy and paste blocks of code or text data files I had to massage over into Word to use the box selection features of Office.

This is the next step, with multi-line editing becoming part of the tool mix we are getting treated to:

The full article (with video) is here.

Tuesday, June 16, 2009

I Will Not Convert

This is my pledge:image

In spite of having to do some experimental development for the iPhone – and thus having to live with a Mac Mini on my desk – I will not convert to being a Mac user.

There are no buttons on the mouse.  The keyboard is terrible.

But I must admit, I am quite fond of a device that sounds like Wall-E  when it boots up…

Toggle Between Code Blocks

Today I was trying to spike out a simple test where I was maxing out my network card and/or my CPU as fast quickly as possible.

Don’t ask.

Anyways, I had two blocks of code that I was working on, one to scan a subnet for ICMP-responsive devices, and another to blitz said devices with ping requests.  I needed to collect a bunch of IPs to ping so I didn’t fully flood any devices…then I was switching back to the block that did the pinging.  After using the Visual Studio buttons for commenting and removing comments for a while I remembered some c commenting bits I learned a while ago.

This is a really simple trick that an old friend of mine showed me back in the late 90’s (who now works at ohai).  The idea here is that you often find yourself working between two code blocks, but don’t want one to run while the other is, you’ll be forever commenting out one block of code and uncommenting the other.

In any language that supports the following two comment marks:

/*...*/  and //


…it is really easy to set up to comment out one block of code and work on the other.  Here’s the setup:



//*/
Console.WriteLine("Hello");
/*/
Console.WriteLine("Hello");
//*/


Now for the trick.  You’ll see that the top block is active and the bottom block is commented out.  To switch between blocks, simply comment out the first slash on the first line, as so:



/*/
Console.WriteLine("Hello");
/*/
Console.WriteLine("Hello");
//*/


…and Presto! you have activated the second block. 



I don’t normally run into this when I’m working in a TDD project, but I do hit it when I’m spiking a fair bit.  This isn’t really a game-changer or anything, but it is certainly handy when you’re fighting with a block of code or two.

Monday, June 15, 2009

Tools Round-up

I am in the process of setting up my development VM and taking a little inventory for the apps that I find indispensible on a weekly – if not daily – basis. 

Here they are, in no particular order:

  • The lastest version of Visual Studio with any available service packs
  • The WPF Toolkit and MVVM Template
  • Karl Schifflett’s XAML Power Toys
  • SQL Server Express
  • SQL Server Management Studio/tools
  • Reflector
  • Resharper
  • Regulator
  • Chrome and IE8
  • OneNote.  Yes, OneNote, seriously…
  • Microsoft Virtual PC

These keep me working and productive.  I suppose I should also mention Office apps in general (Outlook, Word, Excel) but I’m one of those crazies that thinks those should just be baked into the OS already…or immediately available through a browser with just the right amount of functionality that I never have to wait for…

Friday, June 12, 2009

Crossing Thread Boundaries

Sometimes you find a solution to a problem and you just add it to your Swiss Army Knife of code to handle similar problems down the road.  If you’ve ever used a Timer on a WinForms application, you’ve likely run into the following error message:

Cross-thread operation not valid: Control 'someControl' accessed from a thread other than the thread it was created on.

Since .Net 2.0 I’ve run the same game strategy for hopping back over to the UI thread when I want to make updates.  Basically, I make a delegate with the appropriate parameters to handle whatever update I want (like strings for the Text property on a Lable), then check InvokeRequired to re-call the method, if necessary.

But I’ve been neglecting a good friend: anonymous delegates.

Today I came across an article related to something entirely different and they mentioned ‘MethodInvoker’.  This turns out to be a very clean implementation.  Because the anonymous delegate gets the scope variables of the method it’s created in, you don’t have to pass parameters, nor do you have to re-call the same method.

The end result – sans named delegate – looks elegantly like the following example:

void CoordsReceived(object sender, CoordinatesReceivedEventArgs e)
{
this.Invoke(new MethodInvoker(delegate()
{
lblLattitude.Text = e.Lattitude.ToString();
lblLongitude.Text = e.Longitude.ToString();
}));
}




Still very readable, arguably more so, and still takes care of getting back on the right thread to update the UI.



I can’t believe I missed this for so long…all those delegates!