[yoy - Why-O-Why]yoy - “Why-O-Why”

» frame | home browse filter search | refresh | log on

  printed donderdag 29 januari 2015 17:15:20 from www.yoy.be

yoy.be - Why-O-Why

Welcome 06/05/2005
Is this your first visit? Click here for more information about this site. QuickStart...

selected recent changes and comments, log in to see more, browse or filter to see all...

user: StijnSanders commented on: 9/01/2015 17:21:10 "Even snel een login-procedure maken"...

Gaat ook hierover: http://blog.codinghorror.com/the-god-login/

About WideChar and CharInSet...

I posted this on Google+ a while ago, but didn't think of posting it here, so here it is.

I'm sorry, but I have to vent this: (Attention: what follows is a rant about something with programming in Delphi)
What's up with this?

[dcc32 Warning] W1050 WideChar reduced to byte char in set expressions.  Consider using 'CharInSet' function in 'SysUtils' unit.

CharInSet?! It contains Result:=C in CharSet; so it is actually just a tiny wrapper. But one that causes an extra jump, stack frame and return! Very wasteful of resources, and typically in places where I want iterations to go as fast as possible.

TSysCharSet, by the way, is apparently fixed to a set of byte chars. So I suppose some implicit conversion takes place. I wonder why SysUtils' CharInSet doesn't get a warning then? Not even one like this:
[dcc32 Warning] W1058 Implicit cast with potential data loss from 'WideChar' to 'Char'

But more importantly, I think it goes against the grain of the language. With Pascal being firmly rooted in the academic and mathematic, it saddens me deeply that I can not describe a set of WideChar literals. They're ordinal constants like any other, or am I mistaken?

In other words: if I take some old code where s is still just string, is it too much to expect s[i] in ['0'..'9'] to compile to something that checks if the 16-bit value falls between these two 16-bit limit values or not? As far as I know, it's easily done in both 32 and 64 bits machine code. (*1)

Oh, and one more thing. All of this is darkly overshadowed by this: http://utf8everywhere.org/ with which I most strongly agree. Regretfully I do a lot of work on a platform that has decidedly chosen for the 16-bit-character way of handling text, so I have to work with it up to where I can decide to do it otherwise. In practice this means my programming is a mix of WideString and UTF8String complexed by the ennerving equivalence of the latter with AnsiString.

*1: I know, I know, I should be using Unicode's IsDigit, but I have a lot of existing code for parsing script that uses a lot of while s[i] in [..] do inc(i); (*2)

*2: I know, I know, I should be using a lexer/tokenizer/compiler-compiler. See also: a lot of existing code.

*3: Skipping to the last paragraph are we? All right then:
tl;dr: I strongly regret that "WideChar reduced to byte char in set expressions"

location: Application Development > Programming Languages > Object Pascal > Delphi
created: 8/01/2015 23:58:11 « modified: 8/01/2015 23:58:11 weight: 0
tokens: delphi



Of the 5 existing versions of UUID, version 4, based on a mostly random value, is most widely in use. Though chances of a collision are astronomically low, it is not nihil. Also key sequentiality is lost.

In this day and age of highly connected systems, and highly standardised administration thereof, these issues are addressed by this proposal, while still using the available provisions made for UUID values.


UUID with value:
after this AND-mask is applied:

consists otherwise of values with this provenance:

A (16 bits): A unique identifier assigned to a corporation, organization or institution that assumes ownership of the software generating the UUIDs, as registered by a single global (online?) registry.
See http://yoy.be/UUIDv6 (for now? see below. if this will find any acceptance and/or could accrue some budget to host something definitive, it'll move)

B (16 bits): A unique identifier assigned to the specific application, database or software suite, as registered by above corporation, organization or institution, optionally also publically registered in the single global registry.

C (16 bits): A unique identifier assigned to the specific instance or installation of this application, database or software suite.

D (12 bits): reserved for future use, use only 000 for now

E (12 bits): A unique identifier assigned to a certain set or collection of entities within this application or database.

F (16 bits): A range identifier assigned from a central storage in the application or database to one single of possibly many sources of UUIDv6 values.

G (32 bits): A unique index into the assigned range.
If the range is depleted by having generated all possible UUID values with this range, and no new range identifier(s) are readily available, the UUID value source should fall back to UUID v4 values, based on 122 random bits.

