Shrinavat
Members-
Content Count
63 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Shrinavat
-
Looks great, is there any chance of animation support (like SVGMagic do)?
-
Maybe something like https://www.rebasedata.com/convert-interbase-to-sqlite-online ?
-
OExport - XLSX/XLS/ODS/CSV native Delphi/Lazarus import/export library - https://www.kluug.at/kluug-net/xlsx-ods-delphi.php I use Template engine: automatically process user-defined XLSX/XLS templates.
-
Saving a large project takes soooo Loooonnnnggg..
Shrinavat replied to Ian Branch's topic in General Help
The latest version is in the attachment. It supports the latest version of RAD Studio. -
How to pass a parameter to a certain stage of the pipeline?
Shrinavat posted a topic in OmniThreadLibrary
I have a pipeline for downloading files to a specific database. FFileDownloader := Parallel.Pipeline .Stage(Asy_URLBuilder) .Stage(Asy_URLRetriever) .Stage(Asy_DBInserter, Parallel.TaskConfig.OnMessage(Self)) .Run; procedure Asy_URLBuilder(const input, output: IOmniBlockingCollection); var ovIN, ovOUT: TOmniValue; begin for ovIN in input do begin // ... compose url for downloading output.TryAdd(ovOUT); // url is in ovOUT end; end; procedure Asy_URLRetriever(const input, output: IOmniBlockingCollection); var ovIN, ovOUT: TOmniValue; begin for ovIN in input do begin // ... downloading output.TryAdd(ovOUT); // downloaded file is in ovOUT end; end; procedure Asy_DBInserter(const input, output: IOmniBlockingCollection; const task: IOmniTask); var ovIN: TOmniValue; DB: TxxxDatabase; begin DB := TxxxDatabase.Create(nil); DB.DatabaseName := ??? ; DB.Open; for ovIN in input do begin // ... insert downloaded file in specific database end; DB.Commit; task.Comm.Send(WM_TASK_COMPLETED); end; I run a pipeline for various databases. I need to pass DatabaseName to the third stage of the pipeline. How can I do that? Can I use the SetParameter method of Task controller when creating a pipeline? And if so, how? Any help will be appreciated! -
How to pass a parameter to a certain stage of the pipeline?
Shrinavat replied to Shrinavat's topic in OmniThreadLibrary
@Schokohase Thank you, it's works! I wonder if there is another solution? Without creating an extra class? -
How to pass a parameter to a certain stage of the pipeline?
Shrinavat replied to Shrinavat's topic in OmniThreadLibrary
@Schokohase Sorry, I'm afraid I don't know what you're talking about. What method what class i shoud use? The pipeline does not have an Initialize method. -
Here is description (on a russian website) of IDEFont - http://www.proghouse.ru/programming/143-idefont
-
IDEFont A tool to change the font of IDE Delphi https://github.com/zMotoR/IDEFont
-
I hope this is the right place to ask this... Is there a Delphi wrapper for libpng? I would very much like to use it, but I couldn't find it anywhere. Please share if you know anything. If someone got working wrapper for libpng and wants to share it at here would be cool. Thanks!
-
@dummzeuch I saw these links. The libraries are very old, seems more than 15 years old and for very early versions of libpng. Unfortunately, they cannot be used for current versions of libpng.
-
My task is to draw a lot of small images in a certain order on one large one. I'm using TBitmap32 from Graphics32 Library. Since TBitmap32 is a descendant of TThreadPersistent, it inherits its locking mechanism and it may be used in multi-threaded applications. Here is how I do it now in the main thread: var LargeImage: TBitmap32; procedure BuildLargeBitmap; var x,y, bx,by: integer; AreaRect: TRect; tile: TBitmap32; begin LargeImage.BeginUpdate; try AreaRect := GetSpecifiedArea; // small images (tiles) are 256*256 pixels in size LargeImage.SetSize(256 * (AreaRect.Right - AreaRect.Left+1), 256 * (AreaRect.Bottom - AreaRect.Top+1)); { loop of drawing tiles on a large bitmap } by := 0; // bx,by - coordinates on the bitmap where the tile is drawn (in tiles) for y := AreaRect.Top to AreaRect.Bottom do begin bx := 0; for x := AreaRect.Left to AreaRect.Right do begin tile := GetTileFromDB(x, y); // get tile from the database if Assigned(tile) then // if tile exists, render it on the large bitmap RenderTileToBitmap32(LargeImage, tile, bx*256, by*256); inc(bx); end; inc(by); end; finally LargeImage.EndUpdate; end; end; I want to use all the power of OmniThreadLibrary and bring this rendering loop to a separate thread(s). Which one of the proposed abstractions should I use? ForEach, Fork/Join, Map or something else? Please give me advice and an example applicable to my task. Thanks!
-
High-level abstractions - Difficulties in choosing and using appropriate strategies for solving my task.
Shrinavat replied to Shrinavat's topic in OmniThreadLibrary
@Primož Gabrijelčič Do you have any progress for this issue fix? There are no new commits on github. Current workaround with using extra variable is not very elegant, although it works. -
Here is the simplest code: When I click on the button "Read Image in GUI Thread", then everything is fine. TWICImage loads the image from the stream. However, the same code does not work in the thread (click on the button "Read Image in OTL Thread"), I get AV "Access violation at address 0050316F in module 'Project1.exe'. Read of address 00000000". If you use TJPEGImage instead of TWICImage, then everything works fine in both cases. I don't get what the problem is. Can someone explain to me in simple terms what should I do in order for TWICImage to work in the thread? I want to use TWICImage because it allows you to download a wide variety of image formats, not just jpeg. Delphi 10.2.3, Win7SP1 x64. Project full source is in attachment test_OTL_read_from_memory.zip
-
Yes, indeed.
-
Ooops! I completely forgot about that... Thanks!
-
High-level abstractions - Difficulties in choosing and using appropriate strategies for solving my task.
Shrinavat replied to Shrinavat's topic in OmniThreadLibrary
Thank, @Primož Gabrijelčič. That works. And what about my question #1 (numTasks)? -
High-level abstractions - Difficulties in choosing and using appropriate strategies for solving my task.
Shrinavat replied to Shrinavat's topic in OmniThreadLibrary
@Anders Melander I have latest Graphics32 with fixed TBitmap32 constructor access violation AV occurs when executing a line of code Image32.Bitmap.Assign(workItem.Result.AsObject as TBitmap32); - FBackend is nil: This is in case when workItem.Result.Ownsobjects: = True If I comment out workItem.Result.OwnsObject := True line in Asy_Factory procedure and uncomment workItem.Result.AsObject.Free; line in HandleRequestDone procedure, FBackend is not nil. It's a bug. But whose? Mine, GR32 or OTL? -
High-level abstractions - Difficulties in choosing and using appropriate strategies for solving my task.
Shrinavat replied to Shrinavat's topic in OmniThreadLibrary
Questions from my last post are still relevant 10+ days later. Dear @Primož Gabrijelčič, please reply! PS If this OTL subforum is not intended for questions, I am sorry for the time I have wasted. Is there another forum that I can ask specific OTL question and get an answer from the developer? -
High-level abstractions - Difficulties in choosing and using appropriate strategies for solving my task.
Shrinavat replied to Shrinavat's topic in OmniThreadLibrary
I carefully read the "3.9 Background worker" chapter from the "Parallel Programming with OmniThreadLibrary" book, and - hallelujah! I was able to solve my problem with the help of Parallel.BackgroundWorker and Parallel.ParallelTask. Well, at least I think so... Again, project full source is in attachment, here is the main unit part: Everything running like clockwork. But I have a few questions again: 1) If I change numTasks value in Renderer := Parallel.ParallelTask.NumTasks(numTasks).NoWait line to Environment.Process.Affinity.Count - 1, the application starts to work incorrectly. The code after Renderer.WaitFor(INFINITE); line is never executed and my app remains hanging in task Manager after closing. Is this my bug or OTL bug? 2) If I uncomment workItem.Result.OwnsObject := True; line in Asy_Factory procedure and comment out workItem.Result.AsObject.Free; line in HandleRequestDone procedure, I obtain the following AV: "Access violation at address 00604CBF in module 'ImageFactory_BackgroundWorker.exe'. Read of address 00000000." Why? After all, TOmniValue is the owner of TObject-type data! When a object-owning TOmniValue goes out of scope, the owned object is automatically destroyed. But this is not so in my case, so I would like to know why it happens. Is this OTL bug? Dear @Primož Gabrijelčič, please could you answer these questions? Also, your opinion on my ImageFactory code is very important to me! Especially the asynchronous part of the code. Maybe is there a better/easier/rather way to do this? test_ImageFactory_BackgroundWorker.zip -
Need to hook @Brandingapi@GetThemeFont$qqrv from designide260.bpl:
-
Feature request for SPOILER button with code formatting
Shrinavat posted a topic in Community Management
Hello, Is it posible add "spoiler" button in editor toolbar? Of course I can use [ spoiler ][/ spoiler ] tags but without code formatting: Spoiler test It would be nice to be able to hide large chunks of code. Thanks. -
Feature request for SPOILER button with code formatting
Shrinavat replied to Shrinavat's topic in Community Management
@Sherlock You are absolutely right. -
High-level abstractions - Difficulties in choosing and using appropriate strategies for solving my task.
Shrinavat replied to Shrinavat's topic in OmniThreadLibrary
So, I decided to abandon the idea of parallel building a large image from tiles. I coded a small test application for testing my "image factory". Project full source is in attachment, here is the main unit part: Screenshots: I'm not sure I did it right. And now I have a bunch of questions, mostly trivial. If you can answer any, please do. 1) Why does stage II start before the creation of ImageFactory pipeline? (see log) 2) Why can't I restart any task? I get "Adding to complete collection" error. 3) How to terminate the pipeline correctly? Sometimes my app remains hanging in task Manager after closing. 4) Are LargeBitmaps created in parallel when there are several (for task #2/#3)? Despite the increase in FPipelineImageFactory.NumTasks for task #2/#3, the number of threads has not changed in the debugger. Also it is noticeable in the log - the line "stage I" appears sequentially. 5) Getting the result - Image32.Bitmap.Assign(FResultBitmap) in OnStopInvoke method - is that right way? If not, how do I get this correctly? 6) Is the overlay order always preserved? That is, for task #3 the overlay_2 over overlay_1 which on base image? with this code: with FPipelineImageFactory.Input do begin Add(TOmniValue.FromRecord<TTaskRec>(Rec1)); Add(TOmniValue.FromRecord<TTaskRec>(Rec2)); Add(TOmniValue.FromRecord<TTaskRec>(Rec3)); CompleteAdding; end; Thanks in advance! test_ImageFactory.zip -
High-level abstractions - Difficulties in choosing and using appropriate strategies for solving my task.
Shrinavat replied to Shrinavat's topic in OmniThreadLibrary
Thank you for the helpful tips! I will experiment more with these techniques.