Constantly getting this error when LiveView is trying to recompile. Can anyone shed some light on how the LiveView works? The object "Alloy.Globals.layout.activityList" DOES exist, but perhaps the LiveView only recompile parts of the code where Alloy Globals doesn't exist?
[ERROR] : Script Error {
[INFO] : {
[ERROR] : column = 36;
[ERROR] : line = 28;
[ERROR] : message = "undefined is not an object (evaluating 'Alloy.Globals.layout.activityList')";
The "Movies" example app from Appcelerator uses the same logic of having a layout object in Alloy.js. Im doing the exact same thing, but its messing upp the recompile about 8 out of 10 times.
/**
* Calculate element dimensions for given screen size
* #param {Object} size containing width and height properties
*/
Alloy.Globals.calculateElementDimensions = function(size) {
var layout = {};
layout.device = {};
layout.device.width = size.width;
layout.device.height = size.height;
// lists
layout.activityList = {};
layout.activityList.cell = {};
layout.activityList.cell.width = size.width;
layout.activityList.cell.height = 60;
layout.activityList.cell.spacing = 1;
layout.activityList.cell.dateView = {};
layout.activityList.cell.dateView.width = layout.activityList.cell.height;
layout.activityList.cell.dateView.height = layout.activityList.cell.height;
layout.activityList.cell.detailsView = {};
layout.activityList.cell.detailsView.width = (layout.activityList.cell.width - layout.activityList.cell.dateView.width) - 50;
layout.activityList.cell.detailsView.height = layout.activityList.cell.height;
layout.activityList.cell.deleteView = {};
layout.activityList.cell.deleteView.width = size.width * 0.2;
layout.activityList.cell.deleteView.right = (0 - layout.activityList.cell.deleteView.width);
return layout;
};
// Calculate element dimentsions
Alloy.Globals.layout = Alloy.Globals.calculateElementDimensions(Alloy.Globals.Device);
Alloy.Globals.getCalculatedWidth = function(_percentage){
return (Alloy.Globals.Device.width * (_percentage / 100));
};
#Update
I think I might have found whats triggering the error. It seems its not actually a problem with running the new updated code, but rather that there is an error before the shut down and refresh.
**[INFO] : [LiveView] Reloading App**
[INFO] : Login win close
[INFO] : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[INFO] : validateLogInInfo
[INFO] : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[INFO] : UI SHUTDOWN COMPLETE. TRYING TO RESUME RESTART
[INFO] : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[INFO] : RUNNING CODE IN ACTIVITIES.JS
[INFO] : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
**[ERROR] : Script Error {
[ERROR] : column = 36;
[ERROR] : line = 42;
[ERROR] : message = "undefined is not an object (evaluating 'Alloy.Globals.layout.device')";
[ERROR] : stack = "Controller\ncreateController\nController\ncreateController\nvalidateLogInInfo\n";
[ERROR] : }
Alloy.createController('login', {
callback: validateLogInInfo
}).getView().open();**
The error seem to have to do with that I am running code in the window.close event handler. For example in one controller I do this:
Alloy.createController('login', {
callback: validateLogInInfo
}).getView().open();
And in login.js i do:
$.win.addEventListener('close', function(){
log('Login win close');
args.callback();
});
I guess the callback is then trying to run when LiveView is trying to close down and refresh, hence the compiler error. Removing the callback in the windoew.close event results in a successful reload
[INFO] : [LiveView] Reloading App
[INFO] : Login win close
[INFO] : UI SHUTDOWN COMPLETE. TRYING TO RESUME RESTART
SO, is providing a callback to the close event of an other controller completely the wrong way to do this stuff?
Yes, the code seems correct. Try to run the app in LiveView mode and in Trace Console mode and then see if there is something else which is causing this issue.
See image to set Trace mode.
Related
I'm sending bundles to my Home Fragment at another fragments. But when the app opens at the first, gives me an error because app didnt takes any bundles at the first. By the way i'm sending and getting bundles like this;
//Sending
val fragment = Notlar()
val bundle = Bundle()
bundle.putInt("categoryId", -99)
fragment.arguments = bundle
findNavController().navigate(R.id.action_kategoriler_to_notlar, bundle)
//Getting (On Home Fragment)
categoryIdBundle = requireArguments().getInt("categoryId",-1)
I have tried something like;
try {
categoryIdBundle = requireArguments().getInt("categoryId",-1)
} catch (e : Exception) {
categoryIdBundle = -1
}
But even though it opens at the beginning, the bundles i send never come, so the catch block always works. What can i do at this point?
You can try Safe Call Operator in Kotlin .? to make sure if data is not null, and try this code to send data between fragments using bundle
// in the first fragment
findNavController().navigate(
R.id.action_kategoriler_to_notlar,
Bundle().apply {
putInt("categoryId", -99)
}
)
// in destination fragment
arguments?.getInt("categoryId", -1)?.let {
// handle the result here ...
}
you can read more about safe call here, and about send bundle in navigation here
Hope it can help you
I have created an application that has a ShellFromFBFrame inheriting from wxFrame window.
The App object is defined as follows:
bool ShellFromFBApp::OnInit()
{
//(*AppInitialize
bool wxsOK = true;
wxInitAllImageHandlers();
if ( wxsOK )
{
ShellFromFBFrame* Frame = new ShellFromFBFrame(0);
Frame->Show();
}
//*)
return wxsOK;
}
The ShellFromFBFrame is as follows:
ShellFromFBFrame::ShellFromFBFrame(wxWindow* parent,wxWindowID id)
{
//(*Initialize(ShellFromFBFrame)
wxBoxSizer* MainSizer;
wxBoxSizer* mainContentSizer;
wxMenu* createContact;
...
the ShellFromFBFrame opens a new CreateContactFrame:
void ShellFromFBFrame::OnCreateContact(wxCommandEvent& event)
{
CreateContactFrame* createContactFrame = new CreateContactFrame(NULL,wxID_ANY);
createContactFrame->Show(true);
}
The CreateContactFrame is as follows:
CreateContactFrame::CreateContactFrame(wxWindow* parent,wxWindowID id)
{
//ctor
Create(parent, id, wxT("Create Contact"), wxDefaultPosition, wxSize(1100,700), wxDEFAULT_FRAME_STYLE, _T("id"));
// int num;
// num = wxAtoi(row);
//this->rowToFetch = row;
...
BEGIN_EVENT_TABLE(CreateContactFrame, wxFrame)
EVT_BUTTON(ID_CREATEBTN, CreateContactFrame::CreateContact)
END_EVENT_TABLE()
But when I close the CreateContactFrame window by close button or cancel button. My App crashes and I get the following process terminated error message in build logs:
Process terminated with status -1073740940 (0 minute(s), 12 second(s))
What am I doing wrong?
You're running into a stack overflow (how thematic!) due to an infinite recursion: your wxEVT_CLOSE handler calls Close() resulting in another wxEVT_CLOSE being generated and so on. Simply remove the handler completely if you have nothing to do in it to fix the problem.
Also, when encountering a reproducible crash, the first thing to do is to build your program with debug information, run it under debugger and look at the stack at the moment of the crash -- in 90% cases this will provide you with the answer, and this would definitely have been the case here when you would have seen the endlessly repeating calls to your OnClose() in the stack.
It was not a coding issue but rather a build of wxwidgets library. Works fine with MSVC 2019.
Previous version (1.15.1) I was able to perform this code.
Set<String> contextNames = driver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextName); //prints out something like NATIVE_APP \n WEBVIEW_1
}
driver.context((String) contextNames.toArray()[1]); // set context to WEBVIEW_1
However after updated to the latest version (1.17.1), it encountered this error.
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
at com.sapphire.appclient.automation.page.AbstractPage.getContext(AbstractPage.java:53)
...
...
The syntax you are using is wrong.
This is for Python:
If you know the context:
driver.switch_to.context['NATIVE_APP] #appium chrome driver
driver.switch_to.context['WEB_VIEW_chrome] # selenium chrome driver
Return all available context in list:
driver.contexts
So you can use this like:
driver.switch_to.context([0])
NOTE: web_view is always the last key in list, so you can always change the context to webview (FireFox,Chorme,Safari) with this:
contexts = driver.contexts
driver.switch_to.contexts[-1]
Return the current context:
driver.context
The file is getting uploaded properly and my ProgessEvent.Progress method is showing 100% complete, but my Event.Complete method does not fire. Do I have to send something specific back from the server? I am simply sending back a success message. I am not getting any errors.
I suppose I could just proceed when the progress method hits 100%. Shouldn't the Event.Complete method be firing after the data is sent and a response is received from the server?
**Update: I am getting an error with my Event.Complete method....
TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::Event#1277971f1 to flash.events.DataEvent.
* I fixed the problem by changing my onLoadComplete(event:DataEvent) method to onLoadComplete(event:Event). The error went away and I my method is now firing. I will answer my own question when the system allows me to.
Relative code follows:
fileRef = new FileReference();
fileRef.addEventListener(Event.SELECT, onFileSelected);
fileRef.addEventListener(Event.COMPLETE, onUploadComplete);
fileRef.addEventListener(ProgressEvent.PROGRESS,onUploadProgress);
fileRef.addEventListener(IOErrorEvent.IO_ERROR, onUploadError);
fileRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onUploadError);
private function onUploadProgress(event:ProgressEvent):void {
status = ((event.bytesLoaded * 100) / event.bytesTotal).toString();
}
private function onUploadComplete(event:DataEvent): void {
status = "Complete";
}
private function onUploadError(event:Event):void {
if (event is IOErrorEvent) {
Alert.show((event as IOErrorEvent).text.toString());
} else if (event is SecurityErrorEvent) {
Alert.show((event as SecurityErrorEvent).text.toString());
} else {
status = "Unknown error";
}
}
I changed ...
private function onUploadComplete(event:DataEvent):void {
status = "Complete: "+event.toString();
}
To...
private function onUploadComplete(event:Event):void {
status = "Complete: "+event.toString();
}
I am guessing this is because I am not sending data back, only a simple xml block. Hope this helps someone else.
I have an eclipse plug-in which provides a menu item which can be selected to run a command on the currently active file. I would like the plug-in to display a warning message if the currently active file has any errors on it (as reported in the Problems view), similar to how Eclipse acts when you try to run a java project with errors.
I know it's an old question, but I found a solution similar to the one proposed. The code that does what you descrive is in org.eclipse.debug.core.model.LaunchConfigurationDelegate. It checks if the project has errors and show the dialog if needed. Here is the relevant code, from Eclipse Luna:
/**
* Returns whether the given project contains any problem markers of the
* specified severity.
*
* #param proj the project to search
* #return whether the given project contains any problems that should
* stop it from launching
* #throws CoreException if an error occurs while searching for
* problem markers
*/
protected boolean existsProblems(IProject proj) throws CoreException {
IMarker[] markers = proj.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
if (markers.length > 0) {
for (int i = 0; i < markers.length; i++) {
if (isLaunchProblem(markers[i])) {
return true;
}
}
}
return false;
}
/**
* Returns whether the given problem should potentially abort the launch.
* By default if the problem has an error severity, the problem is considered
* a potential launch problem. Subclasses may override to specialize error
* detection.
*
* #param problemMarker candidate problem
* #return whether the given problem should potentially abort the launch
* #throws CoreException if any exceptions occur while accessing marker attributes
*/
protected boolean isLaunchProblem(IMarker problemMarker) throws CoreException {
Integer severity = (Integer)problemMarker.getAttribute(IMarker.SEVERITY);
if (severity != null) {
return severity.intValue() >= IMarker.SEVERITY_ERROR;
}
return false;
}
The same code can run on any IResource instead of an IProject.
I managed to find it easily by suspending from the debugger when the dialog was shown and setting a breakpoint on the relevant class and tracing back from there.
Errors are usually saved as IMarkers on a resource (IFile in your case), so you can query the IFile for the markers you are looking for.
You'll need to know the type of the markers before the look-up (either by debugging and get all the current markers, or by looking at the code the contributed them in the validation process of the file).
Hope that helps.