MarkShark
Members-
Content Count
84 -
Joined
-
Last visited
Community Reputation
25 ExcellentTechnical Information
-
Delphi-Version
Delphi 11 Alexandria
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
CompareString function for UTF8 strings or buffers?
MarkShark posted a topic in RTL and Delphi Object Pascal
Hi all! Is there a library routine or api function that will compare two utf8 strings or buffers without converting them to UTF16? I'm looking for something analogous to AnsiCompareStr. Thanks! -Mark -
I did a lot of trial and error while working on the scrollbars for SynEdit and setting min to 1 seemed necessary. The code I ended up with is in SynEditScrollBars. The official documentation did seem a bit off in some cases. -Mark
-
Is this with Delphi 12 - Athens? Could it be related to this issue mentioned on Stack Overflow? To test if that's the issue just try changing #13#10 to + #13 + #10 to see if it makes a difference. Stack Overflow: Issue related to character literals: https://stackoverflow.com/a/78186835/113128
-
Notification message from an OmniWorkItem
MarkShark replied to MarkShark's topic in OmniThreadLibrary
Just wanted to mention that I realize I can add a notification handler to the entire FWorker with: FWorker := Parallel.BackgroundWorker .NumTasks(1) .TaskConfig(Parallel.TaskConfig.OnMessage(HandleTaskNotification)) .Execute(HandleQueryWorkItem); But I'm wondering if I can do a WorkItem specific handler with the Schedule() call. -
I currently have a background worker that I use to serialize a queue of workitems. The code to create the worker is: FWorker := Parallel.BackgroundWorker .NumTasks(1) .Execute(HandleWorkItem); In this case the HandleWorkItem method is just a dummy method as I actually pass in the workitem code when I schedule the workitem. E.g.: FWorker.Schedule( FWorker.CreateWorkItem(TOmniValue.FromRecord(MyWorkItemDataRec)), FWorker.Config.OnExecute( procedure(const workItem: IOmniWorkItem) var TaskResult: TTaskResult; begin // Do a bunch of work here in a background thread // Now set the Result TOmniValue from a record. workItem.Result := TOmniValue.FromRecord(TaskResult); end) .OnRequestDone(DoneMethod) ); end; This works extremely well, but I'd like to notify the calling thread of the progress. I thought maybe that IOmniWorkItemConfig would have an OnMessage(eventHandler: TOmniTaskMessageEvent) that I could set during the Schedule call (much like OnRequestDone) but I haven't figured out how to do that. Any help or suggestions appreciated.
-
Blast from the past! I worked at the Lab of Computer Science at Mass General Hospital right out of College (a great place with wonderful people.) I worked on Mumps for a few years back then. The database for Mumps/M is a hieratical database and it's not easy to do a direct translation to a relational database (based on knowledge from 30 years ago so it might be completely out of date! lol) In any case, I might look at Zeoslib instead of Firedac since it's open source and might be easier to create a new driver with. Sorry to not be more helpful!
-
SearchBuf issue since Delphi 11.2 fix for wholeword searching.
MarkShark replied to MarkShark's topic in RTL and Delphi Object Pascal
Issue #78 and my pull request to start to fix it is #79. I have it fixed and tested, just needed that last bit of info about the 11.2 problem. Works great in my testing so far. -
SearchBuf issue since Delphi 11.2 fix for wholeword searching.
MarkShark replied to MarkShark's topic in RTL and Delphi Object Pascal
Thanks! Is using Searchbuf (unfortunately with the $if to fix this issue) ok to use as a solution to the SynEdit search engine issue I've been working on? Otherwise, we'd need a reverse version of the current "Next" function which looks like it might be a Boyer-Moore implementation? -
SearchBuf issue since Delphi 11.2 fix for wholeword searching.
MarkShark posted a topic in RTL and Delphi Object Pascal
As of Delphi 11.2 they fixed the wholeword option handing (https://quality.embarcadero.com/browse/RSP-20731) however they changed the way that SelStart works when searching backwards (its' now -1 based instead of zero based..) To fix it to match the earlier behavior you have to do something like: if soDown in StringOptions then Result := SearchBuf(Buf, BufLen, SelStart, SelLength, SearchString, StringOptions) else Result := SearchBuf(Buf, BufLen, SelStart - 1, SelLength, SearchString, StringOptions); Basically, when searching backwards a SelStart of zero means to start the search at char position 1. Maybe there's some reason to make it work that way, but it's a change from earlier versions where searching forwards and backwards used the easier to understand base of zero as the start of the search. I haven't created a bug report for this as I had some problems with attempting to do it recently. Also is there a way to do an ifdef specific to 11.2? -
Using SetLength(Self) inside a record helper for TBytes
MarkShark posted a topic in RTL and Delphi Object Pascal
I was writing a simple record helper for TBytes and realized that some of my routines call SetLength. I'm wondering if this is a problem since the array could/will be reallocated in memory. Simple example: TTestBytesHelper = record helper for TBytes private function GetLength: Integer; inline; public function ReadFromStream(AStream: TStream; ACount: Integer): Integer; property Length: Integer read GetLength; end; { TTestBytesHelper } function TTestBytesHelper.GetLength: Integer; begin Result := System.Length(Self); end; function TTestBytesHelper.ReadFromStream(AStream: TStream; ACount: Integer): Integer; begin // Wondering about this SetLength call! System.SetLength(Self, ACount); Result := AStream.Read(Self, ACount); end; In my testing the ReadFromStream function does seem to work fine. I'm just wondering if calling SetLength on Self while in a record helper is ok to do. Thanks for any insight! -
I use Project Magician, but I don't use custom manifests, so this may or may not be helpful! In the help file it mentions that the child configurations cleaning setting "Application Settings" affects Icons, Manifest File, Output Settings and Appearance, and so that setting is probably what's clearing the child settings in this case. You can clear that setting to see if it helps. What I'd love is for Uwe to open source the tool, but it's definitely been useful to me "as is". I use addition custom .optset files to set version info and such but doing so is undocumented at best.
-
SynEdit - Get current SQL command block
MarkShark replied to aehimself's topic in Delphi Third-Party
Hey @aehimself SynEdit does have the SQLHighlighter which can give you some context information about the SQL, but it doesn't really have a full SQL script processor. Have you looked at the one in ZeosLib? I don't use it for my stuff as I had written one for Oracle's scripting language way back and then adopted it for the other databases with my newer products. Note that you will have to use some sort of statement terminator (which can be as simple as a semicolon or it can be super complex with Oracle's SQLPlus syntax or less complex with a standard "set terminator" type statement.) My tools are Golden (for Oracle) and GoldSqall (for Oracle, PostgresSQL, Firebird, MySQL, etc) and they all have to do exactly what you're doing. -Mark Ford Benthic Software -
SynEdit (https://github.com/TurboPack/SynEdit) can handle huge files and has an XML highlighter (Note: I haven't used that highlighter myself.)
-
My testing with MaxUndo = 1 (to most closely match a TMemo) doesn't show any leaks. I've also tested the other scenarios with no leak issues that I could detect. It's very true that the default settings can chew through a lot of memory for the undo stuff, so in the case of a log like this you must limit or manage the undo. On a related note: Am I correct that LockUndo/UnlockUndo must always be followed by a ClearUndo in order to keep everything in sync? I wasn't' sure if that happened automatically or perhaps is just not an issue. -Mark @pyscripter I'm very impressed by how few issues there have been for such a major rewrite! Well done!
-
I've used: SVGIconImageList also: Image32 Good stuff!