Archive

Archive for the ‘Development’ Category

Code Conversion Tools – VB6 to VB.NET, Java to C# and more

August 22nd, 2006 Thomas 1 comment

You might have used the VB6 to VB.NET Upgrade Wizard in Visual Studio, or maybe the Java Language Conversion Assistant (JLCA) to convert Java code to C#.  These tools have something in common - the technology comes not from Microsoft, but from a company called ArtinSoft.

This is a company with some very intriguing products based on artificial intelligence engines.  Their business is all about source code and platform conversion – VB6 to VB.NET, Java to C#, PL/SQL to T/SQL, Linc to J2EE – you name it, they can probably do it.  They have two AI-based engines, and the one called Freedom is behind JLCA and the VB.NET Upgrade Wizard.  Through a complex process, this engine creates a langage-agnostic intermediate representation of the original source code, which can then be written out in a completely different language.

Now, people tend to complain a lot about the VB.NET Upgrade Wizard, but if you stop and think about what the tool has to do, it works incredibly well.  The quality of the original source is obviously going to be a major factor.  If the VB6 source has Option Explicit off and looks, well, like most VB6 code does, it’s amazing that the wizard can make any sense of it.

One important thing to know is that ArtinSoft sells their own versions of both of these tools: the Visual Basic Upgrade Companion and the JLCA Companion.  These products are much more advanced versions of the free tools.  The VB Upgrade Companion can even convert your VB6 code to C#.  Yes, VB6 directly to C#!  How cool is that?  ArtinSoft also offers consulting services to help with your migration projects.

Sometimes the right answer is to redesign and rewrite your code.  Other (most?) times, that is very hard to justify to your CIO, and that’s when your company might want to consider ArtinSoft’s paid applications and services.  Cost may still be an issue, since I hear that these tools are licensed by number of lines of source code, but that’s something to evaluate while you look at all of the pros and cons and make a final rewrite/upgrade decision.

Categories: Development Tags:

Internal Microsoft Tools Available to the Public

August 3rd, 2006 Thomas Comments off

One of the coolest resources that Microsoft employees have is an internal website filled with hundreds and hundreds of small but useful apps and utilities, many of which were written by Microsoft employees.  Sadly, few of the tools are made available outside of Microsoft, but here are a bunch that have made it out and places to look for more.

Fiddler: In the author’s own words: “Fiddler is a HTTP Debugging Proxy which logs all HTTP traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP Traffic, set breakpoints, and “fiddle” with incoming or outgoing data. Fiddler is designed to be much simpler than using NetMon or Achilles, and includes a simple but powerful JScript.NET event-based scripting subsystem.”

Sandcastle: This is the actual tool that Microsoft uses to generate the .NET Framework’s MSDN-style documentation.  NDoc works fairly well, but Sandcastle is the new tool of choice for building help files.

FxCop: The same tool behind “Code Analysis” functionality in select Visual Studio 2005 Editions, this is one of the most important tools for .NET software developers. This outstanding tool analyzes managed code assemblies for over 200 types of defects, and will point out all kinds of “gotchas” that you never would have noticed on your own.

LogParser: A truly amazing tool, LogParser allows you to write SQL queries against data stored in random files in all kinds of different formats, including XML, CSV and various IIS log formats, and it can write the results to lots of different formats — all without loading the data into a database! If it doesn’t support the format you need, you can write an extension for it.

WiX: One of the first, if not the first, internal Microsoft tool to go open-source.  A set of command-line utilities that build MSI/MSM files from XML command files.  Great for building installers in an automated build process.

RoboCopy and much more: RoboCopy is a very powerful and reliable file copy/move tool that also includes directory synchronization.  It is packaged with dozens of other great tools in the Windows Server 2003 Resource Kit Tools package.  (Many of the tools do not require Windows Server 2003.)

One of the newest and fastest-growing places to find Microsoft-created tools is CodePlex, Microsoft’s newest “community development” website. There is no good way to determine exactly which projects originate from Microsoft, but some are clearly stated. One of the tools you will find here is the Team Foundation Server Administration Tool.

Some tools turn up on the official Microsoft website as unsupported downloads.  For example, Lookout, released in early 2005, is an Outlook add-in that lets you quickly search all types of Outlook and file system data.  Not very useful, perhaps, in this age of Windows Desktop Search and Google Desktop, but it’s an example of what you can find if you dig around in Microsoft Downloads.

Browse the GotDotNet User Samples area — look for the Microsoft logo next to the sample title.  XML tools and Web Service tools are also available on GotDotNet.

Know of more useful tools that originated inside Microsoft?  Please share them!

Categories: Development, Microsoft Tags:

Two Down: Exam 70-536 – .NET 2.0 App Development Foundation

July 24th, 2006 Thomas 1 comment

While the blog has been silent over the last couple of months, I’ve been preparing for and taking more certification exams.  That amidst never-ending yard and house work in this unusually dry, hot summer.