Optionally the number of bits used by F and G may use a different partition of the total of 48 bits. Take care when making changes to this, so the values generated by the new partition will not collide with any values currently in use.


Listed here for these few first entries, may get moved to a more permanent location later:

0001;(testing/staging/private use);for testing, staging or private use only

0001;0001;(testing/staging/private use);for testing, staging or private use only

location: Information > Technology > Information Technology > GUID
created: 5/11/2014 15:39:56 « modified: 5/11/2014 16:09:32 weight: 0
tokens: (friendly-url) coding

The ongoing search for the best suitable font.

There is something mesmerizingly strange about the font “PT Sans” (and “PT Sans Serif” and “PT Mono” for that matter, but in this specific case it’s about “PT Sans”).

For something at work I was looking for a font to use throughout a set of applications and a web-site to tie them together and set them apart from all of the other day-to-day work that people at work do. Therefore this font has a lot of requirements to conform to:

I have tested a large number of fonts for all of these. Some are too wide, some too narrow, some too ugly, some too frivolous. Some are bad at the default screen size. Some are too much just another Helvetica clone. A few were only missing a bold or italic version. I know what I’m asking for is a lot, but fonts that get close are generally of a certain age, further along than version ‘1.0’. It takes a lot of work to make a font, and a lot more of work to make a good font. It shows when the font has gotten a lot of care and attention.

From time to time I search the web for other fonts and go through a procedure to test them: make the website use the font, watch a number of pages with lists and common operations to see what they look like. If I like that, put the font up in an application and see if that looks good. Then run the application on the oldest workstation to see what it looks like.

I like to read about the story behind a font. Who made it, why was it made, what was it originally used for. (How come it’s made free for use?) There is so much there.

For now “PT Sans” is about the only font that fits all of my wishes the best. This is the strange thing about it. It appears to be made specifically for Cyrillic script, but the Latin are really good as well. It’s well balanced, does digits well, renders on screen resolution good. So by that logic there must have been a very large amount of work put into it. Based on a very rich set of knowledge on the subject. But I don’t find any record of that, or don’t know where to look for it.

But that’s it. The last few searches have not resulted in a better fit to my needs than “PT Sans”. The project is in development still, but is using “PT Sans” throughout. It’s looking great. Helping its little bit to make a splendid first impression to everyone I’ve demoed to up till now.

And look at that capital Q. Look at it.

location: www.yoy.be > users > StijnSanders > IRL
created: 3/10/2014 18:50:06 « modified: 3/10/2014 19:06:40 weight: 0
tokens: werk coding weblog

user: StijnSanders commented on: 14/05/2014 23:13:28 Odo

data link changed from OLEDB/ADO to SQLite3.dll

xxmData.pas: Convert queries.xml to queries.sql

It's nice to see projects work nicely together. Especially when they're your own projects. I've combined WikiEngine and xxm (and TSQLite) before. Now I've changed xxmData.pas so it no longer uses XML to store the queries in, but a plain SQL file, which you can load into any SQL editors (especially nice when it has code-completion). So I have a number of queries.xml to transform into queries.sql. There's a tool for that: RE, download queries_xml_to_sql.rxe, change the file path and run it to transform the XML into SQL using the new notation.

location: freeware > xxm
created: 7/05/2014 23:57:28 « modified: 7/05/2014 23:57:56 weight: 0
tokens: coding references:          

user: StijnSanders commented on: 20/04/2014 21:21:22 DelphiProtocolBuffer

Update: rethinkdb 1.13 will drop protocol buffers from it's network protocol in favor of JSON (see here)


When looking to start a Delphi rethinkdb connector, I soon enough found out I'll need a separate solution to work with Google's Protocol Buffer definition files.
And this is it: dpbp: the Delphi Protocol Buffer Parser. It parses a .proto file, and outputs a .pas unit that defines a class for each message. They inherit from TProtocolBufferMessage (defined in the ProtBuf.pas unit) and have the internals to load/save the property values. Run dpbp without command line parameters to see the options you can use to fine-tune the generating process.

Available under the MIT license.

location: freeware
created: 11/04/2014 22:17:47 « modified: 11/04/2014 22:19:03 weight: 0
tokens: delphi

Web Application Security

Read this excellent post:

The xxm version could look something like this:

d:=(Context as IxxmHttpHeaders).ResponseHeaders;
d['X-Content-Security-Policy']:='default-src ''self''';
d['X-XSS-Protection']:='1; ''mode=block''';

