Android - Constantly changing text implementation advice needed - android-asynctask

I have a TextView which shows the amount of points the user has. Users points are filled with time to their max. I want my TextView every 20 sec. to display the time left for the point to be fully filled. (e.g. if the TextView shows "you have 500 points" I want it after 20 sec to change to "will be fully filled in 4:17 min", this text to be displayed for 10 sec. and then change back).
I thought of two ways to do this :
1) With a Handler and Runnable, and each time the text changes to add another runnable task.
2) To do the points filling with AsyncTask, and the text will be changed with the onProgressUpdate method.
3) Any other way you suggest (and think is better).
Thanks for your help in advance,
Dan

Related

Pinescript Problem with Calc after order filled and calc on every tick for backtest. there are a lot of entries on same bar which destroy the backtest

I would like to know if someone has found a solution to counter this horrible calculation from tradingview:
when Calc on every tick is selected only, the numbers of trades in backtesting seems correct, BUT because it doesn't calculate a supplementary intra-bar it really often misses the correct stop loss price. It closes at the close of the next bar after entry. so it destroys the backtest results calc on everytick intrabar stoploss problem example image
when "calc after orders filled" is enabled, it solves the problem of the stop loss BUT it is starting to make completely WTF entries, sometimes on Wick or Open bars which is increasing the number of trades in an unrealistic way. entry on wick example image
if calc after order filled is enabled + Bar magnifier = LITERALLY THE HELL
It's starting to add an infinite number of trades on the same bar sometimes Calc after order filled + Bar Magnifier example image
So please if someone found a solution to these problems it would be incredible.
Same over here brother. I was just looking for help with limit entry orders getting activated on a signal and they seem to enter on bar close. I tried every combination of those settings too, sometimes they work sometimes they dont i guess. I dont know how to help you but if there's a solution would benice. Maybe place a support ticket to trading view.

Is it ok to set a minimum display time for the spinner from the UX standpoint?

I have a task to generate a file based on the data from several records (sources) that could be selected on UI. A user can select from 1 to 100 records. The generation (request processing) time depends on the number of selected records. It can be from several milliseconds to approximately 5 seconds.
I am planning to display the spinner component for this request. But as I mentioned above it might be processed too fast and the spinner will blink. So, is it ok from the UX standpoint to set some minimum displaying time for the spinner to prevent irritating blinks? If yes, then what is the best timeout? 1 second?
P.S. I have read a great Progress Indicators Make a Slow System Less Insufferable article on the Nielsen Norman Group website. But it does not fully answer my question.
Neilson's research would suggest that your guess of 1 second is in the right area - or more specifically, that the time needed is somewhere between 0.1 second and 1 second. I'd probably try 0.5 seconds and see how that feels for the users.
Note that as you can approximately tell in advance what the time will be, you know immediately weather or not to turn on your spinner. So, if the user has less than 10 selected when they press the button (based on the numbers given above, assuming a linear relationship, 10 would be about 0.5 seconds) DON'T display the spinner, but otherwise, IMMEDIATELY display the spinner. This is based on the principle that if the program knows something UX related in advance, that should be immediately shown to the user (the same principle that says you should simply not allow options that are impossible to be selected - i.e. disable them - rather than letting the user choose them and then saying "sorry, can't do that").

Idle and Other times in Chrome Developer Tools. Why the browser is inactivity for so long?

What is included in "Idle" and "Other" times into Sumary of Timeline tab in Chrome Developer Tools?
What causes so much inaction?
Why do these occur?
How to reduce these times? Is it possible?
Why the browser is inactivity for so long (in the context of idle time)?
At the beginning of more than 1.8 seconds nothing happens:
In the middle the "Idle" and the "Other" occupy about 0.3 seconds:
At the end of almost 3 seconds nothing happens:
In this example, we have almost five seconds of inactivity browser...
The "Idle" state occurs when the browser has not yet completed the final rendering of the page on the screen but must put the process on hold while waiting for missing data or resources needed to resume and complete it.
We can deal with long "Idle" periods, for example, when the browser waits for a synchronous response, which is generated for a long time on the server-side.
The "Idle" state should not be confused with the "Loading" state, which is the time the browser actually uploads the response (from the first to the last byte), not the time from sending the request to uploading the response.
The "Other" state represents the time of all browser activities other than those listed in the pie chart, such as DOM tree building, CSSOM and others.
This issue is partly explained on the "Render-tree Construction, Layout, and Paint" website.
I found part of the answer on Addy Osmani's blog:
In Frame mode, the shaded vertical bars correspond to recalculating styles, compositing and so on. The transparent areas of each vertical bar correspond to idle time, at least, idle on the part of your page. For example, say your first frame takes 15ms to execute and the next takes 30ms. A common situation is that frames are synchronized to refresh rate and in this case, the second frame took slightly longer than 15ms to render. Here, frame 3 missed the "true" hardware frame and was rendered upon the next frame, hence, the length of the second frame was effectively doubled.
But this does not exhaust the topic.
Example from which the chart included in the question did not use frames.
I still do not know how to shorten the time, and what is hidden under "Other".
Check out this topic
Idle is just that, nothing was going on so nothing to worry about as far as I know.
Other is "un-instrumented activity". Which is stuff that currently isn't able to be broken down. So, you can't analyze what was going on in there from the DevTools.
Using Start profilling and reload page button instead of Record button will give the results we are waiting, since it stops recording after page to finish the loading, reducing idle.

how to keep a running score in a textbox/object in powerpoint

My powerpoint is made is like a quiz, one slide has a question and 4 answers (buttons with text, not numbers) that can be clicked on. When an answer is clicked on, it is linked to another slide that explains if the answer being right/wrong and then adds/subtracts points from the score.
Currently what I have done is a simple macro that each button is linked to and upon clicking any of the 4 answer buttons, it will go to a certain slide and show a pop up box with their current score.
What I want to do is have either a text box or some object that holds the score throughout the entire presentation and ideally if possible, the score resets when the ppt is closed or opened but the running score is the most important aspect I'm trying to hammer down.
Is this possible for what I'm asking? Let me know if there are any details that would help
Instead of resetting the score when the presentation shuts down, do it at startup. For example, you could put a "Begin the quiz" button on the first slide, have it reset the score, then move to the next slide.
As to where to store the score, there are a number of ways of doing it. One would be to put a rectangle or text box on the last slide and store the score as its text. Make sure the rectangle's sent to back so it's the first shape on the slide, or change Shapes(1) below to indicate the actual z-order position of the shape.
Function SetScore(lScore as Long)
Dim lLastSlide as Long
lLastSlide = ActivePresentation.Slides.Count
With ActivePresentation.Slides(lLastSlide).Shapes(1).TextFrame.TextRange
.Text = Cstr(lScore)
End With
End Function
A companion GetScore function should be easy to come up with, similar to the above.

MATLAB: How to present multiple images/figures to user and wait for click on one of them?

all. I'm new to Matlab and I'm a bit stuck. The last piece of the puzzle to run my experiment is to get some human input (expert supervised system). As easy as this may sound, I just can't seem to figure this one out.
I need to display four images to the user, plus an additional fifth figure (button, or could even be another image, doesn't matter). The code should wait until the user clicks any one of those images/figures and should continue afterwards (closing the figures, too). Obviously, I'd need to know which figure was clicked.
GUI programming in Matlab doesn't seem to be documented clearly to me. Or perhaps it's just in a realm that I'm not talented with. It's definitely a lot more confusing than Visual Studio, that's for sure.
Thanks in advance for your time; I greatly appreciate it! :)
Could you make all five of the images into buttons? The 'CData' property of a button can be used to display an image on a MATLAB button. See the following links for an example and an explanation (that hopefully makes sense!).
http://www.mathworks.com/matlabcentral/fileexchange/2378-buttons/content/buttons.m
http://www.mathworks.com/support/solutions/en/data/1-16V03/
Use menu:
figure(1)
plot...
figure(2)
plot...
figure(3)
plot...
figure(4)
plot...
% this will create a menu of labeled buttons where the user can click
m = menu('Choose a figure','Figure 1','Figure 2','Figure 3','Figure 4','None');
% close all 4 figures
close(1:4) %will close figures 1 to 4
% --------- your program from here on ---------
if m == 5
display('You chose no Figure');
else
display(['You chose Figure:' num2str(m)]);
end
%---------
menu will return a number which corresponds to the option that the user clicked on.

Resources