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

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

  printed zaterdag 19 mei 2012 15:13:54 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: 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 ~469KB
MetaKeys is a resizable, customizable on-screen keyboard.

Softpedia 100% Clean Award bitcoin accepted

location: freeware
created: 17/04/2012 22:30:50 « modified: 29/04/2012 17:15:55 weight: 0
tokens: (friendly-url) 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 ~472KB
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: 18/04/2012 23:48:37 weight: 0
tokens: (friendly-url) (item on yoy.be homepage)

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.

md5.zip (6KB)

location: freeware
created: 16/02/2012 20:26:41 « modified: 30/03/2012 21:57:26 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

Trajectmeting E17

Achthonderdduizend euro! Achthonderd duizend euro is al besteed aan een systeem om op twee punten langs een weg een poging te doen om je nummerplaat geautomatiseerd te lezen, en aan de hand van de tijd daartussen vast te stellen of de bestuurder zich hield aan de maximumsnelheid of niet. Eerst las ik dat er abnormaal zware voorwaarden waren gesteld om te blijven opereren in extreme condities zoals diepe vorst, maar daarna las ik dat er ernstige fouten zaten in zelfs de allerlaatste test-metingen. Het eerste is misschien storend, maar heb ik begrip voor, dat laatste is ronduit verschrikkelijk.

Ik vermoed, ook hier, dat er offertes zijn opgehaald bij precies drie bedrijven (omdat het er minimum drie moeten zijn), eentje belachelijk duur, eentje terecht duur, maar te duur in vergelijking met de derde en goedkoopste. Ik schreef bijna belachelijk goedkoop, maar achthonderdduizend blijft een bedrag dat ik wel eens graag bij de lotto zou willen winnen (minimum natuurlijk). Ik hoef u er waarschijnlijk niet bij te vertellen welke twee van de drie het beste voor-onderzoek voor hebben gedaan.

Het grappige aan dit alles is dat ik laatst op het werk een proof-of-concept opstelling heb opgesteld om met een minimum aan middelen 'barcodes in de verkeerde richting' te scannen langs een transportband. Ik gebruikte open-source-software en een webcam die we als relatiegeschenk kregen en in de kast was beland. Als ik even mijn eigen bestede tijd niet reken, dan kom ik zelfs niet met een veelvoud van mijn budget aan het totaal van de offerte die we een professionele firma lieten opstellen, want alle veelvouden van nul zijn ook nul.

Misschien is dit niet helemaal te vergelijken met juridisch geldige trajectmeting op de openbare weg, maar volg even mee. Tijdens het familiale chaufferen van het voorbije oud-en-nieuw-weekend, speelde ik met het volgende in gedachten. De grootste materiaalkost zou moeten de beeldvormende toestellen zijn. Daar kan je niet rond. Ik lees dat er voor de trajectmeting op de E17 voor infra-rood werd gekozen, maar dit ernstige invloeden ondervind van wind en weer. Dit zou beter zijn om de tekst op nummerplaten waar te nemen, maar ik geloof dit niet echt. Een nummerplaat is nog altijd bedoeld om het best met het blote oog waar te nemen. Dus gebruiken we best 'gewone' camera's die zichtbaar licht meten. Dit zal ook de kost drukken want je vind ze nagenoeg overal tegenwoordig.

In een andere dimensie, bijvoorbeeld een waar ik het voor het zeggen zou hebben, zou de inrichtende macht gewoon kunnen opleggen dat elke nummerplaat moet magnetisch of radiografisch reageren op een elektronische lus in het wegdek met een digitale code die de belettering van de nummerplaat reproduceert, maar dit ligt waarschijnlijk zowel politiek als inzake privacy best gevoelig.

