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

Archive for October, 2018

Aside from the Wayback Machine, what are other options for getting screenshots of websites from the past? – Quora

Posted by jpluimers on 2018/10/15

I’ve used these myself:

There are many more listed in for instance these links:

IIPC OpenWayBack:

–jeroen

Posted in Internet, InternetArchive, Power User, WayBack machine | Leave a Comment »

TweeterID – Twitter ID and username converter

Posted by jpluimers on 2018/10/12

Especially HTC devices used to store part of the context information like this:

<HTCData><Twitter>id:11111111/friendof:00000000</Twitter></HTCData>

[WayBack] TweeterID – Twitter ID and username converter:

Convert any Twitter account’s username or @handle into its respective Twitter ID, or convert ID to username

You can also do the Twitter ID to @handle conversion by URL (at the time of writing, neither existed, which is intentional: replace your own ID there) [WayBack] permalinks – URL link to Twitter user with ID, not name – Stack Overflow:

I could not find a twitter URL that does the conversion the other way around.

–jeroen

 

Posted in Power User, SocialMedia, Twitter | Leave a Comment »

Zamzar – video converter, audio converter, image converter, eBook converter – via @Matijn

Posted by jpluimers on 2018/10/12

Even for Geeks like me, this is a great on-line tool for converting media files: [WayBack/Archive] Zamzar – video converter, audio converter, image converter, eBook converter

Thanks Matijn for pointing me to this.

And for nerds there is ffmpeg:

for name in *.ogg; do ffmpeg -i "$name" -ab 128k -map_meta_data 0:0,s0 "${name/.ogg/.mp3}"; done;

–jeroen

Read the rest of this entry »

Posted in Audio, Emoticons, ffmpeg, Geeky, Media, Power User, Video | Leave a Comment »

Retr0bright – Wikipedia

Posted by jpluimers on 2018/10/12

For removing the yellowing of ABS plastics:

In addition to homemade gel mixtures, hydrogen peroxide-based hair bleaching creams available at beauty supply stores can also be used as a ready-made mix.