location: freeware > xxm
created: 31/03/2014 17:08:01 « modified: 31/03/2014 17:08:01 weight: 0

user: anonymous user commented on: 6/01/2014 18:33:33 RegEx Golf

 ^(?!.*(.)(.)\2\1) works for #5, for 193 points

user: StijnSanders commented on: 1/01/2014 21:54:19 Regular Expression

To whomever this might be of interest: I've decided to open-source this project: https://github.com/stijnsanders/RE

user: StijnSanders commented on: 20/12/2013 22:32:55 Regular Expression

- fixed issue with file left open after save
- 'Builder' item (Multiple)
- 'Groups' item (RegEx)

RegEx Golf

Spoiler alert (don't look below if you indend to have a go yourself first)
this is how I got 3003 points and all green checkmarks on http://regex.alf.nu/ with only about half an hour wasted.

1.  Plain strings (205)
Warming up:
2.  Anchors (208)
Yes, I know about anchors:
3.  Ranges (202)
And about ranges:
4.  Backrefs (201)
And about backrefs:
5.  Abba (188)
Had to look up negation for this one since I generally do that in periferal logic
6.  A man, a plan (162)
What's the plan? And a little cheat to nip that one on the right that ends with p
7.  Prime (262)
All odd numbers except 2 and 25 and multiples of 3
8.  Four (182)
Four vowels? Except the latin tree
9.  Order (179)
I'm getting lazy, just fiddled around with classes to get this one
10. Triples (565)
Tired even, just did a blunt force on this one, I don't know how to make regex'es do math, still a nice score though
11. Glob (310)
Just enumerating combinations here, could perhaps be shorter but I'm thinking about grabbing a bite in a minute
    ^((.+) matches \2|\*(.{3,6})\*(.*)? matches .+\3.+\4.*|(.+)\* matches \5.+|\*(.+) matches .+\6|^[b\*][ipr].+)$
12. Balance (283)
Oh this one is just a trick from the book
13. Powers (56)
Only I forgot how to recurse expressions

location: spotted on the net > IT-related > development related
created: 20/12/2013 17:20:54 « modified: 22/12/2013 23:03:02 weight: 0

user: StijnSanders commented on: 20/06/2013 0:38:20 md5.pas

update! there appears to be an issue with UTF8String constants in Delphi XE

user: StijnSanders commented on: 17/04/2013 23:14:43 DirFind

- Multi-line matches show first line when double-click matching file

Bitcoin Grant: funding the future


Realistisch gezien, maak ik geenenkele kans. Maar, stel! Stel dat het mogelijk zou zijn dat je uit het anonieme een bedrag krijgt per maand waar je comfortabel kan leven, om in ruil je tijdens de kantoor-uren in te zetten voor het constructief meewerken aan een of meer open-source projecten. Hoe zou dat in het echt werken? Ik vroeg me recent al af als ik eventuele winsten die ik dit jaar zou halen op de stijgende Bitcoin koers moet aangeven aan de inkomstenbelasting. Hoeveel is het forfait eigenlijk? Ik denk niet dat ik dat zal bereiken, maar toch. Zou de fiscus het snappen? "Waar komt dat geld van? Is het zwart?" Eeuh, nee, ja, misschien, ik weet het niet. In theorie kan je het zelfs niet weten. Gezien er geen bedrijfsvorm is die je als werknemer inschrijft, zal dit als zelfstandige moeten. Gemakkelijker gezegd dan gedaan in ons apenlandje, en best met wat gevolgen. Zoals wat je moet afdragen aan de sociale kas en ervoor zorgen dat je boekhouding klopt voor onder meer BTW. Urgh. En als dat in de vorm van een eenpersoonsbedrijf moet moet dat waarschijnlijk met een businessplan, en marktonderzoek? Hoe ligt open source software in de markt? Dat alleen al ligt moeilijk want dat zorgt niet rechtstreeks voor je inkomsten. Bon, overdag braaf gaan werken en 's avonds als hobby wat sleutelen aan een sourceforge/github/codeplex dingetje lijkt plots al bij al zo slecht nog niet.

location: spotted on the net > IT-related > development related
created: 8/04/2013 19:50:27 « modified: 8/04/2013 19:50:27 weight: 0

"database locked" errors with SQLITE_CONFIG_SERIALIZED

I've been impressed by sqlite3 ever since I get to know about it. It's open source, and even more it's really put in the public domain completely avoiding the licensing headache. I haven't read the source in great detail, but as I understand it it's all in a single big file! Even how it works internally is impressive.

Since I didn't like the options available, I created my own very thin wrapper for sqlite3.dll without much trouble. Only in this one multi-threaded application, I've run into an occasional "database locked" error, so I had to search documentation and source for what I can do about it.

Working with other database solutions, I've had the common sense of using a database connection for each thread, so each could work with the database undisturbed by eachother. As it turns out this is not required with sqlite3! As stated with SQLITE_CONFIG_SERIALIZED, which is the default setting, you're better off using a single connection over all threads. Indeed in my case it solved the "database locked" errors.

location: Application Development > Data Storage > SQLite
created: 23/03/2013 22:36:26 « modified: 23/03/2013 22:36:26 weight: 0
tokens: delphi

Delphi's TDateTime in a datetime column: how to manipulate from SQL?

Thanks to sqlite's manifest typing, it's possible to insert Delphi's TDateTime values in a field defined by SQL as datetime. I was using this for a while without any problem before I found out sqlite was actually storing a floating point value. There may be a problem though when you try to manipulate these dates with SQL. I searched around for a suitable conversion, and using default sqlite features, I came up with this code:

datetime('1900-01-01','+'||myDateField||' day')

where myDateField is a column or value of type datetime.

location: freeware > TSQLite
created: 19/03/2013 22:25:01 « modified: 19/03/2013 22:25:01 weight: 0

user: StijnSanders commented on: 26/02/2013 18:54:11 MetaKeys

- bug: settings mix-up between delay and repeat
- added numpad.kbl: numpad only layout

user: StijnSanders commented on: 21/02/2013 18:21:45 MetaKeys

- drag to move not on keys
- repeat timer settings
- 'sticky' system key added to be.kbl, us.kbl

user: StijnSanders commented on: 20/02/2013 21:54:16 MetaClick

- don't operate when a mouse button is physically pressed
- 'orbit' selects by proximity, not by having to move over the labels
- setting: cross limb length

user: StijnSanders commented on: 1/02/2013 21:46:07 MetaClick

- division by zero fixed when showing no buttons
- 'orbit' feature (enable by setting Return to: orbit)
- extra cursor tag settings

How to create a shell extension context menu.

I've put it up here, but since it's a pretty good boiler plate code, I'll put it up here as well. Include a unit like this one into an ActiveX library. I especially had a though time to get the values right that are based on idCmdFirst and get sent back when a menu item is invoked. Something that gives pretty strange results if you don't get it right.

unit demoContextMenu;


  Windows, Classes, ActiveX, ComObj, ShlObj;


  { TContextMenu }
  TContextMenu = class(TComObject, IShellExtInit, IContextMenu)
	{ IShellExtInit }
	function IShellExtInit.Initialize = SEIInitialize;
	function SEIInitialize(pidlFolder: PItemIDList; lpdobj: IDataObject;
	  hKeyProgID: HKEY): HResult; stdcall;
	{ IContextMenu }
	function QueryContextMenu(Menu: HMENU; indexMenu, idCmdFirst, idCmdLast,
	  uFlags: UINT): HResult; stdcall;
	function InvokeCommand(var lpici: TCMInvokeCommandInfo): HResult; stdcall;
	function GetCommandString(idCmd: UINT_Ptr; uType: UINT; pwReserved: PUINT;
	  pszName: LPSTR; cchMax: UINT): HResult; stdcall;
	procedure Initialize; override;
	destructor Destroy; override;

  Class_ContextMenu: TGUID = '{put a new GUID here by pressing Ctrl+Shift+G}';


uses ComServ, SysUtils, Registry;

procedure TContextMenu.Initialize;

destructor TContextMenu.Destroy;

function TContextMenu.SEIInitialize(pidlFolder: PItemIDList;
  lpdobj: IDataObject; hKeyProgID: HKEY): HResult; stdcall;
  StgMedium: TStgMedium;
  FormatEtc: TFormatEtc;
  if lpdobj=nil then Result:=E_INVALIDARG else

	if not(Failed(Result)) then
	  for i:=0 to c-1 do

function TContextMenu.QueryContextMenu(Menu: HMENU; indexMenu, idCmdFirst,
  idCmdLast, uFlags: UINT): HResult; stdcall;
  AppendMenu(h,MF_STRING,idCmdFirst+i,'Menu item one');      inc(i);
  AppendMenu(h,MF_STRING,idCmdFirst+i,'Menu item two');      inc(i);
  AppendMenu(h,MF_STRING,idCmdFirst+i,'Menu item three');    inc(i);
	MF_BYPOSITION or MF_POPUP or MF_STRING,h,'DemoContextMenu');