Dan, eenmaal je beeld kan vastleggen, moet je op zoek naar de nummerplaat. Er bestaat waarschijnlijk wel open-source OCR software (of er zou er moeten bestaan), maar die zou ik niet zomaar loslaten op het rauwe beeldmateriaal. Meeste nummerplaten zijn van dezelfde grootte, en dus zou je moeten kunnen snel op zoek gaan in het beeld naar een rechthoek van deze verhouding. Nummerplaten hangen meestal horizontaal, da's ook handig. Zelfs als je geen nummerplaat kan waarnemen, ik denk aan bezoekers uit het buitenland of tijdelijke oplossingen achter de voorruit, dan zou ik er durven op wedden dat de specifieke verhouding van breedte en hoogte, en eventueel andere kenmerken van de omtrek, van alle auto's die tegelijk op het stuk trajectmeting aanwezig zijn, een behoorlijk hoge graad van uniciteit vertoont (een beetje zoals deze).

Deze gegevens moeten allemaal nog verwerkt worden, maar veel moet dat niet kosten. Tegenwoordig worden rekeneenheden niet alleen veel kleiner maar ook veel goedkoper. (Ken je deze?) En iets anders kiezen dan 'gewone' STP netwerkkabels zoals ze overal al liggen zou ik ook niet doen.

Dit alles zou toch veel minder moeten kosten dan wat nu al weer is verdwenen van de staatsrekeningen? Toegegeven, er kruipt nog een hoop werk in. Tegen weer en wind de dingen gaan ophangen. Uitgebreid testen, finetunen, controleren... Maar net dat zijn ze nu waarschijnlijk ook aan het doen. Al maanden lang.

location: Opinions > ".be"-related
created: 2/01/2012 8:29:04 « modified: 2/01/2012 8:30:29 weight: 0
tokens: politiek actueel

user: StijnSanders commented on: 27/12/2011 22:35:42 Hoe noemde dat nu weer?

 just! en ook hier:
 

user: anonymous user commented on: 16/12/2011 15:51:51 Hoe noemde dat nu weer?

 Nu ook op dvd: http://www.youtube.com/watch?v=u4cR8Qj5iRE

user: anonymous user commented on: 16/12/2011 15:50:25 Hoe noemde dat nu weer?

http://en.wikipedia.org/wiki/The_Tripods  

user: StijnSanders commented on: 11/12/2011 23:55:33 xxm

release v1.1.5.285

- xxmHSYS: HTTPAPI handler
- bug fixed: parameters were parsed from request body multiple times
- when BufferSize is set, contexts keep buffers to save on allocating and releasing memory

Warning: the new xxmHSys1 handlers, build using HTTPAPI v1, use the xxm.xml file as a project registry, but require one or more project names to be listed in the command line in order to start hosting the project over HTTPAPI. This might change in a future version. This allows to evaluate xxmHSys1 and test its performance.

release v1.1.4.284

- upload progress monitoring interface
- new IXxmContext members: BufferSize, Flush
- optional project interface to handle exceptions: IXxmProjectEvents

Only three items this release, but three strong, useful features that should have been in there all along.
BufferSize has a default value of 0 so developers new to xxm can experience the fact that data sent gets though to the client as fast as possible, but it's highly recomended to set BufferSize on larger projects except when debugging.

user: StijnSanders commented on: 18/11/2011 0:29:54 Odo

v0.3.0.277
I was under the false impression that SetWindowsHookEx would throw virus-warnings when used to catch messages globally, but this is not the case. Since it catches events more reliably and using less resources, I've updated odo to use a mouse and keyboard hook to count events.
(Doesn't work on 64-bit processes, and no longer supports 'fix102', if you use the feature, don't upgrade! I might re-introduce it in subsequent versions)

Een 'eenvoudige' controle bij aanbestedingen?

Ik had een idee deze morgen. Stel dat een ambtenaar op zoek moet naar een minimum aantal offertes voor een openbare aanbesteding voor iets heel specifiek. Hij/zij vind er eentje, maar moet er meer hebben volgens de regels. Stel dat alle contacten en het zoeken in de buurt en het bedrijfsregister niets opleveren, wat dan? Nu dacht ik, stel dat die terecht kan bij de federatie van de sector. Ik weet niet of de staat federaties van verscheidene bedrijfstakken herkent, maar die zouden toch goed geplaatst moeten zijn om over een overzicht te beschikken van welke leden welk specifiek werk zouden kunnen verrichten voor de staat (aan de beste prijs/kwaliteit). Of als er te weinig zijn onder de leden een initiatief nemen om een nieuwe samenwerken op te zetten.

