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,860 other subscribers

Archive for January, 2019

On my research list: Delphi; automatically generate class body from interface definition

Posted by jpluimers on 2019/01/23

Still need to research this: [WayBack] I search for way to automatically generate class body from interface definition… – Jacek Laskowski – Google+

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, ModelMaker Code Explorer, Software Development | 2 Comments »

Don’t forget your padding… playing with the APK format of a sample “Hello world” Android app

Posted by jpluimers on 2019/01/23

Don’t forget your padding: Hello,I’m playing with the APK format of a sample “Hello world” Android application.my (first) goal is to be able to rebuild an APK from a unzipped one… – Paul TOTH – Google+

References: RSA Algorithm

–jeroen

Posted in Android, Development, Encryption, Mobile Development, Power User, Security, Software Development | Leave a Comment »

CDATA inside JavaScript or style section of HTML? They are for backward compatibility. Sometimes compatibility with ancient browsers.

Posted by jpluimers on 2019/01/23

As a back-end person, sometimes I wondered about CDATA in front-end HTML code was for, especially in JavaScript and CSS style elements.

[WayBackHTML vs. XHTML – WHATWG Wiki explains how to be compatible with XHTML, HTML, XML based tools and older browsers:

The following code with escaping can ensure script and style elements will work in both XHTML and HTML, including older browsers.

In both cases, XML ignores the first comment and then uses the CDATA section to avoid the need for escaping special characters < and & within the rest of the contents (with subsequent JavaScript comments added within to ensure the HTML-oriented code is ignored by JavaScript).

In HTML, older browsers might display the content without the content being within a comment, so comments are used to hide this from them (while modern HTML browsers will run code inside the comments). The subsequent JavaScript comment is added to negate the text added for the sake of XHTML.

The <style> requires the /**/ comments since CSS does not support the single line ones.

   <!---->
       ...
   //-->
   <style type="text/css"><!--/*--><![CDATA[/*><!--*/
       ...
   /*]]>*/--></style>

If not concerned about much older browsers (from which one is hiding the HTML) one can use the simpler:

   //
   <style>/*<![CDATA[*/
   
   /*]]>*/</style>

Also note that the sequence “]]>” is not allowed within a CDATA section, so it cannot be used in true XHTML-embedded JavaScript without escaping.

–jeroen

via:

Posted in CSS, Development, HTML, HTML5, JavaScript/ECMAScript, Scripting, Software Development, Web Development | Leave a Comment »

Convert Indesign Sketch to code: Petra Sketch Plugin | Melbourne | Applying Code

Posted by jpluimers on 2019/01/22

Interesting code generator from 3D models into Xamarin, Delphi or Oxygene code:

[WayBack] Petra Sketch Plugin | Melbourne | Applying Code

Convert Sketch drawings to iOS, macOS, Android a​nd​ Windows native drawing code.

[WayBack] Documentation of Petra Sketch Plugin | Melbourne | Applying Code

Via:

–jeroen

Posted in .NET, C#, Delphi, Development, Software Development, Xamarin Studio | Leave a Comment »

Dilbert Comic Strip on 1995-11-09 | Dilbert by Scott Adams

Posted by jpluimers on 2019/01/22

  • The caption says, “Saint Dogbert enters the Land of Cubicles searching for the demons of stupidity.” Dogbert walks down the hall wearing a bishop’s miter and holding a scepter.
  • The caption says, “Suddenly he finds an over-promoted computer guru spouting useless database concepts.” A man sits at a conference table with two glassy-eyed co-workers. The man says, “You’d be fools to ignore the boolean anti-binary least-square approach.”
  • The caption says, “The monster is dispatched to the dark world by the sight of its most feared object.” Dogbert stands on the conference table holding a document in front of the man. Dogbert says, “Look! Actual code!” The man’s head melts into his shirt and a co-worker says, “Cool!”