function TContextMenu.InvokeCommand(var lpici: TCMInvokeCommandInfo): HResult;
  Result := E_FAIL;
  //not called by application
  if HiWord(Integer(lpici.lpVerb))=0 then
	  Result := NOERROR;
	  case LoWord(Integer(lpici.lpVerb)) of
		1:;//perform action one (use data in Files:TStringList)
		2:;//perform action two
		3:;//perform action three
		else Result := E_INVALIDARG;

function TContextMenu.GetCommandString(idCmd: UINT_Ptr; uType: UINT;
  pwReserved: PUINT; pszName: LPSTR; cchMax: UINT): HResult; stdcall;
  if idCmd=0 then
	if (uType=GCS_HELPTEXTW) then
	  StrCopy(pszName,'Perform one of several functions on files');

  TContextMenuFactory = class(TComObjectFactory)
	procedure UpdateRegistry(Register: Boolean); override;

procedure TContextMenuFactory.UpdateRegistry(Register: Boolean);
  if Register then
	inherited UpdateRegistry(Register);

	ClassID := GUIDToString(Class_ContextMenu);
	CreateRegKey('*\shellex', '', '');
	CreateRegKey('*\shellex\ContextMenuHandlers', '', '');
	CreateRegKey('*\shellex\ContextMenuHandlers\DemoContextMenu', '', ClassID);

	CreateRegKey('Folder\shellex', '', '');
	CreateRegKey('Folder\shellex\ContextMenuHandlers', '', '');
	CreateRegKey('Folder\shellex\ContextMenuHandlers\DemoContextMenu', '', ClassID);

	if Win32Platform=VER_PLATFORM_WIN32_NT then
		r.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions',True);
		r.WriteString(ClassID,'DemoContextMenu Shell Extension');


	inherited UpdateRegistry(Register);

  TContextMenuFactory.Create(ComServer, TContextMenu, Class_ContextMenu,
	'', 'DemoContextMenu Shell Extension', ciMultiInstance, tmApartment);

