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

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

  printed woensdag 23 juli 2014 16:09:57 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: 14/05/2014 23:13:28 Odo

v0.4.0.366
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)

DelphiProtocolBuffer

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:
http://perltricks.com/article/81/2014/3/31/Perl-web-application-security-HTTP-headers

The xxm version could look something like this:

[[@xxmHeaders,]][[!var
d:IXxmDictionary;
]][[
d:=(Context as IxxmHttpHeaders).ResponseHeaders;
d['Server']:='';
d['X-Frame-Options']:='DENY';
d['Strict-Transport-Security']:='max-age=3600';
d['X-Content-Security-Policy']:='default-src ''self''';
d['X-Content-Type-Options']:='nosniff';
d['X-Download-Options']:='noopen';
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

v2.0.3.350
- 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:
    a?foo
2.  Anchors (208)
Yes, I know about anchors:
    k$
3.  Ranges (202)
And about ranges:
    [a-f]{4}
4.  Backrefs (201)
And about backrefs:
    (...).*\1
5.  Abba (188)
Had to look up negation for this one since I generally do that in periferal logic
    ^(?!.*([aeio])(.)\2\1)
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
    (.)(.)((.)\4|.?)\2\1([^p]|$)
7.  Prime (262)
All odd numbers except 2 and 25 and multiples of 3
    ^(?!(xxx){2,}?$)(?!x{25}$)(xx|x(xx)+)$
8.  Four (182)
Four vowels? Except the latin tree
    ([aeiou])(?!.*eae)(.*?\1){3}
9.  Order (179)
I'm getting lazy, just fiddled around with classes to get this one
    ([a-c][c-f]|[l-o]o|h[io]|[st]y)
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
    ([03]0[369]|402|[035]1[25]|390|175|^953|^32|[06]0[02]$|7[258]0?$)
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
    ^((((((((((x)\10?)\9?)\8?)\7?)\6?)\5?)\4?)\3?)\2?)\1?$

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

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

Bitcoin Grant: funding the future

http://bitcoingrant.org/

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

v1.0.2.335
- 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

v1.0.1.333
- 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

v1.2.1.333
- 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

v1.2.0.328
- 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;

interface

uses
  Windows, Classes, ActiveX, ComObj, ShlObj;

type
  PItemIDList=LPCITEMIDLIST;

  { TContextMenu }
  TContextMenu = class(TComObject, IShellExtInit, IContextMenu)
  private
	Files:TStringList;
  protected
	{ 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;
  public
	procedure Initialize; override;
	destructor Destroy; override;
  end;

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

implementation

uses ComServ, SysUtils, Registry;

procedure TContextMenu.Initialize;
begin
  inherited;
  Files:=TStringList.Create;
end;

destructor TContextMenu.Destroy;
begin
  Files.Free;
  inherited;
end;

function TContextMenu.SEIInitialize(pidlFolder: PItemIDList;
  lpdobj: IDataObject; hKeyProgID: HKEY): HResult; stdcall;
var
  StgMedium: TStgMedium;
  FormatEtc: TFormatEtc;
  i,c:integer;
  s:string;
begin
  if lpdobj=nil then Result:=E_INVALIDARG else
   begin
	FormatEtc.cfFormat:=CF_HDROP;
	FormatEtc.ptd:=nil;
	FormatEtc.dwAspect:=DVASPECT_CONTENT;
	FormatEtc.lindex:=-1;
	FormatEtc.tymed:=TYMED_HGLOBAL;

	Result:=lpdobj.GetData(FormatEtc,StgMedium);
	if not(Failed(Result)) then
	 begin
	  c:=DragQueryFile(StgMedium.hGlobal,$FFFFFFFF,nil,0);
	  for i:=0 to c-1 do
	   begin
		SetLength(s,1024);
		SetLength(s,DragQueryFile(StgMedium.hGlobal,i,PChar(s),1024));
		Files.Add(s);
	   end;
	  ReleaseStgMedium(StgMedium);
	  Result:=NOERROR;
	 end;
   end;
end;

function TContextMenu.QueryContextMenu(Menu: HMENU; indexMenu, idCmdFirst,
  idCmdLast, uFlags: UINT): HResult; stdcall;
var
  h:HMENU;
  i:integer;
begin
  i:=1;
  h:=CreatePopupMenu;
  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);
  InsertMenu(Menu,indexMenu,
	MF_BYPOSITION or MF_POPUP or MF_STRING,h,'DemoContextMenu');
  Result:=i;
end;

function TContextMenu.InvokeCommand(var lpici: TCMInvokeCommandInfo): HResult;
  stdcall;
begin
  Result := E_FAIL;
  //not called by application
  if HiWord(Integer(lpici.lpVerb))=0 then
	begin
	  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;
	  end;
	end;
end;

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

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

procedure TContextMenuFactory.UpdateRegistry(Register: Boolean);
var
  ClassID:string;
  r:TRegistry;
begin
  if Register then
   begin
	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
	 begin
	  r:=TRegistry.Create;
	  try
		r.RootKey:=HKEY_LOCAL_MACHINE;
		r.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions',True);
		r.OpenKey('Approved',True);
		r.WriteString(ClassID,'DemoContextMenu Shell Extension');
	  finally
		r.Free;
	  end;
	 end;

   end
  else
   begin
	DeleteRegKey('Folder\shellex\ContextMenuHandlers\DemoContextMenu');
	DeleteRegKey('*\shellex\ContextMenuHandlers\DemoContextMenu');

	inherited UpdateRegistry(Register);
   end;
end;

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

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

 v1.0.5.320

- 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:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb774950(v=vs.85).aspx

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

Helped me. Thanks.

Ajay

dotnetfor.com

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)

v1.1.4.318
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

v1.0.4.312

- 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

v1.0.3.303
- 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,
http://stackoverflow.com/questions/11380576/how-to-write-the-mongodb-code-in-delphi
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 2.0.2.270)

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