Meer nog, welke controle op offertes in openbare aanbestedingen is er eigenlijk? Zelfs als er aan een minimum aantal is voldaan, zou ook daar niet een vakfederatie goed geplaatst zijn om het kaf van het koren te scheiden? En misschien zelfs een extra filter op corruptie te zijn. Als ze zelf niet te correupt zijn natuurlijk... Dus hoe zou de controle op beroepsfederaties moeten gebeuren?

Maar ik zit waarschijnlijk maar wat uit mijn nek te kletsen, want eigenlijk ken ik daar helemaal niets van.

location: Opinions > ".be"-related
created: 17/11/2011 23:30:10 « modified: 17/11/2011 23:30:10 weight: 0
tokens: politiek

Vet-taks? Wat dacht je van een anti-cocooning-taks?

De vet-taks. Geen rokers in de horeca. Een strengen voedsel-inspectie. Cocooning en de verzuring van de maatschappij. Politieke desinteresse. Nog 5 miljard extra inkomsten zoeken. Al dat economisch en politiek nieuws doet rare dingen in mijn hoofd.

Plots dacht ik zo wat het zou doen als ze een ongunstig BTW-regime zouden instellen voor voeding voor thuis-gebruik. Niet alleen vette voeding of kant-en-klaar maaltijden, maar gewoon alle voedsel bedoeld om thuis te gebruiken. Samen met een verlaagd BTW-tarief voor de horeca zou het dan misschien wel lukken om de mensen ertoe te brengen meer buitenshuis te eten. Echte fauteuilaardappelen trekken hier misschien hun neus voor op, en denken misschien direct aan riant eten in een restaurant, maar een gewoon eethuis om de hoek is ook al goed.

De verhoogde vraag naar gewone maaltijden zou de plaatselijke economie ten goede komen. De werkgelegenheid. Misschien ook de volksgezondheid. Maar misschien vooral dat de mensen meer onder elkaar komen. Dat zou moeten het sociaal weefsel ten goede komen.

En zou het meer opbrengen voor de staat? Als het lukt om mensen meer te doen gebruik maken van het betere BTW-regime in de horeca, misschien niet, maar lijkt me helemaal niet erg. Als je ziet wat het op allemaal andere gebieden zou kunnen betekenen dan is de originele BTW-aanpassing eigenlijk maar een kleine operatie, maar die moet wel doelgericht en secuur worden uitgevoerd. En ik reken natuurlijk ook op de strenge voedselveiligheid-inspectie.

Maar het is allemaal maar een ideetje natuurlijk.

location: Opinions > ".be"-related
created: 9/11/2011 20:26:40 « modified: 9/11/2011 20:26:40 weight: 0
tokens: politiek actueel

mini-milestone: first auto-build through a cross-project include

Woohoo! the first auto-build from a second project by using a cross-project include. It'll be available in the next release, but first I'll have to make sure you can't get a deadlock by re-including from the first project... and complete this demo project... and documentation...

location: freeware > xxm
created: 8/11/2011 22:39:39 « modified: 8/11/2011 22:39:39 weight: 0

Liquidatiereserve

Ik zit met een idee. Als een bedrijf sluit is dat jammer. Er zijn altijd gevolgen van die de mensen treffen. Soms is het een klein jong bedrijf dat niet slaagde in vooropgestelde doelen. Soms is het een grote onderneming waarvan de buitenlandse directie beslist te verhuizen naar een land met lagere lonen.

Stel nu dat alle bedrijven verplicht zouden zijn om een 'liquidatie-reserve' op te bouwen, met daarin een bedrag die zou moeten de kosten van een sluiting dekken. Bij kleine bedrijven is dit niet zo veel omdat het vereffenen van de bezittingen normaal nog iets kan opbrengen. Bij grote bedrijven is dit de geschatte kost van de ontslagpremies, plus de sociale opvolging achteraf, plus eventuele herbestemmingskosten van grotere bedrijventerreinen. Eventueel nog dingen, ik ben geen ekspert op dit gebied.

Is het vreemd dat de staat bedrijven verplicht om geld op zij te houden? Misschien. Maar als het van pas komt zal het goed zijn dat dat geld klaar staat. En geld is nooit alleen. Als de staat oplegt het binnen het land moet worden bewaard, dan neemt het nog altijd deel aan de lokale economie.