location: Application Development > Programming Languages > Object Pascal > Delphi > ActiveX / COM objects
created: 12/11/2012 16:41:31 « modified: 12/11/2012 16:42:58 weight: 0
tokens: delphi

user: StijnSanders commented on: 7/11/2012 20:42:46 SideSwitch


- taskbar-icon on taskbar item (Shell_TrayWnd)
- Ctrl+Shift shows class name (for use with FindWindow)
- fixed issue on minimize/close with larger fonts
- option to disable taskbar stay-on-top (Win7)

user: StijnSanders commented on: 18/10/2012 10:05:40 Create a shortcut from code.

See also here for more information on the IShellInfo interface:


user: anonymous user commented on: 12/10/2012 15:06:08 ExecuteReader requires the command to have a transaction...

Helped me. Thanks.



E-mail over HTTP

It might be a stupid idea, but why has no-one ever thought of mapping SMTP/POP3/IMAP onto HTTP. (Or has someone?)
I know, there's a lot on the blogosphere about e-mail and it being broken in all kinds of ways, or not at all, but I don't want to touch upon that.

What I think it really is about is a clean straight-forward way of sending asynchronous messages to eachother. SMTP was created specifically for that. But it is getting old. Really old. Even so, it is based on a number of even older protocols (RFC822, anyone?). It's only normal that protocols cooperate or are based on eachother, but some are clearly established and are a really good fit for most if not all situations and environments, and some are established but happen to be the least worse solution that is available, just waiting to get replaced by something better, as soon as the folk could agree on the replacement.

HTTP was designed to transport hypertext. At first from a server to a client, but basically in any direction. And thanks to MIME, anything really. And face it, isn't almost all of our e-mail in hypertext nowadays? So HTTP and SMTP may have a lot in common, except HTTP has seen a lot more evolution as far as I know, both in design and in support by hardware and software.

How would it work? Just like an MX-record, something else (HTMX-record?) could point at a URL for the domain of an e-mail address. (And I mean full URL: http/https, (sub)domain, path, etc...) So the sender starts a request:

