-
Content Count
3494 -
Joined
-
Last visited
-
Days Won
172
Everything posted by David Heffernan
-
Is a "bare-minimum" EurekaLog possible?
David Heffernan replied to aehimself's topic in Delphi Third-Party
Just trying to use inner exceptions in my own project (which has madExcept) and also feeling the pain ..... -
It's amazing how low expectations have become. "It sometimes works, sort of, if you refresh the page a few times" "You might get better results by spoofing your IP with a VPN"
-
Perhaps they don't know it's broken?
-
Imagine not being able to get your company's website up and running again after more than a week? What an absolute joke. I guess I'll go and find my old Delphi 6 printed language guide to look up the info I can't find online rn.
-
Sure, if you decide that all things must be called "value", then life is tough. But why make things so difficult?
-
I have to say that I have never understood why args get prefixed with A and why local variables get prefixed with L. Upper or lower case. I just don't see the benefit.
-
Am I using threads correctly?
David Heffernan replied to AlexQc's topic in Algorithms, Data Structures and Class Design
Nope, you are wrong. There's a window behind that TStrings. -
Writing a pre-processor to handle conditionals should be quite straightforward. I doubt that there exists the pre-processor that you describe.
-
Collaboration requires somebody to coordinate it, which in this case would need to be the author.
-
No. You just read the Win32 docs and off you go.
-
I have my own functions that call the task dialog api rather than using the VCL component.
-
You don't need a component on a form
-
Isn't this a VCL styles bug? Won't happen with plain windows theme.
-
Why don't you let us give you extra sets of eyes?
-
Perhaps I misunderstood the point you were trying to make, but that pattern of returning a newly created instance, with a Free in the except block is useful. Even then the FreeAndNil isn't needed because Result is not seen by the caller.
-
Not really. The call to LoadFromStream could fail.
-
Yes there is. I explained what was wrong in my first comment. The try of the try/finally is before the local variable LTextFile is assigned, but it should be immediately after it.
-
I don't think the issue is complexity, the example is fine. it's just a couple of minor inaccuracies. That said, I'd strip out the FileExists check and just focus on the exception handling: LTextFile := TStringStream.Create; try LTextFile.LoadFromFile(AFileName); Result := TMemoryStream.Create; try Result.LoadFromStream(LTextFile); except FreeAndNil(Result); raise; end; finally LTextFile.Free; end; If you'd like people to comment on the entire book, do ask!
-
This looks very interesting. After a quick skim of one topic on I note that there's an error on page 89 that is worth addressing. LTextFile is protected by a try/finally but created after the try rather than before the try. In that example I'd also put the try of the try/except immediately after the assignment to Result rather than two lines before it. For what it is worth I'm sure that if you had posted here then quote a few people would have read your book and looked for errors and given feedback. I would happily have done so and would still do so.
-
More efficient string handling
David Heffernan replied to parallax's topic in Algorithms, Data Structures and Class Design
vtune with map2pdb is excellent. It will take time to set it up, but it will save you time in the long run. And you'll have a better end result. -
More efficient string handling
David Heffernan replied to parallax's topic in Algorithms, Data Structures and Class Design
Yes. Use a buffered line reader. But more importantly measure where your code spends its time. Don't guess. -
Showing a warning form to some users
David Heffernan replied to Henry Olive's topic in RTL and Delphi Object Pascal
Sounds like you need to build some messaging infrastructure in to your program. -
More efficient string handling
David Heffernan replied to parallax's topic in Algorithms, Data Structures and Class Design
Regarding the code in the previous post, every call to Delete performs both a copy and a heap allocation. You should be able to do this with one heap allocation and one copy. -
Using translations in unit Consts with Delphi 10.4 VCL
David Heffernan replied to Dirk Janssens's topic in VCL
Why isn't the function call mapping to the native TaskDialog and so letting the OS provide the captions? -
TThread instances to run on separate CPU cores.
David Heffernan replied to DavidJr.'s topic in RTL and Delphi Object Pascal
No. There is no problem. If there are multiple threads then the OS will schedule them into different logic processor cores. Always has. You misdiagnosed your problem before.