Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 01/30/23 in all areas

  1. Hello all, it's ready an initial version of my wrapper around the C++ API of the famous Open Computer Vision library (Opencv) (not the old C API). For now it apply to Opencv version 2.4.13, 32bit, Windows. This library "flattened" the C++ classes to pure C functions, creating a DLL acting as a bridge between applications that "understand" C functions (Delphi, but also C, and others) and Opencv DLL that expose C++ classes. I hope soon to extend to 64 bit, and add some useful Delphi units to have a better OO interface over the simple C functions (a wrapper over the wrapper... πŸ™‚ In future could be a release interfacing with more recent Opencv versions (as the last stable 4.6). Regards Giando https://github.com/gidesa/ocvWrapper24
  2. I just spent some time testing ChatGPTs ability to "understand" and explain Delphi source code. The results were actually quite good. I asked ChatGPT "what’s wrong with the following Delphi code?" function IsoStringToDateTime(const ISODateTime: string): TDateTime; const ISOShortLen = 19; ISOFullLen = 23; var y, m, d, h, n, s, z: Word; begin // ISODateTime should be in one of these formats: // YYYY-MM-DDTHH:NN:SS, YYYY-MM-DD HH:NN:SS // YYYY-MM-DDTHH:NN:SS.ZZZ, YYYY-MM-DD HH:NN:SS.ZZZ if (Length(ISODateTime) <> ISOShortLen) and (Length(ISODateTime) <> ISOFullLen) then raise EConvertError.Create('Invalid ISO date time string: ' + ISODateTime); y := SysUtils.StrToInt(Copy(ISODateTime, 1, 4)); m := SysUtils.StrToInt(Copy(ISODateTime, 6, 2)); d := SysUtils.StrToInt(Copy(ISODateTime, 9, 2)); h := SysUtils.StrToInt(Copy(ISODateTime, 12, 2)); n := SysUtils.StrToInt(Copy(ISODateTime, 15, 2)); s := SysUtils.StrToInt(Copy(ISODateTime, 18, 2)); z := StrToIntDef(Copy(ISODateTime, 21, 3), 0); // Optional Result := EncodeDate(y, m, d) + EncodeTime(h, n, s, z); end; and also "What does the following Delphi function do?" function FileSizeToHumanReadableString(_FileSize: Int64): string; begin if _FileSize > 5 * OneExbiByte then Result := Format(_('%.2f EiB'), [_FileSize / OneExbiByte]) else if _FileSize > 5 * OnePebiByte then Result := Format(_('%.2f PiB'), [_FileSize / OnePebiByte]) else if _FileSize > 5 * OneTebiByte then Result := Format(_('%.2f TiB'), [_FileSize / OneTebiByte]) else if _FileSize > 5 * OneGibiByte then Result := Format(_('%.2f GiB'), [_FileSize / OneGibiByte]) else if _FileSize > 5 * OneMebiByte then Result := Format(_('%.2f MiB'), [_FileSize / OneMebiByte]) else if _FileSize > 5 * OneKibiByte then Result := Format(_('%.2f KiB'), [_FileSize / OneKibiByte]) else Result := Format(_('%d Bytes'), [_FileSize]); end; The answers will surprise you. And these were the shocking answers. The answers were actually quite interesting.
  3. omnibrain

    Need a "Delphi programming guideline"

    Honestly, it would be best if you started looking for a new job. You coworkers don't care. Your boss doesn't care. It works for them (for now), but it will crush you.
  4. Anders Melander

    FileOpen dialog not showing all files

    WOW, indeed πŸ™‚ Your subconsciousness at work.
  5. Fr0sT.Brutal

    Recomnended Email and Webserver Components

    ICS does all that and even includes login form using a browser
  6. Remy Lebeau

    Cross platform HTTP client with proxy support?

    Indy's support for OpenSSL 1.1+/TLS 1.3 is a WIP that is available in this pull request: https://github.com/IndySockets/Indy/pull/299 Correct, Indy does not support platform-specific implementations at this time. Delphi's native HTTP client libraries do, though. Did you report that to Embarcadero? Note that Indy is not specifically tied to OpenSSL exclusively. That is just Indy's default SSL/TLS library since it is cross-platform, but you can use any other library you want, all you need is a TIdSSLIOHandlerSocketBase-derived class that wraps the library's API. Some 3rd party SSL/TLS libraries provide such a class, but for others you will have to write (or find) your own class. There are only a handful of virtual methods that need to be implemented (namely, to handle the handshake, to read/write data, etc).
  7. Tom Chamberlain

    Need a "Delphi programming guideline"

    Do not waste your time, find a new job and leave them in the past. Got reprimanded once for replacing 2000+ lines of code looking for values by doing 'if Edit1.Value = x' on about 200 edit boxes basically named Edit1, Edit2, Edit3..Edit200 on a form (don't ask), just a huge cut-paste, change the component name procedure. I reduced it to about 10 lines using FindComponent in a loop producing the same results. I walked out of that job in less than 1 month after I figured out they (staff and management) refused to learn anything new. Do not suffer fools.
  8. I think Albert was slightly wrong ( only in that case ... and with his cosmological constant ). We have already a world full of idiots, but unfortunately the technology has not yet surpassed our human interactions yet, to help us out of desaster. Maybe that is the whole problem
  9. Fr0sT.Brutal

    Cross platform HTTP client with proxy support?

    What's so wrong with OpenSSL? ICS could compile this lib statically with additional paid 3rd party lib. Having read the code I have (10.3), I'm afraid you can't easily plug into RTL version as it doesn't operate sockets calling more high-level OS functions instead. You could run HTTP CONNECT request to a custom proxy but then you'll have problems doing TLS to a destination host. So I suspect all you have to do is first curse MacOS designers as they deserve and then lower your requirements to include 3rd party.
  10. TheOnlyOne

    A book about Object Pascal Style Guide

    Define "old". This is the current code. The previous programmers worked on it each day. But our boss will not allow us to allocate time to refactoring. As I said, if he wants a new feature implemented (let's say a new pretty Search box) he will personally verify at the end of the sprint if the conditions are meet (DoD) checking only the GUI. The code that's under that pretty GUI... is the hag that nobody checks. You want more juicy stories? We keep all data in strings, but sometimes we keep it in visual controls (listboxes) placed on the form outside the visible area. The form is 1024 pixels, so we have in the main form about 100 invisible controls, starting at pixel 6000. The whole story is here:
  11. Anders Melander

    FileOpen dialog not showing all files

    https://learn.microsoft.com/en-us/windows/win32/winprog64/file-system-redirector
  12. Lars Fosdal

    Convert Png To ico fmx delphi

    IcoFX is my goto tool for Icons. But, I have to admit I use the last free version: 1.6.4
  13. Dave Nottage

    Mac address on Android 6.0 or above

    Apparently things are different on Android 11 or higher: https://developer.android.com/training/articles/user-data-ids#mac-11-plus Going by that documentation, it appears it is not possible any more. If you're after a unique identifier for the device, see the earlier messages in this thread.
  14. Indy supports openSSL 1.1 using the following pull request https://github.com/IndySockets/Indy/pull/299, not sure if works on OSX I publish a commercial library based on Indy that supports openSSL 1.1 and openSSL 3.0 for all Delphi personalities (windows, OSX, linux, iOS...), you can use a TsgcHTTP1Client which inherits from TIdHTTP Indy client and connect using openSSL 1.1 or 3.0 Find below an example using openSSL 1.1 that is cross-platform uses sgcHTTP, sgcWebSocket_Types; function GetHTTP(const aURL: string): string; var oHTTP: TsgcHTTP1Client; vResponse: string; begin oHTTP := TsgcHTTP1Client.Create(nil); Try oHTTP.TLSOptions.OpenSSL_Options.APIVersion := oslAPI_1_1; oHTTP.TLSOptions.Version := tls1_3; oHTTP.Proxy.Enabled := True; oHTTP.Proxy.Host := '3.215.142.228'; oHTTP.Proxy.Port := 3128; oHTTP.Proxy.ProxyType := pxyHTTP; result := oHTTP.Get(aURL); Finally oHTTP.Free; End; end; This still requires the openSSL libraries but I provide already compiled openSSL libraries for registered customers for Windows, OSX, iOS and Android. More info: https://www.esegece.com/ https://www.esegece.com/help/sgcWebSockets/#t=Components%2FHTTP%2FHTTP1%2FHTTP1.htm https://www.esegece.com/help/sgcWebSockets/#t=QuickStart%2FOpenSSL%2FOpenSSL_OSX.htm The package that supports this is sgcWebSockets Enterprise that comes with a custom indy version that support openSSL 1.1 and 3.0 Kind Regards, Sergio
  15. programmerdelphi2k

    Summary row at the end of select

    Anyone who has 1.5mi employees to pay would certainly not be here asking any questions! I preferred to use the old Master-Details, and that's it! would solve! About the "+0.00" (NOT is not for ISNULL checks) is because FireDac likes to determine data types, so I didn't want to do any checks in the component, to show 8 values on the screen... if you want, do it!
  16. Patrick PREMARTIN

    Embarcadero Toaster - Notification Window Caption in Win10

    Hi For those how haven't seen it, the solution is to call PlatformInitialize on your TNotificationCenter component some times before sending any notification like in FormCreate event. Windows will have time to see the shortcut file linked to the registry key and the notification and so not display the registry key name but the EXE file name instead. This problem is just a simple delay in Windows between creating files and seeing them in other API... If you have previous Delphi releases, without PlatformInitialize method, you can create a shortcut to your program in the user startup menu program folder. It should work.
  17. Attila Kovacs

    Skia component and IDE

    Did you know, if you write SQL in upper case, the server processes it faster!?
  18. TheOnlyOne

    Need a "Delphi programming guideline"

    Nope, nope, nope. The robot was a really cool thing we did in the previous company (high-tech labs, clean rooms, fast microcontrollers, CAD, big security all over the place, great salary, high-standards Delphi code). Not in this current company. In this (current) company, we wouldn't even be able to write the software that puts oil in robot's spare wheel πŸ™‚
  19. vfbb

    Upload Google Play android FMX app problem

    You should edit your AndroidManifest.template.xml (You can found it template in your dproj folder after the first compilation to android platform), and not the final AndroidManifest in deploy path.
  20. Andrea Magni

    How to make a component available to all platforms

    A nice hack from @Dalija Prasnikar here: https://stackoverflow.com/questions/27486939/is-there-simpler-way-of-saying-that-delphi-component-control-is-supported-on-all HTH
  21. Attila Kovacs

    Summary row at the end of select

    records.... nevermind. spread your spagetticode in comicbooks
Γ—