Jump to content

RaelB

Members
  • Content Count

    77
  • Joined

  • Last visited

Everything posted by RaelB

  1. RaelB

    Error parsing winmail.dat

    I changed over to use https://github.com/CleverComponents/Tnef-Parser . It looks like it is a comprehensive implementation.
  2. When is MMX Code Explorer not installed?
  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. 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
  5. 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?
  6. 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
  7. 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..)
  8. RaelB

    Delphi Jobs

    Hi, Are there any well known sites to post Delphi job opportunities? Thanks
  9. 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
  10. 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.
  11. 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
  12. 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
  13. 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/
  14. I had installed a number of components into Delphi 10.2 (Tokyo). One such being Graphics32 which has 2 packages: GR32_R, GR32_D (in Folder Source\Packages\RX2). I subsequently installed the packages from Folder RX3 into Delphi 10.3 Rio. I did a similar thing for a few other components. Then when I tried to open 10.2 again, I got a "runtime error 236", and after pressing "OK", (well it's not really OK, but they don't give me any other choice, do they?) the IDE quits/crashes. Anyway, so I uninstalled some of the other components from 10.2 that I had also installed into 10.3 or simply deleted the bpl files from the output directory, and eventually the IDE now loads without a problem. So now I am trying to install Graphics32 into 10.2 again. Beforehand I have deleted all related bpl/dcp files from the computer (using "everything" (voidtools.com) to locate them). The GR32_R package compiles without problem. Then I try to install GR32_D, and I get this error: As far as I know Delphi 10.2 is vcl250/rtl250, and 10.3 is rtl260, so what does it mean that the call stack is showing both rtl250 and rtl260?
  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 🙂
  16. RaelB

    Can VCL, TMS, DeveloperExpress styles be combined?

    There is an enhanced version of Toolbar 2000 called SpTBXLib. see https://github.com/SilverpointDev/sptbxlib It is actually quite a good option, since it supports VCL Styles, and is High DPI aware. It has been used in PyScripter (https://github.com/pyscripter/pyscripter ) And the author has worked on adding these features (i.e. to be High DPI aware), so I recommend that you check it out. Dev Express has it's own skin system that does not work with the VCL styles. So if your app is using a whole range of components, it is probably a good idea not to use their Toolbar/Ribbon system. Only use individual controls you may need, and you can manually select specific styles that would match VCL Styles, if neccessary. I would suggest for you to first upgrade your project to recent version of Delphi, using SpTBXLib and support high DPI, since that is a fair amount of work in itself. Once your app is up and running, then you could decide on replacing various components if necessary.
  17. Hi, I see if a class has the [TestFixture] attribute, then it will be included in the Test Suite. So it seems that the initialization TDUnitX.RegisterTestFixture(TMyTests); is not neccessary. Maybe it just a relic from the past, or does it still serve a purpose?
  18. I'm using the latest version of superobject from here https://github.com/hgourvest/superobject. It fails to parse attached json file (return nil object). I have no problem using x-superobject, and notepad++ has no problem parsing it. Sample code: var O: ISuperObject; S: string; StrList: TStringList; begin StrList := TStringList.Create; try StrList.LoadFromFile(....'sample.json'); S := StrList.Text; O := SO(S); if O = nil then Memo1.Lines.Text := 'O = nil' else Memo1.Text := O.AsJSon(True); finally StrList.Free; end; Can anyone tell me why it fails? Is there a more recent version of superobject to use? hgourvest repo is no longer maintained. (My project is using superobject, so I don't want to swap to another library..) Thanks sample.json
  19. In Data structures & Algorithm courses, there is usually a discussion on Binary Search Trees and it is seems to be an important data structure. Although in Delphi land I don't see much mention of BST. So I'm curious do people use BST and if so in what cases? or does TStringList mostly replace the need for it. If you do use it, what implementation do you use. Most of the libraries I found don't seem to have a BST, although I did find one in https://github.com/Zeus64/alcinoe
  20. Hello, I'm using 10.3.2. I created a VCL Project, then added a Test Project and Test Case (DUnit). When I run the test project, it runs and exits, without doing anything. What is wrong? I have not made any changes to Conditional Defines, so it should be GUI runner. Thanks Rael
  21. RaelB

    DUnit GUI does not seem to work

    It is unchecked. I did find the problem. There was no call to RegisterTest in initialization section of test unit.
  22. In the SimplePipeline project (from HL-III presentation), if I add a call to sleep in AddOne stage, the program (i.e. UI) blocks for 5 seconds. procedure AddOne(const input, output: IOmniBlockingCollection); var v: TOmniValue; begin for v in input do begin output.Add(v.AsInteger + 1); Sleep(1000); end; end; I would expect this to not block the UI, since it is running in a Thread/Task?
×