USB tethering a OnePlus One phone to Windows XP

 Android, Windows  Comments Off on USB tethering a OnePlus One phone to Windows XP
Jun 102018
 

For whatever reason my old Windows XP netbook doesn’t connect to our holiday flat’s WIFI while my OnePlus One Android phone does. So I thought I’d simply tether it to the Netbook via USB to get around this problem. I tried that before with other phones and other computers and don’t remember ever having a problem. This time I got a prompt to install a driver for a rndis device, which failed because I had no Internet connection (It might also have failed if I had one but I couldn’t try.)

So I turned to Google and found multiple posts suggesting to download a tetherxp.inf file and simply use that to install the drivers which apparently are already available in a standard Windows XP installation.

I downloaded that file from one of the links, put it in an empty folder and tried to install it. No luck. It took me a while to find this post on quora, which contains an additional point:

4. Now this is where some of you will get lost, you need to open up the tetherxp.inf file with your favorite code editor (Start->Run->Wordpad). Create a new line below “[AndroidDevices.NT.5.1]” containing your Device Instance Id.

This turned out to be the important part: The tetherxp.inf file contained entries for several widely used phones, but of course not for my rather rare one, so I had to add two lines to it:

[AndroidDevices]
; OnePlus One without adb
%AndroidDevice%    = RNDIS, USB\VID_05C6&PID_676A

[AndroidDevices.NT.5.1]
; OnePlus One without adb
%AndroidDevice%    = RNDIS.NT.5.1, USB\VID_05C6&PID_676A

The part after “USB\” is taken from the details pane of the “rndis” device in the hardware manager.

After adding these two lines I switched back to the “Driver” tab and clicked “Install Driver”. In the following Wizard, I selected “No, not this time” -> “Next” -> “Install from a list or specific location” -> “Next” -> “Don’t search, I’ll choose the driver to install” -> “Next” -> “Have Disk” -> “Browse”. Then I selected the modified tetherxp.inf file and pressed “Open” and “OK” and “Next” again. I then had to tell Windows to ignore that the “Driver” was not digitally signed to finally really get it to install it.

Diesmal funktioniert alles. (Spliff, “Computer sind doof”).

Removing Google Fonts from WordPress driving you crazy?

 Delphi  Comments Off on Removing Google Fonts from WordPress driving you crazy?
Jun 082018
 

I just tried to remove all references to Google Fonts from my blog (which is using WordPress) because they can be a issue under the GDPR. There are many descriptions on how to do that and various plugins that claim to do it for you. I tried several ways, but none seemed to work. There was always one GET request going to Google.

Then I realized that I was still looking at my blog logged in as admin, which calls several WordPress tools, one of them apparently is using Google Fonts. So, I used a different web browser which is not logged in on my site. And guess what? No requests going to Google at all.

So I had – again – wasted more than an hour for a bloody GDPR issue.

GExperts 1.3.10 experimental twm 2018-06-03 released

 Delphi, GExperts  Comments Off on GExperts 1.3.10 experimental twm 2018-06-03 released
Jun 032018
 

Given that the last Delphi release was more than a year ago and that I am about to go on vacation so I won’t be able to download and install a new version I would expect a new Delphi release pretty soon. On the other hand this time I actually managed to extend “my” subscription on time so in theory I could download the new version immediately when it becomes available, so the release might still be some time off.
(Greetings from Mr. Murphy)

Anyway, I thought it to be the right time to make a new GExperts release. I even managed to update the version number to 1.3.10 in the executables as well as in the installers and update a few of the auxiliary files.

I have created installers for all supported Delphi versions and I even tested them a bit on some fresh Delphi installations. They do work! How amazing is that?

New features include:

There were also several bug fixes including 3 Unicode issues.

I am pretty sure this new release is more stable than the previous one.

But anyway:

Please be aware that I mostly work with Delphi 2007, so this version can be regarded as tested quite well, followed by Delphi XE2. The others are only known to compile and new features are usually tested superficially with all versions. This is particularly true for Delphi 6/7 and 2005/2006.

Head over to the Experimental GExperts page to download the latest release it.

Impressum und Datenschutzerklärung

 blog  Comments Off on Impressum und Datenschutzerklärung
May 192018
 

