Redirect BlackBerry device simulator output to console - blackberry

I'm currently developing a BlackBerry application using JDE 4.6.1 on Windows XP. Since I'm running the application directly from the console using fledge.exe I would like to know if there is a parameter for redirecting my application output, namely a simple system.out.println call, to the windows prompt console. Right now I'm able to view that output only on the Eclipse console window in Debug mode.

The simulator only outputs through its JDWP interface. If you don't want to use Eclipse, but are ok with a lighter-weight non-command-line tool, you can run the standalone debug server - you'll find a jdwp.bat file under your eclipse\plugins\net.rim.ejde.componentpackX.X.X.X\bin directory.
There may also be command line tools that let you print JDWP info, not sure as I haven't ever used one.

I don't know of a way to redirect the output, but you might consider using the BB event logger. You can use a simple script to extract the logger output

Related

Delphi run console application from form application

How to run a console application from a standard Delphi form application, but to run it hidden? Also i want to write commands in that console application from my form application.
How can i do those things?
And a personal request for the people who have the newest version of indy10. I have trouble to compile the console application and if is possible some of you to compile it for me and give me link to download. Please, that will be nice if you do me that favor. :)
To run a console app and hide the console window, call CreateProcess passing CREATE_NO_WINDOW in the creation flags parameter.

Blackberry console output

I am new in black berry development, just like console output in J2me development and log cat in Android to see the event log of the simulator, is there anything for Blackberry so that I can keep a track on application logging on Blackberry.
We can use System.out.println to print something to console.
Also we can use EventLogger to log events to device system log (to view the current event log for the device, go to home screen hold down the ALT key and type "lglg"). Its more fun since we can filter logging by source and priority. Event log file also may be downloaded from device with command:
javaloader.exe -u eventlog > eventlog.txt
See article about javaloader
Also, consider to use some custom logging with microlog lib.
You can use System.out.println() and it will appear in the output window in Eclipse. I would suggest putting some wrapper class around it to emulate some of the features of LogCat, such as making static methods that tag each with [DEBUG], [ERROR], stuff like that. Also, there will be a good bit of other debug output from the simulator/device, so find a way to distinguish your logs (I prepend ========== to each of them so I can see it quickly).

How to read from an external console application?

I have a console application that I didn't write. Is there some easy way to read from it?
I need to have the input still on the console window, but read what's being displayed.
I care not whether the output displays to the console or not, so long as the input still works.
Console Application Runner Classes are excellent to control the console application processes and to redirect input and output where required.
I had a project that is doing the same thing. I have a console application written in VB.Net and I run and capture it's output using my Delphi application. I have successfully achieved this by following this tutorial by Zarko Gajic.

Is it possible to run a hidden console application from a Windows service?

I've written a server in Delphi 2010 that needs to launch a console application every now and again to back up a database. The console application can send log information to the console window, but it is not required.
This works fine when running as an application, but when run as a service I get an access violation when launching the console application. This is the case even if I launch it hidden (SW_HIDE).
Is it possible to launch a hidden console application from a Windows service? The solution needs to work on XP, Vista and Windows 7.
EDIT: The access violation happens when I call ShellExecute.
If you are using ShellExecute, then don't: it won't work inside a service, and is almost never the best way to start a process.
Use CreateProcess in stead.
See this bunch of ShellExecute / CreateProcess question threads on stackoverflow.
--jeroen

Debugging Delphi ISAPI Dll on Apache

I have run into a situtation where frequently when debugging a ISAPI Dll (TWebModule) running under Apache I get errors. The caption on the error box is "Debugger Fault Notification" and contained in the message is, among other things:
"c:\program files\Apache\bin\httpd.exe faulted with message......."
When this happens the cpu window pops up, and I have to hit the "OK" button on the error message. I might have to do this 3 - 5 times before program flow continues.
This is happening on my laptop. I have a desktop with the same exact configuration (as far as I know) and I don't have this problem. Both operating systems are XP. So obviously there is some setting or outdated file somewhere.
Also, I have noticed if first run my website when Apache is not in the debugging envrironment it seems not to have this problem. (i.e. start apache in the services, run my web app, stop the service, and then debug it within the Delphi environment).
Any ideas???
While it doesn't directly answer the how to debug using Apache, another alternate debugging technique which works well is to use idDebugger (near the bottom of that page). It will allow you to debug ISAPI DLL's directly from the IDE without having to start/stop services. I now never develop ISAPI DLL's without it.
To avoid this and other problems, I've started xxm. It's an alternative to TWebModule, and uses a separate wrapper to run with IIS, but there's also an Apache, FireFox and IE wrapper! It also uses mixed-HTML-Delphi-source and the development-mode wrappers do the parsing and an auto-compile to give a web-script-like environment.
Also the InternetExplorer plugin works great in the debugger (with iexplore.exe as host application).
Error code 0xC0000008 is Status_Invalid_Handle. That can be thrown by CloseHandle, for example, when you try to close a handle that either was never open or was already closed. The error might not occur when you're running outside the debugger because the API won't throw an exception unless it's being debugged.
If you're getting that exception in code that the debugger doesn't have access to, then the debugger will display the CPU window instead. Look at the call stack to find the place in your code closest to where the exception came from.
It's also possible that it's not occurring in your code at all. Try doing your same debug routine without your module installed. Do you still get errors?

Resources