Jump to content

RaelB

Members
  • Content Count

    28
  • Joined

  • Last visited

Community Reputation

1 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. When is MMX Code Explorer not installed?
  2. Hi, What is the default shortcut to move the current line up or down? (i.e. it is swapping the current line with line above/below). Somehow I had trouble finding this shortcut online. In VS Code it would be Alt+Up/Down Arrow Thanks
  3. Hi, I have a simple pipeline, that takes in a list of 20 items, and has one stage. For each item, the stage waits 1 second, and then sends a message to the main UI, which will add the item to a Memo, and update a ProgressBar. The code is looking like this: procedure TForm1.AddDownloadItems; var DownloadItem: TDownloadItem; I: Integer; begin for I := 0 to 19 do begin DownloadItem := TDownloadItem.Create; DownloadItem.Id := I; FDownloadItems.Add(DownloadItem); end; end; procedure TForm1.Stage1(const input, output: IOmniBlockingCollection; const Task: IOmniTask); var Item: TDownloadItem; InputItem: TOmniValue; begin for InputItem in Input do begin Item := TDownloadItem(InputItem.AsObject); Sleep(1000); Task.Comm.Send(0, Item.Id); Output.Add(InputItem); end; end; procedure TForm1.UpdateProgress(const task: IOmniTaskControl; const msg: TOmniMessage); begin Inc(Progress); Memo1.Lines.Add(msg.MsgData.AsString); ProgressBar1.Position := Progress; end; procedure TForm1.GetDownloadsPipline; var Item: TDownloadItem; begin { ====== Start Pipeline ========= } Screen.Cursor := crHourGlass; StartTime := GetTickCount; FPipeline := Parallel.Pipeline .Stage(Stage1, Parallel.TaskConfig.OnMessage(UpdateProgress)).NumTasks(4) //Environment.Process.Affinity.Count) .OnStop( procedure begin PostMessage(Form1.Handle, WM_STOPPED, 0, 0); end) .Run; Self.AddDownloadItems; for Item in FDownloadItems do FPipeline.Input.Add(Item); FPipeline.Input.CompleteAdding; end; When the program runs, a few items get added to the Memo, and only afterwards the progressbar updates. This seems strange. I would expect the progress bar to update simultaneously with the memo. Please see attached video. Any ideas? Thanks pipeline_progress.mp4
  4. Not sure what you mean by tab group? I think that's what I have (and still have the issue) My layout is as follows: You got any "Update Subscription" countdown in your ide?
  5. Hi, I recently upgraded to 15.0.33. Every few minutes the IDE hangs for a few seconds. I'm mostly working with small to medium sized units. Delphi 10.3.2 Not sure if this is related to MMX, or perhaps to the IDE updating the number of days left to update subscription.. Thanks Rael
  6. Thanks all for the suggestions. The DDetours library was really helpful in this situation (in combination with logging), and helped me locate the problem fairly easily. Yeah not that tricky. I just used a TStringList to keep track of opened files (i.e. Handles) and only logged calls to CloseHandle that had an entry in the stringlist (and then removed them..)
  7. Hi, When trying to modify or overwrite an existing file, I get this error: Similarly the file cannot be deleted with SysUtils.DeleteFile. It seems that the file is actually in use within the same application (since if I close the app and restart it the file can be deleted...) Is there any way i.e. via code or perhaps an external tool, I can find out which piece of code is locking/holding the file? Similar to how when there is a memory leak, FastMM can give a report of which code block created the object. Thanks
  8. RaelB

    Delphi Jobs

    Hi, Are there any well known sites to post Delphi job opportunities? Thanks
  9. RaelB

    TTask running twice?

    @Der schöne Günther: If I set a timeout the problem does not occur. Thanks a lot for your help. Kudos for noticing the thread ID issue. It is something that can be reproduced quite easily as in my test application.
  10. RaelB

    TTask running twice?

    @Der schöne Günther: Yes, it is a thread ID. What you say is an interesting observation. I have created a small demo (attached). I am not able to reproduce the problem of Task 1 running twice, however on some occassion, the WaitForAll and Run Task 1 calls have the same Thread ID. Here is an example trace. The issue occurred for the first run, but not the others. 0x3374 19:33:20:910 AddVideo 0x6518 19:33:21:125 WaitForAll 0x6518 19:33:21:179 Run Task 1 0x6518 19:33:22:590 --- 0x3374 19:33:24:230 AddVideo 0x47C4 19:33:24:240 WaitForAll 0x1984 19:33:24:240 Run Task 1 0x47C4 19:33:24:875 --- 0x3374 19:33:26:397 AddVideo 0x6130 19:33:26:459 WaitForAll 0x6518 19:33:26:459 Run Task 1 0x6130 19:33:27:247 --- Perhaps if you look at the code you will see something wrong. I am using the open source TraceTool for the logging. (https://github.com/capslock66/Tracetool) TTaskRun Test.zip (btw, I'm using Rio 10.3.2) Thanks
  11. RaelB

    Application does not close

    Thanks alot for the suggestions, especially Der schöne Günther - It is indeed related to a TTask not completing. Since the nature of the problem relates more to TTask I am going to follow up the issue over here: https://en.delphipraxis.net/topic/4174-ttask-running-twice/
  12. I have the following code. It creates 3 tasks and then calls `TTask.WaitForAll(tasks)` : procedure TVideoFrame.AddVideo(....); var ... begin MainTrace.SendStack('AddVideo'); btnPaste.Enabled := False; btnUpdate.Enabled := False; Application.ProcessMessages; ... TTask.Run(procedure() var tasks: array of ITask; ... S: String; Res: Integer; begin Setlength(tasks ,3); MemStream := nil; tasks[0] := TTask.Create (procedure () begin ... end); tasks[0].Start; tasks[1] := TTask.Create (procedure () begin MainTrace.Send('Run Task 1'); S := GetHtml(Url); end); tasks[1].Start; tasks[2] := TTask.Create (procedure () begin ... end); tasks[2].Start; MainTrace.Send('WaitForAll'); TTask.WaitForAll(tasks); EnterCriticalSection(_CritSec); // Don't think it's necessary but just to be safe... try try .... // Process results.. except On E: Exception do MainTrace.Send(E.ClassName, E.Message); end; finally LeaveCriticalSection(_CritSec); end; TThread.Synchronize(nil, procedure() begin btnUpdate.Enabled := True; btnPaste.Enabled := True; .... end); end); end; A normal trace would look like this: It seems a little strange that the trace of `WaitForAll` happens before `Run Task 1`, but maybe that's because it takes a few moments before Task 1 starts to run. Anyway that is not the main issue. The problem is I get a trace like this: Task 1 is running twice, and you can see from the trace in a different thread. I also have a breakpoint in the `GetHtml` method, and I see that in fact it is being called twice. How does this happen? In the main user interface I only click the button once. (as you can see from the code, I disable the button so I can't click it twice anyway..) Thanks Rael
  13. Hi, I'm using Delphi 10.3.2, and MMX 15.0.30. Frequently when I switch to the MMX tab (it is docked together with the Structure and Object Inspector Tabs), it is blank. If I switch to another tab (i.e. Object Inspector), and then back to MMX, then it will appear normally.
  14. RaelB

    Application does not close

    I have a VCL app, running on Windows 10, Delphi 10.3.2. Sometimes when I press the X button on the main form (to exit the app), the application does not close. The Main window disappears, however the IDE continues in "Running mode" / Debug Mode, i.e. the Program Reset button continues to be Red. When I press the Red button, the program then terminates completely and normally. Not too much going on in the application. What could be causing the program execution to hang in this way? How can I go about trying to figure out the cause? (I have no OnClose or OnCloseQuery handlers) Thanks Rael
  15. RaelB

    Bungled up component install

    @Uwe and @emailx45, thanks for the tips. I did manage to come right eventually. There were some errant bpl's in C:\Users\Public\Documents\Embarcadero\Studio\20.0\Bpl. Once they were deleted, things started making more sense. Not sure why they were affecting Tokyo installation though. I uninstalled and re-installed a number of components, and also looked through the registry and found a couple of strange entries where some components where referencing a mix of Tokyo and Rio bpl's. (I did a search for rtl260) Not sure how that happened. Maybe due to a custom util that I use 🙂
×