October 2006 - Posts

CopyAsHTML Visual Studio 2005 Add-in. *revised*

I have created a Visual Studio 2005 add-in that lets you copy your source code as html. The code is formatted into html that references CSS classes in the stylesheet used by DotNetSlackers.com article template. If your writing an article you can copy code into it using this add-in. It's still at beta but it does the trick.

To install, download the zip file and copy the files in it to MyDocuments\Visual Studio 2005\Addins, open Visual Studio and select Tools->Addin Manager. You will see CopyAsHtmlAddin, add it and tick the startup option then restart Visual Studio. Sorry about the round about way to install I'll improve that when I get the chance.

To use select some code, right click and select Copy as Html. It supports VB, C#, XML, XSL, XSLT, HTML, XSD, and SQL.The file extension of the source file determines how the code is formatted into html. You don't need to only use it for DotNetSlackers.com articles as the zip file also contains the CSS stylesheet that the html uses.

I've revised this post because soon after the add-in went into the files section I discovered a small bug with the formatted output of the addin so I have updated the application link, if you downloaded it before please download and install again by replacing the files in the My Documents\Visual Studio 2005\Addins folder.

Also the add-in is really a wrapper around Jean-Claude Manoli excellent CSharpFormat. I made the add-in from his source as a learning excercise to see how add-ins work.

Download CopyAsHtmlAddin.zip (17k).

XmlNotepad 2006 and XmlCsvReader

Two new findings...

XmlNotepad 2006 is a free Xml Editor that I've just got a hold of and it looks very handy. It's not quite overkill which I feel XmlSpy is. Nice and simple, with validation, xslt transformations, and so on. Have a look if you haven't already...

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/xmlnotepad.asp

The other, which you'll want in your toolset, is XmlCsvReader by Chris Lovett. This is a reader that parses CSV files and lets you access them as XML. Now that is really handy.... convert all those legacy files, just like that!! Bravo Chris!! It comes with source code so is an ideal reference for creating your own legacy file to xml reader.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/xmlcsvreader.asp

Posted by dsmyth
Filed under:

Best code ever....

Today I saw a piece of code that went along the lines of....

Public Function GetPath(ByVal Path as String) as String

          Return Path

End Function

..... couldn't believe it. Has anyone else came across code as useless as this? Please do share.

Update: mosessaur commented asking more about the code. To be fair to the developer who wrote what I saw today I think the code became similar to that because of the projects scale. Removing the GetPath method completely, if it was actually called, would have resulted in a large number of errors throughout the solution. I doubt very much it was originally wrote that way and the developer took a very quick and lazy way out when the method wasn't needed. 

Why is this the best code ever?

Because it does what it's suppose to do; without error... that's perfect code.

Posted by dsmyth | 4 comment(s)

Coding VBA with VBA.

The idea of writing code that writes code has a certain coolness about it. Being able to give your application the ability to recode itself is part and parcel to AI techniques of coding intelligence because essentially your application can grow and learn. There are many specialised languages that have been designed with this in mind, Lisp for example, but you wouldn't really classify VBA as one of these languages however the ability for VBA to rewrite itself is there and the article at the link below covers, in good detail, how to do it.

http://www.cpearson.com/excel/vbe.htm

Posted by dsmyth
Filed under:

C# Coding Standard and Code Style Enforcer

IDesign (http://www.idesign.net/)  have made available a coding standard for C# that they say has become a de-facto industry standard. I'll need to take their word for that but I've had a reasonable look and it's as good as any other standard to follow. You can download it here C# Coding Standard

IDesign have quite a good Download area with a quite a few sample projects that are worth looking at.

There is also a Visual Studio addin called Code Style Enforcer that checks and highlights any code that doesn't adhere to a coding standard. It's based on the stardard above but it is fully configurable so if you want to enforce your own coding standard then you can do that too. You can find out more information about Code Style Enforcer here.

Posted by dsmyth

DXCore for Visual Studio 2005

DXCore is a powerful and easy to use extensibility framework for Visual Studio® .NET. In the interest of encouraging developers to be pro-active about productivity, Developer Express is making available for general download DXCore for Visual Studio® .NET so that developers can build productivity plug-ins FOR PERSONAL USE ONLY

http://www.devexpress.com/Downloads/NET/IDETools/DXCore/

I haven't looked in depth at how good DXCore is but browsing www.devexpress.com it looks like a few powerful addins have be created using it, so it must be alright.

Posted by dsmyth
The leading UI suite for ASP.NET - Telerik radControls
Outstanding performance. Full ASP.NET AJAX support. Nearly codeless development.