Jump to content

Anders Melander

Members
  • Content Count

    2751
  • Joined

  • Last visited

  • Days Won

    146

Everything posted by Anders Melander

  1. Anders Melander

    String memory usage

    Nice and simple. Lovely!
  2. Anders Melander

    String memory usage

    FWIW, I once, as an experiment, implemented string interning using a dictionary in an application that contained hundred of thousands of strings with about 75% duplicates. It was a 32-bit application which was hitting the 4Gb limit and running out of memory. Sure, it saved a few hundred megabytes but the overhead of the dictionary lookup completely killed the performance. With 64-bit and virtual memory I can't see any reason at all to do this exerciser.
  3. It's still hardware and nothing in the various software APIs require the use of shortstring.
  4. The TFDParam parameter is an object reference (i.e. a pointer). You are not modifying the object reference; You are modifying a property on the object. So drop the var. I would also change the TComboBox parameter to an integer and pass TComboBox.ItemIndex instead; There's no reason to create a dependency on TCombobox when all you need is the ItemIndex.
  5. Anders Melander

    speed of pow() in c++

    Btw, you should probably check out Agner Fog's vector library. Here's the pow implementation (but RTFM ) https://github.com/vectorclass/version2/blob/f4617df57e17efcd754f5bbe0ec87883e0ed9ce6/vectormath_exp.h#L1493
  6. Anders Melander

    speed of pow() in c++

    I don't use C++ anymore but I assume that like everybody else (Delphi for one) it's using pow(x, y) = exp(y * log(x)) and I doubt that you'll find anything faster than that. Here's an implementation: https://github.com/lattera/glibc/blob/master/sysdeps/ieee754/dbl-64/e_pow.c Looks pretty optimized to me. Of course you'll need a decent compiler to turn it into something that actually takes advantage of the processor features.
  7. It's impossible to suggest a good solution without knowing more about the context. If it's just a case of either setting or clearing a TParam value then just pass the TParam to the function and let the function operate directly on that.
  8. I'm pretty sure that anyone asking for help with something as basic as this isn't handling, or even aware of, NaN. Regardless, I personally wouldn't solve the problem with a magic value.
  9. Anders Melander

    Does the main form's OnShow event only ever fire once?

    I don't believe this is true at the Windows API level; AFAIK Windows will not destroy a window handle unless you tell it to do so. But as you know, the VCL on the other hand will do so if it needs to change some attributes that can only be set by CreateWindow(Ex).
  10. Anders Melander

    Does the main form's OnShow event only ever fire once?

    If you mean the, undocumented, TextScaleFactor setting then no, that doesn't do it.
  11. Anders Melander

    Help with TFDBatchMove fields

    Here's some code to get you started: https://bitbucket.org/anders_melander/better-translation-manager/src/master/Source/amDataCsvReader.pas ...used in this unit: https://bitbucket.org/anders_melander/better-translation-manager/src/master/Source/amLocalization.Dialog.Import.CSV.pas
  12. Anders Melander

    Help with TFDBatchMove fields

    I haven't used that particular component, as I have my own CSV import library, but I suggest you examine the DFM file in text mode (Alt+F12 in the IDE) to verify that all properties are as you expect them to be.
  13. Anders Melander

    Delphi developer needed in Denmark

    You might get better exposure if you post your job listing on jobindex; Linkedin is a bit of a self-gloryfying BS echo-chamber so I doubt most developers follow what goes on there.
  14. Anders Melander

    Packages and Package structure

    When you recompile a design-time package that is currently installed then the IDE must unload that package before it can be linked. Now, if you at the same time have forms open that uses one of the components in that package, then the IDE must also close those forms and this is where it typically goes wrong (AVs, internal errors on compile, etc.). Why I don't know. It's probably a bug in the IDE:
  15. I invite you to visit the bug tracker for any of Atlassians products (Jira, Confluence, Bitbucket, etc) and look at some of the existing requests. But leave all hope behind before you enter; The most popular requests, be it bug reports or enhancement requests, are often also the oldest - and we're talking decades. For example the request to have Confluence links open in a new window, a feature provided by just about every other web documentation tool, was rejected after almost 20 years of bad excuses. "Buy a third party solution" is their current stance. Unless a change directly translates to an increase in income then Atlassian doesn't give a sh*t if the request is reasonable. They survive on the sunken cost fallacy.
  16. Anders Melander

    Does the main form's OnShow event only ever fire once?

    You asked about "things not accessible at the time the constructor is called" which is what I addressed. I can't see how the workings of OnShow and OnResize is relevant to that.
  17. Anders Melander

    Does the main form's OnShow event only ever fire once?

    The properties that are calculated/updated on demand when the form or its controls are shown comes to mind. For example the position/size of aligned controls.
  18. Anders Melander

    Packages and Package structure

    There's no problem with just using the components as long as you don't use them at design-time (i.e. place them on forms) as that could create a chicken/egg situation when the forms are opened on a system where the components hasn't yet been installed. If you need to use your components in the package, just create them dynamically in code.
  19. Anders Melander

    Modifying the (Default) Value in registry

    On my system (Windows 10) the mouse pointer color setup is stored in HKCU\SOFTWARE\Microsoft\Accessibility\ in the values CursorColor and CursorType. However... I don't think this cursor color thing works the way you expect. AFAIK the values in the registry are only there so the Mouse Pointer control panel applet can display the current settings. The values indicate how the mouse pointer looks - they do not actually control it. What I think happens, when you change the mouse pointer color in the control panel, is that the applet create a set of cursor files with the desired color/mask and then write the config to the registry so it can display the setting the next time it is run. In other words, in order to change pointer colors, your application will need to: Create some cursor (.cur) files. Write them to the appropriate location on disk. Somehow get windows to load them.
  20. Anders Melander

    Drag Drop via Ole

    Bite me
  21. Anders Melander

    Drag Drop via Ole

    No; It works with all drop targets. And if you look at the WM_DROPFILES example there's also an example of working around the UAC restrictions mentioned by Remy: https://github.com/andersmelander/Drag-and-Drop-Component-Suite/blob/de46eb2b804c33921809504d086285da11d4e3e5/Source/DropTarget.pas#L298
  22. Anders Melander

    Old Window border style on Delphi MDI child form

    Any authoritative sources for this? I've seen people make the same claim many times about both COM (claimed to be superseded by .NET) and GDI (claimed to be superseded by GDI+). Both ridiculous claims. Just because MDI windows doesn't support the same features as SDI windows doesn't mean that they're deprecated. The documentation certainly doesn't give any indication that it is so: https://learn.microsoft.com/en-us/windows/win32/winmsg/multiple-document-interface
×