-
Content Count
2684 -
Joined
-
Last visited
-
Days Won
113
Everything posted by Remy Lebeau
-
Format a Float field text using another field value
Remy Lebeau replied to Andrew Spencer's topic in Databases
I would not use any global variable at all. The TField has access to the DataSet that owns the current record's fields, eg: Text := Format('%.*f', [Sender.DatSet.FieldByName('decimals').AsInteger, Extended(Sender.Value)]); Alternatively: Text := FloatToStrF(Sender.Value, ffFixed, 18, Sender.DatSet.FieldByName('decimals').AsInteger); -
Perhaps the MCI_BREAK command can help you? CTRL+Break is the default for aborting am MCI wait operation, but you can specify a different key, or even disable breaking.
-
Auto Passive Mode and Passive Mode requesting a DIR
Remy Lebeau replied to M-Brig's topic in ICS - Internet Component Suite
EPSV is not limited to just IPv6, it can be used for IPv4 as well. But also, EPSV has another benefit even for IPv4 - it has a well-defined machine-parsable response text, whereas PASV does not. PASV responses are harder to parse since different servers use different formats for their reply text, and there are quite a few different formats in use in practice. -
Auto Passive Mode and Passive Mode requesting a DIR
Remy Lebeau replied to M-Brig's topic in ICS - Internet Component Suite
That makes more sense. I just looked at the latest 9.3 source code, and no, I do not believe it does. For one thing, it is not checking if the server actually supports EPSV before sending that command. And second, it does not appear to switch to PASV when EPASV fails. -
Auto Passive Mode and Passive Mode requesting a DIR
Remy Lebeau replied to M-Brig's topic in ICS - Internet Component Suite
What is "auto passive mode"? Do you mean "Active" mode? "Active" (server connects to client) and "Passive" (client connects to server) are the 2 modes defined by the FTP protocol, and "Active" is the default. "Active" mode is not friendly to NATs, which are commonly used nowadays, so it is best to just always use "Passive" mode only. -
Double, default value
Remy Lebeau replied to Skrim's topic in Algorithms, Data Structures and Class Design
That's the way I usually do it when I need an event handler without an object instance. -
Cannot pass a procedure to another
Remy Lebeau replied to dormky's topic in RTL and Delphi Object Pascal
In general, RTL types named TXXXMethod refer to non-static class methods, and TXXXProcedure types refer to anonymous procedures. -
Try using PROCESS_QUERY_LIMITED_INFORMATION instead. And do try using GetProcessImageFileName() or QueryFullProcessImageName() instead of GetModuleFileNameEx(). This approach should be more compatible with elevated processes.
-
New mem manager test using indy http, json, memtables, etc
Remy Lebeau replied to RDP1974's topic in RTL and Delphi Object Pascal
You can't edit a post after some time has passed. And you can't delete a post, but you can flag a post and ask a moderator to delete it for you. -
What exactly have you tried that is not working for you? Please show some code. Which API are you using to enumerate running processes? CreateToolhelp32Snapshot(), EnumProcesses(), EnumWindows()? Have you tried APIs like GetModuleFileNameEx(), GetProcessImageFileName(), QueryFullProcessImageName()?
-
Delete First & Last Character
Remy Lebeau replied to Henry Olive's topic in RTL and Delphi Object Pascal
The SysUtils unit in Delphi's RTL has AnsiDequotedStr() and AnsiExtractQuotedStr() functions for that exact purpose. -
Receiving UDP packet fails 2 times with 10014 and works
Remy Lebeau replied to Clément's topic in ICS - Internet Component Suite
Winsock error 10014 is WSAEFAULT. I don't know ICS's internals, but presumably fSender.ReceiveFrom() calls Winsock's recvfrom() function, whose documentation says: Your lFromLen variable is uninitialized, so your code is passing an indeterminate value to recvfrom() which exhibits undefined behavior. Sometimes the value is too small, sometimes it is not. You need to initialize your lFromLen variable to specify the size of your lFromSock variable before calling fSender.ReceiveFrom(). On a side note: you are treating lCount=0 as an error condition, but it is not. Unlike TCP, UDP messages can be 0 bytes in size. You should be calling WSAGetLastError() only if lCount is SOCKET_ERROR (-1). -
Does the host application display any UI windows of its own before the DLL's VCL form is displayed? If not, then does GetStartupInfo() report that the 1st window shown should be maximized?
-
All of the major OAuth providers - Google, Microsoft, etc - should have full documentation about their workflows.
-
Simplified "Attach to Process" debugging
Remy Lebeau replied to Jim McKeeth's topic in Delphi IDE and APIs
When I debug a service, I simply run the service normally in the SCM, and have its OnStart event pause execution until the debugger is attached. -
Geoffrey's demo uses Indy's TIdSMTP component to send email with an OAuth2 token. Indy has a TIdHTTPServer component (or TIdSimpleServer if you don't need a full-blown HTTP server).
-
Question about idThreadComponents / idSchedulerOfThreadDefault / idSchedulerOfThreadPool
Remy Lebeau replied to Alisson Suart's topic in Indy
Windows has enough resources to run thousands of threads in parallel. 10 is nothing. So something else is likely causing the error. The Scheduler manages only threads that it creates. It can't manage threads created by TIdThreadComponent. But again, the Scheduler doesn't limit threads that are running, only threads that are idle. When the Scheduler needs a thread, it pulls one from the pool if available, otherwise it creates a new one. When a thread is finished, it is put in the pool if there is room for it, otherwise it is terminated. -
Question about idThreadComponents / idSchedulerOfThreadDefault / idSchedulerOfThreadPool
Remy Lebeau replied to Alisson Suart's topic in Indy
I don't really understand what you're trying to do. But the Scheduler components are not intended to be used standalone, they are meant to be used with TIdTCPServer and derived components. That being said, the pool size only effects the number of threads that are sitting idle in the pool. Not the number of threads that are actively running. -
Why are you connecting to localhost? What exact steps are you doing to reach this error? What API are you using to access Google?
-
DPKs for Delphi 7 are available in Indy's GitHub repo: https://github.com/IndySockets/Indy You have to compile the DPKs yourself to get BPLs, Indy does not provide pre-compiled DCUs/BPLs: https://github.com/IndySockets/Indy/wiki/Updating-Indy OpenSSL DLLs that are compatible with Indy are available in Indy's GitHub repo: https://github.com/IndySockets/OpenSSL-Binaries Indy 10 currently supports up to OpenSSL 1.0.2u (but support for 3.x is in the works).
-
Again, in what context, exactly? Indy recently got some new SASL components for OAuth authentication for SMTP/POP3/IMAP. There is no direct OAuth support for HTTP at this time, though. In general, you are responsible for implementing OAuth protocols yourself depending on your chosen OAuth provider. But once you have a login token, there are ways to use it with Indy. Can you provide more detail about your specific use-case?
-
If it is not already in one of the RTL's 'Androidapi.*.pas' units (did you try grepping for it?), then you'll have to import it manually using Java2Op or similar tool, or use a 3rd party unit that imports it (like this one). Also, this statement: StringToJString('com.embarcadero.EMail.fileprovider') should be this instead: StringToJString(JStringToString(TAndroidHelper.Context.getApplicationContext.getPackageName) + '.fileprovider')
-
Anyone who would have such info would be under an NDA not to discuss it until Embarcadero announced it publicly first.
-
Did you read the documentation yet? Writing Multithreaded Applications Simply get rid of the @ symbol, pass the method by name only. Synchronize(UpdateUI); // Update UI safely from the main thread
-
The non-static Synchronize() method has always been protected. That is perfectly fine when calling it from within the thread's Execute() or DoTerminate() methods. There are also static Synchronize() methods available which are public and can be called outside of a TThread object. This is not a VCL vs FMX issue, since TThread is common to both of them.