Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 01/04/24 in all areas

  1. pyscripter

    Is there any edit/memo which allows multiselect?

    All modern code editors have multi-select and multi-caret functionality (Visual Studio, VS-Code, Scintilla, Atom etc.). Also the freepascal CudaText. See CudaText - Free Pascal wiki for how it works. Very useful. I am currently working to add this to SynEdit.
  2. Brandon Staggs

    Encryption (AES)

    Right, the whole reason for Argon2/id is for consuming a resources to generate a password hash so that a brute-force attack or rainbow table generation is not feasible. Calling Argon2 less secure than bcrypt because someone might use insufficient settings (that nobody would suggest using) is not reasonable. In fairness, the comments on that readme are pretty old. Anyway, I took this way off the rails, I just want to be sure someone who looks at that Delphi Argon2 project on github understands it is incomplete and its readme contains some very outmoded (at best) sentiments. :-)
  3. A pretty simple implementation (assuming ranges are non-overlapping and added in the right order) could look like this: type TRanges = class private FLow: TArray<Integer>; FHigh: TArray<Integer>; FType: TArray<Integer>; public procedure AddRange(ALow, AHigh, AType: Integer); function Contains(AValue: Integer; out AType: Integer): Boolean; end; procedure TRanges.AddRange(ALow, AHigh, AType: Integer); begin FLow := FLow + [ALow]; FHigh := FHigh + [AHigh]; FType := FType + [AType]; end; function TRanges.Contains(AValue: Integer; out AType: Integer): Boolean; var idx: Integer; begin Result := False; if not TArray.BinarySearch<Integer>(FLow, AValue, idx) then begin if idx < 1 then Exit; Dec(idx); end; if AValue <= FHigh[idx] then begin AType := FType[idx]; Result := True; end; end;
  4. I would personally write such a program as a service application and let it monitor messages like WM_POWERBROADCAST to log the events. This way you can be sure that the application is always running and will capture the events when they happen.
  5. Yes they do plus you can add other edit components. So this may be a Woll2Woll issue as the app compile now uses the latest Firepower components update for Delphi 12 and there were no problems with the earlier versions. I will add a post to their forum. Thanks.
  6. I am pleased to announce that Daniele Teti's DelphiMVCFramework (https://github.com/danieleteti/delphimvcframework) now includes an adaptor to integrate with the Sempare Template Engine (https://github.com/sempare/sempare-delphi-template-engine). A sample project (https://github.com/danieleteti/delphimvcframework/tree/master/samples/serversideviews_sempare), modelled on the Mustache sample, illustrates the usage. The README.md provides an overview on the usage and the sample app. Daniele has also published a post on his latest release: https://www.danieleteti.it/post/delphimvcframework-3-4-1-sodium/ The template engine is not included in the distribution. To include it, contrib/get-sempate-template-engine.bat will clone it into the lib folder. The Sempare Template Engine is also available via Embarcadero's GetIt (https://getitnow.embarcadero.com/sempare-template-engine-for-delphi). v1.7.3 and above is required. Note that the template engine is dual-licensed, under GPL for open source and the Sempare Commerical license for commercial projects. Here is an example of how the template engine is used in a project: 1. You need a controller method mapping onto an HTTP endpoint (GET /people) 1 [MVCPath('/people')] 2 [MVCHTTPMethods([httpGET])] 3 [MVCProduces(TMVCMediaType.TEXT_HTML)] 4 5 procedure TWebSiteController.PeopleList; 6 var 7 LDAL: IPeopleDAL; 7 lPeople: TPeople; 9 begin 10 LDAL := TServicesFactory.GetPeopleDAL; 11 lPeople := LDAL.GetPeople; 12 try 13 ViewData['people'] := lPeople; 14 LoadView(['people_list']); 15 RenderResponseStream; 16 finally 17 lPeople.Free; 18 end; 19 end; 2. You need to assign some data to be rendered in the ViewData collection. This could be any data that can be inspected via RTTI. 13 ViewData['people'] := lPeople; 3. Identify the view to be used. 14 LoadView(['people_list']); 4. Define the template 'people_list.tpl' in the 'templates' directory. {{ for person of people }} {{ person.FirstName }} {{ end }} The actual example in the sample project is a bit more detailed. In DAL.pas, type TPerson = class // ... property FirstName: string read FFirstName write SetFirstName; property LastName: string read FLastName write SetLastName; // ... end; The template engine can dereference properties or fields on PODOs, or any type of structure dynamically and provides extensibility methods to support custom behaviour, as required. More detailed documentation is available on https://github.com/sempare/sempare-delphi-template-engine. Please contact us for consulting/support/training if required. info@sempare.ltd/conrad.vermeulen@gmail.com Have fun.
  7. The sample code above uses VarPyth for high level access to python objects. MainModule is custom variant wrapping the __main__ python module. Unless you provide optional parameters to ExecStrings, the code is executed in the context of the __main__ module.
  8. When performance is an issue, pass by reference then. Presumably you are happy to use value types like integer? Or do you shun all value types? Prevent what bugs? Code with interfaces can have bugs too. So it's not some magic solution. Code using interfaces can have leaks. They are still there, the compiler writes them. It's the exact same pattern as used with classes. It's well known and easy to follow. This is true. But it's simple enough to flow the rules and avoid this.
  9. How about? var SL := TStringList.Crete; try SL.LoadFromFile('example.py'); PyEngine.ExecStrings(SL); var Res := MainModule.DoExample('input'); finally SL.Free; end;
  10. Dave Nottage

    iOS 17

    No official fix as yet, however I have come up with the following workaround - Note: this has had no testing beyond a blank app: 1. Copy FMX.Platform.iOS from source\fmx into your project folder. 2. In the TApplicationDelegate.applicationDidFinishLaunchingWithOptions method towards the end, make the following change (i.e. add the one line of code indicated😞 // Creating window WindowManager := PlatformCocoaTouch.WindowManager; WindowManager.Window := TFMXWindow.Create(MainScreen.bounds); WindowManager.RootViewController := TFMXViewController.Create; // *** iOS17 SDK crash issue - Add the following line: *** WindowManager.RootViewController.Super.init; WindowManager.NativeWindow.makeKeyAndVisible; Note also that this measure is needed only if you are building against the iOS 17 SDK - it is not required when building against earlier SDKs.
  11. dummzeuch

    ANN: Parnassus Parallel Debugger

    I second that, but as always I would prefer text + screen shots over a video because it's searchable and I can easily jump between the parts that are currently important for me.
×