Production version on android works differently and unstable. - appcelerator

I have faced an issue of production version working differently from development version on Android.
In particular, I could not call random functions from events (such as click or window open event), which obviously led to problems.
Same code copy-pasted from standalone function to event function code worked fine, also if you directly hook up the function.
There were also random problems on hooking up OnClick from xml, which required doing it in Javascript.
Anyone else experienced those issues?
Error messages I receive in log are not specific and include full javascript code of the file, minimized and cut off at some point.

Related

How can I intentionally crash my Xamarin Android application for not using RunOnUiThread?

I know this sounds like a weird question.
I have a Xamarin.Android app. I'm going through my code and cleaning up stuff that was too aggressively wrapped with calls to RunOnUiThread. My understanding is that code that runs in response to UI events, for example, is already on the UI thread and therefore doesn't need to be wrapped. I don't like the idea of RunOnUiThread calls just sprinkled everywhere like magical pixie dust.
I've removed a bunch of these calls, and preserved the ones I think are necessary. When I run the app, everything works great. But not even a single crash on the first try seemed almost too good to be true, so as a sanity check, I tried to intentionally crash the app by adding UI update code in places where I expected it to be required to be wrapped by RunOnUiThread. However, nothing I do causes that effect!
This makes me concerned that there is some magic happening somewhere that is preventing me from seeing a problem.
The last thing I tried, which I thought would surely crash the app, was to use a Java.Util.Timer to execute a Java.Util.TimerTask that sets the Alpha on an ImageView to 0.5. But still the app hums merrily along!
Now I am totally suspicious that something -- maybe some new OS feature -- is silently fixing things but that customers running in some other configuration will experience crashes. I want to see the error so that I can have confidence that when I don't see it, things are OK.
So, what can I do to intentionally get the Only the original thread that created a view hierarchy can touch its views error?

VB6 creates corrupt compiles...?

I have known for a while that VB6 is trouble, but what can I do - I have a legacy system to maintain and it still being developed here and there.
And I had the weirdest thing ever happen to me with VB6 just now.
Compiled a new version of our application. Tested it - it worked.
Deployed to a client production site. Application keeps crashing! When? When the user clicks anywhere inside a DHTMLEdit control that we have in a specific window. Or sometimes even on the window that contains it.
Now, I've had this before and the solution was always very cryptic. So I tried the following: incremented the project's revision number by 1, recompiled, and guess what?
Works perfectly.
I cannot show code because we are talking about 50,000 lines of code here, and there is no specific code called when clicking the DHTMLEdit control, the form, whatever.
I'm just wondering if anyone else had encountered this oddity.
The VB6 compiler is not a deterministic compiler and does not produce anything near consistent output. IOW, while fixing your bug is not by design, the fact that it can produce such behavior is.
But even in deterministic compilers, making a small change can sometimes "fix" (aka hide) bugs that are triggered by memory alignments, or variable initialition

Different ways to debug a web2py application

As I am new to web2py, I wonder what are the ways available for debugging a web2py application. So far, I've come across the following scenarios:
when a runtime error occurs in a web2py app, an error ticket is generated and normally useful information is contained in the ticket.
however, sometimes only a plain error message is available on a page, for example, 'bad request'. that's it. So what would be the best way in this case to track down what goes wrong? Logging? If so, how do we do it properly?
if no obvious error message is shown, but the app doesn't perform as expected. Usually, I use a debugger with breakpoints to check it out. Any other suggestion?
Any experience/insight is extremely welcome.
You can detect errors at your model or controller layer by adding unit tests. That will help narrow your debugging efforts, especially when the error ticket system breaks down. Unfortunately the web2py documentation doesn't stress the importance of unit tests enough. You can run doctests on your controllers with
python web2py.py -T <application_name>
Since the model layers run for each controller, you will at least find syntax errors in your at the model layer.
The latest version has an integrated debugger. You can set breakpoints on your code and step through it.
The other suggestions are good. I would also suggest the Wing IDE debugger. It isn't very expensive, and works well with Python generally and web2py specifically.
Wing has a capability to do remote debugging -- very useful when you're working through production-style deployment with remote app servers. That capability saved my bacon any number of times.
As #Derek pointed out there is an
integrated debugger for web2py
You can set a breakpoint from the integrated Web2py editor (clicking on 'toggle breakpoint') or setting it manually as indicated in the above link.
Once you hit the breakpoint, you can open http://localhost:8000/admin/debug/interact (if running locally to evaluate any expression at that point.

Time is updating when a form is not even running

A co-worker of mine had downloaded a vb example project a while back to see how to make a call or two, he discovered it today again, and noticed that while sitting in the IDE the time/date is updating automatically when the entire project is not even running.
How does this work, we looked around for code but can't find anything giving it away.
Any ideas?
No enough info, really, but is it possible the time and date are part of a user control sited on the main form? In the IDE, user controls operate in a hybrid mode where their code can be running when the app itself is not.
I can't think of any other scenario where if the IDE is truly stopped, any code can be running.
The StatusBar control in Windows Common Controls can automatically display the current date and time. It updates its display even in design mode.
If you have ever developed controls yourself, you might have experienced an AHA! moment when you realised that your control code is running when the control is being used at design time in the IDE.

Vb6 application works in the IDE but the executable crashes

I have a little problem with visual basic 6 project. Everything works fine in the IDE
but the executable crashes every time, when I run the application. The application uses callbacks to communicate with a C++ dll. Even code as simple as showing a message box fails when the callback starts.
I changed the compilation mode to P-Code and still the problem persist.
Any help would be appreciate.
Thank you all
This sounds like the callbacks may be occurring on a different thread than your application is executing on. [EDIT: As I see Jim has already suggested.] If that's the case, yeah, kaboom just as soon as you "touch" anything OLE related or call into the runtime. Same story as with multimedia timer callbacks, fwiw, and I'd suspect you'll have to take the same precautions as one would with those if this is the case.
The short story with different thread callbacks is that you'll need to post a message to yourself, using PostMessage declared in a typelib so that the Err object isn't set by VB, then let the callback return. You do your own processing on receipt of the posted message. Here's the typelib I used for this with the CCRP Timers library:
http://vb.mvps.org/tools/files/postmessage.zip
Hope that helps...
Who's calling back to whom? Show us a little code.
The IDE can mask real problems, so just being able to run there is no guarantee that what you're doing is supported.
One common problem with callbacks is that VB6's runtime is not thread-safe, so if another thread is calling back into your VB code, you can't do anything that will invoke the runtime -- like access strings or objects.
There are ways around some of these issues, but I think we need to know more first.
Is the code being run from the same location as the IDE? Likely it is a reference problem, and you need to re-register the DLL.
A deployment package should make sure you have everything installed.
A few questions:
Is the executable on the same PC as it was developed, or a different one?
Does the file use a manifest file? If so, does mainfest call XP themes?
Also, if using manifest, does manifest use SXS for OCX files?

Resources