-
Content Count
380 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Clément
-
Right-clicking on the project is what I do. Including the dragging part. This is a time saver. On the other hand working on bigger projects, right clicking on a folder and beeing able to add a new unit to the correct place would be great too. I googled for some tools for that, but found nothing. I'm working on a plugin to add "New unit" and "Add existing" to the context menu at the folder level.
-
FreeAndNil() - The Great Delphi Developer Debate
Clément replied to AlexBelo's topic in Tips / Blogs / Tutorials / Videos
They are debating the age rating for the video. Things went pretty wild yesterday.... "I want to Free this"... "you can't, the fabric of spacetime will collapse if you write code this way".."but, spacetime is thread-safe" .. "No!" Well... I hope the link will be available soon. I want to see some parts in slow motion. -
FreeAndNil() - The Great Delphi Developer Debate
Clément replied to AlexBelo's topic in Tips / Blogs / Tutorials / Videos
Since this is such sensitive debate, better set some base rules: no pulling hair no poking the eye no dropping hot coffee over the speaker desktop no high kick no low kick no wedgie let's try to keep this debate civilized -
TThread Resume Suspend deprecated (Not synchronization)
Clément posted a topic in RTL and Delphi Object Pascal
I wrote a old listener derived from TThread, and I'm using Suspend/Resume when +100 connections are made. The code is simple : if (FThreadCount > _MAX_THREADS) and Assigned(FListener) then FListener.Suspend; if (FThreadCount < _MAX_THREADS) and Assigned(FListener) then FListener.Resume; The compiler is complaining both methods are deprecated. So... should I ignore the warning (W1000) or use a different approach to limit the connections? What would that be? Thanks -
TThread Resume Suspend deprecated (Not synchronization)
Clément replied to Clément's topic in RTL and Delphi Object Pascal
Oh. Now See! I'll study the Semaphore implementation -
TThread Resume Suspend deprecated (Not synchronization)
Clément replied to Clément's topic in RTL and Delphi Object Pascal
I'm looking for something like this... https://docs.microsoft.com/en-us/windows/win32/procthread/suspending-thread-execution "A thread can suspend and resume the execution of another thread. While a thread is suspended, it is not scheduled for time on the processor. If a thread is created in a suspended state (with the CREATE_SUSPENDED flag), it does not begin to execute until another thread calls the ResumeThread function with a handle to the suspended thread." -
Just installed 11.1! The installation ran smoothly ( uninstalling / reinstalling ) I used Web Installer. I compiled a few projects successfully. I really want to test the debugger! 11.0 was driving me nuts!!
-
Systemic failing of Embarcadero development and support or am I just paranoid ?
Clément replied to CyberPeter's topic in General Help
Have you received the "What's coming in RAD Studio" webinar? Having to answer to everyone is very time consuming, repetitive and unproductive task. Maybe it's easier for Emb to address the public from a single place: The Webinar. Hopefully they will tell us what's going on and what they are planning to do (Wiki, roadmap, next update, etc... ) Read more -
Is there any "standard protocol" for recovery from a failure in non atomic operations?
Clément replied to roPopa's topic in Algorithms, Data Structures and Class Design
For a good solution you must work both ends. The application, the device and the connection between them can crash, this is why is very important to be able to query the device! From your application: 1. Write down some identification ( file, table record, etc) 2. Send the data 3. Store the answer ( delete the file, update record status etc) From the fiscal printer, in case of a crash you need to query the ID you sent: a. If file exists or record is in open state then read the ID and query the device for that ID status b. If data was not sent, the device will return with an error, in this case pick up from step 2 c. if data was sent, the device should answer properly, in this case start from step 3 If you can't query the device, you will get a half baked solution to your problem. -
DocWiki.Embarcadero.com does Russian Roulette.
Clément replied to A.M. Hoornweg's topic in General Help
It's tradition. Since newsgroup days Somebody shutdown THE server that could never be shutdown... -
Hello, I'm using D11 I need to create a custom highlighter with the following properties: * VariableList * FunctionList: must have () (open and close parenthesis) * Literals * constants Variables: SomeString, SomeInteger, SomeDouble should be highlighted as variable if they are in VariableList Functions: DateFormat( param1, param2 ), Date() should be highlighted as functions only when the '(' is typed; The following expression should be display like: c:\temp\DateFormat(Date(),"yyyy_mm_dd") and c:\temp\DateFormat( Date, "yyyy_mm_dd") // here Date is a variable I found some old code in the internet for older versions/branches of TSynEdit. I'm using the latest from Getit! Is there any example somewhere? Thanks
-
Interface question
Clément replied to David Schwartz's topic in Algorithms, Data Structures and Class Design
Why don't you use the TListView in Virtual mode (OwnerData := True)? Use the OnData event with Item.Index as your index and use an objectList like TStudentList = TObjectList<TStudent>; get the data from this list, for example: procedure TForm1.ListView1Data(Sender: TObject; Item: TListItem); begin var lStudent := glbStudentList[ Item.Index ]; Item.Caption := lStudent.Name; Item.Subitems.Add(''); // lStudent.Score1 ? Item.Subitems.Add(''); // lStudent.Score2 ? Item.Subitems.Add(''); // lStudent.Score3 ? Item.Subitems.Add(''); // Total ? end; Remember to "feed" your listview using the count property: MyListVview.Items.Count := glbStudentList.Count; This assignment is required everytime you add or remove a student from the list. -
Is it possible to write "generic" code for TObjectList<T> descendants?
Clément replied to RaelB's topic in RTL and Delphi Object Pascal
Have you tried: TBook = Class End; TNote = Class End; TBooks = TObjectList<TBook>; TNotes = TObjectList<TNote>; TSerializeJSON<T : class> = Class private public function ToJSON<T : Class>( aList : TObjectList<T> ) : String; End; And call it : procedure TForm56.FormCreate(Sender: TObject); var lNotes : TNotes; S : TSerializeJSON<TNote>; begin S := TSerializeJSON<TNote>.Create; Memo.Lines.text := S.ToJSON<TNote>(lNotes); end; This is just to give you an idea. I just compiled and posted -
What is the best (fast) way of checking if a string is number?
Clément replied to wuwuxin's topic in Algorithms, Data Structures and Class Design
Have you tried to use val ? ex: val('1287653.3', yourFloat , InvalidCharIndex ); Val converts a string to a numeric value. The Result argument can be an integer, Int64, or floating-point variable. If the conversion is successful, InvalidCharIndex is zero. Otherwise, the value of InvalidCharIndex is the string position where Val first detected a format error. Val is not a real procedure. -
Hello, This suite is designed to keep devices online during active hours and optionally turn them off, both manually or automatically. The client app can configure each devices properties like hostname, MAC address, active hours, shutdown hours and allows to wake-up or shutdown several devices when needed with a button click. In case of an emergency, you can shutdown all devices. If the service is installed and running, each device will be checked and woke-up (or shutdown) automatically using the active hours and shutdown hours. NB: You must configure WOL properly in your OS and BIOS! You can check it out at https://www.dhs.com.br/dhsWOLSuite.html It's free! Save up energy! Don't keep machines up and running if they aren't required. Save the Planet!
-
Hello, I'm using Delphi 10.4.2 with Firedac against SQL Server northwind database. I setup the components to execute asynchronously and assigned the OnError event. But the out of memory is not cached and I don't have a clue on how/where to catch it I'm running this query "select * from categories, orders, employees" to simulate the error a user is reporting. The application (32 bit version) memory goes to 1.7Gb and raises the out or memory. The problem is not the query per se, I'm just trying to catch the out of memory error. Here's some code: function TSQLTaskWorker.DoCreateQry(const aSQL: String; aFDConnection: TFDConnection): TFDQuery; begin Result := TFDQuery.Create(nil); if Assigned(aFDConnection) then Result.Connection := aFDConnection else Result.Connection := fFDConnection; Result.FetchOptions.Mode := fmAll; Result.FetchOptions.Items :=[fiBlobs]; Result.FetchOptions.Cache :=[fiBlobs]; Result.FetchOptions.AutoFetchAll := afAll; Result.FetchOptions.RecsMax := 100000; Result.SQL.Text := aSQL; end; procedure TSQLTaskWorker.DoSetConnection(aTaskConnection: TSQLTaskConnection); begin { ... Setting up fFDConnection ... } fQryAsync:= DoCreateQry('', fFDConnection ); fQryAsync.ResourceOptions.CmdExecMode := amAsync; fQryAsync.AfterOpen := event_QueryAsyncAfterOpen; fQryAsync.AfterExecute := event_QueryAsyncAfterExecute; fQryAsync.OnError := event_QueryAsyncError; end; procedure TSQLTaskWorker.DoRunSQLAsync(aSQLTaskRequest: TSQLTaskQueryRequest); begin fQryAsync.SQL.Text := aSQLTaskRequest.SQL; fQryAsync.Tag := NativeUInt( lTaskAsyncQueryResponse ); fQryAsync.OpenOrExecute; end; When DoRunSQLAsync is called, fQryAsync.OpenOrExecute is called and returns immediately as expected. I can follow the memory building up until the out of memory is raised. The error is raise before calling any events, and afterward no event is called either. I can't find a way to trap such error. Here's the call stack: Since I'm not able to handle properly this error, my application becomes unstable and must be closed. Any ideas? Clément
-
I've been testing Delphi 11 with small projects, just because their are simply to migrate and test. Although most features are working fine, some bug are very annoying and counter productive. 1) Code refactor: Is not working fine. There are methods (or classes) that kept the old name. For example, I'm renaming a class with several methods. Only part of them gets renamed in the same unit. Nothing happens with external references. I have to check manually or "Compile and Fix" the bad refactored code. 2) LSP: It's hard to describe. There's clearly an improvement but something got broken in the way. Lot's of curly lines are shown where code is fine. I have to close/reopen the IDE. If I refactor a method name for example, The new name will get red curly lines. After adding units or refactorying code, there are so many curly line is hard to pin point what is correct and what's not. Once the project compiles, I have to restart the IDE for those curly lines to disappear. 3) Delphi 11 Help need some help.. again 😞 4) When debugging Inline var the wrong value is displayed but the routine works as expected, i.e, the value is correct. 5) Incremental searching components (component palette) is very slow. Someone forget to use BeginUpdate/EndUpdate? 6) When closing the IDE there's this error that pop's once in a while. The projects I'm working are very simple, and I'm using valina components from the IDE ( TControlList, TControlListButton, SVG Images from ethea, ICS ), in fact the same components/source code are shared with 10.4.2 (which is working fine) On the other way... 1) Delphi 11 generates faster and smaller code. 2) The IDE design is the best, snappier, no more flicking, and very fast! I really enjoy working with it 3) The class helpers for TDatetime and currency are great! 4) the debugger improved a lot and displays correctly (most of the time) generics and complex structures, both in 32 and 64 bits. 5) Getit is great! I will continue migrating my small projects to Delphi 11, but I will wait for a patch before considering Delphi 11 as my main IDE.
-
Good news! I'm calling TFDConnection.AbortJob from an instance in the main thread, and it is aborting the query running in another thread! How cool is that! Also I manage to catch the out of memory error in my default Query execution flow! The application remains stable even after the out of memory
-
I will try to call AbortJob from the main thread. My TFDConnection is in another thread, so it should work.
-
This is my "cKwel" query tool available for free in 32bit and 64bits. The user downloaded the 32bit version because he is using 32bit library to connect to his database.🤨 The SQL Query is already running in it's background thread. FireDAC accepts the following Execution modes: amBlocking The calling thread and GUI are blocked until an action is finished. amNonBlocking The calling thread is blocked until an action is finished. The GUI is not blocked. amCancelDialog The calling thread and GUI are blocked until an action is finished. FireDAC shows a dialog, allowing to cancel an action. amAsync The calling thread and GUI are not blocked. The called method returns immediately. TFDQuery is created using amBlocking. In this mode, just placing TFDquery.Open in an exception block solves the problem. But, in this mode the user have to wait until the end of the execution and there's no way to Cancel the query (calling abortJob) Since I'm already in a background thread, amNonBlocking and amCancelDialog are not an option. Which leaves me with amAsync. The "Cancel Query" button is working. But I can't catch the out of memory error, and who knows what other exceptions?
-
Hello Lajos, The application in question is a query tool, so the user can test or write queries against several SQL Engines. If the user wrote is doing "something wrong" , I must catch the error and display it nicely. This uncatched out of memory is making the application unstable. When using "amAsync", Firedac spawns a thread to fetch the data, and returns immediately the control to the app. That's fine. The issue of retrieving such volume of records is to trigger the out of memory inside that thread and not surfacing it. At least, so far, I couldn't find a way to catch it. I'm working on plan B and monitoring the memory used. If the memory gets close enough to the limit, I will abort the job. At least the application will remain stable.
-
Hi, I managed to duplicate this small bug in Delphi 11 and Delphi 10.4.2. 1) Drop TControlList and Inside the Item area drop a TControlListButton. 2) Drop a ImageCollection and assign some images. 3) Drop a TVirtualImageList, link it to ImageCollection and Add some images. 4) Link TVirtualImagelist to TControlListButton.Images Notice that it's not possible to View the icons either in ImageIndex nor ImageName properties. You can set then manually, for example, if you assign ImageIndex := 0 and ImageName will reflect the correct image. Should I report it? Or is it already known?
-
Small bug in TControlListButton (Delphi 11 and Delphi 10.4.2)
Clément replied to Clément's topic in VCL
Done: https://quality.embarcadero.com/browse/RSP-35770 -
Trojan:Script/Sabsik.TE.A!ml detected (false positive of course)
Clément replied to Clément's topic in RTL and Delphi Object Pascal
Just to end this thread, I finally got my digital certificate, and I'm signing my applications. I kept a false positive version of the product to test signing it. Well it did work. That version wasn't compiled with DEP or SEH, and signing solved the false positive too. Hopefully this thread will help others -
RAD Studio 11.0 Support
Clément replied to Angus Robertson's topic in ICS - Internet Component Suite
Salut, I downloaded v8.67 from svn and it is complaining of a missing file ( under Delphi Alexandria ) [dcc32 Fatal Error] OverbyteIcsD110Run.dpk(169): F1026 File not found: '..\Source\OverbyteIcsLibeayEx.pas' Under Delphi Sydney it is compiling Ok. (That file is not in the project)