v2.0.2.300
- 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>]]]
    options:
      /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:

  Application.ControlDestroyed(Application.MainForm);

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

[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!

v1.1.0.290
- 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

[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

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

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

v2.0.0.288
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)

(md5)(md5/)(sha1)(sha1/)

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)

(md5)(md5/)

md5.pas

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!).

Enjoy. 

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;

interface

implementation

uses Windows, SysUtils, ComObj;

var
  SaveInitProc:pointer=nil;

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

initialization
  SaveInitProc:=InitProc;
  InitProc:=@FixComInitProc;

end.

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

user: StijnSanders commented on: 2/02/2012 21:21:18 >=, <= operators

If I look at this page, the query you're looking for would look like this in JSON notation for example 'x>10':

{x:{$gt:10}}

in Delphi notation this could be written as:

BSON(['x',BSON(['$gt',10])])

or in the condensed form (where one BSON call does the embedded levels):

BSON([x,'[','$gt',10,']'])

>=, <= operators

Very nice, I'm trying it.

Is there a way to use >=. <= operators for quering objects? I know I should use &gt, but, how to use it with TMongoWireQuery?

location: freeware > TMongoWire
created: 2/02/2012 14:02:01 « modified: 2/02/2012 21:31:28 weight: -100
tokens: coding

Delphi 6: Sockets.pas doesn't call WinSock.closesocket!!!

I've made a strange discovery! The code in Delphi's default Sockets.pas doesn't call WinSock's closesocket! (At least Delphi 6, newer versions may have this fixed) Which causes a handle leak when you use TTCPClient and related classes. (At least in Delphi 6 and 7, I haven't been able to check newer versions.)
Update: I've found this item on edc's qc (from 2002!)

I've done extensive debugging to find out which would make the best work-around and this is what I came up with:

class
  TMyTCPClient = class(TTCPClient)
public
procedure
Close; override; end;


procedure TMyTCPClient.Close;
var
  h:TSocket;
begin
  h:=Handle;
  inherited;
  if h<>INVALID_SOCKET then closesocket(h);//handle leak?
end;

You need to keep a local copy of the Handle value, since inherited performs shutdown-code, but also sets the socket handle value to INVALID_SOCKET without calling closesocket.

There appears to be an OnDestroyHandle event, but the socket's handle is no longer available by the time it gets called.

It's a nasty little bug that also only pops up unexpectedly after a long time running. It took me a pretty long while with intensive sleuthing now and them, but I'm glad I found this.

location: Application Development > Programming Languages > Object Pascal > Delphi
created: 30/01/2012 14:43:11 « modified: 2/02/2012 22:17:10 weight: 0

Printer.Canvas is not threadsafe!

What a strange discovery I made today. I was hunting down a weird exception we noticed in the logs of the live system.

It turns out that a 'global' callback procedure is being called when you use Printer.Canvas (Printer.Canvas.StretchDraw in my case) by the GDI subsystem. The default AbortProc in Printers.pas calls Application.ProcessMessages, which was causing trouble in my case.

There's a quick workaround:

function MyAbortProc(Prn: HDC; Error: Integer): Bool; stdcall;
begin
  Result := not FPrinter.Aborted;
end;

And then right after Printer.BeginDoc; call SetAbortProc(Printer.Canvas.Handle,MyAbortProc);

location: Application Development > Programming Languages > Object Pascal > Delphi
created: 26/01/2012 19:46:39 « modified: 26/01/2012 19:46:39 weight: -200
tokens: delphi

MetaKeys
[MetaKeys icon]A fully customizable resizable on-screen keyboard.
MetaClick
[MetaClick icon]In search of stress relief for your fingers? Have MetaClick send clicks where you hover the mouse.
DirFind
[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)
RSS
[XML RSS 2.0]
[Valid RSS]
ClustrMaps


Check PageRank

DirDiff
[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
[SideSwitch icon]Two monitors and only one taskbar? Keep track of your apps with a list on each screen.
TreeBrowse
[TB icon]Is  tabbed browsing the answer? Who knows. Try TreeBrowse for another alternative.
  Get it from CNET Download.com!
Odo
[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
[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