Stop execution (breakpoint) every time the execution enter in one of my classes - iphone

Is there any way to stop the execution EVERY time the app enter in one of my classes?
The equivalent would be to put a breakpoint in every single entry point of my class (for ex. viewDidLoad, viewDidAppear...) Sometimes I just need to capture every time my class is called, and I dont know which one is the entry point, so I was obliged to put a breakpoint in every entry point.
Is there any way to automatize this?

Don't know about a class but maybe this can help you.
Setting the breakpoint on a file.

Related

Anylogic: Running a model but stuck suddenly without any error

I'm new to Anylogic and created a simple traffic model. Only use 'carSource', 'CarMoveTo', 'Car Dispose' blocks to set the car routes. But After I ran the model, it worked for a while, then all the cars froze without any error occurring. ’Events‘ panel also stopped. How to solve it?
Most likely your model is running into an infinite loop somewhere in the logic. The first place to check would be all your loops that might become infinite,e.g Do loops, Do-while loops, iterator for loops where you perhaps change the counter variable manually...
If you have the professional version of AnyLogic the best option is to run the model in debug mode until you get this to the point where it freezes and then press pause. You will then see where in the code the model is getting stuck.
If this does not work you might need to start putting traceln in major functions and see ing you can spot the last traceln that gets printed and keep on adding more and more until you can find the point between two traceln where the model freezes
I had the same problem, that after a certain time, all cars froze and there wasn't a signle error.
The problem on my side was that the stop line was too close to the intersection, so I moved it a little bit farther.

Cyclic Timeout Event Double Looping

I am trying to use a cyclic event countdown to trigger certain functions. However, the problem I am facing is that the event in my model seems to double run at each trigger. An example is shown in the screenshot, where at each trigger, the model time is printed twice instead of once. I tried creating this on a totally new model, but the occurrence cannot be replicated. Is there any settings in AnyLogic that I may have edited that is causing this?
you can't replicate it because that's not the root cause of your problem...
click ctrl+F to find a string on your project
write down "traceln" to find everywhere where you are using the traceln function
It is certain that you are using it somewhere else to print the time...

Initialize counter in LabVIEW

I inherited some LabVIEW that has a time counter on it. Although I don't completely understand it because I am not familiar to LabVIEW and I have been successful to some extent.
What I couldn't make though, is to initialize this counter.
And this is my unsuccessful attempt (it just doesn't progress anymore).
I've seen this question that seems similar, but it didn't help me to solve my problem.
Also, my attempt was based on this NI help: http://zone.ni.com/reference/en-XX/help/371361P-01/lvhowto/initializing_shift_registe/ after which I assumed it would work, but it doesn't.
This does what I believe you're going for. It now resets when first called or when the reset button is pressed. Also, I put a tiny wait in there to avoid unnecessary CPU loading.
The reason your attempt to fix it didn't work is because you were initializing the shift register of the timer every time it ran. That shift register has to be left uninitialized so it can retain the value from the previous run.
Here is example of timer, with reset functionallity. It is done as FGV - functional global variable.
Below are screenshots of the each state:

Thread.sleep() proving superior to implicitlyWait

I have a lot of Thread.sleep() commands in my java selenium webdriver project. I have read often and again that using the sleep command is a bad practice and implicitlyWait command should instead be declared once after a browser instance is launched and it will take care of the whole script. This is not working for me on this project.
As There are a lot of NoSuchElementExceptions being thrown for certain elements, I added a sleep command just before each element that poses a problem. The script passed. When I took off the sleep commands and declared implicitlyWait 30 seconds, script failed with a WebdriverException/NoSuchElementException as webdriver is unable to find each of those elements. Sleep command is finding the elements in 2 or 3 seconds. Is Thread.sleep() proving superior here? If I have to use ExplicitlyWait, then I have to declare a lot of them also, as there are many elements that require expected conditions. Is there a workaround?
Thread.sleep() - Set each time you want to wait. A "dumb" wait. It waits for the time specified, no more, no less. If your element is available in 25ms, it will still wait the 10s that you specified leading to wasted time each run.
Implicit wait - Set once and persists throughout the life of the WebDriver instance. It waits for the specified time for every .findElement() call. So if you ever need to check that an element does not exist, etc. then your check will wait for the time specified in the implicit wait which also leads to wasted time.
Explicit wait (WebDriverWait) - Set each time you want a wait. This is just a specific instance of a FluentWait. It is customizable with all the common needs (visible, clickable, etc.) using ExpectedConditions. This is the best practice.
Fluent wait - Set each time you want a wait. The Swiss Army knife of waits. Can do anything... is fully customizable. Can be useful in very specific instances but generally most of your wait needs will be covered by WebDriverWait with ExpectedConditions.
How I use waits...
I use the page object model and in the constructor for each page object that is run when a page is loading, I use a WebDriverWait to wait for an element on the page to be available. Once that element is available, I know that the full page is loaded. Now I can scrape whatever elements I want off the page. If I ever change the state of the page, I have another WebDriverWait to wait for a new element to appear which signals that the dynamic page change has finished. Now I can scrape at will again.
You really shouldn't need to wait for every .findElement() call. Wait for the page to load or wait for a dynamic page change as I described above and you'll only need waits in very specific instances... not everywhere.
NOTE: Do not mix implicit and explicit waits. You will get bad/weird results.
Use explicit wait for your element to locate. It will wait till the condition or the maximum wait time provided before throwing the Exception.
WebDriverWait wait = new WebDriverWait(WebDriverRefrence,20); // pass time in seconds as much you need
WebElement myElement = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("your element's id")));
Note:
FluentWait may be another good option too.

How do I preload my RunAsync code splits

I have split my module with GWT.RunAsync to load faster for the first time. But once it is loaded, I want to load all other code splits as user will be idle for some time, and it will be faster for him to work on those parts when needed.
Any one have tried to do this? Any simple way of doing?
You can call GWT.RunAsync with a callback function that may or may not run the newly-loaded code. In the case where the code isnt' run, the callback turns into a no-op... with the handy side-effect of loading the rest of the code.
See "prefetching" at http://code.google.com/webtoolkit/doc/latest/DevGuideCodeSplitting.html#patterns