Jump to content

Lars Fosdal

Administrators
  • Content Count

    3565
  • Joined

  • Last visited

  • Days Won

    120

Everything posted by Lars Fosdal

  1. Lars Fosdal

    I get value=none

    Please, be civil.
  2. Lars Fosdal

    order by string same integer

    uses WinApi.ShLwApi, ... type TCompareLogical = class(TComparer<String>) function Compare(const Left, Right: string): Integer; override; end; function TCompareLogical.Compare(const Left, Right: string): Integer; begin Result := WinApi.ShLwApi.StrCmpLogicalW(@Left[1], @Right[1]) end; procedure TForm1.Button1Click(Sender: TObject); var LArr: TArray<string>; begin LArr := ['1','1.1','1.1.1','1.2.1', '1.1.1.1','1.1.1.2','1.1.1.3','1.1.1.4','1.1.1.5','1.1.1.6','1.1.1.7','1.1.2' ,'1.1.2.1','1.1.2.2','1.1.3','1.1.3.1','1.1.4','1.1.4.1','1.1.4.2','1.1.5','1.1.5.1','1.1.6','1.1.6.1' ,'1.1.6.2 ','1.2','1.2.1.1','1.2.1.10','1.2.1.11','1.2.1.2','1.2.1.3','1.2.1.4','1.2.1.5' ,'1.2.1.6','1.2.1.7','1.2.1.8','1.2.1.9' ]; var Comp := TCompareLogical.Create; TArray.Sort<string>(LArr, Comp); Memo1.Lines.AddStrings(LArr); Thanks, @Stefan Glienke, I didn't know about that function. I also did not know about HIERARCHYID in SQL, so thank you for that one, @mofareh ORDER BY Cast ('/' + acc_numb + '/' AS HIERARCHYID)
  3. Lars Fosdal

    "Always break line between else and if" vs. comments

    Well, I am not that consequent, so I'll make do, doing it manually. It did take me 30+ years to develop this style for readability, though. One of the benefits of breaking before then, is that it becomes easy to comment out parts of the if condition. One of the benefits of the hanging indent on single line statements, is that it is easy to spot where the full statement ends. Readability is cruical. Maintainability improves with readability.
  4. Lars Fosdal

    OAuth2 bearer token example?

    LOL, no 😄
  5. Lars Fosdal

    "Always break line between else and if" vs. comments

    /off-topic Preferences of code. I like begin/end for clarity. However, I also like unusual breaks before then and strange indentations of single statements. If only I could convince the formatter to do my bidding. procedure MyProcedure(a, b: Boolean); begin if a then begin if b then Beep else Beep end else begin if b // Kommentar then Beep else Beep; end; end;
  6. Lars Fosdal

    OAuth2 bearer token example?

    I think I was fooled by my own expectations with regards to the simplicity of OAuth2 and functional level of the TOAuth2Authenticator. The C# code example can be found here, but it uses another assembly from Thinktecture to do the http parts. https://github.com/LarsFosdal/csharp-ion-api-sdk/blob/master/DotNetBackendOAuth2/Program.cs I'll ponder a little, google some more, and see if I can't crack this nut.
  7. Lars Fosdal

    OAuth2 bearer token example?

    I have instrumented the C# app with logging, so I see exactly what happens. The challenge is convincing the Delphi REST components to do the same thing.
  8. Lars Fosdal

    [Problem] Convert DB from unidac sqlite to FD sqlite

    There also is a confusing comment here https://docwiki.embarcadero.com/CodeExamples/Sydney/en/FireDAC.SQLite_Encryption_Sample
  9. Lars Fosdal

    [Problem] Convert DB from unidac sqlite to FD sqlite

    It is just weird with the message saying that the DB is NOT encrypted? Ref. https://docwiki.embarcadero.com/Libraries/Sydney/en/FireDAC.Phys.SQLite.TFDSQLiteSecurity.CheckEncryption
  10. Lars Fosdal

    [Problem] Convert DB from unidac sqlite to FD sqlite

    Are you sure there is no way to convince FD to use the appropriate encryption method?
  11. Lars Fosdal

    [Problem] Convert DB from unidac sqlite to FD sqlite

    Why can't it connect?
  12. Lars Fosdal

    [Problem] Convert DB from unidac sqlite to FD sqlite

    What if you in the app, first export to json with UniDAC, then close all Unidac DB conns, and then import with FireDAC?
  13. Lars Fosdal

    [Problem] Convert DB from unidac sqlite to FD sqlite

    It might be a bit banale, but what about a new version of the old app that exports to a json or xml file, and then the new app can import from that json or xml file?
  14. Nice idea, though. File a suggestion at https://quality.embarcadero.com/secure/Dashboard.jspa
  15. Lars Fosdal

    FireDAC + TableNames with '$'

    Please enter a report in https://quality.embarcadero.com/secure/Dashboard.jspa
  16. Lars Fosdal

    FireDAC + TableNames with '$'

    $ is not mentioned on that page, and $$ did not help.
  17. Lars Fosdal

    Close application during form create??

    That is interesting. Although, at that point the creation has been completed.
  18. Lars Fosdal

    ProgressBar not update in android

    Have a look at C:\Users\Public\Documents\Embarcadero\Studio\22.0\Samples\Object Pascal\Database\RESTDemo
  19. Lars Fosdal

    Digitally Sign Applicaiton

    Note that as an alternative to post-build events in the IDE, you can use a build server - such as Continua CI. We use that. It triggers after a commit to Git, increment versions, builds, runs unit tests, and translates, signs, package and copy the variants to their respective staging shares, and creates a zipped copy. Amazing time saver that ensure all builds are consistently handled.
  20. Lars Fosdal

    Digitally Sign Applicaiton

    The given example does not have any spaces in the references, so quotes won't help for those - otherwise I agree.
  21. The cost of maintaining multiple versions is staggering. With limited resources, it makes sense to focus on subscription users. I don't like it either, and I really don't like how they gimp the community version, but yeah - they are not MS with deep pockets filled from other products.
  22. I use VS 2022 and C# on .NET. It gets confused if you have third party assemblies without sourcecode that extend standard classes. It will show the doc for the standard class methods, even if the IL is decompiled correctly for the third party assembly. But, no, I haven't seen it stop working completely.
  23. Lars Fosdal

    ProgressBar not update in android

    Also, I would like to stress that doing direct SQL to a server from a mobile device is high risk. I recommend a REST service as a front end to the database.
  24. Lars Fosdal

    ProgressBar not update in android

    Create a shared percentage variable that can be referenced from both the db thread and the main thread In the UI, show the progress bar display, and refresh it on a timer f.x every 500ms, getting the percentage from the shared variable Create a thread to do the SQL fetch/write operations and update the shared progress percentage variable Once the thread is completed, close the progress bar display You may want to protect the shared variable with a critical section.
  25. Lars Fosdal

    FireDAC + TableNames with '$'

    @Dmitry Arefiev - Is there a way to deal with $ in table names for PostgreSQL?
×