Und damit der Amtschimmel was zum Wiehern hat, gibt es jetzt rechts oben Links zum Impressum und zur Datenschutzerklärung.

Bleibt zu hoffen, dass die jeweiligen Generatoren etwas erzeugt haben, was nicht abmahnfähig ist. Mir persönlich gefällt insbesondere die Datenschutzerklärung nicht, denn laut DSGVO soll sie leicht verständlich sein, das was da drin steht, ist es aber nicht wirklich. Aber ich werde den Teufel tun, und jetzt an einem Schriftstück herumfummeln, das von dem Generator auf der Webseite eines Rechtsanwalts erzeugt wurde.

Comments and lots of other features disabled

 blog  Comments Off on Comments and lots of other features disabled
May 192018
 

I have already spent too much time to make my site compliant with GDPR rules. I have disabled

  • comments on all pages (also deleted existing comments)
  • track backs
  • options to like pages
  • direct links to “social” media
  • JetPack features, including site stats

I have also tried to find and remove any requests my site sends to anywhere else but dummzeuch.de.

I’m still not done and I already hate it. Many useful features are now gone, existing comments have been deleted, I will no longer get stats on which pages have been requested.

And I might still decide to shut down the whole thing. I like publishing and interacting with my users, but I don’t want to spend the time for bullshit. So, if on 2018-05-25 you come back here and find that all the content is gone, you can thank the EU and the German government.

Welcome to #neuland.

Nussecken-Rezept (German only)

 German Only  Comments Off on Nussecken-Rezept (German only)
May 102018
 

Meine Frau hat vor kurzem ein altes Familienrezept ausgegraben, das nicht nur ich sondern auch meine Arbeitskollegen sehr lecker fanden. Leider kann ich das für die derzeit in sog. Bäckereien verkauften Nussecken nicht sagen. Die sind in der Regel viel zu süß und werden dazu noch in Schokolade ertränkt (Löbliche Ausnahme: Die Nussecken der Bio-Bäckerei Barth in Koblenz). Dieses Rezept ist anders. Man schmeckt die Nüsse und die Aprikosenmarmelade, nicht nur die Schokolade.

Nuss- oder Kokosecken

(Rezept der Familie Bläsing)

Zutaten für ein Backblech

Teig:

  • 150g Mehl
  • 1/2 getrichener Teelöffel Backpulver
  • 65g Zucker
  • 1 Päckchen Vanillinzucker
  • 1 Ei
  • 65g Butter
  • zum Bestreichen: 2 Esslöffel Aprikosenkonfitüre

Belag:

  • 100g Butter oder Margarine
  • 100g Zucker
  • 1 Päckchen Vanillinzucker
  • 2 Esslöffel Wasser
  • 200g Haselnusskerne (halb gemahlen oder gehackt) oder 200g Kokosraspeln

Guss:

(Die Zubereitung des Gusses ist nicht mehr lesbar, alternativ kann man einfach Schokoladenkuvertüre erwärmen. Oder auch einfach weglassen.)

  • 50g (2 gut gehäufte Esslöffel) Puderzucker
  • 2 gehäufte Teelöffel Kakao
  • 2 Esslöffel heißes Wasser
  • 10g Butter

Zubereitung

Teig:

Den Teig wie Mürbeteig verarbeiten, auf das Backblech ausrollen und mit der Konfitüre bestreichen.

Belag:

Das Fett mit Zucker, Vanillinzucker und Wasser zerlassen und einmal aufkochen.
Die Nüsse daruntermengen und alles kalt stellen.
Die abgekühlte Masse auf dem Teig verteilen.
Vor den Teig einen geknickten Papierstreifen legen, damit die Masse nicht herunterläuft.

Ofen 10 Minuten vorheizen, dann bei 175°-195° 15 Minuten backen.

Das Gebäck etwas abkühlen lassen, in Vierecke schneiden und dann diese nochmals in Dreiecke teilen.

Schokolade erwärmen und sparsam(!) auf die Ecken gießen.

Alles abkühlen lassen und nicht zuviel probieren, die anderen wollen auch noch was ab.

Remote access to the Embarcadero License Center via SSH tunnel

 Delphi  Comments Off on Remote access to the Embarcadero License Center via SSH tunnel
Apr 282018
 

Once you have set up an Embarcadero License Center (ELC) for your company (with network named user or concurrent licenses) you will need network access to it in order to start the Delphi IDE.