location: Opinions > ".be"-related
created: 2/11/2011 15:36:13 « modified: 2/11/2011 15:37:12 weight: 0
tokens: politiek

Power user trick: restart the Printer Spooler service.

Sometimes, there's still one or more jobs in the printer queue, none are deleting or cancelled or in an error state, the printer is powered on, connected, doesn't report any error also, but doesn't start printing. It's a strange situation, but just happens to happen from time to time. This power user trick comes in handy: (No guarantees: this may still not work if something else actually is causing the disruption)

This breathes new live into the print job sub-system and may sometimes cause the 'hanging' jobs to resume printing.

location: www.yoy.be > users > StijnSanders > IRL
created: 13/09/2011 0:04:51 « modified: 13/09/2011 0:04:51 weight: 0
tokens: computers

Hoe noemde dat nu weer?

Een tijd terug, sinds ik deze zag: http://xkcd.com/556/ en ik bijna dagelijks kan uitkijken op de windmolens tussen Melle en Wetteren, moet ik zo af en toe terug denken aan iets wat ik me herinner van vroeger. Ik moet nog niet zo oud geweest zijn, en misschien zelfs te jong om te snappen waar het over ging (en daarom blijf ik denken dat het misschien de moeite is om er naar op zoek te gaan), dus het moet in de buurt van de vroege jaren 80 op de televisie zijn geweest. Het moet een soort science fiction serie zijn geweest die handelde over de bezetting van de aarde of toch een deel er van door een andere groep wezens. Mensen of buitenaardse wezens weet ik niet meer, maar ik herinner me wel iets van een driehoekige tatoeage op het hoofd. En ook van die grote machines met lange poten waarmee ze over het landschap bewogen, zeg maar een meter of 20. Het was een behoorlijk donkere serie, en misschien zelfs niet engelstalig. Als ik zo zou moeten gokken kom ik op dit http://en.wikipedia.org/wiki/Rise_of_the_Triad maar da's een computerspel van midden de jaren 90, en heeft er dacht ik niets mee te maken, dus dat spoor loopt dood. Iemand enig idee?

location: www.yoy.be > users > StijnSanders > IRL > Nostalgia
created: 10/09/2011 14:07:40 « modified: 10/09/2011 14:07:50 weight: 0

Safari Mobile: no focus from load or timed events

On one website, I'm using jQuery to load a form into a cell of a table to edit a value on that row, and set focus to the edit field, so the user can edit or overwrite the value rightaway.

On an iPad (not sure which version it was on), the keyboard doesn't show, and the field doesn't get the focus. It takes another click onto the field to give it focus and get the keyboard to show.

Sleuthing around, it appears that this is by design! Because showing the keyboard is slow and/or intrusive?! I disagree. I think this is a clever way of degrading the user experience of using an interactive website with Safari Mobile in such a way it would get interesting to create a specific iPhone/iPad app.

Though other sources tell me this is a bug and could get fixed in future versions...

location: Application Development > Platforms > iOS
created: 30/07/2011 2:01:14 « modified: 30/07/2011 2:01:14 weight: 0
tokens: coding

Ideetje: zonnepanelen doen CO2 omzetten in CH4 (voor de brandstofcel op de zolder)

Stel, je dak ligt vol met zonnepanelen. Stel die brengen het meest op als de meeste mensen niet thuis zijn, minder energie gebruiken dus, en het 'slimme net' neemt dus ook niet af van je. Dus geen inkomsten en de zonnepanelen betalen zichzelf niet terug.

Kunnen we dus zelf iets er mee doen? Batterijen zijn peperduur en verliezen behoorlijk veel. En even omhoog pompen heb ik niet direct plaats voor op mijn woningperceel. Mocht ik in een gebied geplaagd door droogte wonen, en toegang hebben tot zeewater, zou ik misschien desaliniseren, daar is veel energie voor nodig. Maar dat is niet het geval, regenwater genoeg en dat is nog relatief zuiver.

