Brian Evans
Members-
Content Count
376 -
Joined
-
Last visited
-
Days Won
4
Brian Evans last won the day on February 13 2024
Brian Evans had the most liked content!
Community Reputation
111 ExcellentTechnical Information
-
Delphi-Version
Delphi 12 Athens
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
As Remy already mentioned an array or list works. I tend to put such things in a dynamic array. Can move the array to someplace higher in scope if desired but for code that doesn't run that often I usually create it as needed and let it fall out of scope and be destroyed. procedure TForm1.Button1Click(Sender: TObject); Var SomeMemos : array of TMemo; begin SomeMemos := [Form1.Memo1,Form1.Memo2,Form1.Memo3,Form1.Memo4,Form1.Memo5]; // Dynamic Arrays are zero based so need to subtract one compared to 1 based SomeMemos[5 -1].Lines.Add('test!'); end;
-
Is TBitmap.LoadFromStream blocking when used in a BG thread?
Brian Evans replied to domus's topic in FMX
In general an ever growing queue is a bad thing - at some point adding new items has to at least pause or it grows unbounded. The default size in the .create is a bit on the low side at 10 which I think is a source of bugs. This parameter perhaps should not have a default forcing the developer to think of a sane value or the need to .grow(). The defaults for create(): AQueueDepth is the length of the queue, which is by default set to 10. PushTimeout is the timeout when a new element is pushed, which is by default set to INFINITE. PopTimeout is the timeout when a new element is popped, which is by default set to INFINITE. -
Strange behavior with "RANGE checking" and "Overflow checking"
Brian Evans replied to DelphiUdIT's topic in RTL and Delphi Object Pascal
Sure you don't have the options reversed between debug/release? The processor might be making poor choices in where it sends instructions but it would be odd to see a couple more instructions execute faster even with poor choice of execution unit scheduling or register usage. The only difference I see is the default debug settings generate code that does range bounds checking on a[i] checking it is within the array bounds. -- range and bounds checking off Project1.dpr.51: DivandMod(a[i], 2039, resto); 000000000036CB5E 488B05834B0300 mov rax,[rel $00034b83] 000000000036CB65 8B0D594B0300 mov ecx,[rel $00034b59] 000000000036CB6B 8B0C88 mov ecx,[rax+rcx*4] 000000000036CB6E BAF7070000 mov edx,$000007f7 000000000036CB73 4C8D05764B0300 lea r8,[rel $00034b76] 000000000036CB7A E881FEFFFF call DivandMod -- range and bounds checking on Project1.dpr.51: DivandMod(a[i], 2039, resto); 000000000036CB83 8B053B4B0300 mov eax,[rel $00034b3b] 000000000036CB89 48833D574B030000 cmp qword ptr [rel $00034b57],$00 000000000036CB91 740D jz Project1 + $150 000000000036CB93 488B0D4E4B0300 mov rcx,[rel $00034b4e] 000000000036CB9A 483B41F8 cmp rax,[rcx-$08] 000000000036CB9E 7205 jb Project1 + $155 000000000036CBA0 E8BBFFECFF call @BoundErr 000000000036CBA5 488B0D3C4B0300 mov rcx,[rel $00034b3c] 000000000036CBAC 8B0C81 mov ecx,[rcx+rax*4] 000000000036CBAF BAF7070000 mov edx,$000007f7 000000000036CBB4 4C8D05354B0300 lea r8,[rel $00034b35] 000000000036CBBB E840FEFFFF call DivandMod -
Check whatever component/library you are using to add export to xlsx capability to QuickReport. Update: Seems they added it at some point.
-
Does "Size to grid" actually do something?
Brian Evans replied to dummzeuch's topic in Delphi IDE and APIs
Seems busted, does nothing here in VCL. Help says it: Changes the position and the size of the selected control so that every edge is aligned with its closest line of the design grid. Help text from toolbar descriptions here: https://docwiki.embarcadero.com/RADStudio/Athens/en/Toolbars -
The Snipping Tool in Windows 11 does video in addition to static screen grabs. After triggering (SHIFT+Win+S) make sure video is selected, select the screen region you want to record then start recording.
-
Delphi IDE and application created crashes with Mouse click on TActionMainMenuBar
Brian Evans replied to srikanthch's topic in VCL
Isn't SPHTMLHelp an ancient third-party library? If I remember it added support for opening CHM help files before Delphi itself did over a decade ago. -
It can generate a text file per exception that contains much more than just the stack trace. You can then do whatever you want with the text file. The log viewer tool they provide can display the contents of that text file in an easy-to-read way - nicely formatted and split up. ref: https://www.eurekalog.com/help/eurekalog/bug_report_page.php
-
Could just be logging the stacks of exceptions that are handled and logging them as part of seeing what errors users hit most often. Of limited use but have seen it done - like graying out invalid choices + hint of why on mouse over or click instead of letting the user select an item and then producing an error dialog/message latter on that users are hitting far too often.
-
In recent releases deleting the plugin content from the layout is another approach. Use the Edit Layout at the bottom left of the Welcome page. Leaves a welcome page that loads fast and has a nice color gradient that closes when you open a project. I find the "no tabs yet" thing it puts in the middle of blank space when nothing is open more distracting than the empty welcome page with gradient.
-
Type inference in assignment but not comparison??
Brian Evans replied to PiedSoftware's topic in RTL and Delphi Object Pascal
From my understanding: expressions always evaluate the same and it is the assignment operation doing type conversions when they are straightforward. That works for assignment because there is a variable on the left of a specific type and not an expression and they are never reversed. A comparison has an expression on both sides and can be reversed so type conversion on corner cases could mean A = B and B = A give different results. Better to have the programmer explicitly make each expression evaluate to the same type or at least be stricter than what happens on assignment. -
Postgres limitation - no multiple statements in a prepared query (queries must be prepared if they use parameters). Note a single statement runs in a transaction anyway so the begin;/end; are not needed in the example. Most use stored procedures in the database when there is a need to execute multiple statements based off passed in parameters. Some use DO and pass in the contents of a stored procedure body as a string to run as an anonymous code block but then you can't pass in any parameters.
- 13 replies
-
- firedac
- postgresql
-
(and 1 more)
Tagged with:
-
In Postgres BEGIN needs to be followed by a semicolon. It is equivalent to some other databases START TRANSACTION. It should be paired with a COMMIT and not END. Ref: PostgreSQL: Documentation: 17: 3.4. Transactions Single statements usually run as a transaction anyway - either the whole statement executes or none of it does. So, for a single statement your SQL would just be: update mytable set testno = testno + :increment where id = 1;
- 13 replies
-
- firedac
- postgresql
-
(and 1 more)
Tagged with:
-
Parameters are not processed by Delphi inside string constants in SQL queries. You are using Dollar-Quoted String Constants (strings delimited by starting and ending with $$). do $$ string constant that is executed as an anonymous code block $$ Ref: PostgreSQL: Documentation: 17: 4.1. Lexical Structure
- 13 replies
-
- firedac
- postgresql
-
(and 1 more)
Tagged with:
-
FireDAC Exception handling without driver info
Brian Evans replied to NamoRamana's topic in Databases
That message comes from the underlying database so knowing which database is helpful in interpreting it. Seems counterproductive to be removing context from error messages.