Usually the server will only be accessible from within your intranet (I for one would not trust the ELC security to be good enough to let that server directly face the Internet.). So, in order to access it from a remote computer (e.g. your notebook on a customer’s site or your PC in your home office), that computer must have access to your intranet. If the connection is not available, Delphi will revert to offline usage which will work fine until the offline usage period expires which by default is 7 days but can be configured to up to 30 days.

There are multiple options to provide that access, the one I use is SSH tunneling via Putty.

By default the ELC listens on port 5567 for clients to connect to it, that port is specified when importing a license into ELC and cannot be changed later. The license manager reads the server name and port from the .slip file you provided to it, so you need a way to

  1. Resolve the name to the IP address
  2. Tunnel the port to your intranet

Let’s say, the name of your server is elc.yourcompany.local, its internal IP address is 192.168.1.200 and it listens on the default port 5567.

Name resolution can easily be done by adding an entry to the hosts file, but which IP do put there? If you add the IP of the actual server, it will not work, because that IP is in the intranet and your computer is not, so routing will fail. But using ssh you can tunnel local ports to remote ports, so we add our localhost IP (127.0.0.1) to the hosts file:

# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host
#
# localhost name resolution is handle within DNS itself.
#       127.0.0.1       localhost
#       ::1             localhost
127.0.0.1 elc.yourcompany.local

This will tell the client to expect the server to be listening on 127.0.0.1:5567. Now we only need to tunnel that local port to the actual ELC server by adding an entry to Putty:

Don’t forget to save that session configuration in order for it to be available later.

Now, simply connect your ssh session, start Delphi and voila, it will connect to the ELC, request a license and you are done.

TThread is not a normal class

 Delphi, GExperts  Comments Off on TThread is not a normal class
Apr 222018
 

In Delphi, threads have traditionally been implemented as classes descending from TThread. While there have been quite a few improvements to multithreading, TThread is still the most compatible way. But TThread is not a normal class.

In a normal class, the constructor and destructor usually look like this:

constructor TSomeClass.Create;
begin
  inherited;
  FSomeList := TStringList.Create;
end;

destructor TSomeClass.Destroy;
begin
  FreeAndNil(FSomeList);
  inherited;
end;

In the constructor, we first call inherited and afterwards add code to initialize additional fields of the object. In the destructor we first free any fields of the object and only then call inherited for the ancestor class to free its resources.

Now, TThread is peculiar because its constructor and destructor are usually executed in the program’s main thread, while its Execute method is executed in a different thread. But, when is that thread started? It’s started when you call the inherited constructor. So any initialization that thread needs must be done before calling inherited!

Edit: Several people have pointed out that my claim is somewhat “outdated”, where “outdated” means that since Delphi 6 the thread is started in the AfterConstruction method rather than in Create. In Delphi 5 it was the last command in TThread.Create (here is a probably not authorized copy of that code, search for “Delphi5Thread” on the page).

What I wrote about the destructor is still true though.

constructor TMyThread.Create;
begin
  FSomeList := TStringList.Create;
  inherited;
end;

Otherwise the field FSomeList might not have been initialized when the thread tries to access it.

Similar, if the thread is still running, you must be sure that all the resources it requires are available until it has stopped. So, the first thing would be to tell the thread to terminate, wait for it to actually do that and only then destroy it.

MyThread := TMyThread.Create;
// do something else while the thread does its thing
// ...
// now tell it to terminate (this is standard way of doing that
// but it might not be the best)
MyThread.Terminate;
// and destroy it
FreeAndNil(MyThread);

But that’s only half of it. The destructor must also take care not to destroy anything the thread still needs:

destructor TMyThread.Destroy;
begin
  // first, wait for the thread to terminate
  // (the inherited destructor calls WaitFor)
  inherited;
  // now the thread has definitely terminated, so we can free the resources
  FreeAndNil(FSomeList);
end;

Beware: These are just the simplest precautions to take when programming with multiple threads. As they say: "Creating threads is easy but multithreading is hard." If you can, use a library that does the ground work for you.

Why do I blog about this? I just fixed a few Access Violations in GExperts that were caused by TThread objects implemented the wrong way. (I have no idea who did that, it’s quite possible that I am myself to blame for that.)