.NET Compiled in Debug? How do you know?



.NET 4 – Tuple instead of out parameters






string outParameter1, outParameter2;

     var retValue = 0;
     outParameter1 = null;

     if (!string.IsNullOrEmpty(inParameter))
         outParameter1 = inParameter;
         outParameter2 = "Kewl";
         retValue = 1;
     else outParameter2 = "NOT Kewl";

     return retValue;




The tuple option can be like this:

var t = TupleFunction("Test");

var retInt = 0;
var retString1 = string.Empty;
string retString2;

     if (!string.IsNullOrEmpty(inParameter))
retString1 = inParameter;
retString2 = "Kewl";
retInt = 1;
else retString2 = "NOT Kewl";

     return Tuple.Create(retInt, retString1, retString2);


There are some drawbacks to tuples:


I hope this helps.

Windows: Wired vs Wireless





The PowerShell Journey: Part 1

As a developer I try to use the latest and greatest and when something good comes about I try to pick up as much of it as I can.  The use of command or batch files has been a part of my world for a long as I have used computers.  Back in the day, there were batch menus for DOS computers so people with little or no computer experience could get the their applications (Lotus 123, Wordstar, etc.)  The days of doing DOS menus has past but the power of the command shell remains.

The New Command Shell for Windows

I know I am late to the party when it comes to PowerShell but when it comes to shells I am skeptical at first, excited or dismayed second.  Recently there seems to be more and more need to run a shell with more power than VBScript could hope to provide, I was skeptical but I now see the fruit of such a pursuit.  When PowerShell hit the street I hardly noticed because I was very happy with my shell and I could do anything with a cscript command that could not be done with old DOS commands.   Thanks, but no thanks.

Then something changed, I needed to run a script to start & stop an IIS application pool on another server.  I looked and found this http://blog.developers.ie/cgreen/archive/2006/10/20/2341.aspx which clearly uses .NET to control a remote IIS web application pool.  I was about to translate this to VBScript when I thought about what PowerShell is supposed to be able to do out of the box.  I pursued it and came up with the following script:

# Action : Start, Stop, Recycle
param([string]$server, [string]$AppPool, [string]$Action)
$sPath = "IIS://" + $server + "/W3SVC/AppPools/" + $AppPool
$de = New-Object System.DirectoryServices.DirectoryEntry($sPath)

I know it isn’t sexy but it performs the task I needed. This is just the beginning, I’m sure there will be more scripts with more meat in them. Stay tuned, I am starting a series: The PowerShell Journey.

Backup and Archive





Code Simplification: String Maximum Length

I was looking at some old code and ran across something that struck a chord of wrong with me.

string temp; 
temp = "There can only be one!";
if (temp.length > 15) temp = temp.substring(0, 15);

Then I thought we could use a little math to handle the problem:

string temp; 
temp = "There can only be one!";
temp = temp.substring(0, Math.Min(15, temp.Length));

I think Microsoft should have included this kind of method to the String class. Hope this helps.

AMD: Remember you are a technology company!

AMD seems to have lost itself somewhere along the way.  I have owned several AMD-based systems over the years starting with a 386 clone to an Athlon several years ago.   Having a deep love for all things hardware and software, I like to know what the technical specifications of just about anything I read about.  The type of hardware doesn’t matter, be it a hard drive, case, power supply or processor; it’s all good to me.  That is why I need to convey my deep disappointment about AMD.

I saw a new laptop on Newegg‘s web site and was intrigued to see a processor I have never seen before.  The processor is a mobile Phenom II quad-core and the machine looks like a upper-middle end machine except I know nothing about the processor.  I assumed that going to the AMD web site would yield all kinds of information about the processor.  I was utterly flabbergasted to see it not on the list of mobile processors from the home page.  I then searched the web site for the phrase “mobile Phenom” with odd results, the first two links had the processor named but no link to any technical documentation just all kinds of marketing.  The third link took me to a page listing all the classifications for the processors with “AMD Notebook Platform for Home” and “AMD Notebook Platform for Work” listed but when I clicked on those I get more of what I found in the initial search, marketing material.  Then I saw on the far right, a link to “Compare Processors” with notebook processors listed and there is a compare page.  I select the first “AMD Phenom™ II Quad-Core Mobile Processors” option and there are two processors I clicked on the P620 and no luck.  Just the basic technical facts about the design and manufacturing of the processor.  Don’t they think we want to know about the power management features, the memory controller, the memory type is uses, etc?  Twenty minutes and nothing to show for it.

I gave up at this point and looked for more detail outside of the AMD site and was disappointed again.  Another five minutes lead me to all kinds of speculation on performance because AMD has no material to say how the processor performs relative to the old line of mobile processors or even compared to the desktop version.

How can I buy a machine when I know virtually nothing about the processor?

AMD, I know I am just one guy but here are your action items:

  • Make the specifications of your processors easier to find and available to search engines.  I hate to point out that your direct competitor makes 90% of the specifications very easy to find.  Do the same.
  • Make a detailed specifications page with all of the details including architecture, bus configuration and any other real selling points for a technology geek.  If your marketing department is feeling a little left out, then include links to the marketing materials for the pseudo-techs or non-techs.
  • If it makes sense, have a technology oriented version of your site where people like me can find the dirty details like relative performance and technology factors to make educated decisions on the validity of the processor as the platform for a tech-geek.

You may just sell more of your product if more information is available.