jsonDoc: JSON object for Delphi based on IUnknown and OleVariant
2015-06-26 21:21 jsonDoc [permalink]
I was using bsonDoc.pas and bsonUtils.pas from the TMongoWire project in several projects that didn't have anything to do with MongoDB, so I thought this one deserved a repository of its own:
yoy/delphi on beginend.net
2015-06-25 18:07 yoybe on beginendnet [permalink]
I've proposed the Delphi RSS feed of this site to https://www.beginend.net/. Thank you Eric.
Results of the programming paradigms survey
2015-06-25 00:11 plsurveyresults [permalink]
A while ago I created a little survey about programming language specifics, and posted it on reddit/programming. Here are the results.
There were 123 responses on May 21st, 8 on May 22nd and one more on the 23rd. I guess then it moved off the first page on reddit... The posted ended on a solid score of zero upvotes.
Whitespace: the majority of you (93 votes) like whitespace to be unimportant to syntax, the others (34) like that it defines scope or levels in code.
6 prefer not to use an operator for assignment. Some nice people note that Lisp uses (set! ) for assignment, and Scheme uses equal, which are not really operators. Someone warns not to use == in Java for general comparison. Good to know. (Reminds me to send the daily thank you to the person that once warned me not to use Java.)
Readability: 87 like code to read like human language, against 41 that appreciate that it's for the machines that we're writing. So that's bad news for my attempt at designing a programming language without reserved words...
Subject Object Verb: 109 prefer infix notation (a+b), 15 prefer prefix notation (+ a b), 1 voted postfix (a b +) and 7 prefer something else than operators.
Declarative-Executive: 60 like declarative and executive separate and can live without having them nested, 16 find that declarative and executive should be visually separate but may occur nested, 47 think executive prevails (so they can manipulate their declarative, eew!)
Compiler directives, Pre-compiler: 49 prefer language specific syntax to denote code that is dependent on something external, 39 prefer the linker to be smart enough to ignore unused logic, 38 sticks to the heavy pre-compiler with its own box of tricks.
Garbage collection: 57 likes reference counting; 43 doesn't even bother with clean-up or gives the GC a ping; 26 does their own object lifetime management (or is unwittingly writing leaks).
Multiple Inheritence: 88 claim not to need it; 38 claim to use it; 3 claim do be blissfully oblivious, the lucky bastards.
Concurrency: 80 prefer syntax to work with a parallel workload, 36 likes to just write loops and have the language put the metal to work, 14 roll their own threads.
Generics: Yea 98, Nay 32, the yeas have it. Another reminder I'm part of a (shrinking?) minority...
As I noted in the reddit remarks, I'm not used to setting up surveys like this, and may not have selected the most neutral wordings for the questionnaire, perhaps steering the results a little. In any case, it's nice to hear back from people, and compare where you are in relation to the masses, get to know if your niche is still comfortably narrow.
2015-06-23 21:25 sha512 [permalink]
I added SHA-512 to the collection! I also had a quick comparison with code similar to some other implementations where instead of a loop, a long list of 'round' calls are made, with some convolution made in the arguments, and it turns out the way I go at it here performs better. (Your milage may vary)
yoy.be new design!
2015-06-19 20:50 new design [permalink]
I finally have the new design for this website ready! It was long over due. Hope you like it. I have removed a lot of the dynamic back-end of this website, it was very under-used here, but it lives on in another form. The re-design also serves as a re-focus for this website, so it serves its two main purposes better: my personal weblog and the main place to download my freeware from and get updates. The openness to add things here is gone, but I am always available for advice, comments, remarks and questions on twitter, stackoverflow, google+, github and others like that.
2015-03-03 21:42 r1825 [permalink]
- error page: back link when referer, refresh link only on GET
- LoadCopy by library file signature to avoid multiple copies being loaded, retries on access denied
- default xxmSession on TStringList (sorted!) instead of TObjectList
- parser: in code, treat lines that start with "<" and end with ">" as HTML,
allow [[#]] section on one line in a code section
- recycle allocated memory buffers, use HeapAlloc instead of GlobalAlloc
- long polling support (IXxmContextSuspend, IXxmProjectEvents2)
- xxmHttp: thread to wait on groups of (slow) connections that have all content in buffer
- xxmHttp: support basic authentication (401, "WWW-Authenticate: Basic")
- xxmIsapi: asynchronous sending on more than 64KiB in buffer (project should set Context.ContentBuffer!)
- xxmLocal: custom handling of WWW-Authenticate,
when debugging hold 'X' on authenticated page load to clear stored credentials
- xxmConv: /noupdate switch
- revised thread scheduling from thread pool
trick: get a non-empty recordset with NULLs
2015-02-26 10:31 i3098 [permalink]
If you ever need a non-empty recordset with all NULL values, e.g. for listing the columns:
select C.* from (select 1 X) X left outer join Customer C on C.ID=0
"Even snel een login-procedure maken"...
2015-01-09 17:21 r1823 [permalink]
→ "Even snel een login-procedure maken"...
Gaat ook hierover: http://blog.codinghorror.com/the-god-login/
About WideChar and CharInSet...
2015-01-08 23:58 i3097 [permalink]
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"
2014-11-05 15:39 i3096 [permalink]
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
The ongoing search for the best suitable font.
2014-10-03 18:50 i3078 [permalink]
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.
2014-05-14 23:13 r1811 [permalink]
data link changed from OLEDB/ADO to SQLite3.dll
xxmData.pas: Convert queries.xml to queries.sql
2014-05-07 23:57 i3076 [permalink]
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.
2014-04-20 21:21 r1802 [permalink]
Update: rethinkdb 1.13 will drop protocol buffers from it's network protocol in favor of JSON (see here)
2014-04-11 22:17 i3075 [permalink]
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.
2014-01-01 21:54 r1798 [permalink]
→ Regular Expression
To whomever this might be of interest: I've decided to open-source this project: https://github.com/stijnsanders/RE
2013-12-20 22:32 r1794 [permalink]
→ Regular Expression
- fixed issue with file left open after save
- 'Builder' item (Multiple)
- 'Groups' item (RegEx)
2013-06-20 00:38 r1789 [permalink]
update! there appears to be an issue with UTF8String constants in Delphi XE
2013-04-17 23:14 r1787 [permalink]
- Multi-line matches show first line when double-click matching file
"database locked" errors with SQLITE_CONFIG_SERIALIZED
2013-03-23 22:36 i3068 [permalink]
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.
Ik wil ook wel zo van die structurele maatregelen.
2013-03-21 23:00 i3066 [permalink]
Ik heb geen pol en sok gestudeerd. Ik ben helemaal geen expert. Ik heb iedere dag het gevoel dat ik nog maar net een beetje probeer de politiek te volgen. Ook belangrijk: ik baseer mij enkel op de zaken zoals ze via het 'normale' kanaal tot bij u en mij raken: nieuws op TV, radio, tijdschriften en internet. En toch...
Als het geld op is moeten ze er nieuwe bij drukken. De VS doet het. Groot Britannië doet het. Maar Europa? Ho maar. Ik veronderstel voorlopig even gemakkelijkheidshalve dat Merkel en Hollande dat niet wil. Als het moeilijk gaat, en je beschikt over een nationale munt, en met het sleutelen aan de percentages van dit en dat helpt niet meer, dan kan je gaan voor een devaluatie (een duur woord voor geld bij drukken). De mensen zijn even kwaad, de koopkracht schommelt een beetje, maar uiteindelijk keert er vanalles, doet iedereen verder en komt het goed.
Ik vermoed dat er iemand zal gedacht hebben misschien werkt het ook als we gewoon van iedereen een stuk spaargeld afnemen, dan daalt de koopkracht toch ook? In Cyprus zit zelfs veel geld van buiten Europa, dat is ook mooi meegenomen. Maar zo werkt het niet. Ik vrees dat een run-on-the-bank onafwendbaar is. Misschien zelfs trubbels met Rusland. Niet goed.
Intussen in eigen land vragen de banken of de staat toch niet wat langer zou willen schulden maken. Lijkt me geen zo'n goed idee, al was het voor de trubbels met Europa. Ze vragen 'structurele maatregelen'... Dat vond ik wel heel vreemd. Banken schreven meer leningen uit dan goed voor hun was, toegegeven vooral in de VS, maar die rommelkredieten worden in alle soorten en vormen herverpakt en doorverkocht, tot het boeltje ineenstort, ze straten en wijken met een keer iedereen uit het huis zetten (en niemand die wil kopen, lijkt me nog eens een slecht idee op zijn eigen) en dan lijken er wereldwijd banken of onderuit te gaan of het heel erg moeilijk te krijgen.
Maar da's intussen al een paar jaar terug. Intussen gaat het niet goed met het heropleven van de economie, dus houden ze de percentages laag. Wij krijgen minder dan de inflatie op spaargeld (handig voor de banken) en lenen zou moeten makkelijker om dragen zijn met zo'n lage rente, toch als de bank je wil lenen. Daar lijkt het te schorten als ik het zo hoor. Ze zijn nu plots wel heel streng om hun geld uit te geven. En ze vragen om 'structerele maatregelen', om wat precies? Of de staat zou willen borg staan voor de leningen voor deze heroplevende economie? Lijkt me wat vreemd dat de huizen die sterker uit de storm zijn gekomen zo bang zijn van een beetje risico.
In plaats van te liggen verhuizen, zouden de rijke mensen beter zelf schuldnota's uitdelen. Iets in de zin van 'deze bon geeft u in 2020 recht op 50 euro uit de pocket van rijke mijnheer of mevrouw X'. Daarmee betaal je dan je boodschappen. En dan zien we in 2020 wel om ze terug te betalen. Lijkt misschien vreemd, maar het totaal bedrag aan Amerikaanse staatsschuld lijkt me een groot genoeg bedrag om een volledig land uit te bouwen. En hoeveel de dollar waard is, is toch afhankelijk van hoeveel de Chinezen er voor willen geven, toch?
Maar ik ben geen expert. En ik probeer maar te volgen wat ik in het nieuws zie. Maar ik denk er toch het mijne van.
Delphi's TDateTime in a datetime column: how to manipulate from SQL?
2013-03-19 22:25 i3065 [permalink]
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:
where myDateField is a column or value of type datetime.
2013-02-26 18:54 r1775 [permalink]
- bug: settings mix-up between delay and repeat
- added numpad.kbl: numpad only layout
2013-02-21 18:21 r1766 [permalink]
- drag to move not on keys
- repeat timer settings
- 'sticky' system key added to be.kbl, us.kbl
2013-02-20 21:54 r1765 [permalink]
- 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