-
Content Count
3504 -
Joined
-
Last visited
-
Days Won
115
Everything posted by Lars Fosdal
-
A bit of Googling dug up http://delphidabbler.com/articles?article=9 with src https://bitbucket.org/delphidabbler/article-9-demo/src/master/ which demos the basics - but you'd still need to do the checks to figure out what is relevant to your own app.
-
I haven't seen one, but I haven't really been looking for one. I guess you have these links already... https://docs.microsoft.com/en-gb/windows/win32/dataxchg/clipboard https://docs.microsoft.com/en-gb/windows/win32/api/winuser/nf-winuser-setclipboardviewer
-
Pimlico: Microservices in Delphi - Part 1
Lars Fosdal replied to John Kouraklis's topic in I made this
Friends don't make friends use Synchronize. -
Bug in Delphi string behavior?
Lars Fosdal replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
Not the programming error - the possible need for a hint or a warning that helps a programmer avoid the error. -
Bug in Delphi string behavior?
Lars Fosdal replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
QP it, perhaps? -
Bug in Delphi string behavior?
Lars Fosdal replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
Would it make sense to have a compiler hint for referencing initialized variables with an out parameter? -
Bug in Delphi string behavior?
Lars Fosdal replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
It is actually documented: http://docwiki.embarcadero.com/RADStudio/Rio/en/Parameters_(Delphi)#Out_Parameters Hence, since the const argument contains the same reference... -
Bug in Delphi string behavior?
Lars Fosdal replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
procedure TForm1.AnsiUpperTest; var s, o:string; begin s:='default'; AnsiUpperTestConvert(s,o); end; Adding a separate output variable helps. Can it be that the const DefaultValue is cleared by the out reference? Alternatives: Use a var param or a function result. -
How Delphi manages mapping data aware control to a data source on a data module
Lars Fosdal replied to Martyn Spencer's topic in Databases
YMMV, by a LOT. We don't use data-aware controls at all, but do all the DB work behind the scenes and pass custom classes to the UIs. These classes have methods to retrieve themselves from the DB, save themselves, as well as various processing methods, and we use helper/proxy-classes to simplify populating the UI as well as taking input from the UI. The source of the data doesn't matter to the UI, and we found it easier to have absolute control over the UI behavior and data updates and creation. Our UIs are much more than CRUD interfaces, as the data types are very complex and interdependent, as well as manipulated from multiple systems. But - in the end - we do a lot of explicit "wiring" in code in the UI proxies. For other solutions, data-aware components can work perfectly, but TBH, I've only worked with one solution that used them, and they had written an entire ORM to handle their data retrieval and input from DB to UI and back, -
Writing DLL functions unit
Lars Fosdal replied to metinkocadag2003's topic in Algorithms, Data Structures and Class Design
Without documentation about the parameters of these functions and their types, you will be unlikely to succeed. -
Squint and read: CreateFormFromStings
Lars Fosdal replied to Darian Miller's topic in RTL and Delphi Object Pascal
Mine too, especially when I've written the semantically correct word, but the compiler barfs because the actual word in the code is misspelled. -
Generic Command Line Parser for Delphi 10.3.x
Lars Fosdal replied to Lars Fosdal's topic in I made this
The parser only deals with the parsing of a basic syntax. The interpretations of the validity of variations of switches, flags and arguments still has to be built on top of the base parser. I decided not to write those parts, as there are so many (potentially conflicting) ways to write it. It should be easy to add that layer yourself, though. -
Generic Command Line Parser for Delphi 10.3.x
Lars Fosdal replied to Lars Fosdal's topic in I made this
Double (or multiple) switch chars work. But - as mentioned: the syntax for multiple arguments to an option is (arg1, arg2, ..., arg n) If you need the separator as part of a string, you quote the string. (art1, "this , is in arg2", 'this has a " in it') Parse(' --strings="String A, StringB,StringC, String D and E"') 1 Switch[--] Option[strings] Flag[=] Values["String A, StringB,StringC, String D and E"] AsString('strings'): String A, StringB,StringC, String D and E -
The annoying problem of the growing GExperts menu
Lars Fosdal replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
What about breaking down the menu into groups? Yes, it is convenient to have everything on top level ... until it isn't. Since I don't use GExperts, my grouping suggestion is only based on menu names, not on actual functionality - so some placements may be totally wrong. File Code Librarian Code Proofreader ... Favorites Open Project Backup ... Class Browser Dependencies Source Export Component Copy Names Find Reference Grid ... Hide / Show Non.-Visual Rename Replace Select Set FocusControl Set Tab Order ... To Code Editor Bookmarks Comment Empty Code Blocks Clipboard History Experts Focus Go to Grep Next Item Previous Item Results Search ... Macro Library Playback Record Start/Stop Tools Ascii Chart IDE Menu Shortcuts... Keyboard Shortcuts Message Dialog PE Information To Do List -- Configuration About Window Add Dock Window Reselect Desktop -
Squint and read: CreateFormFromStings
Lars Fosdal replied to Darian Miller's topic in RTL and Delphi Object Pascal
For some reason, many of the programmers I know have various degrees of dyslexia - which leads me to mentally auto-correct the misspellings I find, and in many cases, leave them as is. Usually, changing the spelling leads to something unpleasant happening, such as a mismatch between stream content and object property, DB field names, etc. -
Early return benefits: The contract clauses of the method are clearly defined at the top of the method code. If you made it past the contract clauses, your code is safe to run You can easily add or remove contract clauses without breaking the code (or having to add yet another layer of indentation) I used to be a nester, but I evolved.
-
Generic Command Line Parser for Delphi 10.3.x
Lars Fosdal replied to Lars Fosdal's topic in I made this
@Mike Torrettinni I updated the gist at https://gist.github.com/LarsFosdal/f8a3e2a7caa5e541e4c04f10dfdfcfff with an extra Analyze function that writes a clearer breakdown of the parsing. and added your example and a modified version of it to the test app. As far as I can tell, it works as expected? Your example: /strings="String A, StringB,StringC, String D and E"' is a single string param. The test output: Parse(' /strings="String A, StringB,StringC, String D and E"') 1 Switch[/] Option[strings] Flag[=] Values["String A, StringB,StringC, String D and E"] AsString('strings'): String A, StringB,StringC, String D and E ClientIdentifier = My modification of your example: /strings=(String A, StringB,StringC, String D and E) is an array of strings. Note the use of parenthesis to indicate multiple arguments. Parse(' /strings=(String A, StringB,StringC, String D and E)') 1 Switch[/] Option[strings] Flag[=] Values[("String A";StringB;StringC;"String D and E")] AsString('strings'): String A ClientIdentifier = -
How do you deal with non-critical customer feature requests?
Lars Fosdal replied to Mike Torrettinni's topic in Project Planning and -Management
Every request needs evaluation to understand WHY the request is being raised, and if the request actually is what the customer needs - or if he is just attempting to scratch an itch instead of curing the cause of the itch. -
Most efficient way to delete multiple items from a TList<T>...
Lars Fosdal replied to Steve Maughan's topic in Algorithms, Data Structures and Class Design
TList<T>.Pack( function (const L, R: T): Boolean begin Result := (L.Condition); end); -
Create multiple tasks without freezing the interface
Lars Fosdal replied to DarkDucke's topic in OmniThreadLibrary
Did the refactor solve your "always same I" problem? -
Why is my firebird database code unstable under load? (code included)
Lars Fosdal replied to Yaron's topic in Databases
Nope. F5 or Ctrl-R and the visual error remains, and I still can't edit the post again. -
Create multiple tasks without freezing the interface
Lars Fosdal replied to DarkDucke's topic in OmniThreadLibrary
Is it about the pitfalls of variable captures? The simplest solution to that is to simply divide and conquer. Also - the queuing code you wrote, will only do five scrapings since you never descrement nCount when a task completes, nor do you retry the loop until there are no lines not containing 'done'. procedure TForm1.QueueScraping(I, Q: Integer); Async( procedure begin Memo1.lines.add('I=' + I.ToString() + ' Q=' + Q.ToString()); GetWebContent(I); end ).Await( procedure begin Memo1.lines.add('Done I=' + I.ToString() + ' Q=' + Q.ToString()); end); end; procedure TForm1.BitBtn1Click(Sender: TObject); var I, nCount : Integer; begin I := 0; nCount := 0; for I := 1 to StringGrid.RowCount-1 do begin if StringGrid.Cells[0, I] <> 'done' then begin inc(nCount); if nCount > 5 then Break; QueueScraping(I, nCount) end; end; end; -
Did you call BluetoothLE1.DiscoverServices before calling GetService? http://docwiki.embarcadero.com/Libraries/Rio/en/System.Bluetooth.TBluetoothLEDevice.GetService http://docwiki.embarcadero.com/Libraries/Rio/en/System.Bluetooth.TBluetoothLEDevice.DiscoverServices
-
Blogged : Introducing DPM - a Package Manager for Delphi
Lars Fosdal replied to Vincent Parrett's topic in Delphi Third-Party
Pessimist = Experienced optimist 😛 -
Why is my firebird database code unstable under load? (code included)
Lars Fosdal replied to Yaron's topic in Databases
@rvk - My question was due to the comment in the docwiki link that explicitly mentions Firebird and Interbase. Likewise, in http://docwiki.embarcadero.com/Libraries/Rio/en/FireDAC.Comp.Client.TFDCustomConnection.Transaction - it says "Note: At the moment, this behavior applies only for InterBase and Firebird connections."