-
Content Count
3319 -
Joined
-
Last visited
-
Days Won
110
Everything posted by Lars Fosdal
-
Is variable value kept after For.. in ... do loop?
Lars Fosdal replied to Mike Torrettinni's topic in RTL and Delphi Object Pascal
Which means lists and arrays of objects may be preferable over lists and arrays of records in certain situations. -
Is variable value kept after For.. in ... do loop?
Lars Fosdal replied to Mike Torrettinni's topic in RTL and Delphi Object Pascal
So, looping an array of records using for v in array, can be significantly more expensive than indexed access using for vx := Low(array) to High(array), given the size of the record? -
git - do you 'pull' before/after switching branches?
Lars Fosdal replied to David Schwartz's topic in General Help
It is good practice to pull / update, CHECK AND COMPILE before push / commit. I agree with Dalija and Anders that if there are unintended cosmetic changes in a commit (explicit form coordinates / white space), it is good practice to discard the changes before the commit. That really simplifies looking for actual changes in the version history later. And - for the love of developer team sanity - write proper push / commit statements 😛 Edit: To clarify - comment the scope and purpose of the changes. If there are caveats, they should be comments in the code, not in the commit. -
Remove non-utf8 characters from a utf8 string
Lars Fosdal replied to borni69's topic in Algorithms, Data Structures and Class Design
Isn't single characters in the #128-#255 range invalid in UTF8, if not prefixed to form a sequence? Are there per definition, UTF8 sequences that are invalid? -
Is variable value kept after For.. in ... do loop?
Lars Fosdal replied to Mike Torrettinni's topic in RTL and Delphi Object Pascal
http://docwiki.embarcadero.com/RADStudio/Sydney/en/Declarations_and_Statements_(Delphi)#For_Statements For to rules are pretty clear: For in rules are a bit general: I am not sure how this would be a problem if we are talking about a loop over a list of objects, as we then would be passing a reference to the list object? I have not really thought about how the variable of a for in loop over an array of records is kept. Do we see a deep copy of the array element in the loop variable, or is there pointer magic involved? I can see how this could be a problem if the reference passed is to a local stack copy. -
@Carlo Barazzetta, This looks awesome, but I found a bug and identified the cause. https://github.com/EtheaDev/SVGIconImageList/issues/119 Luckily it was possible to work around the bug by removing the offending section.
-
string helpers question
Lars Fosdal replied to David Schwartz's topic in RTL and Delphi Object Pascal
ROFL! -
Help needed. Re-raising exception gives AV.
Lars Fosdal replied to a topic in RTL and Delphi Object Pascal
https://quality.embarcadero.com/browse/RSP-31084 -
Help needed. Re-raising exception gives AV.
Lars Fosdal replied to a topic in RTL and Delphi Object Pascal
program SydnetExceptionsReRaise; {$APPTYPE CONSOLE} uses System.SysUtils; function LogExceptionFunc(const E: Exception): string; begin Result := E.Message; Writeln('Func Log + ' + E.Message); end; procedure LogExceptionProc(const E: Exception); begin Writeln('Proc Log + ' + E.Message); end; procedure Test1_OK; begin try try raise Exception.Create('This is a raised Exception'); except on E: Exception do begin LogExceptionProc(E); raise; end; end; except on E: Exception do begin Writeln('Test 1 ', E.ClassName, ': ', E.Message); end; end; end; procedure Test2_OK; var lMessage: string; begin try try raise Exception.Create('This is a raised Exception'); except on E: Exception do begin lMessage := LogExceptionFunc(E); raise; end; end; except on E: Exception do begin Writeln('Test 2 ', E.ClassName, ': ', E.Message); end; end; end; procedure Test3_Fail; begin try try raise Exception.Create('This is a raised Exception'); except on E: Exception do begin LogExceptionFunc(E); raise; end; end; except on E: Exception do begin Writeln('Test 3 ', E.ClassName, ': ', E.Message); end; end; end; begin try try Test1_OK; Test2_OK; Test3_Fail; except on E: Exception do begin Writeln('Unexpected ',E.ClassName, ': ', E.Message); end; end; finally Write('Press Any Key'); ReadLn; end; end. Here you go. No joke. -
Help needed. Re-raising exception gives AV.
Lars Fosdal replied to a topic in RTL and Delphi Object Pascal
If you expand it with the examples that actually works - it would be sufficient for a QP, IMO. -
Help needed. Re-raising exception gives AV.
Lars Fosdal replied to a topic in RTL and Delphi Object Pascal
Interestingly, the two following changes eliminates the AV on raise. Either, change LogException to a procedure procedure LogException(const E: Exception); begin Writeln('Log + ' + E.Message); //Logging('Blah blah' + Result, 'Exceptions'); FYI end; or assign the result to a variable: on E: Exception do begin lMessage := LogException(E); // AV in Sydney, OK i Berlin // LogExceptionEx(E, lMessage); // OK raise; end; It does look like a compiler problem. Is there a QP report? -
Clearly, it is based on jokes alone.
-
tsslhttpcli TSslHttpCli Access violation at address or 404 error
Lars Fosdal replied to Estefanie's topic in ICS - Internet Component Suite
I guess injecting a deprecated statement for the old class could be an option - or is that too brutal. -
@Jim McKeeth should kick some shins to have a new roadmap produced.
-
if WinApi.Windows.IsIconic(Application.MainForm.Handle) then begin // Log something end; https://docs.microsoft.com/en-gb/windows/win32/api/winuser/nf-winuser-isiconic?redirectedfrom=MSDN
-
Blocking the Windows Screen Saver in Delphi
Lars Fosdal replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
I can't remember why not - prolly because Numlock was the first to spring to mind. Anyways, I've been using this for years now, and never experienced any adverse side effects. -
Fast Reports suddenly disappared - and reinstall fails
Lars Fosdal posted a topic in Delphi IDE and APIs
Have any of you seen something similar to this? Delphi 10.3.3 -
Fast Reports suddenly disappared - and reinstall fails
Lars Fosdal replied to Lars Fosdal's topic in Delphi IDE and APIs
Well, it sort of forced my hand in switching to 10.4.1 a little ahead of time. Going live on new version to day. Oh, such fun to reconfigure all the build scripts 😛 -
New feature request: Open dfm as Text if malformed (vote if care)
Lars Fosdal replied to Tommi Prami's topic in Delphi IDE and APIs
Sounds like an excellent suggestion! -
10.4.1 - Debug Layout with Parnassus Bookmarks raises AV
Lars Fosdal posted a topic in Delphi IDE and APIs
Much annoying. Very bug. 😛 https://quality.embarcadero.com/browse/RSP-30576 -
10.4.1 - Debug Layout with Parnassus Bookmarks raises AV
Lars Fosdal replied to Lars Fosdal's topic in Delphi IDE and APIs
Doh! Ref. https://blogs.embarcadero.com/ide-plugins-in-rad-studio-10-4-1/ The solution was to use GetIt to uninstall 1.6.1 and install 1.6.2. -
There is an extra fee for solving homework problems, isn't there?
-
Generics: Classes vs Records - Differences in use
Lars Fosdal posted a topic in Algorithms, Data Structures and Class Design
Thread split off from if Data.TryGetValue(aId, vNewData) then vNewData.DataName := aName; else begin vNewData := TDataRec.Create; vNewData.DataId := aId; vNewData.DataName := aName; Data.Add(aId, vNewData); end; @Stefan Glienke - What is the best container for random lookup access for records? -
Best Practices for FireDAC FetchMode/RecordCount Settings
Lars Fosdal replied to Larry Hengen's topic in Databases
Indexing and doing index maintenance is crucial to maintain performance. If the queries can be done completely free form, that will be a challenge. IMO, there are few settings to FireDAC that really affects the performance once the query has been passed to the server. -
Generics: Classes vs Records - Differences in use
Lars Fosdal replied to Lars Fosdal's topic in Algorithms, Data Structures and Class Design
In my experience, it is far easier to use classes when you need to modify contents. I wish it weren't so, and it can be worked around - but then usually with pointer references, and at that point (pun intended), I might as well be doing objects and maintain type safety and support polymorphism.