-
Content Count
2067 -
Joined
-
Last visited
-
Days Won
27
Everything posted by Attila Kovacs
-
Google Chrome is blocking the download of my application โ HELP!!!
Attila Kovacs replied to Steve Maughan's topic in General Help
Also downloaded successfully with the orange button on the top right without any problem. Version 81.0.4044.113 (Official Build) (64-bit). The app looks interesting, is it like Regiograph? -
That's true. But if he goes: var FSomething: PChar; procedure HandleMessage(var Msg: TMessage); begin FSomething := PChar(Msg.WParam); end; then that was it. And depending on how he is populating the log messages, the memory manager could give him the same address for X times in the client thread. To have even more fun in debugging.
-
@Darian Miller I've slightly modified your code, with the sleep you can fine-tune to get it synced ๐ procedure TMyThread.Execute; var Buffer: string; r: integer; begin while (not Terminated) do begin r := random(3242424); Buffer := TEST_STRING + inttostr(r); PostMessage(MainWindowHandle, WM_STATUSOUT, WParam(PChar(Buffer)), r); // Sleep(30); end; end; // Main thread procedure TForm1.WmStatusOut(var Msg: TMessage); begin if PChar(Msg.WParam) <> TEST_STRING + inttostr(Msg.LParam) then begin OutputDebugString(PChar(Msg.WParam)); end; end; or if we want more dramatic results: procedure TMyThread.Execute; var p: pchar; r: integer; begin while (not Terminated) do begin r := random(3242424); p := StrNew(pchar(TEST_STRING + inttostr(r))); try PostMessage(MainWindowHandle, WM_STATUSOUT, WParam(p), r); finally StrDispose(p); end; // Sleep(30); end; end;
-
Difference between Pred and -1
Attila Kovacs replied to John Kouraklis's topic in RTL and Delphi Object Pascal
@Mike Torrettinni Nothing special, I thought you like exotic methods ๐ -
Difference between Pred and -1
Attila Kovacs replied to John Kouraklis's topic in RTL and Delphi Object Pascal
@Mike Torrettinni Do you know Concat() ? -
Press F7 or F8 to start the debugging session for the application and in CPU View on the code pane press ctrl+g and enter $0040DD41. Which line is it in the code? But It's a low address, so it will be most likely system.pas, so you have to look after the call stack, either on AV or by putting a breakpoint there with a condition. Also, there is an inherited; in the message handler, how do the other handlers look like?
-
How to creating an image preview in the background?
Attila Kovacs replied to Steve Maughan's topic in Algorithms, Data Structures and Class Design
"Debouncing". Slow users are out of luck. -
What is the proper way to display the progress from a pipeline stage when the main thread is blocked by WaitFor()? VCL.
-
MiTeC System Information Component Suite 14.1.0 released
Attila Kovacs replied to mitzi's topic in Delphi Third-Party
Is it possible to retrieve a notebooks serial number? Is it stored anywhere? Ok, I have found it. Btw. the compiled demos on your homepage are detected by chrome (or windows?) as malicious (virus inside the zip). It would be a good idea to sort it out as a host application could have the same problem if linked with this lib. -
Ooookay, everything is working perfectly, it was a journey, transforming the legacy code to work with OTL, which I really enjoyed. It's frightening how easy and how fast can you write complex and _working_ code with this lib. The online documentation seems to be a bit behind the current release (didn't check the book yet), so I took a copy of the book at leanpub with a custom input in the box as a small donation and a big thank you.
-
is it ok regarding to multithread design pattern to free an object in a different process thread as it was created in? Seems to work, but are there any caveats? function TfrmSync.NewCookieList: TclCookieList; begin Result := TclCookieList.Create(nil, TclCookieItem); Result.Assign(FCookies); end; mainthread begin ... Fpipeline := Parallel.pipeline.Stage(Retriever, ....)...Run; Fpipeline.input.Add(TRetrieverParam.Create(..., NewCookieList)); <---- New instance ... Fpipeline.input.CompleteAdding; end; procedure TfrmSync.Retriever(const input: TOmniValue; var output: TOmniValue); begin ..... TRetrieverParam(input).CookieList.Free; <---- EOL end;
-
freeing an object in different process
Attila Kovacs replied to Attila Kovacs's topic in OmniThreadLibrary
@Fr0sT.Brutal eauhm, yes, thread of course.... thanks! -
Never underestimate this kind of answers, this tells me always that there is a user error. It was. Thx. I have here something what I'm not getting and very hard to debug. (got it, not even multi threading problem, it just revealed it \o/) btw, I still can't figure out what "Parallel.TaskConfig.OnMessage(Self)" does, as 2nd parameter to a stage. thx
-
It "closes" the dataset, then you can manipulate its properties including sql text etc.. then you set it active again with open() or with sql() in firedac, I'm not familiar with the "sql()" method, but it's for sure a shortcut for setting the Sql text, parameters and opening the query.
-
anyway, you could consider using temporary queries instead of one (or more) particular queries as a swiss knife on a datamodule: procedure DoSomething; var Q: TFDQuery; begin Q := TFDQuery.Create(nil); try Q.Connection := dm.FDConnection1; Q.Sql('....'); <DoSomething> Q.Close; finally Q.Free; end; end; or similar.. or "Q" as a class Field like "FQxy" if you have to work with db controls...
-
if this works without a ".close" between the two ".open()" then I'm speechless.
-
AV's are cool, because you have the address. btw, did you look for pervasive/windows logs?
-
As I put more code into the pipeline stages some questions are arising. For example, some of the exceptions are arriving as "string" into the final output collection instead as "exception". One case is "Abort" and the other one is if I'm re-raising an exception in the stage code. Why is that? Also, what is the proper way to re-run a task or add a new one after "CompleteAdding"? I would like to return the task with the exception and be able to re-fire the same task. (Network communication) Do I need a new pipeline?
-
Ha-ha. ATM I entered the code here I just noticed that pipeline is a local variable, and also an interfaced obj. ๐
-
Sadly I'm stuck already, if I omit WaitFor(), nothing happens. Occasionally one task will be executed if I'm hitting the start button like a maniac, but I have 4 values assigned to the input. I'm playing with the example with retriever/inserter. pipeline := Parallel.pipeline // .Stage(Retriever) // .NumTasks(Environment.Process.Affinity.Count * 2) // .Stage(Inserter, Parallel.TaskConfig.OnMessage(Self)) // .Run // ; pipeline.input.Add(TThreadParam.Create(....)); pipeline.input.Add(TThreadParam.Create(....)); pipeline.input.Add(TThreadParam.Create(....)); pipeline.input.Add(TThreadParam.Create(....)); pipeline.input.CompleteAdding; // pipeline.WaitFor(INFINITE); I've tried to put ".run" after completeadding as a 'trial and fail'attempt, and in this case on the first run 2 tasks are executed, and from the second run all tasks are executed. I'm really missing the explanations from the doc, there is also an example "procedure TfrmOtlParallelExceptions.btnPipeline1Click(Sender: TObject);" where is no waitfor() but processing output right after "CompleteAdding", which is also confusing. // Provide input 37 with pipeline.Input do begin 38 // few normal elements 39 Add(1); 40 Add(2); 41 // then trigger the exception in the first stage; 42 // this exception should be 'corrected' in the second stage 43 Add('three'); 44 Add(4); 45 CompleteAdding; 46 end; 47 48 // Process output; there should be no exception in the output collection 49 for value in pipeline.Output do 50 Log(value.AsString);
-
Thank you Primoลพ. Awesome lib.
-
Thanks, does this mean pipeline is the wrong approach here or can I run the pipeline without Waitfor? Could not find anything in docs. Edit: ok, I think I just have to omit WaitFor. I'll give it a try.
-
Automatically make your PC wake up at a given time
Attila Kovacs replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
you could just work 7/24, problem solved -
Or get rid of "parentfont" and do it like css? Inherit and overwrite if apply. Anyway, you have to implement it carefully to not to affect rendering speed too much and keep the dfm as tiny as possbile.
-
Issue with TVirtualStringTree OnNodeDblClick
Attila Kovacs replied to Mike Torrettinni's topic in VCL
defer your showmessage with a custom message