Dus, zou ik kunnen CO2 uit de lucht plukken? En er O2 van maken. En als het even kan CH4 overhouden. Met een truuk kan je die dan opslaan en door een brandstofcel sturen. Bijvoorbeeld 's avonds, als ik thuis kom en de zon gaat slapen.

Als ik zo snel even zoek dan lijkt het niet onmogelijk. Misschien lukt het pas op 250°C, maar we zitten toch met energie over, dus dat zou wel eens goed kunnen lukken...

O jee! Een goed idee! Ik ga dat nu moeten patenteren zeker? Alleen jammer dat dan weer zoveel kost in Europa...

location: Opinions > Science
created: 19/05/2011 21:55:16 « modified: 19/05/2011 21:55:16 weight: 0

AutoClick

I think it would be really handy if you could set a number of clicks at the same location for the program to perform before stopping.

location: projects > AutoClick
created: 4/05/2011 8:20:34 « modified: 4/05/2011 8:20:34 weight: 0
references:  

user: StijnSanders commented on: 19/04/2011 21:57:39 AutoClick

bitcoin acceptedv1.0.8.275
minor update: the cursor tag hides after an interval without movement of the mouse cursor
also added an 'bitcoin accepted' logo to the settings dialog

user: StijnSanders commented on: 19/04/2011 21:37:11 Odo

bitcoin acceptedv0.2.8.274
Added an about box to the settings dialog, and a bitcoin logo and bitcoin address (hint hint)

Model van de verschillen in zwaartekracht op aarde.

Tiens, nu ik deze zie: http://www.boingboing.net/2011/04/04/mapping-the-pull-of.html herinner ik me een oude kaart (misschien wel deze?) waar Sri Lanka abnormaal groot op staat. Mogelijk omdat ze de kust-lijnen toen nog in kaart brachten door er met een boot rond te varen. (Wat bij ondiepe wateren wel nog eens lastig was). Zouden die twee met elkaar kunnen te maken hebben? Als er minder zwaartekracht is om aan het water te trekken, gaat een boot er dan gemakkelijker door? Of moeilijker? Of misschien hadden ze net een lading drank opgeladen die de cartograaf van toen wel lekker vond, kan ook altijd natuurlijk.

location: spotted on the net > science > space
created: 4/04/2011 15:27:09 « modified: 4/04/2011 15:27:09 weight: 0

SQLite, a foreign key and its referential integrity...

Hmm, I guess this will take a lot more getting used to than I thought... Consider this code:

create table tbl1 (
id integer primary key autoincrement,
name varchar(50) not null
);
create table tbl2 (
id integer primary key autoincrement,
tbl1_id int not null,
name varchar(50) not null,
constraint FK_tbl1_tbl2 foreign key (tbl1_id) references tbl1 (id)
);
insert into tbl1 (id,name) values (1,'test1');
insert into tbl2 (id,tbl1_id,name) values (2,1,'test2');
insert into tbl2 (id,tbl1_id,name) values (3,2,'test3');
update tbl1 set id=id+100;
select * from tbl1;
select * from tbl2;

This works on SQLite3 without errors! Not on the inserts, setting an autoincrement field, not on updating the id field(s) that are in use by a foreign key, which actually breaks referential integrity between the two tables! Or have I stumbled upon a fault/bug/incorrectness in SQLite3?

location: Application Development > Data Storage > SQLite
created: 2/04/2011 0:03:07 « modified: 2/04/2011 0:04:27 weight: 0
tokens: coding

Delphi code to send a Wake-up on LAN signal

Yes, it's that easy!

unit un_WakeUpOnLAN;

interface

type
  TMACAddress=array[0..5] of byte;

function MACAddressFromStr(x:string):TMACAddress;
procedure SendWakeUpOnLAN(Address:TMACAddress);

implementation

uses SysUtils, WinSock;

function MACAddressFromStr(x:string):TMACAddress;
var
  i,j,b:integer;
begin
  j:=0;
  for i:=1 to Length(x) do
    if x[i] in ['0'..'9','A'..'F','a'..'f'] then
     begin
      if byte(x[i])>$40 then b:=9 else b:=0;
      if j>12 then raise Exception.Create('MAC Address too long');
      if (j and 1)=0 then
        Result[j div 2]:=(b+(byte(x[i]) and $F)) shl 4
      else
        Result[j div 2]:=Result[j div 2] or (b+(byte(x[i]) and $F));
      inc(j);
    end;
  if j<12 then raise Exception.Create('MAC Address too short');