POST /incomingmail HTTP/1.1
Host: example.com
From: "John Doe" <john.doe@acme.us>
To: "James Day" <james.day@example.com>
Subject: Meeting invitation about some project
Date: Sat, 29 Sep 2012 15:38:11 +0000
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: deflate
Content-Length: 1234

At this point the server can respond with '100 Continue' or a suitable error code when spam detection or a blacklist does its job.

Same for POP3/IMAP: much like this REST thing that's getting so much attention, HTTP verbs GET and DELETE should be all you need to sift through the wad of timewasters people send you daily.

But, off course, it's just an idea. I've got lots of interesting stuff to work on before I'll put time in this probably, but if you think it's a good idea, let me know.

location: Opinions > Computer related > Internet
created: 30/09/2012 1:35:03 « modified: 30/09/2012 1:35:03 weight: 0
tokens: internet

user: StijnSanders commented on: 28/09/2012 22:52:01 AllSorts (shell extension)

Switched over to Lazarus, and is now available in both 32 and 64 bits.
Added option "copy content", supports UTF-16, UTF-8 or the current 8-bit encoding.

"Even snel een login-procedure maken"...

Ik dacht 'ik bouw even snel een login-procedure op die website', niets van. Laat dat 'even snel' maar weg, en 'login-procedure' is volgens de regels van de kunst ook niet meer wat het was als je het vergelijkt met begin de jaren 90. Laat ik dan even snel even een exhaustieve lijst proberen op te stellen: (Als ik iets vergeet geef me een seintje!)

location: www.yoy.be > users > StijnSanders > IRL
created: 15/09/2012 16:32:15 « modified: 29/09/2012 11:29:56 weight: 0
tokens: internet coding

user: StijnSanders commented on: 12/09/2012 21:29:39 SideSwitch


- horizontal positioning relative to configured icon height
- 'Clear' now uses window enumeration instead of GetWindow(,GW_HWNDNEXT)
- not showing zero pixel windows

user: StijnSanders commented on: 2/09/2012 23:10:01 How to recreate 70's 'programming conditions'

 Came across this golden oldie: The UNIX-Haters' handbook

user: StijnSanders commented on: 23/07/2012 21:50:08 SideSwitch

- minimize/restore and close buttons
  (hold Ctrl to make 'x' send WM_QUIT instead of WM_CLOSE)
- no longer showing GetLastActivePopup duplicates (unless Ctrl is pressed)
- no longer showing window maximized on other monitor that restores to this monitor
- hold Shift to show all top-level windows
- setting: timeout to get window icon (was 150ms before)
- setting: mirror window position when switching between monitors
- opening pop-up menu rests hide timer to 5 seconds
- fixed issue that was not showing minimized windows in some situations

user: StijnSanders commented on: 9/07/2012 11:06:28 BSON and arrays

 Also, please remember to accept my answer if you found it satisfactory.

user: StijnSanders commented on: 9/07/2012 8:23:10 BSON and arrays

I did! Have a look. Things to remember:

BSON and arrays

 Dear Mr. Sanders:

I posted a question on stackoverflow,
it is fully in your grip, so please take a while to see it! thank you!

location: freeware > TMongoWire
created: 8/07/2012 7:50:12 « modified: 8/07/2012 7:50:12 weight: -100

user: StijnSanders commented on: 4/07/2012 21:58:00 Regular Expression

