Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 05/26/23 in all areas

  1. Anders Melander

    MAP2PDB - Profiling with VTune

    Success! Pushed and merged to master. Thank you to all that helped. You really saved me a lot of time. Especially since I was pretty unfocused and preoccupied (new job, lots of other projects, summer finally arrived).
  2. John R.

    MAP2PDB - Profiling with VTune

    Congrats! Fantastic work to both of you. Thank you. Even though it is high above my knowledge, it is a pleasure following this thread between @Jan Rysavy and @Anders Melander. I'm glad that such knowledgable people are still part of the Delphi community and hope that this project will get sponsored by Embarcadero somehow. Thanks again.
  3. Jan Rysavy

    MAP2PDB - Profiling with VTune

    Exactly, I saw it in debugger...
  4. Brandon Staggs

    Problems with Delphi class structure / visibility

    The uses clause is not for classes, it's for units. The only "visibility" issue with regard to CLASSES defined in UNITS is what you put in INTERFACE vs IMPLEMENTATION. But since you are refusing to post ACTUAL CODE (nothing you have posted would compile, so it can't be ACTUAL CODE), there is little anyone here can do to help you understand.
  5. Anders Melander

    MAP2PDB - Profiling with VTune

    Just did: https://bitbucket.org/anders_melander/map2pdb/downloads/ (map2pdb.20230526a-3.0.1.zip) Updating the readme.md now...
  6. Anders Melander

    MAP2PDB - Profiling with VTune

    Ah... That must be this block: // Write an empty block just so our layout matches LLVM. // This can be removed once our output is validated. FWriter.BeginBlock; FWriter.Write(Byte(0)); FWriter.EndBlock; The block doesn't appear in any stream so it must be marked free. It's block #3 = bit 3 = 0x00000008 I'll try to remove the block instead first. Stay tuned... Btw, I think I now know what checkInvariants is doing. What threw me was that it appeared to be modifying the FPM and I couldn't understand the purpose of that since it would have made the FPM unusable afterwards. I think it's working on a copy of the FPM; It marks all blocks found in a stream as free (in the FPM copy) and once it has done that for all the streams it checks if all blocks are now marked free. And well done, yourself! This looks interesting 🙂
  7. What kind of programming languages have you actually used before? Because you would have same issues in most languages... Event in javascript or python you need an instance to actually use it.
  8. David Heffernan

    Problems with Delphi class structure / visibility

    It's possible to write poor code in any language.
  9. Stefan Glienke

    Use case or if else ?

    Turn the strings into an enum or an index and put the functions into a const array over that enum/index.
  10. Clément

    Use case or if else ?

    I would also register my methods. They all seems to have the same signature. unit Unit121; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Generics.Collections, Vcl.StdCtrls; type TMyDecodeProcedure = procedure ( aDoc, aCdn, aRequestCorrelation, aMessageText : string ) of object; TForm121 = class(TForm) Button1: TButton; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } fDecoders : TDictionary<String, TMyDecodeProcedure >; procedure RegisterDecodeFunc; procedure DecodeExportAcc( aDoc, aCdn, aRequestCorrelation, aMessageText : string); procedure DecodeExportErr( aDoc, aCdn, aRequestCorrelation, aMessageText : string ); procedure DecodeExportReg( aDoc, aCdn, aRequestCorrelation, aMessageText : string ); public { Public declarations } function Execute( aDecoder, aDoc, aCdn, aRequestCorrelation, aMessageText : string; var aErrMsg : String ) : Boolean; end; var Form121: TForm121; implementation {$R *.dfm} procedure TForm121.FormCreate(Sender: TObject); begin fDecoders := TDictionary<String, TMyDecodeProcedure >.Create; RegisterDecodeFunc; end; procedure TForm121.FormDestroy(Sender: TObject); begin fDecoders.Free; end; procedure TForm121.DecodeExportAcc(aDoc, aCdn, aRequestCorrelation, aMessageText: string); begin // end; procedure TForm121.DecodeExportErr(aDoc, aCdn, aRequestCorrelation, aMessageText: string); begin // end; procedure TForm121.DecodeExportReg(aDoc, aCdn, aRequestCorrelation, aMessageText: string); begin // end; function TForm121.Execute(aDecoder, aDoc, aCdn, aRequestCorrelation, aMessageText: string; var aErrMsg : String): Boolean; var lDecoder : TMyDecodeProcedure; begin Result := fDecoders.TryGetValue(aDecoder, lDecoder); if Result then lDecoder( aDoc, aCdn, aRequestCorrelation, aMessageText ) else aErrMsg := Format('Decoder not found: %s', [aDecoder] ); end; procedure TForm121.RegisterDecodeFunc; begin fDecoders.Add('EXPREG', DecodeExportReg ); fDecoders.Add('EXPACC', DecodeExportAcc ); fDecoders.Add('EXPERR', DecodeExportErr ); { ... } end; procedure TForm121.Button1Click(Sender: TObject); var lErrMsg : String; begin lErrMsg := ''; Execute('EXPREG','1','2','3','4', lErrMsg); end; end. And you can add decoders more easily too..
  11. Minox

    Just open folder ( Android )

    If you have the rights to access the "DCIM/MyFolder" folder, you could build a simple browser (via "System.IOUtils.TDirectory.GetFiles") yourself and display the files contained in a list. Or launch an "Intent" with "ACTION_GET_CONTENT", to open the system app
  12. David Heffernan

    Use case or if else ?

    It would also be better to write a function that took the string, and returned the method to be called, to be held in a variable of procedural type. You could then have a single call to the procedure where you passed the arguments. It's very repetitious to pass the same 4 arguments to 14 separate methods.
  13. Fr0sT.Brutal

    Use case or if else ?

    TEnum + array[TEnum] of strings + case TEnum(IndexStr) => 1. Constants are extracted from code 2. array[TEnum] ensure constants are in sync with enum 3. named enum members are more readable than numbers 4. static analyzer (alas not the Delphi's) will how warning if case won't cover all possible enum values I used IndexStr approach in some of inline switches but it really doesn't look obvious. If this case is speed-critical, you probably have to use sorted array and binary search. However for low number of items it gains almost nothing. Dictionary also has its penalty of hashing the value to be searched for. In fact seems for short sets of short strings nothing beats dumb linear search in an array
  14. programmerdelphi2k

    Community license

    As I said above, imagine the scenario: An avid programmer in Delphi, is on a trip, and takes the opportunity to debug his code, and, unfortunately, connects to the public and open Wifi at the train/metro station... he runs his application developed in Delphi CE, and, ... days later, the train/metro company receives a letter from Embarcadero saying that he "must" buy (without delay) a Professional or Enterprise license of Delphi, because it was detected that a Delphi CE application was being used on the day xx/xx/xxxx at xx:xxhr... and the company it's not eligible for $5000/year Isn't this a dire situation caused by Embarcadero's type of marketing?
  15. To investigate the issue, you should determine at which moment it happens. I'm not sure you can reach HTTPClient's internals but start with line number inside TWinHTTPClient.DoExecuteRequest in the call stack. Also check if it has any logging features. And try to gather as much info as possible - time, file size, concrete request, whether Internet is up at the moment of disconnect, etc
  16. Achim Kalwa

    remove ExplicitXxxx properties

    I know I am late to the party, but you might try the attached package for Delphi 10.4.1. It uses the hooking code from Andreas Hausladen's VclFixPack v1.4 to patch the TControl.DefineProperties method to a modified code, which does not write those Explicit* properties to the DFM file. Unpack the zip archive, open DControlsFix.dpk in Delphi 10.4.1, compile & install. There is nothing to customize. If this package is installed, the patch is active. If you like to get the default behaviour back, just uninstall the package. Use at your own risk 😉 DControlsFix.zip
×