How to debug a j2me application in netbeans with breakpoint? - java-me

I am unable to check the flow of execution of my j2me application using breakpoint.
I am using Netbeans IDE.Googling it I came to know that after setting a breakpoint,I need to run the app and then when the AMS reaches the breakpoint,if I go on pressing F6,i'll get to know the flow of execution .But it doesnt seem to work for me.

If the IDE is not doing what you want, maybe try to add this code right before your breakpoint:
try
{
throw new RuntimeException();
}
catch(RuntimeException rex)
{
rex.printStackTrace();
}

Related

communicate with console application in service fabric

I've just started a PoC on service fabric for a project and I'm stuck on something that should have been straightforward but has become a real pain ...
What I need to do is host a console app returning some values in the service fabric and be able to call it on demand and get back its return value.
So I've created a simple exe looking like this, hosted in a GuestExe
static void Main(string[] args)
{
Console.WriteLine("123");
File.AppendAllText("hello.txt" + DateTime.Now.ToString(), "Hello world!");
//Console.ReadLine();
}
First, if the readline is commented, the explorer shows the guestExe as failing and the file is not created.
If I uncomment it, the guest exe will appear as being good in the explorer, and the console app will be started on it's own (despite I didn't ask for it), the file will be created, and I won't be able to call it.
cluster image
I've tried to just hit few things in my browser : the endpoint above, http://localhost:19081/PoC9/GuestExe?cmd=instance and same without the cmd argument.
If anyone has any idea of how that should be done, please help :)

Xamarin Android: Can I not create a new object of my MainActivity?

I have a location mocking method in my main activity. Unfortunately, I cant put this method into another class (yet!). So, I need a service, to call this method from my main activity every 5 seconds. So i created a countdown in within a service that, while the app is in the background, should run the method in my MainActivity. But it doesnt.
public void OnTimedEvent(object sender, System.Timers.ElapsedEventArgs e)
{
Log.Info("2", "CountDown ausgeführt!");
var test = new MainActivity();
test.getMockLocation();
}
This is my code. As you can see, I'm installing a new object of my Main Activity and then ask for the method in within this activity. This does work. Well at least Visual Studio does not complain. If I now debug my app on my phone, nothing happens. I dont get no errors or anything.
Now, when I run this app Step by Step and it reaches this point
"var test = new MainActivity();"
I get "Frame not in Module".
So, it basically crashes as soon as I ask it to install a new object of my Main Activity.
May anybody tell me why this is?
THANKS :)
Unfortunately in Android you cannot create Activities like this, they need to be instantiated by the OS. Also, instantiate a whole Activity only for a method is not ideal, I suggest you to find the way to get that method/function out of that Activity so you can use it anywhere in your program.
Did you create your app via Xamarin Forms? If you did, you can utilize the Xamarin Forms MessagingCenter for background services and then you can call your mock location tasks.
This is the link for a very helpful walk-through and example of MessagingCenter.

API Breaks past 8-9 Devices?

It would seem that streaming breaks when there is too many devices in the account. After about 8 or 9 it just stops streaming data to me all together.
Are you using Firebase? I came on here to post a similar issue myself. If I change the temp through the nest device or the web tool, my Firebase listeners are updated. If I try to set a value, the value that I try to set is echoed back to my listener (like there has been an update on the thermostat even though it wasn't changed successfully) then, the correct value (unchanged) comes immediately after.
The weird thing is that it works.... then it just doesn't. Is this similar to what you've been experiencing?
Update:
Now it appears as if my listeners are not working either. I can query the server using REST successfully.
Update #2:
Now my listeners are working again but still no control.
Update#3:
Well... I think I see my problem at least. I don't know if it will help you (or me for that matter) but here it is...
protected void setHighTemp(int value){
fb.child("target_temperature_high_f").setValue(value, new CompletionListener() {
public void onComplete(FirebaseError arg0, Firebase arg1) {
System.out.println("Communicaiton error: " + arg0);
}
});
Output:
Communicaiton error: FirebaseError: Too many requests
I remember reading the following paragraph in https://developer.nest.com/documentation/glossary#client
Client
An integration of your application or service with Nest
devices. When you create a Nest account and sign up for the Developer
Program, you can add up to 10 clients to the account.
This might be your problem.

Handling WinJS app upon relaunch

When back home is pressed app exists but it is not terminated yet.
When user press primary or secondary tile app is relauched.
Default way is to let application navigate to the last visited page in the navigation history.
I don't know if there is a bug but this way doesn't work as expected because any code inside page ready function executes but it doesn't count later when page is rendered. Static binding works but not dynamic.
I need to know what is the proper way of handling relaunch in an app that uses default navigation template?
What to do if I want clean start, destroy everything and than navigate to home?
How to overcome problem with framework not taking into consideration code inside page ready function?
Upon app initialization you should check for the ApplicationExecutionState, and do whatever you want in either case.
Thanks for your answer but it is quite clear from the start how to obtain ApplicationExecutionState.
Actually what I need was to execute all bindings and other post processing after DOM has been loaded in a promise timeout.
if (app.sessionState.previousExecutionState === 1) {
WinJS.Promise.timeout().then(function () {
performeAfterProcessing();
});
}
else {
performeAfterProcessing();
}
So if everyone encounters some strange behavior after application has been relaunched try to execute your code using promise timeout.

An exception of type 'Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException'

Im getting the following error when I run the coded UI application:
An exception of type 'Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException' occurred in Microsoft.VisualStudio.TestTools.UITesting.dll but was not handled in user code
This exception arises in the Mouse.Click() function in the below code.
public static void DestinationMaster()
{
Mouse.Hover(PPI.PPIHome.PPI_Main.PPI_Window.MastersPane);
Mouse.Click(PPI.PPIHome.PPI_Main.PPI_Window.DestinationMasterPane.DestinationMasterHyperlink);
}
The application doesnt run after this exception.I am using IE 8 as my browser to run the application.But when I run the application ,IE mode is changed automatically to compatibility mode.Is this related to the exception?
Is there a way to resolve this issue and get my application to running.Thanks in advance.
Does the hover work? Can you hover over the link instead to make sure that works? What happens when you find the control from the UIMap?
What does PPI.PPIHome.PPI_Main.PPI_Window.DestinationMasterPane.DestinationMasterHyperlink.TryGetClickablePoint() return?
Does the UI need to scroll to see the link? If so you could use PPI.PPIHome.PPI_Main.PPI_Window.DestinationMasterPane.DestinationMasterHyperlink.EnsureClickable() to scroll to the control.
Try to use WaitForControlReady() to make sure the page is fully loaded before coded ui acts on it. Sometimes coded ui can move faster than the application under test.
Make sure you have the latest update for VS2012

Resources