end;

procedure SendWakeUpOnLAN(Address:TMACAddress);
var
  s:TSocket;
  i:integer;
  a:TSockAddr;
  d:array[0..16] of TMACAddress;
const
  x:TMACAddress=($FF,$FF,$FF,$FF,$FF,$FF);
begin
  d[0]:=x;
  for i:=1 to 16 do d[i]:=Address;
  a.sin_family:=AF_INET;
  a.sin_port:=htons(0);
  a.sin_addr.S_addr:=INADDR_BROADCAST;
  s:=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
  if s=INVALID_SOCKET then
    raise Exception.Create(SysErrorMessage(WSAGetLastError));
  try
    if (connect(s,a,SizeOf(a))=SOCKET_ERROR)
      or (setsockopt(s,SOL_SOCKET,SO_BROADCAST,PChar(@i),4)=SOCKET_ERROR)
      or (sendto(s,d[0],102,0,a,SizeOf(a))=SOCKET_ERROR) then
      raise Exception.Create(SysErrorMessage(WSAGetLastError));
  finally
    closesocket(s);
  end;
end;

var
  WSAData:TWSAData;

initialization
  WSAStartup($0101, WSAData);
finalization
  WSACleanup;

end.

location: Application Development > Programming Languages > Object Pascal > Delphi
created: 29/03/2011 8:28:46 « modified: 29/03/2011 9:42:06 weight: 0

bitcoin: digital currency of the people (be your own bank)

I've been asked if I accept donations for the freeware I make available over this website, but I don't. I don't have a legal entity to my name to accept any funds for work done, and frankly I don't even care for checking if and how I could get this in the clear with the tax services.

Today I read about http://www.bitcoin.org/ and this looks like exactly what I need. It's not that hard to set up, and the fact that no institute like a bank is envolved is really interesting. Even the 'funds' itself actually measures in 'mathematical solids in the digital world', so if I were to amass e certain amount of it, it would get financially interesting to check out these aforementioned tax issues (perhaps by an accountant...)

So, if anyone wants to wire me anything (even 0.01BTC just to check if it works) here's a bitcoin address:

1Q5omBMcpRQkx7WqPpHceM37ZBqpCgyrDB

location: spotted on the net > legal issues > financial
created: 23/03/2011 16:45:07 « modified: 23/03/2011 16:45:07 weight: 0
tokens: internet actueel beurs coding politiek weblog

prime numbers

I once had the idea of building a sieve to find primes, with two arrays of integers: one array with the primes found so far, and one array with a multiple of the corresponding prime which is just above the number currently being investigated. If a multiple would match, it's not a prime, if I wouldn't find a multiple in all previously found primes, I've got a new prime. This way I would not have to multiply or trial-divide anything. All you have to do is start with a first element set to 2, and 'investigate' 3. This is the next prime of course, and 4 hits the next multiple of 2 that's larger than 3 already.

The first go was long (long!) ago back in 16-bits. It found primes up to 65521. But we're having multiple 64-bit monsters purring on our laps nowadays, so I had another go. Turns out the technique spits out primes in sequence faster than I/O can handle, so I had to optimize a bit. Finding all 32-bits primes took a few hours, so I started a 64-bits version somewhere in februari and left it running on a machine I have in the attic that also records television stuff now and then.

I'm not sure if anyone can use all of the prime numbers in sequence for something, but there it is. If you want a copy, let me know. I could also make a version of the program that runs on several cores. I could also make a client that gets ranges of numbers to check for primes and post them back. But I'm not planning to do that. I suspect I won't find anything ground-breaking in the primes-world this way.