[WayBackRetr0bright – Wikipedia

More background information:

–jeroen

Read the rest of this entry »

Posted in History, LifeHacker, Power User | Leave a Comment »

MotionEyeOS on Odroid C1+ with Logitech USB web cameras

Posted by jpluimers on 2018/10/11

Hopefully I get this to work after fixing

The first part of the fix was to

  1. re-image the SD card.
  2. boot
  3. wait 5 minutes (there is no output on HDMI apart from some flickering and no output on TTY using 115200 bits/second despite trying [WayBacken:c1_hardware_uart [ODROID Wiki])

The second part is getting the USB web cameras to work.

I’ve got two types, but the label on them doesn’t list their common name, only their P/N sometimes with M/N:

  1. P/N 860-000049 M/N V-UBC40 (really old USB cameras)
  2. P/N 860-000334 (new USB camera)

The MotionEyeOS web interface didn’t list any working cameras so I had to do some digging.

Luckily [WayBackWebcam software and driver support for Windows has a table of part and model numbers combined with product names, so they got revealed them as these:

  1. P/N 860-000334 = M/N V-U0028  with name HD Pro Webcam C920
  2. P/N 861225 = M/N V-UBC40 with name Quick Cam Messenger
    (which is funny as the P/N on the label is different)

Both are supported by motion according to [WayBackLogitech < Motion < Foswiki though the Quick Cam Messenger needs [WayBackQuickcam Messenger & Communicate driver for Linux which I should try to cross-compile one day.

The latter works fine. Below are some settings I used.

Read the rest of this entry »

Posted in *nix, Development, Hardware Development, Linux, Odroid, Power User | Leave a Comment »

database connection – Looking for a generic way to pool TCusomConnection in Delphi – Stack Overflow

Posted by jpluimers on 2018/10/11

What is the proper way for pooling of TCustomConnection instances in Delphi, that allows to distinguish between instances that have effectively equal connection properties and the ones that are effectively unequal?

I’ve tried searching the RTL and VCL sources and didn’t find a generic way.

I could copy either of the specific ones I found (see list below) and adapt them to a more generic solution or adapt one of the answers in #16404051 to be for TCustomConnection, but I wonder if there is an existing solution for TCustomConnection in the first place.

Specific ones I found in Delphi XE8:

  • DBX: unit Data.DBXPool
  • FireDAC: unit FireDAC.Stan.Pool
  • IBX: unit IBX.IBConnectionBroker

Source [WayBackdatabase connection – Looking for a generic way to pool TCusomConnection in Delphi – Stack Overflow

Hopefully by now I’ve some implementation for this that works nicely.

If not, these might get me started too:

In the .NET world, I take these things for granted, and it looks like ADO already does it out of the box as well:

–jeroen

via: [WayBack] Is there a Delphi library that allows for pooling of TCustomConnection… – Jeroen Wiert Pluimers – Google+

Posted in Delphi, Delphi XE8, Development, Software Development | 2 Comments »

linux – dmesg time vs system time time isnt correct – Server Fault

Posted by jpluimers on 2018/10/10

[WayBacklinux – dmesg time vs system time time isnt correct – Server Fault helped me solve this problem with an Odroid C1+ running busybox:

[root@meye-062016b9 ~]# hwclock --show
Wed Apr  3 20:25:47 2013  0.000000 seconds
[root@meye-062016b9 ~]# date
Wed May 31 09:48:18 UTC 2018
[root@meye-062016b9 ~]# hwclock --systohc --utc
[root@meye-062016b9 ~]# hwclock --show
Wed May 31 09:48:29 2018  0.000000 seconds
[root@meye-062016b9 ~]# date
Wed May 31 09:48:35 UTC 2018
[root@meye-062016b9 ~]#

Note: If your logging clock in /var/log/dmesg.log is wrong by an exact couple of hours, then try [WayBacksyslog time wrong – but date returns the correct time? and edit [WayBack] /etc/sysconfig/clock.

The above involves looking if I can get MotionEyeOS working Giving up on the official Ubuntu for Odroid C1 image.

So far not much luck: the Ubuntu got hosed, but before it was stable as in that didn’t reboot suddenly.

Now the MotionEyeOS (which is busybox based) reboots itself without notice about every 3 minutes, despite no other hardware connected and trying 3 different power supplies.

The Odroid C1+ only draws 0.34 Ampère at 5.13 Volt which is well within specs.

I’m puzzled:

[Wed May 31 09:49:51 2018] Booting Linux on physical CPU 0x200
[Wed May 31 09:52:20 2018] Booting Linux on physical CPU 0x200
[Wed May 31 09:54:50 2018] Booting Linux on physical CPU 0x200
[Wed May 31 09:57:19 2018] Booting Linux on physical CPU 0x200
[Wed May 31 09:59:49 2018] Booting Linux on physical CPU 0x200
[Wed May 31 10:02:22 2018] Booting Linux on physical CPU 0x200
[Wed May 31 10:04:56 2018] Booting Linux on physical CPU 0x200
[Wed May 31 10:07:26 2018] Booting Linux on physical CPU 0x200
[Wed May 31 10:09:59 2018] Booting Linux on physical CPU 0x200
[Wed May 31 10:12:29 2018] Booting Linux on physical CPU 0x200
[Wed May 31 10:14:58 2018] Booting Linux on physical CPU 0x200

jeroen

Posted in *nix, *nix-tools, Power User | Leave a Comment »

TObjectHelper for easier debugging a cast mismatch and a typed FreeAndNil

Posted by jpluimers on 2018/10/10

The below came in really useful in an old project I took over that was full of bugs having to do with improper casts and FreeAndNil usage.

EDIT 20181010: WordPress.com keeps mangling angle-brackets in pre and code sections, so I added the code to a gist; see link below.

First the examples.

procedure TMyServer.UnbindFromIdTcpServerStatusContext(const aContext: TIdContext);
var
  lClientSession: TClientSession;
begin
  lClientSession := TObjectHelper.Cast<TClientSession>(aContext.Data);
...
end;

type
  TBaseDataInterface = class(TObject)
  strict private
    FDatabase:      TIBDatabase;
    FTransaction:   TIBTransaction;
...
  end;


destructor TBaseDataInterface.Destroy();
begin
  TObjectHelper.FreeAndNil(FDatabase);
  TObjectHelper.FreeAndNil(FTransaction);
...
  inherited Destroy();
end;

And the implementation.

unit ObjectHelperUnit;

interface

type
  TObjectHelper = record
    class function Cast<T: class>(const aValue: TObject): T; static;
    class procedure FreeAndNil<T: class>(var Value: T); static;
  end;

implementation

uses
  System.SysConst,
  System.SysUtils;

class function TObjectHelper.Cast<T>(const aValue: TObject): T;
var
  lException: Exception;
begin
  if Assigned(aValue) then
  begin
    if aValue is T then
      Result := T(aValue)
    else
    begin
      lException := EInvalidCast.CreateFmt('%s; actual type %s but expected %s.',
        [SInvalidCast, aValue.QualifiedClassName, T.QualifiedClassName]);
      raise lException;
    end;
  end
  else
    Result := nil;
end;

class procedure TObjectHelper.FreeAndNil<T>(var Value: T);
begin
  System.SysUtils.FreeAndNil(Value);
end;

end.

–jeroen

Gist:


unit ObjectHelperUnit;
interface
type
TObjectHelper = record
class function Cast<T: class>(const aValue: TObject): T; static;
class procedure FreeAndNil<T: class>(var Value: T); static;
end;
implementation
uses
System.SysConst,
System.SysUtils;
class function TObjectHelper.Cast<T>(const aValue: TObject): T;
var
lException: Exception;
begin
if Assigned(aValue) then
begin
if aValue is T then
Result := T(aValue)
else
begin
lException := EInvalidCast.CreateFmt('%s; actual type %s but expected %s.',
[SInvalidCast, aValue.QualifiedClassName, T.QualifiedClassName]);
raise lException at ReturnAddress;
end;
end
else
Result := nil;
end;
class procedure TObjectHelper.FreeAndNil<T>(var Value: T);
begin
System.SysUtils.FreeAndNil(Value);
end;
end.


procedure TMyServer.UnbindFromIdTcpServerStatusContext(const aContext: TIdContext);
var
lClientSession: TClientSession;
begin
lClientSession := TObjectHelper.Cast<TClientSession>(aContext.Data);
end;
type
TBaseDataInterface = class(TObject)
strict private
FDatabase: TIBDatabase;
FTransaction: TIBTransaction;
end;
destructor TBaseDataInterface.Destroy();
begin
TObjectHelper.FreeAndNil(FDatabase);
TObjectHelper.FreeAndNil(FTransaction);
inherited Destroy();
end;

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

tcp – How can I trigger a script when a certain port becomes available for requests? – Unix & Linux Stack Exchange

Posted by jpluimers on 2018/10/09

Netcat to the rescue waiting for a Windows 10 upgrade to finish (which can take hours):

while ! nc -z 172.22.0.67 3389; do echo "sleeping"; sleep 10; done; echo 'The server is up!'

Via: [WayBacktcp – How can I trigger a script when a certain port becomes available for requests? – Unix & Linux Stack Exchange, quoting from the answer:

  • nc is Netcat, “the Swiss-army knife for TCP/IP”,
  • -z means: do not send any data, just check if the port is open,
  • while ! nc -z …; do sleep 0.1; done: keep checking and sleeping for one tenth of a second until the port opens up, i.e. Netcat returns with a zero (success) status.

–jeroen

Posted in *nix, *nix-tools, Communications Development, Development, Internet protocol suite, Power User, TCP, Windows | Leave a Comment »

Giving up on the official Ubuntu for Odroid C1 image

Posted by jpluimers on 2018/10/09

After the trouble in Ubuntu: Fixing the myserious “Failed to stop apt-daily.timer: Connection timed out” I got into more trouble:
apt-get update && apt-get upgrade hung the device.

It booted fine, but a new update showed it was in a hosed state.

I don’t expect vendor supported distributions to fail this way, so I gave up on the ubuntu-16.04-minimal-odroid-c1-20160817.img.xz .

–jeroen


root@odroidC1:~# apt-get update && apt-get upgrade
Hit:1 http://ports.ubuntu.com/ubuntu-ports xenial InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports xenial-updates InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports xenial-backports InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports xenial-security InRelease
Hit:5 http://deb.odroid.in/c1 xenial InRelease
Reading package lists… Done
E: dpkg was interrupted, you must manually run 'dpkg –configure -a' to correct the problem.
root@odroidC1:~# dpkg –configure -a
Processing triggers for ureadahead (0.100.0-19) …
Setting up initramfs-tools (0.122ubuntu8.8) …
update-initramfs: deferring update (trigger activated)
Processing triggers for systemd (229-4ubuntu17) …
Processing triggers for initramfs-tools (0.122ubuntu8.8) …
update-initramfs: Generating /boot/initrd.img-4.4.0-28-generic
WARNING: missing /lib/modules/4.4.0-28-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-28-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_FQEGW2/lib/modules/4.4.0-28-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_FQEGW2/lib/modules/4.4.0-28-generic/modules.builtin: No such file or directory
root@odroidC1:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 396M 0 396M 0% /dev
tmpfs 81M 3.3M 78M 5% /run
/dev/mmcblk0p2 59G 1.1G 55G 2% /
tmpfs 403M 0 403M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 403M 0 403M 0% /sys/fs/cgroup
/dev/mmcblk0p1 128M 11M 118M 9% /media/boot

Posted in Development, Hardware Development, Odroid | 3 Comments »