Mostrando postagens com marcador c#. Mostrar todas as postagens
Mostrando postagens com marcador c#. Mostrar todas as postagens

28 agosto 2009

My Own Code Snippet Formatter

Some weeks ago when I needed to publish code snippets here for the first time, I looked for plug-ins for Windows Live Writer and found two good alternatives, from which I decided to use the simpler one.

After that, I started to build my own code snippet formatter. Only for C# snippets, and using JavaScript, that is far from what I'm used to write.

After some weeks working on it in my spare time, it's finally usable.

It is available here.

But, if you want a true syntax highlight tool, try this one.

Enjoy!

15 agosto 2009

Parsing a Delphi DFM File

Some time ago a friend asked me to help him to parse a DFM file into .NET objects. We tried to find something in the web that does the job but no success, so I accepted the challenge and wrote the parser he needed.

If for some reason you need a DFM parser, or just for curiosity, you can download it from here.

Here is an example of how to use it:

class Program { 
    static void Main(string[] args) { 
        var fileName = @"c:\Unit1.dfm"; 
        var dfmParser = new DfmParser(fileName); 
        dfmParser.ReadFile(); 
        foreach (var node in dfmParser.Nodes) { 
            if (node.PropertyType == "string") { 
                node.PropertyValue = "'Hello World!';"; 
            } 
        } 
        dfmParser.SaveFile(); 
    } 
}

The example above loads this file:

object Form1: TForm1
  Left = 0
  Top = 0
  object Label1: TLabel
    Left = 8
    Top = 40
    Caption = 'Label1';
  end
  object Label2: TLabel
    Left = 48
    Top = 40
    Caption = 'Label1';
  end
end

And rewrites like this:

object Form1: TForm1
  Left = 0
  Top = 0
  object Label1: TLabel
    Left = 8
    Top = 40
    Caption = 'Hello World!';
  end
  object Label2: TLabel
    Left = 48
    Top = 40
    Caption = 'Hello World!';
  end
end

If you find some use for this, enjoy :)

11 julho 2009

A comparative study of the Java and C# languages

If you search the web for comparisons between the Java and C# programming languages, you will end up finding two great articles, among many others.

The first one is written by Dare Obasanjo, and available in his site 25 Hours A Day. The other, that is not so descriptive but provides great examples, is a code for code comparison available in the JavaCamp.org website.

I’m citing these two great resources because now I’ll post here the final work I did for my System Analysis course, that is also a comparison between such languages.

The main differences between my comparison and the one made by Dare Obasanjo is that the mine tries to use a didactic line, running from the easiest languages aspects to the most complex ones. Also, and a downside for most of the readers of this blog, is that it’s only available in portuguese.

If you speak portuguese, maybe you enjoy!

A comparative study of the Java and C# languages