The Wiert Corner – irregular stream of stuff

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

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

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

    Join 1,862 other subscribers

Archive for 2016

In metric, one milliliter of water occupies one…

Posted by jpluimers on 2016/04/22

(:

“In metric, one milliliter of water occupies one cubic centimeter, weighs one gram, and requires one calorie of energy to heat up by one degree centigrade—which is 1 percent of the difference between its freezing point and its boiling point. An amount of hydrogen weighing the same amount has exactly one mole of atoms in it.Whereas in the American system, the answer to “How much energy does it take to boil a room-temperature gallon of water?” is “Go fuck yourself,” because you can’t directly relate any of those quantities.

from Wild Thing: A Novel by Josh Bazell

–jeroen

via A Brit Abroad – In metric, one milliliter of water occupies one….

Posted in About, Personal | Leave a Comment »

Internal version numbers for conditional defines etc

Posted by jpluimers on 2016/04/21

Thanks Daniel Jackson for posting (the DocWiki hasn’t been update yet):

Version Conditional: VER310
Product Version: 24
Package Version: 240
IDE Version: 18.0
Compiler Version: 31

Source: I had expected Embarcadero would have updated the documentation to reflect the…

–jeroen

Posted in Delphi, Delphi 10.1 Berlin (BigBen), Development, Software Development | 2 Comments »

RubyMania has reached Delphi – Times helper method implementation for integers – from Asbjørn Heid

Posted by jpluimers on 2016/04/21

The below fragment is one of the favourite kinds of examples in the Ruby world:

5.times { |i| print i, " " }

It uses the times method on Integer and prints:

0 1 2 3 4

There are many implementations of this in other languages, for instance Ruby’s ‘times()’ function in C# | Of Code and Me (which the WordPress.com editor fucked up as it replaced Action<int> with Action which is a totally different thing, so the gist with code is below.

public static class IntExtensions
{
    public static void Times(this int i, Action func)
    {
        for(int j = 0; j < i; j++)
        {
            func(j);
        }
    }
}

Which you use as

5.Times(i => Console.Write(i));

It’s slightly off as it prints:

01234

I know; nitpicking, but this code works (did I ever tell I love .NET fiddle?):

5.Times(i => Console.Write("{0} ", i));

Well, Mason Wheeler encouraged Asbjørn Heid for the below Ruby Mania in Delphi; just read the comments at In C# nearly everything is an object, so when writing a unit test for a string…

Since the WordPress.com editor fucks up TProc<Integer> into TProc and TProc behaves differently from TProc<Integer>, I’ve included a gist link with the actual code below.

program RubyManiaConsoleProject;

uses
  System.SysUtils;

type
  TRubyMania = record helper for ShortInt
    procedure times(const IterBody: TProc);
  end;

procedure TRubyMania.times(const IterBody: TProc);
var
  i: Integer;
begin
  for i := 0 to Self-1 do
    IterBody(i);
end;

begin
  5.times(
    procedure(i: Integer)
    begin
      Write(i, ' ');
    end
  );
end.

It also shows why I hardly use anonymous methods in Delphi: they’re way too verbose.

–jeroen

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Event, Software Development | 1 Comment »

XSD enumerations: restrict strings, integers, etc.

Posted by jpluimers on 2016/04/21

XSD enumerations are nice as they can be used to restrict simple XSD types to a set of values.

But they can also be hard if the set changes over time: restricting further is not possible, but extending isn’t always easy either.

Some interesting links:

–jeroen

Posted in Development, XML/XSD, XSD | Leave a Comment »

Detecting the use of “curl | bash” server side | Application Security

Posted by jpluimers on 2016/04/20

From the “let people know when they are stupid” department:

Another reason not to pipe from curl to bash. Detecting curl | bash serverside.

Source: Detecting the use of “curl | bash” server side | Application Security

–jeroen

Posted in Development, Python, Scripting, Software Development | 1 Comment »

Support of import in xsd.exe – Jose Luis Calvo Salanova – Site Home – MSDN Blogs

Posted by jpluimers on 2016/04/20

I tend to forget this: xsd.exe can resolve xs:include, but not xs:import. When using xs:import it will complain about missing types.

Simple solution: reference all imported XSDs (but not included XSDs) on the same command-line:

I was trying to create a C# class with xsd.exe from an schema that imports others schemas like that xsd.exe /c schema.xsd and it fails miserably reporting an error like “The datatype ‘xxx’ is missing.”. Basically xsd.exe doesn’t resolve the schemaLocation attribute.

Dare Obasanjo’s article addresses the problem, and Scott Hanselman had the same problem -and solved it-.

The solution isn’t very nice, but at least it’s simple. You have to tell xsd.exe all the schema referenced, xsd.exe /c schema.xsd importedSchema1.xsd importedSchema2.xsd

Be aware that the C# filename is sometimes generated from all XSD filenames on the command-line (I’ve noticed this when the import is specified before the actual XSD file, if the import is at the end, the name of the import is used.

If my memory serves me right, older versions of XSD.exe could not resolve unix-style relative paths on the command-line, but newer versions do.

–jeroen

via: Support of import in xsd.exe – Jose Luis Calvo Salanova – Site Home – MSDN Blogs.

Posted in .NET, C#, Development, Software Development, XML/XSD, XSD | Leave a Comment »

Positive: Delphi 10.1 Berlin is out; negative all Embarcadero HTTPS sites still vulnerable to DROWN attack

Posted by jpluimers on 2016/04/19

The good news: Delphi 10.1 Berlin is out and released in Berlin (note: you might want to rename Delphi 10 Seattle into Delphi 10.0 Seattle).

Some links:

The not so good thing: I won’t be using it for a while as now for like 6 weeks or so, all the embarcadero HTTPS sites have been vulnerable to the DROWN man-in-the-middle attack that has been discovered 20160301.

Which means that even without going around the non-HTTPS partner site, I won’t be able to make a secure connection and install it.

Which gives me more time to play with the Xamarin Visual Studio 2015 integration, the cool stuff that MvvmCross offers and some of the other .NET Goodness at BUILD 2016 – .NET ALL THE THINGS! | Beth Massi

Read the rest of this entry »

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Development, QC, Software Development, Visual Studio 2015, Visual Studio and tools | 6 Comments »

existing complex XSD types: use xs:complexContent in combination with xs:extension

Posted by jpluimers on 2016/04/19

I tend to forget how to extend existing complex XSD types. It is by using xs:complexContent in combination with xs:extension: Element (complexContent).

A cool thing: xsd.exe supports this when generating .NET code (for instance C#).

More at XSD Tutorial – Part 3/5 – Extending Existing ComplexTypes and SimpleTypes.

–jeroen

Posted in Development, Software Development, XML/XSD, XSD | Leave a Comment »

MikroTik CRS226-24G-2S+RM Review – A super switch

Posted by jpluimers on 2016/04/18

Interesting device: Our review of the MikroTik CRS226-24G-2S+RM a 1U rackmount 24 port gigabit switch with dual 10 gigabit Ethernet SFP+ ports and a slick management interface.

Source: MikroTik CRS226-24G-2S+RM Review – A super switch

It’s fanless, support SFP+ and many people seem to like it.

Pictures are at Just got my CRS226-24G-2s+RM! – MikroTik RouterOS.

There is also a desktop version of it called CRS226-24G-2S+IM.

–jeroen

Future reading:

Posted in Ethernet, Network-and-equipment, Power User | Leave a Comment »

Coloured floppies…

Posted by jpluimers on 2016/04/18

Reminder to make one of the below.

–jeroen

Read the rest of this entry »

Posted in About, Fun | Leave a Comment »