Jump to content

Alberto Paganini

Members
  • Content Count

    51
  • Joined

  • Last visited

Community Reputation

3 Neutral

About Alberto Paganini

  • Birthday May 25

Technical Information

  • Delphi-Version
    Delphi XE2

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Alberto Paganini

    Buying a mini pc to install Delphi

    Hello again Thanks for this advice, my monitor had 1 VGA and 1 DVI. I took this onboard and connected one PC to one monitor port and the other PC to another. Then purchased a USB hub and plugged the keyboard and the mouse (and I still have two more USB ports available). All I have to do is to switch one USB cable and I can control one of the two PCs Thank you Alberto
  2. Alberto Paganini

    Buying a mini pc to install Delphi

    But don’t you need any hardware to connect all the hardware? I want to make clear I want to use one computer at the time I don’t want to keep both machines on at the same time. Many thanks Alberto
  3. Alberto Paganini

    Buying a mini pc to install Delphi

    Hello, I took the advice and compared the performance of the N100 against my desktop CPU single thread. I decided to spend a little more and get something that would perform better. In the end, taking advantage of a deal, I purchased this one: https://www.amazon.co.uk/dp/B0CBJRZ1WY?ref=ppx_yo2ov_dt_b_fed_asin_title&th=1 I don't want to get rid of the old desktop and want to switch between desktop and Mini PC easily. I was looking into a KVM switch. No problem with the mouse and keyboard as they both have USB connectors, the only issue is the monitor which has a DVI connector like this one https://www.amazon.co.uk/Benfei-Bidirectional-Female-Adapter-Gold-Plated-DVI-Male-HDMI-2-Pack/dp/B07CXY79KR?source=ps-sl-shoppingads-lpcontext&ref_=fplfs&smid=ABI01N1FCUZG9&th=1 while the Mini PC has HDMI ports. How can I connect the KVM switch to the Mini PC? The idea is to purchase one of these KVM switches https://www.amazon.co.uk/dp/B0D5XSXHCH/?coliid=I1QSRNJHGDRMZN&colid=3JBTT5GDUAMXQ&psc=1&ref_=list_c_wl_gv_ov_lig_pi_dp and connect the old desktop to the switch via DVI cables. To connect the Mini PC to the switch, I have found these cables https://www.amazon.co.uk/dp/B0CDRSP469/?coliid=I2C187CZ18BSFU&colid=3JBTT5GDUAMXQ&ref_=list_c_wl_gv_ov_lig_pi_dp&th=1 Will this work? Do I need anything else? Would you recommend it? Many thanks Alberto
  4. Alberto Paganini

    Buying a mini pc to install Delphi

    Hello again, I read your previous comments, and I hear you. Honestly, I thought every PC was built in China, or at least all the components were made in China. I am more than willing to look into exceptions if you can point them out. I looked into Beelink forum and it seems TPM is supported by their motherboards but sometimes it's not straightforward to enable. The preinstalled Windows is definitely, a customised version. I chose Amazon because I thought a return would be straightforward in case something goes wrong. Am I wrong ? Why are you avoiding Amazon these days ? If there is a better solution please let me know and I will look into that too. I wish I had the knowledge and confidence to do that, Anders. At the first hurdle, I would not be able to progress. Many thanks for your help Alberto
  5. Alberto Paganini

    Buying a mini pc to install Delphi

    Hello again, Thank you very much to everybody for your answers. Just to clarify a few points, the budget I have is £ 250 max (EUR 300). In addition to Delphi, I would use it as an everyday PC (web browsing, MS Office). I am not a gamer therefore I don't need much power. I am looking for a new machine because I have an old one with Win 7 32bit. This is still working perfectly but no software has been updated and the performance is not the one that used to be. I will keep this machine though. Back to the original question, this is the hardware I have in mind 16GB RAM 512GM HD OS Windows but I can purchase Win 11 Graphic card being a non gamer I am not too bothered memory slots 2 HDMI+at least 2 fast USB (with USB hubs I can add more) I have already monitor, mouse, keyboard I have found these two mini PC on Amazon https://www.amazon.co.uk/Generation-Processors-Mini-PC-TRIGKEY/dp/B09VB6RK5L/ref=sr_1_19?crid=28IW58GPKU5WV&dib=eyJ2IjoiMSJ9.Osz6FijRchMrjKfN7_mprD5kJMeJeADwENYLX9JPUZJCQuGq0th04V9qLysT9Jc60OxgNyG6GlqXroxmyD8pes3k-DSrFCWMKgtRVGw3YjH5IextFntZvStnGurGD0wQsrU1ntJ-zutshySY9VH9ViU4X1H4lxw2_eVkf5uQxHC7RnFGXc5fX2j6H7_qJuF3h6qikvmW4qjm2o396qjmYq3f555HdRy9jbYVCz-BL2gT5roM_BsidwUKZvuEwkc_JZ5c8CQNN9Ow9LH2l0gWoNY811EqDyMygFKvCJN-x8A.4i5XU5kcvaFNGbFIzji5yeUnhnuLdZ4RLx7JPC2j0kk&dib_tag=se&keywords=mini+pc&nav_sdd=aps&qid=1730325108&refinements=p_36%3A9708205031%2Cp_n_feature_browse-bin%3A21740491031%2Cp_n_feature_twenty-eight_browse-bin%3A49894983031%2Cp_n_feature_eight_browse-bin%3A27344122031&rnid=27344119031&s=computers&sprefix=mini+pc&sr=1-19&ufe=app_do%3Aamzn1.fos.d11e5925-8655-4946-ae2d-1a23abeb136b https://www.amazon.co.uk/Beelink-Lake-N100-Processor-Computer-MINI-S12/dp/B0BZGPTLPG/ref=sr_1_3?crid=28IW58GPKU5WV&dib=eyJ2IjoiMSJ9.oeSF7jwpawC-6vtsOXgkoJbHW7PRaFeeyFzOEbg3j8Kg-lbsPNmhBf9AZjllSzl4U4sWr-rrpo4eYatk3rR-SmcytxKW_H92trvDahZRGZjH8Mkta4mjfhV4-J7ejploO7fY5k8dAZyH71hATzKYnC8p_fCBYyKu4syDdpa1RQahYVivm8WmV_UgQC_JZEwECnNN-NLK55hR-Vy59DkM5Jm7KH6qlSmynPqIRr3vo5TRY5gEE8Bn_T2C1JrHSo2fU5GSlLn99nTCMl--SMC_ryiI1BjffrLKT1qppM1UsxM.hj5DpUFZ-DgbHkEKC1zsD7QwlY2fOMZQLrx3DTZeqRU&dib_tag=se&keywords=mini%2Bpc&nav_sdd=aps&qid=1730325219&refinements=p_36%3A20000-25000%2Cp_n_feature_browse-bin%3A21740491031%2Cp_n_feature_twenty-eight_browse-bin%3A49894983031%2Cp_n_feature_eight_browse-bin%3A27344122031&rnid=9708204031&s=computers&sprefix=mini%2Bpc&sr=1-3&ufe=app_do%3Aamzn1.fos.d11e5925-8655-4946-ae2d-1a23abeb136b&th=1 The reason why I chose Amazon is because if something goes wrong during the warranty period there is no problem in replacing the machine or getting a refund.
  6. Hello, I am thinking of buying a mini PC and installing Delphi CE. I chose the mini PC mainly because of its small footprint. I am not a professional programmer, so I would not use it for 8+ hours every day. What do you recommend in terms of CPU, RAM, SDD size, etc.? Is it a good idea? Many thanks Alberto
  7. Hello, I am trying to update DSharp to the latest release. Before doing that I updated Spring4D successfully. When I tried to update DSharp and build DSharp.Core.DelphiXE2.bpl I had the error message "[DCC Error] DSharp.Collections.Iterators.pas(54): E2170 Cannot override a non-virtual method" Here below is the excerpt of the unit with line 54 TCustomIterator<T> = class(TIterator<T>) private fProc: TIteratorProc<T>; public constructor Create(const proc: TIteratorProc<T>); function Clone: TIterator<T>; override; function MoveNext: Boolean; override; // line 54 end; Any idea of what I am missing out on? Many thanks Alberto
  8. Alberto Paganini

    Delphi SQL Formatter

    Hello, Isn't the download still available ? Is there an alternative link ? Many thanks Alberto
  9. Alberto Paganini

    Unit dependency viwer

    Hello, Isn't there a 32 bit version of the software ?
  10. Alberto Paganini

    Transform string into TDateTime

    One important part of the application I am working on is to retrieve data from a service provider as often as possible. The function JsonStringToDateTime is called tens of thousands of times from several processes in a few minutes in order to parse the data provided therefore, the faster the function the more times the application can retrieve data. This is one of the most "popular" functions but there are others similar and called as much as this one and I will look into these too. I understand this is just a quick fix, the next step would be to refactor the logic of the application in order to retrieve data and parse it in a better way (maybe parse only the necessary data) but that would require more time and I would like to see some results in the short run. However, for the records here the three versions with the usual quick test. program SoapTest; {$APPTYPE CONSOLE} {$R *.res} uses madExcept, madLinkDisAsm, madListHardware, madListProcesses, madListModules, System.SysUtils, Soap.XSBuiltIns; const gOutOfScopelDate: TDateTime = 2 + 365; {*****************************************************************************************} function JsonStringToDateTime(S: widestring): TDateTime; {*****************************************************************************************} begin result := gOutOfScopelDate; with TXSDateTime.Create() do begin try XSToNative(S); result := AsDateTime; finally Free; end; end; end; {*****************************************************************************************} function JsonStringToDateTime2(S: widestring): TDateTime; {*****************************************************************************************} begin try Result := EncodeDate(StrToInt(Copy(S, 1, 4)), StrToInt(Copy(S, 6, 2)), StrToInt(Copy(S, 9, 2))); Result := Result + EncodeTime(StrToInt(Copy(S, 12, 2)), StrToInt(Copy(S, 15, 2)), StrToInt(Copy(S, 18, 2)), 0); except result := gOutOfScopelDate; end; end; {*****************************************************************************************} function JsonStringToDateTime3(Src: widestring): TDateTime; {*****************************************************************************************} function CharToDigit(aChar: Char): Integer; inline; begin Result := Ord(aChar) - Ord('0'); end; var S: string; pSrc, pDest: PChar; begin SetLength(S, 8); pSrc := Pointer(Src); pDest := Pointer(S); try //date pDest^ := pSrc^; (pDest + 1)^ := (pSrc + 1)^; (pDest + 2)^ := (pSrc + 2)^; (pDest + 3)^ := (pSrc + 3)^; (pDest + 4)^ := (pSrc + 5)^; (pDest + 5)^ := (pSrc + 6)^; (pDest + 6)^ := (pSrc + 8)^; (pDest + 7)^ := (pSrc + 9)^; {(*} Result := EncodeDate( // year CharToDigit(S[1]) * 1000 + CharToDigit(S[2]) * 100 + CharToDigit(S[3]) * 10 +CharToDigit(S[4]), CharToDigit(S[5]) * 10 +CharToDigit(S[6]), //month CharToDigit(S[7]) * 10 +CharToDigit(S[8])); //date {*)} //time pDest^ := (pSrc + 11)^; (pDest + 1)^ := (pSrc + 12)^; (pDest + 2)^ := (pSrc + 14)^; (pDest + 3)^ := (pSrc + 15)^; (pDest + 4)^ := (pSrc + 17)^; (pDest + 5)^ := (pSrc + 18)^; {(*} Result:=Result+EncodeTime( CharToDigit(S[1]) * 10 +CharToDigit(S[2]), //hh CharToDigit(S[3]) * 10 +CharToDigit(S[4]), //mm CharToDigit(S[5]) * 10 +CharToDigit(S[6]), //ss 0//ms ); {*)} except result := gOutOfScopelDate; end; end; const aTimes = 5000; var TimeResult: TDateTime; a: TDateTime; b: TDateTime; I: Integer; hh, mm, ss, ms: Word; begin a := Now; for i := 0 to aTimes do begin TimeResult := JsonStringToDateTime('2021-02-11T02:25:00.000Z'); end; b := Now - a; DecodeTime(b, Hh, mm, ss, ms); Writeln('JsonStringToDateTime sec:' + IntToStr(ss) + ' msec:' + IntToStr(ms)); a := Now; for i := 0 to aTimes do begin TimeResult := JsonStringToDateTime2('2023-03-13T02:25:00.000Z'); end; b := Now - a; DecodeTime(b, Hh, mm, ss, ms); Writeln('JsonStringToDateTime2 sec:' + IntToStr(ss) + ' msec:' + IntToStr(ms)); a := Now; for i := 0 to aTimes do begin TimeResult := JsonStringToDateTime3('2023-03-13T02:25:00.000Z'); end; b := Now - a; DecodeTime(b, Hh, mm, ss, ms); Writeln('JsonStringToDateTime3 sec:' + IntToStr(ss) + ' msec:' + IntToStr(ms)); Readln; end. In all honesty, I didn't think that replacing Copy would make a big difference, obviously, I was wrong. I was under the impression that StrToInt could be replaced but I didn't know how to do. The improvement that the changes suggested by @Fr0sT.Brutal make is very big! Thank you. I hope I have understood all the suggestions. Many thanks Alberto
  11. Alberto Paganini

    Transform string into TDateTime

    I was not able to think of anything better in order to transform parts of a string into numbers and then put everything into a TDateTime. Is there an alternative to that, considering that performance is important here?
  12. Alberto Paganini

    Transform string into TDateTime

    @emailx45 That is technically correct, there is no "null date" in Delphi. The software I am working on should receive dates >01/01/1901 only. If something goes wrong the procedure assigns 01/01/1901 to Result. Somewhere else the application checks Result and if it is is 01/01/1901 treats this accordingly. I should have renamed it something like gOutOfScopeDate
  13. Alberto Paganini

    Transform string into TDateTime

    Yes, sorry I forgot to remove it. Any particular reason for that? I am not trying to be funny here. I just want to understand why this is better. Yes, not a problem in my case.
  14. Alberto Paganini

    Transform string into TDateTime

    I would like to replace JsonStringToDateTime with JsonStringToDateTime2 in my code because it is significantly faster. Here below a small example program MyTest; {$APPTYPE CONSOLE} {$R *.res} uses madExcept, madLinkDisAsm, madListHardware, madListProcesses, madListModules, System.SysUtils, Soap.XSBuiltIns; const gNullDate: TDateTime = 2 + 365; {*****************************************************************************************} function JsonStringToDateTime(S: widestring): TDateTime; {*****************************************************************************************} begin result := gNullDate; with TXSDateTime.Create() do begin try XSToNative(S); result := AsDateTime; finally Free; end; end; end; {*****************************************************************************************} function JsonStringToDateTime2(S: widestring): TDateTime; {*****************************************************************************************} var Dummy: string; begin try Result := EncodeDate(StrToInt(Copy(S, 1, 4)), StrToInt(Copy(S, 6, 2)), StrToInt(Copy(S, 9, 2))); Result := EncodeTime(StrToInt(Copy(S, 12, 2)), StrToInt(Copy(S, 15, 2)), StrToInt(Copy(S, 18, 2)), 0); except result := gNullDate; end; end; var TimeResult: TDateTime; a: TDateTime; b: TDateTime; I: Integer; hh, mm, ss, ms: Word; begin a := Now; for i := 0 to 5000 do begin TimeResult := JsonStringToDateTime('2021-02-11T02:25:00.000Z'); end; b := Now - a; DecodeTime(b, Hh, mm, ss, ms); Writeln('JsonStringToDateTime sec:' + IntToStr(ss) + ' msec:+' + IntToStr(ms)); a := Now; for i := 0 to 5000 do begin TimeResult := JsonStringToDateTime2('2021-02-11T02:25:00.000Z'); end; b := Now - a; DecodeTime(b, Hh, mm, ss, ms); Writeln('JsonStringToDateTime2 sec:' + IntToStr(ss) + ' msec:+' + IntToStr(ms)); Readln; end. Can you see any drawbacks in JsonStringToDateTime2 ? Many thanks Alberto
  15. Alberto Paganini

    tlsv1 alert protocol version

    Ok, I have found out the final issues. It turned out that Windows 7 does not enable TLS 1.2 by default. You have to do it manually by following this process https://support.site24x7.com/portal/en/kb/articles/how-to-check-if-tls-1-2-is-enabled At this stage, the function above started working. Next, I had to add one extra line in a third party code every time TIdSSLIOHandlerSocketOpenSSL is created. The extra line is sslIOHandler.SSLOptions.SSLVersions := [sslvTLSv1_2]; After that, the application started working as before. @Remy LebeauThank you for your help Alberto
×