A couple of weeks back, I took the 70-536 exam and walked away with a score of 895.  Disappointing (yes, all things are relative) because I got 100% on the sections that should have been the hardest for me and missed questions on “easier” sections.  However, a lot always depends on how they phrase the questions and how much you read into them.  This was no better than any of the past MS exams in that regard.

I’m now certified as an MCTS: .NET Framework 2.0 Distributed Applications.  Could they make these titles any longer?  My end goal is MCPD, which requires three more exams (argh).

The majority of the 45-question, 2-hr max test was code questions where you have four or five code samples from which to choose.  There were also “choose and order” questions where you have 6-7 actions and you have to pick just the ones you need and put them in the right order.

None of the exam prep books were available when I prepared for this test, and the scope of this exam is so large that I resorted to simply reading the MSDN class library documentation.  I went through each class in the exam prep list, looked it up and read the docs.  Yes, it was every bit as painful as it sounds.  I used the MeasureUp practice test after I had read through everything.

The official MS Press prep book is finally available, with another non-Microsoft book supposedly coming soon.  Here’s the exam prep guide.

Categories: Development, Personal Tags:

Use MSBuild with .NET 1.1

May 18th, 2006 Thomas Comments off

As most of you probably know, MSBuild is the new XML-driven build tool provided with .NET Framework 2.0.  You do not need to install Visual Studio 2005 to get and use MSBuild.  I’ll never understand why Microsoft went away from nmake and make files when they moved to Visual Studio .NET from the old C/C++ compilers.  It was a big design mistake and one that has made it difficult to create automated builds or build scripts of any significant complexity.  Thankfully they finally decided to clone nAnt and give us a real build tool again.

In any case, the real point of this post is that .NET 1.1 projects have just as much, if not more, to gain from MSBuild as .NET 2.0 projects do, and that has just become much easier.  The “MSBuild Extras – Toolkit for .NET 1.1″ is now available.  If you’ve been using nAnt, this is a great way to prepare for .NET 2.0 and take advantage of MSBuild’s power today.

Also of interest, you’ll find that the download for this toolkit is on a Microsoft site called CodePlex, stated to be “Microsoft’s community development” site.  I’m not quite what this means to GotDotNet, which has filled exactly that role for many years now.  Perhaps Microsoft is hoping to create their own SourceForge in CodePlex.  It will be interesting to see how it is ultimately used, but it seems to be picking up a bunch of interesting projects.

Categories: Development Tags:

One Down: Exam 70-529 – .NET 2.0 Distributed App Development

May 9th, 2006 Thomas 1 comment

It’s been quite some time (C++/MFC/COM era) since I’ve updated my Microsoft certifications, so with the brand-new .NET 2.0 exams trickling out, now seemed like a good time to renew.  The goal this time around: MCPD Enterprise Applications, or Microsoft Certified Professional Developer: Enterprise Applications Developer.  (If you hadn’t heard, Microsoft revamped the certification program yet again.)

I started off by taking 70–529 – .NET 2.0 Distributed Application Development about a week ago.  This is a 40 question, 2 hour (maximum) test that covers Web services, WSE 3.0, Remoting, MSMQ, “serviced components” (i.e. COM+) and asynchronous calling patterns and Remoting events.  The interesting things about this test are that 1) Remoting is an almost-dead technology and 2) WSE 3.0 is not even part of the .NET Framework.

Remoting still exists in .NET 2.0, but no one at Microsoft will recommend writing any new code with it.  It’s really only there for backward compatibility.  You should have heard of Windows Communication Framework (formerly Indigo) by now, and Remoting will truly be dead when it arrives.  Remoting should have had little or no presence in this brand-new test, but it’s there, so you need to know it.

Aside from that, the rest of the topics are quite relevant to any .NET developer writing distributed applications today.  The questions are multiple-choice style, with choose-one, choose-two, and choose-all variants.

Final result: Pass, score 953 (passing is 700).

Categories: Development Tags:

Get the Consolas Font for Visual Studio 2005 from Microsoft

May 9th, 2006 Thomas Comments off

Every now and then Microsoft releases an update for Visual Studio that arrives with little or no fanfare, and the latest example is the Consolas font package.  According to Microsoft, “Consolas is intended for use in programming environments and other circumstances where a monospaced font is specified.”

Consolas is specifically designed for ClearType, Microsoft’s advanced font-smoothing/anti-aliasing technology found in Windows XP and Windows Server 2003.  According to the licensing terms, Consolas is only available to licensed users of Visual Studio 2005.  Of course, the font would be useful in many other environments.  When you install the package, it changes the default text editor font in Visual Studio 2005 to Consolas.

I’ve only spent a day with Consolas, but so far I like it.  You will probably need to adjust your ClearType settings with the ClearType Tuner to avoid having the font appear either too light or too dark.  ClearType is mainly intended for LCD screens, but I’m using it on a CRT with good results too.

Categories: Development Tags:

To Throw or Not to Throw?

March 11th, 2006 Thomas Comments off

