Jump to content

Leaderboard


Popular Content

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

  1. Sherlock

    A gem from the past (Goto)

    That reminds me:
  2. dummzeuch

    Delphi and "Use only memory safe languages"

    Since Delphi is kind of a legacy programming language nowadays, backwards compatibility is very important. You don't want to throw away millions lines of proven code because they don't work any more, or even worse, because they are now buggy. So trying to change strings to be zero based was a bad idea, even if it was "just for mobile platforms".
  3. Your taps Variant has not assigned a value. You are missing: taps := MainModule.taps;
  4. This Win64 exception was due to using Free on a stream that was already closed, instead of NilAndFree which checks first, and is used elsewhere in the same function. Not sure why Win32 hides the bug, but Win64 does not, this was within finally/end. Not in SVN yet, and the V9.1 HTTP snippet is now broken because last week I added authentication to the web server directory it uses to test something else, and forget snippets uses that directory. Angus
  5. JonRobertson

    Delphi and "Use only memory safe languages"

    Should that matter? I started learning Pascal 35 years ago and C the following year. Not once have I written c := (a < b) ? a : b; or if (a == b) { doSomething(); } while writing Pascal code.
  6. Angus Robertson

    TCP Port Check with timeout

    The sample OverbyteIcsIpStmLogTst is the proper test bed for the TIcsIpStrmLog component. For a successful remote connection, the events triggered are: 11:55:09 C[0] State: Starting 11:55:09 C[0] TCP/Client Opening Connection to [2a00:1940:0:c::128]:80 11:55:09 C[0] TCP/Client Connected OK 11:55:09 C[0] State: OK (manually stopped) 11:55:24 C[0] State: Stopping 11:55:24 C[0] TCP/Client Disconnected 11:55:24 C[0] State: None But for an unsuccessful connection it normally keeps trying to reconnect to the remote IP, so there is no immediate state change: 11:50:56 C[0] State: Starting 11:50:56 C[0] TCP/Client Opening Connection to [2a00:1940:0:c::128]:5000 11:51:17 C[0] TCP/Client Failed Connection - Connection timed out (#10060) - Retrying in 10 secs 11:51:27 C[0] TCP/Client Opening Connection to [2a00:1940:0:c::128]:5000 This is one of the 'features' of the component, if the client connection fails or drops it keeps trying to restore the connection, although that is exactly what you don't want! With RetryAttempts set to -1, the events called are: 12:06:45 C[0] State: Starting 12:06:45 C[0] TCP/Client Opening Connection to [2a00:1940:0:c::128]:6666 12:07:06 C[0] State: Stopping 12:07:06 C[0] State: None 12:07:06 C[0] TCP/Client Failed Connection - Connection timed out (#10060) 12:07:06 C[0] TCP/Client Disconnected So you need to check Stopping and/or None for failure, there is no specific State: Failed event, unless you watch the literals for timeout out. Angus
  7. Angus Robertson

    TCP Port Check with timeout

    Most ICS functions are async, not blocking, you missed IpLogClient.onLogProgEvent := onCliLogProgEvent; from snippets, and in the event you check IpLogClient.States[0] for logstateOK or something else if failed. As is often discussed here, it is rarely necessary or useful to use ICS components in a thread, but if so you can not use application.processmessages since that is the main thread, you have to create the component within the thread Execute method, set the MultiThreaded property to true, and call the component ProcessMessages method instead. Angus
  8. Dllama, a simple and easy to use library for doing local LLM inference directly from Delphi (any language with bindings). It can load GGUF formatted LLMs into CPU or GPU memory. Uses Vulkan back end for acceleration. Simple Example uses System.SysUtils, Dllama, Dllama.Ext; var LResponse: string; LTokenInputSpeed: Single; LTokenOutputSpeed: Single; LInputTokens: Integer; LOutputTokens: Integer; LTotalTokens: Integer; begin // init config Dllama_InitConfig('C:\LLM\gguf', -1, False, VK_ESCAPE); // add model Dllama_AddModel('Meta-Llama-3-8B-Instruct-Q6_K', 'llama3', 1024*8, '<|start_header_id|>%s %s<|end_header_id|>', '\n assistant:\n', ['<|eot_id|>', 'assistant']); // add messages Dllama_AddMessage(ROLE_SYSTEM, 'you are Dllama, a helpful AI assistant.'); Dllama_AddMessage(ROLE_USER, 'who are you?'); // display the user prompt Dllama_Console_PrintLn(Dllama_GetLastUserMessage(), [], DARKGREEN); // do inference if Dllama_Inference('llama3', LResponse) then begin // display usage Dllama_Console_PrintLn(CRLF, [], WHITE); Dllama_GetInferenceUsage(@LTokenInputSpeed, @LTokenOutputSpeed, @LInputTokens, @LOutputTokens, @LTotalTokens); Dllama_Console_PrintLn('Tokens :: Input: %d, Output: %d, Total: %d, Speed: %3.1f t/s', [LInputTokens, LOutputTokens, LTotalTokens, LTokenOutputSpeed], BRIGHTYELLOW); end else begin Dllama_Console_PrintLn('Error: %s', [Dllama_GetError()], RED); end; Dllama_UnloadModel(); end.
  9. Remy Lebeau

    TCP Port Check with timeout

    DNS lookups and connect attempts are two different things. I don't think you can do non-blocking DNS lookups using the standard hostbyname()/getaddrinfo() APIs that most people's socket code uses. You would have to use platform-specific APIs (ie, like DnsQueryEx() on Windows), or send manual DNS queries over non-blocking sockets. A connect() timeout can be implemented by just using a non-blocking socket and close() the socket after the timeout elapses. If it uses a thread internally, that is just an implementation detail of the OS, but that shouldn't block the app from being able to move on.
  10. Remy Lebeau

    TCP Port Check with timeout

    Why TIcsIpStrmLog and not TSslWSocket directly? Are you saying that ICS does not support connect timeouts on TCP sockets at all? Or just that the TIcsIpStrmLog component specifically does not support this? In general, there are ways to implement a connect timeout on a TCP socket - namely: by using a non-blocking socket with select() or (e)poll() for the timeout. by aborting the socket from another thread. I would be surprised if ICS does not use the first one.
  11. @Dave Nottage Thanks for giving hope and pointing to the right direction, as always As expected. simply starting and debugging an iOS 16.7.5 device with SDK 17.4 fails, with the following message: Starting the Debug Build without debugger ( Ctrl+Shift+F9 ) works well, start and seems OK so far. After a few more steps, I could really debug again on XCode 15.3 + iOS Device 16.7.5 + iOS SDK 17.4. Edit: Worth to mention: Running on MacBook Pro Intel: MacosOS Sonoma 14.4.1; Parallels Desktop 19.3.0 Here is the whole process is documented: I hope that can help another poor guy, who is getting crazy from the mysterious Apple moves.
  12. Interesting, I hadn't fully appreciated this as I've never specifically dealt with cfg files before. Thanks for the detailed historical explanation - very useful.
  13. Anders Melander

    Delphi 12 is available

    This place isn't representative. Most developers don't participate in communities and don't even know they exist. I've worked at a lot of different places and with a lot of different developers in my career and I think I've only ever met one other developer IRL that participated in communities. Not that I can see. My experience with Lazarus/FPC is limited to using it to make some open-source projects FPC compatible but from my POW they are constantly playing catch up with Delphi. And I think Lazarus sucks as an IDE.
  14. Darian Miller

    language updates in 10.4?

    Added a quick blog post on inline variables: https://www.ideasawakened.com/post/newly-discovered-hidden-benefits-of-inline-variables-in-delphi
×