Jump to content

Anders Melander

Members
  • Content Count

    2857
  • Joined

  • Last visited

  • Days Won

    156

Everything posted by Anders Melander

  1. Anders Melander

    Any Known Issues with ZCompressStream?

    Didn't anyone Google "zlib checksum"? According to the ZLib specification there is a checksum: https://tools.ietf.org/html/rfc1950
  2. Anders Melander

    How to operate a private field in other unit?

    That almost sounded like an insult but assuming that wasn't the intention; I didn't write the code but I've been tasked with maintaining, fixing and modernizing it. with isn't the only problem but it's the one that makes refactoring the code a much harder task than it should have been - and it makes the code undebuggable. Among the other beauties in this code base are the local procedures; The above was actually found in a local procedure, several levels down. The top level method is a few thousand lines of pure horror.
  3. Anders Melander

    Double-dabble to convert binary to decimal

    Ummm. I must be missing some deeper meaning here but what is the point of pretending that an integer values isn't already stored in binary format? I mean, I could understand if you were trying to implement bin/dec conversion on a denary computer but other than that this sounds like an algorithm for people that doesn't have access to computers.
  4. Anders Melander

    How to operate a private field in other unit?

    I dnt knw bout u, bt I gt $ 4 the Q of my cde. Not for the amount of keystrokes I can save.
  5. Anders Melander

    Double-dabble to convert binary to decimal

    You mean to say that you've memorized all the 16 hex digits? Wow
  6. Anders Melander

    How to operate a private field in other unit?

    I'm still hoping that with will be completely eliminated from the language. Here's a few lines from the code I'm currently working on: begin ...3-400 lines of code... with vPlan.DataController, dbSlaktePlan, BLPlan, Grupper ,Data[Id] do begin ...a few hundre lines more... with vPlan, BLPlan.SiteSum, Plans[Id] do begin ...and it goes on...
  7. Anders Melander

    Localization inquery

    It seems to me that what you're describing is beyond the scope of localization and therefore BTM. BTM is a localization manager/editor. It provides translations to the standard localization mechanism built into the Delphi RTL. If you're not using that, and it doesn't sound like it, then I can't see how BTM can meet your needs. That said, the translated resource modules generated by BTM are just DLLs containing the translated resources (i.e. resourcestrings and DFMs). This means that you can use regular Windows APIs to load and extract the resources from these resource modules. It's also possible to hook into the resource loading mechanism and redirect the loading of selected forms to other resource modules. This could provide the multi-language capability. You could also just read the translation project file (it's XML) and extract the translations from there. But, to be honest, none of the above sounds like a good path to go down.
  8. Anders Melander

    Workaround for binary data in strings ...

    Yes but that was not what you wrote.
  9. Anders Melander

    Workaround for binary data in strings ...

    *cough* WideString *cough* Available since D4 or thereabouts...
  10. Yet again the duck proves that it's invaluable.
  11. Anders Melander

    Drone control from mobile

    ArduPilot and QGroundControl not working for you?
  12. Anders Melander

    More performance Stringgrid sorting algorithm help

    Yes. Without that I wouldn't use them.
  13. Anders Melander

    More performance Stringgrid sorting algorithm help

    Fair enough. I've come to use them a lot. Often I have to remind myself to use a new feature after it's introduced but this one feels so natural that I'm not thinking about it all. If anything I have to remind myself not to use it too much. The ternary operator. Didn't like it when my main language was C++ and I still don't like it. For me it somehow breaks the flow when I'm reading code.
  14. Anders Melander

    More performance Stringgrid sorting algorithm help

    Why so sad? Because of the leak?
  15. Anders Melander

    Olevariant and memory leak

    I would examine the call to Save in the CPU view in the debugger to determine when, and if, the passed variant is cleared. I remember there was some leakage issues surrounding variants passed as value parameters to dispatch interfaces but I can't remember the details anymore. Not related to your leak but: Instead of String(AInputVariant) you could do: VarToStr(AInputVariant) Instead of copying the TStringStream to a TMemoryStream, why don't you just operate directly on the TStringStream? lStringStream.Position := 0; lOutputStream.CopyFrom(lStringStream, lStringStream.Size); is the same as lOutputStream.CopyFrom(lStringStream, 0);
  16. If you could define what "some json issue" is then we (and you) would have a chance of actually solving this problem. Right now we're all just guessing.
  17. Anders Melander

    GetIt

    Yeah, there's that. My point was more that the Delphi does much more. Not that it wouldn't be nice if they made it more or better "pluggable".
  18. Anders Melander

    GetIt

    So, you do a lot of GUI design, debugging and building in VSCode?
  19. Anders Melander

    UCS4StringToWideString broken?

    Remember that we're talking about UCS4StringToWideString and not WideStringToUCS4String but I'll try again: Yes, it's a given that the resulting string, which is a 2 byte widestring, will be zero terminated as all Delphi long strings are. If the input was a PUCS4Char (a pointer to a zero terminated 4 byte string) then the input would have to be zero terminated. But it isn't. The input is an array in which the length is implicit. This means that the zero termination requirement is superfluous. The function could be implemented so that it handled both arrays with and arrays without a zero in the final entry. You know; Defensive coding. Just in case someone mistakenly passed an array that wasn't zero terminated because the documentation didn't state that you had to...
  20. Anders Melander

    git workflow question

    Okay. Yes, I can see that there's a git merge --squash command. So I guess SourceTree squashes commits by default because when I merge and push I only get one new commit in the history of the target. The only reference to "squash" that I've come across in SourceTree is in the Interactive Rebase dialog (which I don't understand enough to dare use).
  21. Anders Melander

    UCS4StringToWideString broken?

    I meant the function doesn't need it to be zero terminated (it has the length already).
  22. Anders Melander

    ExtractFileDrive bug

    So how do you deal with mapped drives, mounted volumes, symbolic links, junctions and hard links?
  23. Anders Melander

    git workflow question

    Squash? But that's a rebase thing, right? So how can you squash without rebase? Anyway. Let's say I have my 'master' commit history: 1. Initial commit 2. Made some changes 3. Fixed some changes At commit #2 I branch 'master' into 'FooBar' and make "a few" commits to that branch: 1. Experimental stuff 2. Enhancements ... 999. Refactorings 1000. Updated easter egg Now I merge my 1000 commit branch into master (resolve conflicts etc): 4. Merge branch 'FooBar' into 'master' And push. So the now 'master' commit history will read: 1. Initial commit 2. Made some changes 3. Fixed some changes 4. Merge branch 'FooBar' into 'master' Are you saying that you'd want the whole 1000 'FooBar' commits to appear in the 'master' commit history? I can see that if you don't have 'FooBar' pushed to the remote then the history will be lost, in which case it makes sense, but if you have pushed it, then there's no need to duplicate that history in 'master'.
  24. Anders Melander

    Where is the Install command in the Project Manager of D10.3?

    You didn't answer any of the questions.
  25. Anders Melander

    git workflow question

    I'm not sure I agree with it. As I read it, and I may well be misunderstanding it, it assumes that when I merge my 1000 commit feature branch into master that I want all 1000 commits to appear in the master commit history. Well I definitely don't. The 1000 commits are the sausages being made and I only want the finished sausage in the master commit history. There's also this: What it should have said is: never rebase a public branch. It's perfectly safe and normal to rebase a private branch on a public branch. Assuming on=onto. Maybe that's what he meant.
×