It does make a nice tool to list sets of primes, and the primes list is great to split any (large) number in its prime factors. Have a look: (but please don't overload my spare machine in the attic!)

primes...

location: www.yoy.be > users > StijnSanders
created: 14/03/2011 0:36:44 « modified: 25/08/2011 21:14:25 weight: 0
tokens: (friendly-url)

mozilla-build fails: "rm: cannot lstat `conftest.exe ': Permission denied"

I've been looking high and low, found some things that get close, but not close enough (the closest being this one about Microsoft Antimalware Service, but I don't have that one here), but it turns out to be just this: disable the virus-scanner, either while building or by excluding the mozilla build folder(s)...

Because I can't find it anywhere I put it up here, I hope people find it by searching...

So, now I'm stuck because I have the rather new MSVC++2010 Express and it isn't supported (yet?) So I'll have a look why not, or downgrade to the 2008 one...

location: Information > Technology > Information Technology > Internet > WebBrowser > FireFox
created: 9/02/2011 17:40:02 « modified: 9/02/2011 17:40:02 weight: 0

user: StijnSanders commented on: 30/01/2011 21:54:56 Zijn die nu waarlijk zo laag gevallen?

O jee! en tellen kunnen die ook niet meer! (2000 miljard is toch 2 biljard?)

Zijn die nu waarlijk zo laag gevallen?

O jee! zijn die waarlijk zo laag gevallen! En De Standaard dan nog! Ik dacht dat die nog wat van plan waren een beetje serieux uit te stralen...

En het meneerke links komt ook verdacht veel voor als 'relevante afbeelding' op een hoop items in de lijst...

location: spotted on the net > ".be"-related
created: 20/01/2011 22:44:19 « modified: 20/01/2011 22:44:19 weight: 0
tokens: actueel

user: StijnSanders commented on: 14/12/2010 15:24:20 TSQLite
token: (friendly-url)

(TSQLite)

TSQLite

An alternative SQLite3.dll wrapper

location: freeware
created: 14/12/2010 15:23:58 « modified: 14/12/2010 15:23:58 weight: 0
tokens: delphi (friendly-url)

user: StijnSanders commented on: 14/12/2010 15:23:21 TMongoWire
token: (friendly-url)

(TMongoWire)

TMongoWire

Delphi MongoDB Driver

A Delphi driver to access a mongoDB server.
It maps variables onto Delphi variables of type OleVariant, which resembles the loose typing of JavaScript a lot.
There are two main units and three main object to enable access to a mongo DB server:

bsonDoc.pas
  TBSONDocument = class(TInterfacedObject, IBSONDocument, IPersistStream)

  function BSON:IBSONDocument; overload;
  function BSON(x:array of OleVariant):IBSONDocument; overload;

mongoWire.pas
  TMongoWire=class(TObject)

  TMongoWireQuery=class(TBSONDocumentsEnumerator)

location: freeware
created: 2/12/2010 10:05:35 « modified: 2/02/2012 21:36:33 weight: 0
tokens: delphi (friendly-url)

user: StijnSanders commented on: 8/11/2010 21:58:23 How to set the thread display name for the thread list deb...

 See also http://nldelphi.com/Forum/showthread.php?t=36655

How to set the thread display name for the thread list debug window

This little trick appears to work in the Delphi debugger also! Use this code to set the debug display name for the current thread:

interface


function IsDebuggerPresent: BOOL; stdcall;

implementation


uses
Windows;


function
IsDebuggerPresent; external 'kernel32.dll';

procedure
SetThreadName(ThreadDisplayName:AnsiString);
var
  ThreadInfo:record
    dwType:LongWord;
    szName:PAnsiChar;
    dwThreadID:LongWord;
    dwFlags:LongWord;
  end;
begin
if IsDebuggerPresent then
begin
  ThreadInfo.dwType:=$1000;
  ThreadInfo.szName:=PAnsiChar(ThreadDisplayName);
  ThreadInfo.dwThreadID:=LongWord(-1);//calling thread
  ThreadInfo.dwFlags:=0;
  try
    RaiseException($406D1388,0,SizeOf(ThreadInfo) div SizeOf(LongWord),@ThreadInfo);
  except
    //
  end;
end;
end;

location: Application Development > Programming Languages > Object Pascal > Delphi > Debugging
created: 5/11/2010 0:25:47 « modified: 5/11/2010 0:45:47 weight: 0
tokens: delphi

Creating a virtual image of that old laptop

