Author

I am Joannes Vermorel, founder at Lokad. I am also an engineer from the Corps des Mines who initially graduated from the ENS.

I have been passionate about computer science, software matters and data mining for almost two decades. (RSS - ATOM)

Meta

Entries in dotnet (15)

Saturday
Jul282007

RESX utilities open-sourced

Due to popular demand, I have finally open-sourced my RESX utilities. All the content (source code as well as binaries) is now available at resx.sourceforge.net, released under the GPL open-source license.

The release includes RESX Editor a simple yet efficient RESX file editor. It can be very handy if the translator is not too much familiar either with XML or with Visual Studio.

The release also includes Resx2word a RESX to Microsoft Word converter. The converter has been packaged as a command line utility (resx2word.exe and word2resx.exe).

Thursday
Jul052007

More ScrewTurn tips (feed2js plugin)

ScrewTurn is used as a CMS for Lokad.com. Along with the main website www.lokad.com, we have also blog.lokad.com and forums.lokad.com that both provide RSS feeds. For a long time, I have been looking for a simple way to include RSS snippets directly in the web pages without any satisfying solution. You can have a look at the right sidebar of Lokad Products page to see what I mean by "Feed Snippet".

Feed2js for RSS snippet inclusion


For one month, I have been using Feed2js.org that provide a javascript based solution to include RSS snippets in your webpages. The Feed2js approach has one single major advantage: simplicity. Just cut-and-paste a sample javascript that call Feed2js.org and you're done. Unfortunately, this approach has two major drawbacks. First, it's roughly double the latency to complete the webpage retrieval. With Lokad.com, the overhead delay was sufficient to be noticed even when a DSL connection. Second, it potentially expose your website to cross-scripting attack (I am only saying potentially because Feed2js.org has proved to be very reliable in my experience).

Feed Snippet Plugin for ScrewTurn


For those reasons, I have settled myself for an improved (yet home-made) solution for ScrewTurn: a custom RSS feed snippet plugin. This piece of code relies on the ScrewTurn plugin framework. It retrieve the RSS feed on the server side and then use the ASP.Net caching mechanism to keep a copy for 1h before re-downloading the RSS feed. With this plugin, you can include a RSS feed snippet in your ScrewTurn page with a single line:

<feed itemCount="4" dateFormat="yyyy-MMM-dd">http://myfeedurl</feed>

The attribute itemCount indicates the maximal number of RSS items to be displayed in the web page. The attribute dateFormat corresponds to the .NET DateTime formatting option to be used to display the post publication date.

Download: FeedSnippetPlugin.cs.zip

Tuesday
Jun122007

Few traps for former C++ developers coding in C#

I have been proofreading a couple of time C# source code written by former C++ developers. Also C# and C++ have a lot in common at the syntax level, the conceptual framework underlying the two languages is really different. This post is a negligible attempt to point out the most common issues.

C# is garbage collected. You should not need any destructor. If you are using destructors, then it's probably wrong 99% of the time. If you have doubts, ignore destructors, it's the way to go with garbage collected languages.

Pre-processor statements are deprecated. Although C# does have statements like #if #else #endif, the pre-processor statements are de-facto a deprecated construct in C#. Like destructors, they are some very specific cases where those statements can be used. Yet, 99% of the time, using those statements would just be a design mistake.

C# comes with native guidelines. Microsoft has published very extensive guidelines about variable, method, class naming. Every single C# line you write is expected to be compliant with those guidelines.

Saturday
Mar172007

Iridium r8 released and new website fo Math.NET

Math.NET is open-source project delivering mathematics / statistics libraries written in C# (and mostly targeting .Net, although Mono compatibility should not be an issue). I have been personally contributing on the numerics package of Math.NET code-named Iridium.

Several years ago, I did setup a mediawiki-based website for Math.NET, but it's now completely obsolete. Yet, I would like to mention Christoph Ruegg has released a brand new website for Math.NET. Update your (social) bookmarks with http://mathnet.opensourcedotnet.info/

Check also 8th release (March 2007) of the Iridium package available in the download section.

Wednesday
Oct252006

Let's get cosmetic on C# documentation

I am gathering here just a few C# documentation cosmetic tips that I apply in my own projects. I do not pretend to have achieved any absolute truth or any optimal practice with those tips. I just find them convenient when applied with consistency.

  • #region #endregion directives can be great, but caution not to overuse them by putting a dozen of directives within a 200-lines long code file. Indeed, if region makes the code structure more apparent, region also makes the code less proofreadable because you have to open the regions to actually start reading. As a rule of thumb, region directives should only be used for at least 100 lines.

  • XML documentation is great too. But again, Visual Studio makes it quite easy to overuse XML documentation. Basically, with 3 strokes you can generate up to a dozen of lines of empty comments. Yet, if those comments are not completed with insightful content then you're just polluting your code. Here, I define insightful as being any comment that goes beyond the information implicitly provided by the method signature itself. Example: if you have a method named Foo.DeleteUser(Guid userId) do not tell me, that userId is the user identifier. I know it because it's obvious. Tell me what happen when no such user exists. Documentation has to be maintained like the rest of the source code. Useless documentation only makes the code harder to maintain.

  • In the case of the internal project, wrapper methods (methods that basically forward the call to another method) is the kind of objects where it's actually better not to document. Instead, I prefer using a <seealso/> XML documentation reference. Indeed, documenting a wrapper is pretty much like duplicating your documentation. If this documentation is exposed to your customers, then you do not have much choice, you have to duplicate the docs (MSDN are full of replicates), but for the internal development needs, I found such replication far from being cost-effective. Thus I avoid the docs replication through XML references.