update: fixed a minor issue with the 'Repeat' item, added 'Groups' item (RegEx), (forgot to update the version number, still at

user: StijnSanders commented on: 10/05/2012 21:06:57 DirFind

- issue expanding closest line above for lower indentation-levels over blank lines
- shell context menu on files/folders items
- command line parameters support:
    DirFind [<options>] <search path> [<filter filenames> [<exclude filenames> [<search pattern>]]]
      /i  ignore case
      /m  multi line
      /a  count all matches
      (/-... to disable, default settings are loaded from previous session)

Force Application.Run to skip the message loop (from within OnCreate event handler).

Warning: this is a very specific hack an may not apply to other situations.

For a number of projects that check for an update of the program executable on the central file server, from within the main form's OnCreate event handler, I was searching for a way to 'skip' Application.Run; when an update is found. I was using "raise EAbort.Create('Auto-update available.');" already to skip the remainder of the OnCreate event handler, but back in the project source (.dpr), Application.Run would start and perform the message loop. I used PostQuitMessage before, but that doesn't seem to always work, a better way would be to skip the message loop altogether.

I used "if SelfUpdateAvailable then Application.Run;" for some time, but in any new project that would use the auto-update mechanism, you would have to remember to put it in, or the support-calls after the first update for the program would remind you, or have you wondering first what's wrong with the auto-update this time. Anyway, it's better to leave the .dpr just the way Delphi hands it to you since it will modify it later when you add forms or data modules.

So I figured out I could disarm Application.Run by calling this from the 'start auto update' code:


This causes Application.MainForm to be unassigned, and Application.Run to skip starting the message loop, mission accomplished.

location: Application Development > Programming Languages > Object Pascal > Delphi
created: 10/05/2012 13:13:32 « modified: 10/05/2012 13:14:52 weight: 0
tokens: delphi

user: anonymous user commented on: 24/04/2012 1:15:26 ExecuteReader requires the command to have a transaction...

 great info....thank you so much


[MetaKeys icon]Download: MetaKeys_setup.exe ~672KB
MetaKeys is a resizable, customizable on-screen keyboard.

Softpedia 100% Clean Award bitcoin accepted

location: freeware
created: 17/04/2012 22:30:50 « modified: 26/02/2013 18:53:47 weight: 0
tokens: (friendly-url) (item on yoy.be homepage) references:  

How to recreate 70's 'programming conditions'

When getting my batchelor CS, we were the last batch to get COBOL. (They replaced it with Java the next year. And Pascal with C++ as well, by the way.) It feels like I was the only one that understood the code width was limited to 72 characters and had to start at position 8, just to be sure it would fit on Hollerith cards. We had all the modern editors and compilers of the age, so I never worked with cards and tape.

I searched around a bit back then, and remember reading about how hard programming was back in the 70's (pre-dating my existance). COBOL was there just to make the process somewhat easier, and serve as a stepping-stone to a working result so you wouldn't have to do it all in raw processor-code. You still had to 'write' the program, prepare it as a stack of cards, get over the the card-reading office in time for when you're on the schedule (don't drop the cards!), wait for mainframe time to get around to having the compiler run on your code, and just hope and pray you finally would get something else back than a print-out of syntax errors. If the mail-boy didn't misfile it.

