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

  • Pages

  • All categories

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

    Join 1,822 other followers

Archive for September 11th, 2017

Delphi code of the day…

Posted by jpluimers on 2017/09/11

I was debugging an issue where a Delphi SOAP implementation was shoe-horned into an Indy server and came across the [WayBackTWebRequest.UpdateMethodType Method.

The further you get down the if/then/else tree, the more often the indexed property Method is accessed, same for the conversion/comparison code.

property Method: string index 0 read GetStringVariable;

So if the HTTP method is POST (very common), then the calls are being made 3 times:

procedure TWebRequest.UpdateMethodType;
begin
{$IFDEF NEXTGEN}
  if Method = 'GET' then  { do not localize }
    FMethodType := mtGet
  else if Method = 'PUT' then   { do not localize }
    FMethodType := mtPut
  else if Method = 'POST' then  { do not localize }
    FMethodType := mtPost
  else if Method = 'HEAD' then  { do not localize }
    FMethodType := mtHead
  else if Method = 'DELETE' then  { do not localize }
    FMethodType := mtDelete
  else if Method = 'PATCH' then  { do not localize }
    FMethodType := mtPatch;
{$ELSE !NEXTGEN}
  if System.AnsiStrings.AnsiStrComp(PAnsiChar(Method), 'GET') = 0 then  { do not localize }
    FMethodType := mtGet
  else if System.AnsiStrings.AnsiStrComp(PAnsiChar(Method), 'PUT') = 0 then   { do not localize }
    FMethodType := mtPut
  else if System.AnsiStrings.AnsiStrComp(PAnsiChar(Method), 'POST') = 0 then  { do not localize }
    FMethodType := mtPost
  else if System.AnsiStrings.AnsiStrComp(PAnsiChar(Method), 'HEAD') = 0 then  { do not localize }
    FMethodType := mtHead
  else if System.AnsiStrings.AnsiStrComp(PAnsiChar(Method), 'DELETE') = 0 then  { do not localize }
    FMethodType := mtDelete
  else if System.AnsiStrings.AnsiStrComp(PAnsiChar(Method), 'PATCH') = 0 then  { do not localize }
    FMethodType := mtPatch;
{$ENDIF NEXTGEN}
end;

–jeroen

Posted in Delphi, Development, Software Development | 4 Comments »

Terry L@u’s blog: Manage non-domain Hyper-V servers (Windows Server 2016 Technical Preview) by Hyper-V Manager

Posted by jpluimers on 2017/09/11

One day I will need this: Terry L@u’s blog: Manage non-domain Hyper-V servers (Windows Server 2016 Technical Preview) by Hyper-V Manager [WayBack]

Via: Matthijs ter Woord

–jeroen

Posted in Hyper-V, Power User, Virtualization, Windows, Windows Server 2016 | Leave a Comment »

W123 – Tacho-Reparatur – works for W116 odometer (kilometerteller) as well

Posted by jpluimers on 2017/09/11

Since the odometer of our W116 would stall every now and then, we had to repair it.  Luckily the instructions at W123 – Tacho-Reparatur [WayBack] work fine for a W116 as too.

It’s different between 450SEL and 450SEL 6.9 and contains a bunch of lightbulbs so for completeness some links that help fixing lighting issues:

–jeroen

Read the rest of this entry »

Posted in cars, LifeHacker, Power User, W116 | Leave a Comment »

 
%d bloggers like this: