The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,784 other followers

Archive for the ‘C#’ Category

Keep consistent formatting – via: The Oracle at Delphi: Code is the language, formatting is the dialect.

Posted by jpluimers on 2017/06/13

When this developer finally went to commit his/her changes, they had also reformatted most of the codebase into his/her preferred coding style/format. This was even for files for which no other changes had been made!Imagine the next developer coming along and pulling down the latest changes from the source control system and trying to merge them into their own local changes.

Because of all these code-format-only changes, it became nearly impossible to merge any changes without going through every conflicted file and painstakingly reconcile the changes.

I’ve seen this happen on a few projects where there have been sequential single developers some of which reformatted the whole code base within a few days of taking over.

It made it impossible to perform a “blame” or proper history tracking of feature changes.

That increased the cost of maintenance a lot.

I’ve been on several teams that enforced a pre-checkin standardised formatting of the code. Only rarely that causes problems, usually it’s a blessing to as it makes for a consistent formatting of the code-base where it is much easier to cut the crap and focus on what the real problem is.

–jeroen

Source: The Oracle at Delphi: Code is the language, formatting is the dialect.

Posted in .NET, C#, Delphi, Development, Software Development | 2 Comments »

MiloszKrajewski/LibZ: the alternative to ILMerge (Resolve instead of merge assemblies)

Posted by jpluimers on 2017/05/30

ILMerge has all sorts of drawbacks with things like XAML, WPF, NHibernate, dynamically loaded assemblies and reflection.

Jeffrey Richter: Excerpt #2 from CLR via C#, Third Edition | Microsoft Press blog has an interesting approach based on adding a callback to the AppDomain’s ResolveAssembly event with some steps so you can embed assemblies as resources which you then – unlike ILmerge- dynamically resolve.

Those steps require a bit of manual labour which is taken away by MiloszKrajewski/LibZ: LibZ, the alternative to ILMerge.

The repository on github even compresses your assembly resources.

–jeroen

Posted in .NET, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Development, Software Development | Leave a Comment »

Anders Hejlsberg on Modern Compiler Construction | Seth Juarez | Channel 9

Posted by jpluimers on 2017/05/18

One of those “must watch” videos if you are remotely or more interested in how compilers influence our day to day coding activities.

The Red Dragon Book, first edition: Compilers. Principles, Techniques and Tools.

The Red Dragon Book, first edition: Compilers. Principles, Techniques and Tools.

It starts out with referring to the Dragon Book (well, actually the first edition of the Red Dragon Book, as there are three) describing the compilers as having front-ends consisting of a Lexer, Parser and Type Checker and back-ends consisting of Code Generator and Emitter. A full compilation is going through all five stages and there is an increasing cost using these traditional stages when going from syntax highlighting via collapsible regions to red squiggles and code completion will need to go further along those stages taking an increasing time – like seconds or even longer – whereas the user experience requires responses in ~ 100 milliseconds where his code might not even compile in the first place.

Then Anders goes on describing Roslyn, TypeScript and Compiler API JSON interfaces to them so you can run them as a service and keep compiler state, rebuilding just enough of the state on source code changes. He goes on talking about how Visual Studio, Visual Studio Code, Command-Line Compiler, Sublime Text and other tools (can) use these APIs to interact with the compiler so it keeps state of slowly evolving code of which the tools than can emit what they need.

Anders explains this much better and much more visually than I do: so it’s a highly recommended video.

Read the rest of this entry »

Posted in .NET, C#, Delphi, Development, Software Development | 2 Comments »

How to secure memory? – Medo’s Home Page

Posted by jpluimers on 2017/03/15

Sometime you might want to protect your data in memory – the greatest example is when dealing with anything related to passwords. It is simply not smart to keep that data around in a plain-text. In .NET there are multiple methods you can use for this purpose, starting with SecureString, ProtectedMemory, and my favorite ProtectedData.…

Source: How to secure memory? – Medo’s Home Page

via: Found this via +Ilya S a post from +Josip Medved – Stuff like this should be way built into an OS, and RTL’s should have a secureMalloc()… – Joe C. Hecht – Google+

–jeroen

 

Posted in .NET, .NET 4.0, .NET 4.5, C#, C# 4.0, C# 5.0, C# 6 (Roslyn), Development, Software Development | Leave a Comment »

An exponential back-off implementation I used somewhere; probably room for improvement, but it works good enough.

Posted by jpluimers on 2017/01/17

I will probably need this again somewhere in the future: An exponential back-off implementation I used somewhere; probably room for improvement, but it works good enough.

It’s Delphi, but I’ve not seen practical implementations in C# either.

(the updated version thanks to Anders Melander).

–jeroen

Posted in .NET, C#, Delphi, Development, Software Development | 5 Comments »

 
%d bloggers like this: