Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9309747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:56:38+00:00 2026-06-19T00:56:38+00:00

I created a routine for generating thumbnails and heres the basic flow: 1) get

  • 0

I created a routine for generating thumbnails and heres the basic flow:

1) get all jpg url from directory
2) iterate all the url
   2.1) load url into a bitmap using URLRequest
   2.2) resize the bitmap to small size
   2.3) encode the bitmap into jpg
   2.4) write the jpg into a file
3) update list dataprovider with thumb url and refresh

this works for 1 file but fails on 2 or more files and this is bec steps 2.1 to 2.4 is enclosed in a static function with async methods. 2.1 is async, resize is async, encode is async, each are nested thru anonymous function waiting for completion event.

by the time the next iteration reaches step 2.1, it will pass new url and the callback methods from previous iteration will use it.

Whats a better approach to this problem? do i just create a class to do step 2 and instantiate it everytime instead of static functions? i feel its kinda heavy.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T00:56:39+00:00Added an answer on June 19, 2026 at 12:56 am

    As you said, your functions need to save their state, they need common data for all sequence of operations. This is exactly why classes were invented.

    You shall not feel sorry for using this ‘heavy’ approach as adobe uses it with AsyncToken and so on. If this code is not a bottleneck of your program’s performance, you shall definitely use classes: it will make your code much more clear.

    However, if you feel that performance is important here, you can make your iterations start async: if maximum of started operations is achieved, then don’t start new operation until one of them is finished. In that case you can create pool of such classes and reuse them.

    However, I guess in your case bitmap operations duration will be so big comparing to instantiation of simple class that you can ignore instantiation overhead).

    You can also just act as you act now, just don’t start new operation until previous one is 100% complete. This is a special case of previous variant, in that case your main class serves as suggested new class, it reuses itself and maximum limit of operations is 1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created the following recursive routine to get all the checked nodes in a
I have created a routine to make the corners of Delphi visual controls to
I have problem with Oracle 9.2 and JMS. I created PL/SQL routine to send
I need to have the URL like photos/13/rate => I have created following routing
I have created a basic site using ASP.NET routing according to Mike Ormond's example
Created .NET WCF service, tested it - works. Generated schemas from Data and service
I am designing a dashboard-like workbook in Excel and I've created a routine to
I created an excel template for a file i've done for a routine work
I happen to get all the symfony problems of the creation... I want to
I have created a Powershell routine for setting mp3 tags on songs, where I'd

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.