The last few days I've been looking up a lot of information on a specific topic, but haven't found all that I need in a single place, so here it goes. This is the story of (yet another) someone that had the great idea of 'cloning' a virtual image out of the old physical machine, to run as a virtual machine on the brand new machine, with a multiple of the capacity of the old machine.

If you don't care about the story, scroll to the bottom to see the quick guide through the steps to take.

The old, aging, deteriorating laptop is ready for retirement, it's got its power connector re-soldered twice already, two out of three (...) USB ports no longer respond, etc. But, all your data is on it. It's full of tools and software you use and you'd like to use. You're not looking forward to the awkward time ahead using two laptops, re-installing software and tools, moving data around, and optionally finding out you've lost all of those precious personal perferences, settings, profile data...

Virtualization is a buzzword nowadays among the happy few that pull the reins on the server farms, but it's pretty available for home users as well. So why not try to pull a virtual image off of the physical machine and see if it would run on the new machine?

Step 1: Pulling the image.

A straight-forward method for modular desktop machines was to put the old harddisk into another machine as secondary drive and pull an image from it. I'm moving between laptops and I don't feel like dismantling this one (any more)... So I need to pull an image of the currently running system, from the main harddisk partition, and write it over network, since this 20GB is nearly full.

(On a side note, I'm was quite happy this last months to discover cleanmgr http://support.microsoft.com/kb/253597 and especially the 'remove system restore points' option on the second tab! Hundreds or thousands of dead unused kilobytes just sitting there you can get rid of with a mouseclick.)

I found this great tool that does the trick: http://www.chrysocome.net/dd

dd if=\\?\Device\HardDisk0\Partition0 of=\\192.168.0.3\temp\oldlaptop.img bs=128k --progress

'Partition0' apparently is the address of the entire disk, underneath any partitioning or locks the system has on the filesystem. Oddly enough it's available to read from, so take care with running other programs while you're pulling the image. Any files written to while the diskdump is writing may end up corrupt.

I've tried a number of block sizes, ranging from 4k to 2M, but 128k is about a good size to keep both the harddisk and the network interface (100Mbps) busy enough so they won't have to wait on eachother too much. Less would make more read operations, and less data packets going out, more would read more at once, but the disk may forget what to do while the data is flushing down the twisted pair.

Start 2: Running the image.

Let's see. I've selected qemu www.qemu.org to run the image, it's light-weight, runs well (and closes well), but I hear good things about VMWare player also. http://www.vmware.com/products/player/

And it boots! It shows a Windows logo for a second... and throws a 'blue screen of death' with an error that states, among other things "STOP 0000007B", and loops into a reboot which repeats.

Thing is, the old machine had an Intel something in it's center, the new one has it of AMD build, could this be causing problems? From what I read on the web it does. But I've also read all kinds of trickery and tool-slinging to alter registry and core files, but they all boil down to disabling the erring drivers, while still keeping the system running enough to get to boot in a new virtual enclosure.

Start 3: Fixing them drivers.

So back to the old machine. I've tried several things, but what I finally did to get it running is checking every little thing in the device manager (with display of hidden devices swicthed on), which showed the brand's name in the description, and 'update' the drivers to the generic make of drivers, which seem to do the trick also. It may take a reboot or two, and some things may re-appear getting plugged to play again, but you just play them down again putting the generic label on it. (Update driver > no, not now > I wont to choose > don't search > select the plain vanilla one)

Then I took a new diskdump, and just to let this old bird fly again, I restarted in safe mode, and selected to restore a restore point from before I started this endeavor.

Start 4: Does it run now?

Does it run now? Looks like it does, the image is holding a system that wasn't shutdown properly (deuh), so it starts a scandisk before it boots, but that's only normal. Any file that was open at the time of the diskdump may get 'corrected', but I warned you. Then the system boots, telling you you need to activate. Just like you would when you replace your motherboard. (Which I kind of did.)

So, in short, this is what you need to do to convert a physical Windows installation into a virtual image:

location: www.yoy.be > users > StijnSanders > IRL
created: 28/10/2010 23:23:16 « modified: 28/10/2010 23:23:16 weight: 0
tokens: weblog computers

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