Source: [WayBackDilbert Comic Strip on 1995-11-09 | Dilbert by Scott Adams

–jeroen

via: [WayBackarchitecture – Why does the .NET framework have no concept of classes as first-class types? – Software Engineering Stack Exchange

Posted in Development, Software Development | Leave a Comment »

Passwordless SSH

Posted by jpluimers on 2019/01/22

Note: if the system you SSH from is ever compromised, then assume the passwordless targets are also compromised!

–jeroen

Posted in *nix, *nix-tools, Communications Development, Development, Internet protocol suite, Linux, openSuSE, Power User, SSH, SuSE Linux, TCP, Tumbleweed | Leave a Comment »

Why don’t I get the warning W1036 Variable “‘MyStrings’ might not have been initialized”…

Posted by jpluimers on 2019/01/21

Historically, [WayBack] W1036: Variable '%s' might not have been initialized (Delphi) has had a lot of gotchas.

The most important still is that it never show for managed types (strings, interfaces, etc).

Usually W1036 shows for non-managed types, but Dan Hacker has found a new case where it does not in [WayBack] Why don’t I get the warning W1036 Variable “‘MyStrings’ might not have been initialized’ if the StringsToDo parameter in DoSomething is defined as a var… – Dan Hacker – Google+

He noticed it in Delphi XE and 10.2 Tokyo.

I tested it with the Win32 compiler in XE8.

This warns:

program W1036;
{$APPTYPE CONSOLE}
uses
  System.SysUtils,
  System.Classes;

procedure DoSomething(var StringsToDo: TStringList); // <-------- this line makes the difference
begin
  //do nothing
end;

procedure Test;
var
  MyStrings : TStringList;
begin
  MyStrings.Free;   {W1036 warning if StringsToDo param is NOT var}
  DoSomething(MyStrings);
end;

begin
end.

This does not warn:

program W1036;
{$APPTYPE CONSOLE}
uses
  System.SysUtils,
  System.Classes;

procedure DoSomething(StringsToDo: TStringList); // <-------- this line makes the difference
begin
  //do nothing
end;

procedure Test;
var
  MyStrings : TStringList;
begin
  MyStrings.Free;   {W1036 warning if StringsToDo param is NOT var}
  DoSomething(MyStrings);
end;

begin
end.

initially, I misread his report and reacted wrongly on the cause (but rightly on the suggested use case of var and of TStringList):

Because a var parameter means that the caller should pass in an initialised parameter. Otherwise it should be an out parameter, not a var parameter.

var parameter for reference types like TStrings (only pass as TStringList if it deliberately is not compatible with TStrings) is a risky thing anyway, because the called method can overwrite it and then the caller has to notice the change, then decide what to do with the previous value (likely free it).

I later correct myself:

Looking better, I think it is a compiler issue.

The only difference between nothing and var is the loading of the parameter as a pointer:

with var

//W1036.dpr.16: MyStrings.Free; {W1036 warning if StringsToDo param is NOT var}
//004CD924 8B45FC mov eax,[ebp-$04]
//004CD927 E8B8A6F3FF call TObject.Free
//Project1.dpr.17: DoSomething(MyStrings);
//004CD92C 8D45FC lea eax,[ebp-$04]
//004CD92F E8E0FFFFFF call DoSomething
without var
//W1036.dpr.16: MyStrings.Free; {W1036 warning if StringsToDo param is NOT var}
//004CD924 8B45FC mov eax,[ebp-$04]
//004CD927 E8B8A6F3FF call TObject.Free
//Project1.dpr.17: DoSomething(MyStrings);
//004CD92C 8B45FC mov eax,[ebp-$04]
//004CD92F E8E0FFFFFF call DoSomething

So:

  • with a var, a pointer to the instance of MyStrings (obtained by a lea instruction) gets pushed on the stack
  • without a var, the instance of MyStrings (obtained by a mov instruction) gets pushed on the stack.

For the difference metween mov and lea, and the use of [] brackets, see:

–jeroen

Source: Why don’t I get the warning W1036 Variable “‘MyStrings’ might not have been i…

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | 3 Comments »

Linus Torvalds – Google+: Working gadgets: Ubiquiti UniFi collection (and a whole bunch of Unifi/Ubiquiti/Ubtn links).

Posted by jpluimers on 2019/01/21

Seems my interest in Ubiquiti needs more research: [WayBackLinus Torvalds – Google+: Working gadgets: Ubiquiti UniFi collection.

Hopefully by now I’ve time to re-design the WiFi coverage in the house and invest in a few of those access points.

Related:

Splitting 5Ghz and 2.4Ghz SSIDs: two ways (I think the second is cleaner)

  1. Either have one WLAN group with a set of SSIDs, then in each access point disable the 2.4Ghz SSID on the 5GHz radio, and disable the 5Ghz SSID on the 2.4Ghz radio
  2. Have different WLAN groups with an SSID (or set of SSIDs) for each frequency, then in each access point select the appropriate group for each radio

For both the first and second one, you need to configure under “Config” -> “WLANs”.

For the second one, you can clone from the first, then change the SSID names.

–jeroen

Read the rest of this entry »

Posted in Power User, Ubiquiti, WiFi | Leave a Comment »

Installing as a LAN -> WiFi bridge: FRITZ!WLAN Repeater 1750E

Posted by jpluimers on 2019/01/21

I have a bunch of [WayBackFRITZ!WLAN Repeater 1750E | Overview | AVM International devices; this is the quickest way to install them as LAN -> WiFi bridge (connect ethernet to your LAN; use the WiFi as a bridge).

  1. Connect the FRITZ!WLAN to your LAN
  2. Connect the FRITZ!WLAN to power
  3. Connect your laptop to the WiFi SSID FRITZ!WLAN Repeater 1750E with password 00000000 (that eight times a zero)
  4. Set your laptop with a fixed IP address 192.168.178.127 with netmask 255.255.255.0 and gateway 192.168.178.2 for WiFi.
  5. Connect to your FRITZ!WLAN at http://192.168.178.2
  6. Setup your FRITZ!WLAN for the first time (password, country) and have it reboot
  7. Logon to the FRITZ!WLAN
  8. Change the WiFI password and the SSID for 2.4 Ghz and 5.0 Ghz channels (I use a different SSID for both as many Fritz!Box devices have both bad 2.4Ghz performance and a hard time to automatically switch from 2.4Ghz to 5.0Ghz on the same SSID automagically).
  9. Change your laptop to use DHCP on WiFi
  10. Reconnect to the Fritz!Box with the new SSID and password

–jeroen

Posted in Fritz!, Fritz!WLAN, Internet, Power User | Leave a Comment »

Google Sheet with forwarding addresses. Please feel free to add yours….

Posted by jpluimers on 2019/01/21

[WayBack] I have created a Google Sheet with forwarding addresses. Please feel free to add yours- only the info you are comfortable with. Please DO NOT add full e… – Di Cleverly – Google+

[Archive.is] Forwarding Addresses – Google Sheets

–jeroen

Posted in G+: GooglePlus, LifeHacker, Power User, SocialMedia | Leave a Comment »