I remember even earlier on errors would arise because cards would get out of order (like I said, don't drop the stack, which regretfully unfortunately did happen), or even worse no compiler-errors arise and it only later gets apparent when the program behaved unexpectedly. (Did they even do debugging back then?) This was easily (...) solved by introducing code-line-numbers and have the (pre-)compiler order the lines from the input-file by number.

So I was wondering, in this day and age of virtual reality, advanced computing and online gamified educational experiences, would it be interesting to have something so us youngsters could appreciate how it was back then, by trying to recreate how it was to code. I'm not so much thinking about an emulated PDP-11 with a hall of tape stations. I'm more thinking of cubicles, internal mails, stacks of cards, print-outs, fighting for a few minutes of terminal access...

It's just an idea though. I'm afraid I don't have the time and skill to create a game like this.

location: www.yoy.be > users > StijnSanders > nice idea's but no time to spend on them
created: 16/04/2012 11:17:11 « modified: 16/04/2012 11:17:11 weight: 0
tokens: coding

user: StijnSanders commented on: 12/04/2012 18:26:08 MetaClick

AutoClick is now called MetaClick!

- changed name to MetaClick (previously AutoClick)
- issue with default settings on first run
- smaller button margin (2 instead of 6 pixels)
- setting: avoid selected applications


[MetaClick icon]Download: MetaClick_setup.exe ~677KB
MetaClick does mouse clicks for you when you're unable to click, or when clicking is an opeation that takes a lot of effort.

Get it from CNET Download.com!When the mouse pointer stops moving, MetaClick counts down a fixed interval and orchestrates a mouse click. This may cause you to click more than normally, but there's a lot of space to direct the click to when you don't need the click (e.g. the application caption bar), and if you think about it, in most cases you move to somewhere to click there. Switching modes enables double-clicks, drag operations, and rolling the scrolling wheel!

Softpedia 100% Clean Award Famous Software Download FindMySoft.com Safe To Install Award: AutoClick
BrotherSoft Editor's PickBrothersoft rating: 5/5 Reviews on SoftSea Reviews on SoftSea bitcoin accepted

location: freeware
created: 12/04/2012 18:18:36 « modified: 20/02/2013 21:53:36 weight: 0
tokens: (friendly-url) (item on yoy.be homepage) references:  

user: StijnSanders commented on: 12/04/2012 18:09:43 DirFind

- bug reading UTF16/UCS2 files
- issue updating display on abort

user: StijnSanders commented on: 5/04/2012 21:22:21 DirFind
token: delphi

I've switched back to Delphi. The .Net version had trouble running more than three threads, and behaved strangly when exceptions occur. The option to use three regex'es in one run is gone, but there's an option now to use Execute instead of Test showing both the number of files that match, and the exact total number of matches in these files.
Also new is that when you double-click a matching line (double-click a file-node to get these), you not only get the five preceding and succeding lines, you also get the lowest preceding line of each lower level of indentation. It's hard to explain, but in most languages you should get the lines that starts the scope the line is in: namespace, function, method, loop or condition branch.

user: StijnSanders commented on: 30/03/2012 21:57:46 md5.pas
token: (friendly-url)


user: StijnSanders commented on: 16/02/2012 20:28:59 md5.pas

 Code in a slightly modified form also used here: https://github.com/stijnsanders/TMongoWire/blob/master/mongoAuth.pas

user: StijnSanders commented on: 16/02/2012 20:27:10 md5.pas
token: (friendly-url)



This is odd, it looks like there isn't an open source md5.pas unit. And by open source I mean under a permissive license or without copyright or licensing. So I set out to write my own and share it here. I based it on the original RFC, and even more the description than the reference implementation, because it uses a few of those C tricks I don't like. I hope it's performant enough, in case you're demanding performance of it. I've done some testing myself, but if you detect any kind of issue, please let me know.

md5.pas with MD5Hash for strings, sometimes used with passwords

md5Stream.pas with MD5HashFromStream which takes any kind of stream (TFileStream, TMemoryStream...), and optionally a preset number of bytes to take from the stream (from the current position!).


Update: since MD5 and SHA1 are really similar, I've done the same for SHA1 and added sha1.pas and sha1Stream.pas.
Update 2: since I needed it for something else, I've added RIPEMD160 as well. And while I'm at it SHA256 as well

md5.zip (12KB)

location: freeware
created: 16/02/2012 20:26:41 « modified: 6/05/2014 19:07:31 weight: 0
tokens: delphi (friendly-url)

COM/ActiveX objects and Windows Vista and newer

Applications that provide one or more ActiveX/COM automation objects, created with older versions of Delphi, running without administrative privileges, throw an EOleSysError when strarting up (typically from within the Application.Initialize;). This is because the application will try to register its type library and class registrations when it starts. Add this unit to the project to silent this error at run-time:

unit comFixW6;



uses Windows, SysUtils, ComObj;


procedure FixComInitProc;
    if SaveInitProc<>nil then TProcedure(SaveInitProc);
    on e:EOleSysError do if e.ErrorCode<>TYPE_E_REGISTRYACCESS then raise;



location: Application Development > Programming Languages > Object Pascal > Delphi > ActiveX / COM objects
created: 2/02/2012 21:55:51 « modified: 2/02/2012 22:01:41 weight: 0
tokens: delphi

[MetaKeys icon]A fully customizable resizable on-screen keyboard.
[MetaClick icon]In search of stress relief for your fingers? Have MetaClick send clicks where you hover the mouse.
[DirFind icon]Grep is fine, grep is good, but feel free to join the GUI age and find what you're searching for in a single overview.
yoy TortoiseSVN icons
Have you made your own TortoiseSVN icon sets already?
I did. (v1.6 ready)
[XML RSS 2.0]
[Valid RSS]

Check PageRank

[DirDiff icon]Two copies of files and both have been modified? Don't despair, diff the changes and prepare the merge in no time!
[SideSwitch icon]Two monitors and only one taskbar? Keep track of your apps with a list on each screen.
[TB icon]Is  tabbed browsing the answer? Who knows. Try TreeBrowse for another alternative.
  Get it from CNET Download.com!
[Odo icon]"How long have I been working on this?"
"When did I start this morning?"
Never wonder again. And see how much you really do on mouse and keyboard.
[BarcodeStuff icon]Delphi code to generate barcodes in two steps. First encode information in a TBits object, then render the TBits sequence into something, e.g. a bitmap or HTML.
Regular Expression
[RE icon]Struggled with scripting RegEx's just to get something from a large file?
Build them into something that works right-a-way with click and drag