Best Way to Display Progress Bar For Long SQL Transactions? - asp.net

So I have C# function that's gathering data results and images and uploading them to the SQL Database.
What I'd like to do is create a progress bar showing the progress through this function(by like incrementing the bar 1/NumOfLoops each pass of the outer most loop).
I was hoping to just use a DIV with changing width as my progress bar, stuck in an update panel.
The issue of course is triggering the update panel to update.
Or is there a better way to go about this?

Yes, this is possible, but you may not the like the solution I link you to, because it involves using an iFrame.
Read Easy incremental status updates for long requests for details on how to use JavaScript to create an iFrame that hosts your long running process .aspx page and then have that page stream back its progress.
Note: In the example, the progress values are streamed back and reported via the text of the button, which is disabled while the long-running process does its work.

Related

When to use wait.until in Appium?

I just started developing a test automation for an iOS app using Appium. I have to click several buttons in the app one after another with different XPath/Accessability ids.
I wondered, when to use the wait.until(ExpectedConditions.visibilityOf Element) expression.
Example:
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//XCUIElementTypeApplication[#name=\"app\"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeTabBar/XCUIElementTypeButton[3]")));
Should I check every time before I click a button if this button is actually visible or existing on the current state of the app or is this just unnecessary and time-wasting?
In my opinion, you should use ExpectedConditions in two case:
Screen load takes long, so you not ending up trying to click something that has not loaded yet. If you find your tests flaky (sometimes pass some times fails) then this probably the main reason why it happens
If you have something like ajax on your screen you want to make sure the data is changed on the page. (Example is you created a post on Facebook, and want to make sure content displayed)

Reactjs+Meteor with pub/sub for infinte scrolling

I am writing an application in Meteor with React. I am trying to achieve an infinite scroll feature.
What I am doing is subscribing to a publication with a limit which is tracked by my component's state. When the component detects that it has reached the bottom, it increments the limit in its state.
This triggers a re-render and a subscription to more data.
The issue I have is the whole component being re-rendered. It loses scroll position and takes you to the top.
How do I achieve infinite scroll with pub/sub based on the limit saved in state and only adding extra rows in the component instead of rendering the whole thing?
Subscribing to the whole list with no limits is not an option for me
So, I couldn't find a way to do it with pub/sub so I had to use Meteor.call, that does a mongo's skip() and limit() based on a page to fetch data from the database and then save that data in the component's state.
This way it does not re-render the entire thing but only adds nodes for the new data it receives.
This also means there is none of the automatic socket stuff happening, which is fine for my use case.
One benefit I do get is it's easy to know whether there is more data left in the database to fetch. Surprisingly tricky with pub/sub unless you add a package.
You have to store your data in some stack and enlarge it. React will render only new elements of your stack instead of re-rendering whole component.

Bar Chart in JavaFx

I'm new in JavaFx and i want to display a Bar Chart after choosing a date (for the SQL query) and clicking the button "display chart". I'm wondering if it is possible to display the chart in the same Tab Pane where the button is. What should i write in my button listener? Can anyone help me?
If this is possible, i want also to use the progress indicator while waiting for the result.
I'm not going to write the code for you, but I'll try to address some of the questions you raised.
I'm wondering if it is possible to display the chart in the same Tab Pane where the button is.
Yes, that seems to be what the sample image you provided is already doing.
What should i write in my button listener?
The code to fetch the chart data and display the chart. If you have trouble writing this, you should create an mcve which replicates just the specific thing which is going wrong.
If this is possible, i want also to use the progress indicator while waiting for the result.
See the sample code here, which is a "Sample for accessing a local database from JavaFX using concurrent tasks for database operations so that the UI remains responsive." The sample makes use of a progress indicator.
Aside: For future questions, you might benefit from just asking a single question in a question, providing some source code which replicates any issue you have, subdividing your problem into parts and asking a specific question on just one particular part you are having an issue with (for example displaying items in a bar chart could be a different question from asynchronously retrieving items from a database).

How to create a "Please Wait" spinner while data is being imported

I am creating an Flex AIR app which imports data from a zip file into a sqlite db. I need to show a progress bar / "Please Wait" spinner animation so that the user waits till the operation completes.
I have tried to put a pop-up spinner animation but the problem is that the spinner stops spinning as soon as the database import queries start executing.
I need to run both the spinner code and the import code simultaneously rather than sequentially.
Thanks
The problem you are facing here is because Flex is a single threaded application. When you run large amounts of as processing, the thread does not update the UI, so your spinner stops spinning.
I think you can work around this by creating a Green Thread to handle your processing code if it can be sliced down. You can check here for an as3 implementation of the Green Thread.
I can provide some more info on implementing it if you need.
Your issue could be caused by the fact that Flash is single-threaded. Try replacing the import with at timer, to remove the cpu-intesive operation.
It that proves not to be the issue, a bit of code could speed up debugging :)
So - if you want just a spinner, you do not need any more data. If you want a progress bar, though, you will just have to know how much data is there (most likely the size of the zip will be precise enough). Then - have some Event.ENTER_FRAME listener in which you will take a part of the data, insert into table... And stop there. It will then show the animation of stuff. Try to see what amount of data is optimal... Most likely by adding a FPS meter there too, and if it goes too low, make the amount lower.
If you want the progress bar, just increment a variable with how many bytes were already parsed, and divide that by the total bytes - a ratio for progress bar. Rest same as spinner.

Creating an interactive website

I want to create an interactive website using aspx and ajax, that there will be an option to create chess game room for example and other players will be able to join.
I have 2 Questions:
I wonder if you have any idea how can I make that after one player clicks on a button and finish his turn, the other player will be able to do a move.
After the first player finish his turn I will change the turn by using the database, but the point is how can I refresh the other player's site so when the other one finish his turn, the turn will come to the second player?
When someone creates a room and than close his browser - I need that room to be closed.
Shall I use the Session_OnEnd to close the room he opened?
Thanks!
I wonder if you have any idea how can
I make that after one player clicks on
a button and finish his turn, the
other player will be able to do a
move.
There are a lot of ways you can do this. If it was me I would have a "moves" database table or something and track whos move it is in there. Then on the page have SetInterval() javascript method that uses an ajax service to look in that "moves" table and determine when it is the users turn.
When someone creates a room and than
close his browser - I need that room
to be closed. Shall I use the
Session_OnEnd to close the room he
opened?
You can use Session_OnEnd. As an alternative you could use the ajax method that checks the moves table to see when a user hasn't checked in x minutes, then close their session.
The simplest way is probably to do a simple heartbeat/polling on each client to see if it is his/her turn yet. Although, push/comet has been getting easier and easier these days.
If you're already using a polling/heartbeat technique, it would be trivial to close a session after, say, 5 missed heartbeats.

Resources