-
Content Count
3710 -
Joined
-
Last visited
-
Days Won
185
Everything posted by David Heffernan
-
I need to merge these two codes but I have little programming practice.
David Heffernan replied to MrCamarium's topic in Network, Cloud and Web
Combine can mean many things. Realistically though, if you want to do programming, you can't avoid gaining the skills necessary. -
I can't see a joke here. Maybe I should just mute the topic because there is nothing more to say.
-
It isn't the case. Why are you speculating on something about which you have zero information?
-
Is a "bare-minimum" EurekaLog possible?
David Heffernan replied to aehimself's topic in Delphi Third-Party
No doubt I can get the information about the nested exceptions using ME code. I solved my problem a different way that was actually a bit more elegant and avoided the complexity of nested exceptions anyway. -
Is this telling you is that your data structure is wrong? What you need is a record with the 4 values and then array of that record. Then basic array sort with custom comparer gets it done. Then again, perhaps you so need direct access to contiguous arrays of each of the 4 scalars. As stated you really need a sort algo that allows you to provide both comparer and exchanger. I had such a thing once. The final approach is not to modify the arrays at all. Create an integer array with values from 0 to N-1 and then sort that using the x values to determine the order. Have the compare function return CompareSingle(x[idx[left], x[idx[right]])
-
Is a "bare-minimum" EurekaLog possible?
David Heffernan replied to aehimself's topic in Delphi Third-Party
In Pascal code Exception.InnerException is never assigned. -
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.