-
Content Count
2771 -
Joined
-
Last visited
-
Days Won
147
Everything posted by Anders Melander
-
Can you see the resourcestring in the .drc file? [edit] Btw, have you remembered to update the translation project after these changes? If you don't update the translation project it will only contain the strings that were in your project when you created the translation project.
-
That's the newest release; It's from December 2022. I don't know where you you got the year 2019 from. Nothing special needs to be done. If the resourcestring is implemented in unit XXX and you drop a component from XXX onto a form in unit YYY of project ZZZ, then the IDE will include unit XXX in unit YYY's uses clause and when you compile ZZZ, the resourcestring will appear in the ZZZ.drc file (it's a text file) located the sample place as ZZZ.exe. If you don't have ZZZ.drc then you need to configure your project to produce that file (see the project linker options) - but BTM should complain if it can't find the file.
-
All resourcestrings, regardless of the unit they come from, are listed under the Resourcestrings module node.
-
I'm still not sure what you're saying - or asking. You hide rows by filtering them out: Hover over the Status column header, click the button that appears in the header. Select the statuses that should be visible. Like in my screenshots. That's not really a question, but anyway: If your component strings appear in the string grid, then they can be translated; All resourcestrings and published component string (and string list) properties can be translated.
-
I'm not really sure if this is what you're asking for but you can indicate which modules to translate and which to ignore by right-clicking and changing their status: and then you can filter on the status: You can do the exact same in the string grid:
-
Loading A Project (DevExpress Behemoth Installed)
Anders Melander replied to a topic in Delphi IDE and APIs
I doubt that it's DevExpress that's slowing your project load down. I always have it installed and do not have any problems with it. It's more likely the livebindings design-time support that's the culprit (at least it used to be a common cause of slow downs). Try disabling the livebindings design time packages and see if that helps. The attached .reg file does that for Delphi 10.3, 10.4, and 11.x You may need to reinstall DevExpress afterward as I believe some of their packages have dependencies on the livebindings packages. disable delphi livebindings.reg -
Store a large number of images in the filesystem or in a DB?
Anders Melander replied to RaelB's topic in Databases
Why would that make a difference? The whole directory/tree would need to be scanned anyway, even if he's only interested in the image files. [edit] Oh, I guess you mean select files based on the filename as opposed to the file content. I would probably go for an in-memory database (e.g. SQLite or even just a TFDMemTable) for the index but store the files on disk (but don't put all files in a single folder - that will suck). That said, if you have 50K files averaging 30Kb each, that's only 1,5 Gb total (+ overhead) so you could actually fit the whole thing in memory. -
Ray Lischner. He wrote 3 Delphi books, AFAIR, none of them about component design. I've got "Delphi in a Nutshell" (basically just a reference book) and "Hidden Paths of Delphi 3" (about the old open tools API). Both had horrible binding and fell apart right away.
-
Trap TFDConnection error on data module create etc?
Anders Melander replied to Chris1701's topic in Databases
It was aimed at SQLite but it was not meant as a dis. As long as the limitations and risks are taken into account it's a fine embedded database engine. I haven't used it in a while but I have just read through the technical documentation and I can see that a lot has been done with regard to reliability since then. Still, after having read the docs I couldn't help but feel that there were problem areas that were brushed over or simply left out. -
Trap TFDConnection error on data module create etc?
Anders Melander replied to Chris1701's topic in Databases
...and the ability to not corrupt the database if the application crashes. -
You (mostly) just need to derive your class from TComponent: type TFruit = class(TComponent) private FColor: string; protected public constructor Create(AOwner: TComponent); override; published property Color: string read FColor write FColor; end; ...and then you also need to register your component: procedure Register; begin RegisterComponents('Cool Stuff', [TFruit]); end; I suggest you read the documentation.
-
[Delphi] Looking for a Delphi Profiler in 2023
Anders Melander replied to Willicious's topic in Delphi IDE and APIs
That isn't really a profiler. -
Trap TFDConnection error on data module create etc?
Anders Melander replied to Chris1701's topic in Databases
Create the TFDConnection in code (e.g. in the DM constructor). Open the connection after the DM has been created. For complex applications, I use a design where the application startup is divided into stages. The stage progression is centrally controlled and broadcast to all interested parties. Something like this: // The following could be in the .dpr file type TRunStageBoot = bsInit..bsReady; TRunStageShutdown = bsShutdown..bsShutdown; begin // Broadcast startup progression for var Stage := Low(TRunStageBoot) to High(TRunStageBoot) do RunStageNotify(Stage); Application.Run; // Broadcast shutdown progression for var Stage := Low(TRunStageShutdown) to High(TRunStageShutdown) do RunStageNotify(Stage); end. ...and the run stage management: type TRunStage = ( bsInit, // Whatever needs to run before the DMs are created. E.g. load config. bsCreateModules, // Create DMs bsConnectDatabase, // Connect to database bsLoadDatabaseSchema, // Validate and update database schema bsLogin, // Perform application login bsInitUI, // Create main UI (e.g. mainform) bsReady, // Show UI bsShutdown // Application shutdown ); IRunStageSubscriber = interface {...GUID...} procedure RunStageNotify(Stage: TRunStage); end; TRunStageDelegate = reference to procedure(Stage: TRunStage); procedure RunStageNotify(Stage: TRunStage); procedure RegisterRunStageHandler(Delegate: TRunStageDelegate); overload; procedure RegisterRunStageHandler(const Subscriber: IRunStageSubscriber); overload; // ...similar for unsubscribe... implementation var // Create on demand in RegisterRunStageHandler. Free in finalization. RunStageSubscribers: TList<IRunStageSubscriber>; RunStageDelegates: TList<TRunStageDelegate>; procedure RegisterRunStageHandler(Delegate: TRunStageDelegate); begin RunStageDelegates.Add(Delegate); end; procedure RegisterRunStageHandler(const Subscriber: IRunStageSubscriber); begin RunStageSubscribers.Add(Subscriber); end; procedure RunStageNotify(Stage: TRunStage); begin for var Subscriber in RunStageSubscribers do Subscriber.RunStageNotify(Stage); for var Delegate in RunStageDelegates do Delegate(Stage); end; ... ...and the DM with the connection would then look something like this: type TDataModuleDatabase = class(TDataModule, IRunStageSubscriber) private FConnection: TFDConnection; private // IRunStageSubscriber procedure RunStageNotify(Stage: TRunStage); public constructor Create(AOwner: TComponent); override; end; var DataModuleDatabase: TDataModuleDatabase; implementation constructor TDataModuleDatabase.Create(AOwner: TComponent); begin inherited; FConnection := TFDConnection.Create(Self); // Setup params on connection ... // Register so we will be notified when the connection should be opened RegisterRunStageHandler(Self); end; procedure TDataModuleDatabase.RunStageNotify(Stage: TRunStage); begin case Stage of bsConnectDatabase: FConnection.Open; end; end; procedure RunStageNotify(Stage: TRunStage); begin case Stage of bsCreateModules: DataModuleDatabase := TDataModuleDatabase.Create(Application); end; end; initialization // Register so we will be notified when the DM should be created RegisterRunStageHandler(RunStageNotify); end; -
Did you read the page linked to? First paragraph states: [edit] I guess you don't know what the PDB file is for. The PDB file is used by the profiler to map the addresses in the application being profiled to source files, function names, and line numbers. Without that information, the profiler would only be able to show you the raw addresses. Download and install VTune. Download map2pdb, extract the exe, and save it somewhere of your choice. For example c:\tools\map2pdb\map2pdb.exe Add a menu item in the Delphi IDE via Tools -> Configure Tools... The parameters in the above are: -debug -v -pause -bind:$EXENAME $PATH($EXENAME)$NAMEONLY($EXENAME).map -include:0001 Make sure the compiler are generating a full map file: Compile your project. Execute the map2pdb tool action. Launch VTune and create a profiler project for your exe. Profile the project in VTune. Profit!
-
VCL Handling of dpi changes - poor performance
Anders Melander replied to Vincent Parrett's topic in VCL
At least you no longer have this problem... Eh? -
Problem writing to memo on main form from thread
Anders Melander replied to Jud's topic in General Help
Replace application.processmessages with form1.TestMemo.Update ...and then Google "avoid application.processmessages", "never use application.processmessages", "don't use application.processmessages", etc. -
The trigger is the presence of the "⁄" character anywhere in the text. It's the Unicode "Fraction Slash". It can be reproduced with the GDI ExtTextOut function, which is how I accidentally discovered it. I suspect that this is actually a bug in GDI because as far as I can tell there's nothing in the font tables that should require that character to be present before ligatures are applied. It could also be a bug in the font that triggers a bug in GDI; There are a lot of bugs in Cascadia and Fira. Normally, in an OpenType shaper, the fraction slash triggers hardcoded logic ("hardcoded" as in "logic not defined in the OpenType tables") that converts numeric fractions from the form 1/2 to ½ but that requires the 'frac' feature to be enabled which it isn't by default.
-
Unless you've discovered the magic key to unlock it:
-
Marketing. I don't think they originally intended it as such but since it at best doesn't hurt performance, that's what it became. Yes, it does. Maybe now would be a good time to read up on what virtual memory is. You don't have to allocate beyond physical memory before virtual memory comes into play. You just have to allocate beyond the process' working set. The working set is the part of your process' virtual memory that is backed by physical memory. The working set can grow and shrink depending on memory access and global resource pressure but there's always an upper and lower limit. Of course, it's a bit more complicated than that (there are more layers than what I have described) but that's the basic overview. In general, I would recommend that one doesn't try to outsmart things one doesn't fully understand. Be it threading, memory management, or women 🙂
-
combining two characters to a string switches them
Anders Melander replied to dummzeuch's topic in RTL and Delphi Object Pascal
No. The order is undefined. For example, if you evaluate the expression (A and B and C ) the evaluation order might very well be BCA. Only boolean short circuit evaluation has a defined order. -
I'm writing a shaper for complex text layout and for that, I need to do Unicode decomposition and composition (NFD and NFC normalization). Does anyone know of a Pascal library that can do this? I have the following basic requirements: Open source with a workable license (i.e. not GPL). Cross platform (i.e. not tied to Windows or whatever). Operate on UFC4/UTF-32 strings. Based on the standard Unicode data tables. Must have the ability to update tables when new Unicode tables are published. Must support both NFD decomposition and NFC composition. So far I have found the following candidates: Delphi Unicode libraries PUCU Pascal UniCode Utils Libary 🔵 Origin: Benjamin Rosseaux. ✅ Maintained: Yes. ✅ Maintained by author: Yes. ✅ License: Zlib. ⛔ Readability: Poor. Very bad formatting. ✅ Performance: The native string format is UCS4 (32-bit). ✅ Features: Supports decomposition and composition. ✅ Dependencies: None. ✅ Data source: Unicode tables are generated from official Unicode data files. Source for converter provided. ⛔ Table format: Generated inline arrays and code. ✅ Completeness: All Unicode tables are available. ✅ Hangul decomposition: Yes. ✅ Customizable: Required data and structures are exposed. ✅ Unicode level: Currently at Unicode v15. ⛔ Unicode normalization test suite: Fail/Crash FreePascal RTL 🔵 Origin: Based on code by Inoussa Ouedrago. ✅ Maintained: Yes. 🔵 Maintained by author: No. 🔵 License: GPL with linking exception. ✅ Readability: Good. Code is clean. ✅ Performance: Code appears efficient. ⛔ Features: Only supports decomposition. Not composition. ✅ Dependencies: None. ✅ Data source: Unicode tables are generated from official Unicode data files. Source for converter provided. ✅ Table format: Generated arrays in include files. ⛔ Completeness: Only some Unicode tables are available. ⛔ Hangul decomposition: No. ⛔ Customizable: Required data and structures are private. ✅ Unicode level: Currently at Unicode v14. ⛔ Unicode normalization test suite: N/A; Composition not supported. JEDI jcl 🔵 Origin: Based on Mike Lischke's Unicode library. 🔵 Maintained: Sporadically. 🔵 Maintained by author: No. ✅ License: MPL. ✅ Readability: Good. Code is clean. ⛔ Performance: Very inefficient. String reallocations. The native string format is UCS4 (32-bit). ✅ Features: Supports decomposition and composition. ⛔ Dependencies: Has dependencies on a plethora of other JEDI units. ✅ Data source: Unicode tables are generated from official Unicode data files. Source for converter provided. ✅ Table format: Generated resource files. 🔵 Unicode level: Currently at Unicode v13. ✅ Completeness: All Unicode tables are available. ✅ Hangul decomposition: Yes. ⛔ Customizable: Required data and structures are private. ⛔ Other: Requires installation (to generate the JEDI.inc file). 🔵 Unicode normalization test suite: Unknown The FPC implementation has had the composition part removed so that immediately disqualifies it and the JEDI implementation, while based on an originally nice and clean implementation, has gotten the usual JEDI treatment so it pulls in the rest of the JEDI jcl as dependencies. I could clean that up but it would amount to a fork of the code and I would prefer not to have to also maintain that piece of code. That leaves the PUCU library and I currently have that integrated and working - or so I thought... Unfortunately, I have now found a number of severe defects in it and that has prompted me to search for alternatives again. Here's the project I need it for: https://gitlab.com/anders.bo.melander/pascaltype2
-
In the end, I had to abandon PUCU as the author never bothered to react to my bug reports. Instead, I tried to adapt the JEDI implementation: I removed all dependencies and fixed the worst bugs and performance issues. Finally, I ran the code against my unit tests. The result was a big disappointment; While it didn't crash like PUCU, it failed even more of the test cases. The test suite uses the 19,000 NFC (compose) and NFD (decompose) normalization test cases published by the Unicode consortium. So back to square one again. Comparing the algorithms used by the JEDI library against countless (I've looked at over a hundred) other Unicode libraries didn't reveal the cause. They all used the same algorithms. Blogs and articles that described the algorithm also matched what was being done. I was beginning to suspect that Unicode's own test cases were wrong, but then I finally got around to reading the actual Unicode specification where the rules and algorithms are described, and guess what - Apart from Unicode's own reference library and a few others, they're all doing it wrong. I have now implemented the normalization functions from scratch based on the Unicode v15 specs and all tests now pass. The functions can be found here, in case anyone needs them: https://gitlab.com/anders.bo.melander/pascaltype2/-/blob/master/Source/PascalType.Unicode.pas#L258 Note that while the functions implement both canonical (NFC/NFD) and compatible (NFKC/NFKD) normalization, only the canonical variants have been tested as they are the only ones I need.
-
Paste image from clipboard : RGB becomes BGR on IOS 64 bits ?
Anders Melander replied to FabDev's topic in FMX
The bitmap in that issue is a version 1 BMP in BI_RGB format so the problem I mentioned does not apply. Issue RSP-37651 might be related. According to that issue, it's fixed in 11.2 but as far as I can tell from looking at the source in 11.2 it hasn't been fixed. At least not in the way suggested by the reporter. -
Paste image from clipboard : RGB becomes BGR on IOS 64 bits ?
Anders Melander replied to FabDev's topic in FMX
I don't have time to look at the source but if the bitmap being pasted is a 16 or 32-bit BMP bitmap with BI_BITFIELDS encoding then the problem can be that Delphi's TBitmap doesn't really support the nuances of that format. The BI_BITFIELDS format uses 3 (or 4, depending on the BMP version) mask values that specify the layout of the RGB channels in the pixel values and AFAIR TBitmap ignores the mask values and instead assumes a certain layout.