Jump to content

Ian Branch

Members
  • Content Count

    1352
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Ian Branch

  1. Ian Branch

    Some REST help please.

    Hi Team, I haven't forgotten this, just dealing with some issues for a Customer.
  2. Ian Branch

    Credit Card Bank Fee and VAT/GST?

    Hi Team, In some places, not all, the use of a Credit Card to pay by a Customer incurs a 'Bank Fee' on the Seller. The Seller offsets this by adding an appropriate 'Bank Fee' to the sale. Question - Where VAT/GST applies, the Sale will incur a VAT/GST as part of the Sell Price. Does the 'Bank Fee' also incur the VAT/GST? What is the general experience/knowledge? Regards & TIA, Ian
  3. Ian Branch

    Feedback Request - FastReports vs ReportBuilder?

    In my early Delphi days I used FastReport however at that time it didn't/couldn't do what i needed so I moved to ReportBuilder. Since then I have never seen or come across a reason to look for another report engine. Ian
  4. Hi Team, I redid my routine to use StrCmpLogicalW. Now I get... uses System.Generics.Defaults; procedure SortStringArray(var AStringArray: TArray<string>); var Comparer: IComparer<string>; begin Comparer := TComparer<string>.Construct( function(const ALeft, ARight: string): Integer begin Result := StrCmpLogicalW(PChar(ALeft.ToLower), PChar(ARight.ToLower)); end ); // Sort the string array using the custom comparer TArray.Sort<string>(AStringArray, Comparer); end; Regards & Tks. Ian
  5. Hi Team, I have been following this thread because I have a need. What would be the correct natural sort order for these? 'file10.txt', 'File2.txt', '2fileb.txt', 'file1.txt', '1FileA.txt', 'file20.txt', '12fiLe.txt', 'file11.txt', '10file.txt' Is there a reference for dictating Natural Sort Order rules? I have my own StringArray Natural Sorting routines and they seem to work. I just want to make sure they are giving me the correct result IAW NSO rules. This is what I am producing att: Regards & TIA, Ian
  6. Hi Team, D11.3. Is there a way to pickup the number at build/compile time so I can include it in a log message? e.g. something like..LogMessage('This is line # '+%LineNumber%); I know I can hard code it but it would need to be re-done every time there is a code change. Regards & TIA, Ian
  7. Ian Branch

    Line number at build/compile time??

    I did say Tks = Thanks.
  8. Ian Branch

    Line number at build/compile time??

    Excellent! Tks p2k.
  9. Ian Branch

    Upgrading from 11.2 to 11.3

    I Third that...
  10. "Intelligence" - I think, therefore I am..
  11. Ian Branch

    App Tethering issue..

    Hi Team, Despite my pitiful efforts I have managed to get App Tethering working between two Apps. But, I have a problem. IIUC, the Sender has to be running before the Receiver. Something about establishing a socket This I can't guarantee. 😞 Is there any way to configure App Tethering so it dosn't matter if the Sender or Receiver starts first?? Regards & TIA, Ian
  12. Hi Guys, D11.3.1. This is what I understand att. Feel free to correct me if my understanding is incorrect. 1. If I set FormatSettings with a Country code, i.e. "var FormatSettings := TFormatSettings.Create('en-AU');", then that action will configure the various TFormatSettings properties in SysUtils to the Australian formats. 2. I can then forget about the variable FormatSettings. 3. Having set these properties in SysUtils, whatever Unit has SysUtils will have/use the set properties. 4. Any function/procedure that uses a FormatSettings property will now use the relevant set TFormatSettings property according to the Country/Region code employed in the '.Create()'. Are my understandings correct? Regards & TIA, Ian
  13. Ian Branch

    Setting & Usage of TFormatSettings..

    Ahhh. Tks for the tip. That was always a/the risk. Won't happen. Tks to all for your inputs and guidance. Regards, Ian
  14. Ian Branch

    Setting & Usage of TFormatSettings..

    Hi Dalija, Thank you for your input. Appreciated. Have you ever worked with Pacific Islanders? I have been dealing with them for the past 7 years and they can be extremely frustrating. They will do things with their PC just because. Including changing their date & time formats. and in a couple of cases their Region. My Customer wants all the Apps to operate to a standard format, interestingly, to en-AU, despite what the User may have done with his/her PC. I thought this would be a good way to enforce it. Regards, Ian
  15. Ian Branch

    NormalizedLocaleName??

    Hi Team, Win 11, D11.3.1. I am playing around with TFormatsettings and I am using this Emba code.. procedure Test; var str1, str2: string; FS: TFormatSettings; strResult, strFormat: TStringBuilder; begin strResult := TStringBuilder.Create; strFormat := TStringBuilder.Create; FS := TFormatSettings.Create('en-AU'); strFormat.AppendFormat('%s %s', [FS.LongDateFormat, FS.LongTimeFormat]); str1 := FormatDateTime(strFormat.ToString, Now()); strResult.AppendLine('1.'+str1); ShowMessage(FS.NormalizedLocaleName); strResult.AppendLine(FS.NormalizedLocaleName); //A second instance with a different locale (used for comparison) FS := TFormatSettings.Create('ro-RO'); strFormat.Clear; strFormat.AppendFormat('%s %s', [FS.LongDateFormat, FS.LongTimeFormat]); str2 := FormatDateTime(strFormat.ToString, Now()); strResult.AppendLine('2.'+str2); strResult.AppendLine(FS.NormalizedLocaleName); ShowMessage(strResult.ToString); // end; What should FS.NormalizedLocaleName return? Emba Help says a string but I am getting nothing back. Or maybe I am and it is blank. Not expected. Regards & TIA, Ian
  16. Ian Branch

    NormalizedLocaleName??

    Hi p2k, I didn't really know what to expect, although I thought it might be, in my case, Australia.
  17. Ian Branch

    Open IDE in DPI Unaware??

    Hi Team, D11.3.1. Win 11. When I double click on a Delphi file in Windows Explorer, it opens in Delphi IDE in DPI Aware mode. Is there someway to make Windows or Delphi open the IDE in DPI Unaware mode when I double click on a Delphi file fromthe File Explorer? Regards & TIA, Ian
  18. Ian Branch

    Open IDE in DPI Unaware??

    Yup it works, but it isn't perfect, yet. 😉
  19. Ian Branch

    NormalizedLocaleName??

    p2k, I was just experimenting with Formatsettings and came across this that gave me nothing. Ian
  20. Ian Branch

    Message Broker??

    Hi Team, D11.3. I have an App that populates the captions of two labels. It all works fine. What I would like to do is make this captions availabe to other Apps rather than regerating them in the other Apps. All the Apps are on a Windows 2012 Server. Multi-User. Some of the Apps may be running via RDP, the same and other Apps may be running via LAN, i.e. called from the Server and running physically on the User's PC. Users are using Win 7 & Win 10 workstations. The generating App may be being used at any time by many Users. The term Message Broker came to my mind and IIRC there was something by one of the inhabitants of this Forum that might be my solution. Can somebody refresh my memory and point me in the correct direction please? Or, alternatives. The simpler the better. 🙂 Regards & TIA, Ian
  21. Ian Branch

    Message Broker??

    Hi Team, Thank you for your inputs/suggestions? It seems App Tethering might be an option also. Is there working demo with source of App Tethering? Regards & TIA, Ian
  22. Ian Branch

    TProcessList issue.

    Hi Team, D11.3.1. I have the following function I am trying to get to work.. function GetApplicationInstances(const FileName: string): TArray<string>; var ProcessList: TProcessList; Process: TProcess; i: Integer; begin Result := TArray<string>.Create; ProcessList := TProcessList.Create; try for i := 0 to ProcessList.Count - 1 do begin Process := ProcessList[i]; if Process.FileName = FileName then begin Result.Add(Process.UserName); end; end; finally ProcessList.Free; end; end; I have bothe System.SysUtils and System.Diagnostics in my Uses clause but I am still gettin an 'undeclared identifier' for TProcessList and TProcess. What have I missed please? Regards & TIA, Ian
  23. Ian Branch

    TProcessList issue.

    Solved. I added the count to the function. function GetApplicationInstances(const FileName: string; out Count: Integer): TArray<string>; var ProcessEntry: TProcessEntry32; Snapshot: THandle; ProcessList: TList<string>; begin ProcessList := TList<string>.Create; try Snapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if Snapshot <> INVALID_HANDLE_VALUE then begin ProcessEntry.dwSize := SizeOf(ProcessEntry); if Process32First(Snapshot, ProcessEntry) then begin repeat if (ProcessEntry.szExeFile = FileName) then // Replace with appropriate condition begin ProcessList.Add(ProcessEntry.szExeFile); end; until not Process32Next(Snapshot, ProcessEntry); end; CloseHandle(Snapshot); end; Result := ProcessList.ToArray; Count := ProcessList.Count; finally ProcessList.Free; end; end; Tks Guys. Regards, Ian
  24. Ian Branch

    TProcessList issue.

    OK. Moving on. Using Enums rather than TProcess. function GetApplicationInstances(const FileName: string): TArray<string>; var ProcessEntry : TProcessEntry32; Snapshot : THandle; ProcessList : TList<string>; begin ProcessList := TList<string>.Create(); try Snapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if Snapshot <> INVALID_HANDLE_VALUE then begin ProcessEntry.dwSize := SizeOf(ProcessEntry); if Process32First(Snapshot, ProcessEntry) then begin repeat if (ProcessEntry.szExeFile = FileName) then // Replace with appropriate condition begin ProcessList.Add(ProcessEntry.szExeFile); end; until not Process32Next(Snapshot, ProcessEntry); end; CloseHandle(Snapshot); end; Result := ProcessList.ToArray; finally ProcessList.Free; end; end; I have the following lines. var Instances: TArray<string>; Instances := GetApplicationInstances(sFileName); I can't see a way to get the number of elements in the TArray. I thought "for var i := 0 to TArray(Instances).Count do Memo1.Lines.Add(Instances);" would be a monty, but no. How please?
  25. Ian Branch

    TProcessList issue.

    Hi Team, I found that bit of code and thought it would do the trick. Oh well. What I am try to achieve is a delphi function that when given a full application path/name, return how many instances are in use and who is using them.
×