I have written an app that uses the answer command. This seems to run well until it is deployed to the iPad or simulator where there is a discernible delay when I choose either of the responses on the answer.
I am using Livecode version 6.5.1 and deploying to iOS 7
my code says :
answer question "Hooray !!! you have finished..." with "Play again" or "go back" titled "Game over"
go card "Category Page"
there is a noticeable delay between responding to the answer question prompt and the next card being displayed. If I take out the answer statement, then the next card is displayed immediately.
(PS I realise this code doesn't show what action to take for each option - I have commented that out at the moment to try to isolate the problem)
It shouldn't be slow. If the problem persists I would report it as a bug. 6.5.2 was released a few days ago so give that a try first:
http://downloads.livecode.com/livecode/
If the problem persists report the issue here:
http://quality.runrev.com
To my experience, the answer command isn't slow on mobile devices. So far, the only device that caused me serious problems with the answer command was the Sony Vaio, if the answer command is preceded by a beep.
You may have a script somewhere, which executes right before or after the next card opens.
A quick wat to test this is
on someHandler // openCard or whatever this may be in your own script
answer question "Hooray !!! you have finished..." with "Play again" or "go back" titled "Game over"
lock messages
go card "Category Page"
unlock messages
end someHandler
If your handler starts with a lock screen, the next card won't be drawn until the handler finishes. E.g.
on someHandler
lock screen
answer "something"
go next cd
// do a lot of stuff here
end someHandler
may cause a long delay.
Also, going to a card directly after executing the answer command without using e.g. get the result or an if statement may cause problems occasionally. I have had cases where the script continues to run till the end of the handler while the answer window was on screen.
Another problem could be that you are actually going to the card of another stack or running the syntax in a (pre)OpenCard, (pre)OpenStack or other (pre)Open* handler. If you do this, the card may not render until the (pre)Open* handler has finished running. You can solve this with a construction like
on openStack
send "initiateStack" to me in 0 millisecs
end openStack
on initiateStack
// put everything here that doesn't need to be
// done before the card is visible, e.g. setting
// fields and checkboxes on other cards, reading
// user preferences etc.
end initiateStack
So far just a number of possibilities. If you can provide more details, e.g. the actual code of your stack, I'll update my answer as necessary.
Related
I hope, I can formulate my question correctly and understandable.
When I write an Android App in Kotlin, I normally have a button to close the app and for example finish it with writing a file or something like that.
Now, sometimes I don't finish it with the button, but swipe it out. Then, the file is not wirtten..
Is there a Kotlin statement to catch the "swipe out" and perform some code? When I Inflate another view, at the end I have a dismiss-statement or dismiss.listener and can do some code.
example:
dialog.dismiss() or popupwindow.dismiss()
So question: is there a dismiss.app or something like that?
When your app's Activity is destroyed (either by the user swiping it away, or the system killing the app to free up some resources) it goes through the usual lifecycle steps, ending with onDestroy.
These steps also get pushed to any lifecycle-aware components that are observing that activity's lifecycle, including Fragments (like a DialogFragment) - so that will also get an onDestroy() call. Fragments can be destroyed at other times too, but you can look at the activity's lifecycle to see what's going on there if you need to.
But really, as a general rule you want to save data in something like onStop(), when the activity/fragment is going to stop being visible, i.e. it's going into the background. That's a good time to make sure you've saved all your important data and state, because the user may not be coming back, and you can't be sure onDestroy will be neatly called (e.g. there could be a crash, or the phone might suddenly lose power).
Don't rely on persisting data with the onSaveInstanceState() callback though - that's intended for saving UI state, and if the user backs out of the app / swipes it away, that's counted as a fresh start for the next time they load the app, so onSaveInstanceState won't be called (since the UI state isn't being saved). Use onStop instead (or onPause if you like - have a look at those links for more info on what the difference is)
I am very new to Unity / Vuforia scripting and really need help.
I have composed a whole Timeline in unity but cannot trigger an event ... there are still code errors ...
In the DefaultTrackableEventHandler script, I understand that you have to attach a piece of code that allows these events to be triggered but I haven't been able to do this for 48 hours. Help from the community would be very useful. please.
Here is the scenario:
When launching the application a video should appear. When the target is found, the video should stop to leave room for the Timeline which is triggered automatically, since the target has been found. If the user loses the target then the Timeleine will have to stop and the starting video will have to start again.
Someone could help me with this problem that has taken my head for 48 hours ...
thank you so much
Looks like you have to write scripts that contains differents functions that manage all those points. One script that starts and stops your video (2 different functions), and a other that starts and stops your timeline. (Don't forget to hide the video when you stop it)
Once you have those scripts you can attach them to a object and then, use them in DefaultTrackableEventHandler. (You add you function to the right event by clicking the + button, dragging your object with the script and choosing the right function to use).
Screenshot of DefaultTrackableEventHandler
I have an integration test that runs through a "confirm details" process, and then goes back to the main page to verify that the details have indeed been processed.
However, when I visit the main page near the end of the test, it doesn't go there...
within '#confirm_details' do
page.find_button("Continue").trigger('click')
end
find("#email_confirmation_modal a.email_confirmation_yes").trigger('click')
expect(page).to have_css('span.balance') # Probably a false positive, but I've also
# checked for elements that should only be there after the click
visit '/myaccount'
expect(page).to have_current_path '/myaccount'
... result:
Failure/Error: expect(page).to have_current_path('/myaccount')
expected "/sign_up/confirm_details" to equal "/myaccount"
... but sometimes it's fine. Anyone have an idea why?
(I'll add other details here as I think of them.)
The my_account action in the controller doesn't always get fired (this should surely be the app's entry point, right?)
When it does work, the page loads in well under a second, so it's not running into the 2-second limit. In fact I've tried looping visit '/myaccount' until page.current_path == '/myaccount' and it hung.
Page load is not guaranteed to have finished when visit returns (drivers try to do their best on that, but it's not always possible). For that reason you should always use a Capybara provided matcher when there is one for what you're trying to test since they have waiting/retrying behavior built in. In your case you should never use the RSpec provided eq matcher with current_path, instead you should be using the Capybara provided have_current_path matcher.
visit '/myaccount'
expect(page).to have_current_path('/myaccount')
If that doesn't fix your issue then it's likely to be something with your code that is filling in the "confirm details" so you'll probably want to add the tests full code to the question.
I'm adapting my regression tests to test a web app in firefox. The biggest stumbling block seems to be how to automate the modal dialogs in firefox.
In ie I use variations of the script below, but it doesn't work in Firefox. Is there an alternative that will work in both ie and firefox?
popup=Thread.new {
autoit=WIN32OLE.new('AutoItX3.Control')
ret=autoit.WinWait(title,"",60)
if (ret==1)
puts "There is popup."
autoit.WinActivate(title)
button.downcase!
if button.eql?("ok") || button.eql?("yes") || button.eql?("continue")
autoit.Send("{Enter}")
else
autoit.Send("{tab}")
autoit.Send("{Enter}")
end
elsif (ret==0)
puts "No popup, please check your code."
end
}
at_exit { Thread.kill(popup) }
end
button.click_no_wait
check_for_popups("Message from webpage", "OK")
Given you are talking about a javascript created dialog, I really have to ask, is there a lot of value in actually testing those?
It basically amounts to testing the functionality of the browser
If you are talking about the type of popups described here http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups then I think the first solution, of overriding the javascript may well be your best cross platform option.
The problem with modal dialogs like this is that they are basically a UI even that is happening out at the OS level, it's no longer inside the browser DOM, and thus you need tools that are specific to the OS (like stuff that depends on win32ole, such as autoit) in order to generate the necessary interaction with the native UI and click buttons, send keystrokes etc. Most of the solutions presented should I think work with FF on windows (with proper renaming of expected window titles etc) but would fail on a mac or *nix OS. That means you need a different solution for each OS, which is a pain.
It might simply be easier to verify you can find the proper stuff that would fire the event in the HTML of the page, so you know an event WOULD be fired, and then override things so it isn't. After all it's not really your job to validate that the browser pops up a local dialog when something like alert('This is an alert box') is invoked in javascript. Your concern is that in the HTML a given element is coded to fire off the event that is needed e.g. that there's something like this onClick = 'javascript:x = confirm('Do you really want to do this');" affiliated with the element
I am experiencing a similar problem in Firefox (and I do have to test in Firefox). I can see the code calling the Javascript but when I try to override as described above nothing happens. Is there any kind of a workaround for this? Anticipated updates to Watir? ;-)
I've written a Blackberry appliation with the Blackberry JDE, running on a 9000 simulator. I tested it a week or so ago and loaded it on a Blackberry 9000 phone, and everything worked just fine. Sometime between then and now, though, something went wrong.
My code does the whole moving arrow "loading things from the internet" or whatever thing, but no screens pop up. My original screen, which is just a MainScreen with a RichTextField doesn't load at all. This screen, at least, has most likely not changed in the passing week, so if something broke, it would be in one of the later screens/lines of code that it shouldn't even be getting to yet!
Is it possible that my .jad or .cod file are corrupted somehow? I noticed that when I first put code on my machine, I just stuck in the .cod file that Eclipse provided me. Then, last week, the .cod file it gave me didn't work, because it was ACTUALLY a zip file with a two .cod files inside of it. Using the .cod file with the same name as the .cod file they were in succesfully loaded my app. I did the same this time, and I don't get invalid cod file errors or anything, but the app is still as broken.
Is there some direction I should be looking? Is the issue likely to be in my code, the cod file, the phone, or somewhere completely else?
-Jenny
Edit: I've narrowed it down to the problem only occuring if I attempt to load a particular screen. My problem is that this screen is nearly identical to another screen that IS working just fine on the actual device. Both screens are generated from the same method (which makes a webservice call and gets XML back and parses it to populate the fields of the screen). The only difference is that the screen that is breaking is going to a different URL. This URL DOES work (both from a browser and from the simulated device), so I"m at a loss. The application doesn't seem to crash, (it's still running in the background), it just doesn't attempt to display anymore.
Edit:
Okay, I'm seeing some tunneling errors immediately after I load my app, (but before I execute any of my networking code). When i do execute my networking code, it works just fine, unless it happens to be for my "Rental" section. I commented out all calls to that, and made my menu item for Rentals simply make a print statement. The code behaves identically (it freezes, or displays a white screen after selecting the button). All other menu items work (including those that call threads or network methods). And the rentals menu sucessfully executes in the simulator.
private MenuItem _rentals = new MenuItem("My Rentals", 110,
10) {
public void run() {
//if the last thing I did was a rental
//just show the screen
//else, reload rentals
System.out.println("Rentals was selected");
displayError("Rentals was pressed");
// if(rental){
// System.out.println("It's a rental!");
// popScreen(getActiveScreen());
// pushScreen(_offeringsScreen);
// }else{
// System.out.println("Getting Rentals from scratch");
// RentalsThread _rThread = new RentalsThread();
// _rThread.start();
// }
}};
I'm at a complete loss here: The device debugger doesn't seem to even register me selecting the menu item, and not a single line of code executes! It just freezes! I'll try putting back in my RentalsThread call in the start of my program (which was also freezing) just to see if I can tease apart the problem with the Rentals Thread (which makes the Rental Screen), and the problem with the Rentals menu item.
Okay, I think I have this figured out.
1.) My code was still behaving identically even after commenting out everything because I wasn't rebuilding the .COD files (they automatically rebuild if you try to run it in the simulator, but don't when you're generating a .ALX file, for some reason).
2.) The code I had for generating the Rental Screen was adding things to said screen. Apparently this is all well and good on the simulator, but on the real device it's required that you do all graphics manipulation (even for graphics not yet displayed) in an event thread (I used invokeAndWait).
So, now everything seems to be working just fine. There wasn't anything wrong with my networking (nor did I think there was, because my other networking screen works just fine). I still don't know why I get all those weird tunneling network things before I start, but it doesn't seem to affect anything yet.
See also:
BlackBerry UI Threading - The Very Basics
BlackBerry threading model
several suggestions:
if you have some background work with resources like file IO or networking, app just may stuck there... provide error handling and try to debug app from device!
code signing, check latest code update for API which require signing. But since there are no errors this is doubtful.
To debug on device, run Blackberry Device Manager, attach phone to usb, in eclipse select project, Context Menu -> Debug As -> Blackberry Device.
See A50 How to Debug and Optimize
UPDATE I see "Tunnel failed" exception, so it's like network connection problem...
See tunnel failed in blackberry bold. why?
How to Configure Full Internet Access On BlackBerry
UPDATE Support - Application stops responding when opening a connection