You may have noticed inconsistencies in the .NET Framework BCL (Base Class Library) since 1.0 with regards to the behavior of Get/Indexer methods when the requested value does not exist.  For instance, the indexer on the 1.1 System.Collections.Hashtable class returns null/Nothing if the requested value does not exist.  However, the indexer on System.Data.DataRow, which you often use to retrieve column values from a DataTable, throws an exception if the requested column does not exist.  In yet another twist, System.Reflection.Assembly’s GetType() method has two overloads that accept boolean parameters indicating whether or not to throw an exception if the type is not found.

These differences are the result of various Microsoft BCL development teams and individuals with differing opinions on “throw on missing” vs. “don’t throw on missing.”  This has been a long-running debate inside Microsoft, and it’s something that you should also consider carefully when designing your classes.  While working at Microsoft several years ago, I had the opportunity to monitor some of these debates on several of the internal technical discussion groups (which carry massive amounts of emails).

The first question you might ask is: in an average execution flow, would I expect to encounter missing values, or does that represent an exceptional circumstance?  In a general purpose class when you don’t know how it will be used, there’s no way to answer this question.  This, of course, is the problem that Microsoft faces.

Fortunately, it appears that a consensus has finally formed within the BCL team.  I believe that it is a reasonable compromise between the two approaches and introduces a pattern that is easily recognizable by developers while maximizing flexibility.  This pattern includes a pair of methods: Try<Operation>() and <Operation>().  For example, TryGet() and Get().  It’s a very simple idea — the Try version of the method returns a boolean indicating whether the operation will succeed or fail, and the non-Try version throws an exception if the operation fails.  The biggest downside of this approach, in my opinion, comes down to the additional clutter it brings to a class – namely, doubling the method count for certain types of methods.

It’s important to be aware of this pattern, because you will find it in many places in the .NET Framework 2.0 BCL.  The new classes in System.Collections.Generic might be the ones you encounter most often, but you will also find this pattern on the common types, like Int32.TryParse() and Int32.Parse().  It’s interesting to note that this pattern existed in 1.0/1.1, but only on the Double class!

One potential gotcha, which represents a big difference between 1.0/1.1 and 2.0, is that the indexer on 2.0′s Dictionary (hashtable) throws KeyNotFoundException when the key is missing, and in 1.1′s Hashtable, the indexer does not throw an exception in that case.  Be careful of this difference when you’re used to 1.1 and working in 2.0, or vice versa.

When you’re designing classes, I encourage you to take advantage of this pattern (where appropriate) to make the behavior of your classes more predictable and consistent with the rest of the Framework.

Categories: Development Tags:

Test Your HTML with the W3C Markup Validation Service

January 29th, 2006 Thomas 1 comment

A co-worker asked me today about an issue in a Web app in which pages display correctly in IE 6.0 but incorrectly in IE 5.5.  He could duplicate the problem in IE 6.0 by changing the page’s <DOCTYPE> tag.  Sometimes issues like this are due to rendering engine differences (or bugs) in various browsers.  However, I very often see developers test the code and functionality of their Web pages, but fail to test the HTML.

There are far too many Web pages out there that have broken and/or sloppy HTML.  I know, I know, you have a deadline to meet and as long as it works on your computer it’s fine, right?  Hopefully that’s not your attitude.  There’s an excellent, free tool from the W3C that can quickly and easily validate your HTML and give you a list of errors and issues.  You can quickly jump to the trouble spots and make corrections.

The W3C (World Wide Web Consortium)’s free Markup Validation Service can validate HTML, XHTML, MathML, SMIL and SVG documents, and it is still being tweaked and improved.  I highly encourage you to add it to your Web development toolkit.

Categories: Development Tags:

Enterprise Library for .NET 2.0 Finally Arrives!

January 17th, 2006 Thomas Comments off

Updated 1/20/2006

I hope you’re not still using the Microsoft Data Access Block and sibling Blocks in your code.  If you are, I hope you have a good excuse!  Microsoft released Enterprise Library for .NET 1.1 about a year ago to replace the old Blocks.  It was co-developed by Microsoft and Avanade, and Avanade still carries on a proprietary enhanced version called ACA.NET.  The former Blocks that were incorporated into Enterprise Library gained a more unified programming and extensibility model, improved documentation and samples and an extensible GUI configuration tool.  We used Enterprise Library throughout most of 2005 on a large WinForms app, and it worked great.  I recommend it to every .NET development team.

Since then, I’ve moved on to Visual Studio 2005 like many of you, and we’ve all been (patiently?) waiting for Microsoft patterns & practices to rework Enterprise Library for .NET 2.0.  A couple deadlines passed with no code, but it’s finally here.  You really owe it to yourself and your dev team to check out the excellent work being provided by the patterns & practices team.

Categories: Development Tags:

Update for Visual Studio 2003 to 2005 Web Project Conversion Wizard

January 4th, 2006 Thomas Comments off

For those of you thinking about upgrading a Visual Studio.NET 2003 ASP.NET 1.1 Web project to Visual Studio 2005 and ASP.NET 2.0, Microsoft recently released an updated version of the Visual Studio 2005/Visual Web Developer 2005 Web Project Conversion Wizard.  This is newer than the version included in the Oct/Nov 2005 RTM build!

Categories: Development Tags: