Global tasks (handler)
I have programmed legacy DAQ cards like the 6024 using LabWindows CVI for 15 years. Now I have to use a USB 6218 and DAQmx. I want to use a counter to measure my loop time. If I start a task (like start the counter) in one subroutine call I can not call that same task in another subroutine call (like read the counter). The task handler ID seems to only be a local variable. The task or taskhandler can not be made a global variable. If the create, start, read, stop, and clear tasks are all in the same subroutine, everything works. I hope I am stating this problem correctly, I am an engineer who knows some programming, not a pure programmer.
RobertoBozzolo,
First of all, thank you kindly for your quick response and help. I think you are onto the source of my problem. I have attached some information to explain the code. The program is very large. I thought I have defined the Task Handler at the system level with a static definition. But when I compile the code, I get a message that the task handler is undefined.
I hope I have explained my code in the attachecment well enough for you to see the problem.
I have to share with you that I have never used task handlers. Somehow, since CVI was started I have gotten by without out it. Right now I am not a fan of the DAQmx approach to data acquisition and control. I used to be able to use simple easy IO or legacy library routines that were very straight forward and used a minimum of code. I also tried defining the tasks in Measurement and Automation Explorer, but I could not get those to work also. I thought it was just me but I talked to two other engineers who also dabble in programming and they too are not happy with the improvement.
I think the issue is that we have to be better programmers. Instead of just engineers who use the CVI tool.
Again, I want to thank you for any help that you can offer.
Mike
Attachments:
Taskhandler issue.docx 22 KB
Similar Messages
-
How to set up global exception handling to provide user friendly messages to user?
AFAIK there is no real global exception handing available for now in ADF. So I need some "tutorials" about exception handling in:
- Model
- Controller
- View
Thx
Regards
Zmedarefer this
http://blogs.oracle.com/groundside/entry/adventures_in_adf_logging_part
controller
http://blogs.oracle.com/jdevotnharvest/entry/extending_the_adf_controller_exception_handler
http://andrejusb.blogspot.com/2011/03/exception-handler-for-method-calls_19.html
http://my.safaribooksonline.com/book/databases/oracle/9780071622547/introduction-to-oracle-adf-task-flows/ch04lev1sec7
http://my.safaribooksonline.com/book/databases/oracle/9780071622547/working-with-unbounded-and-bounded-oracle-adf-task-flows/169 -
Flex bug in global error handling
My application's global error handler (uncaught error handler) works mostly, but I found a case where it doesn't work, but should. Before I filed an official bug report I wanted to post the issue here.
Here is the issue: in a module, ErrorEvents that are not listened for and are dispatched by a Flex component are never caught in the application's uncaught error handler.
I have a sample project that demonstrates this. Here is the module in my test case:
<?xml version="1.0" encoding="utf-8"?>
<s:Module xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
private function onClickSparkDispatch():void {
dispatchEvent( new ErrorEvent( ErrorEvent.ERROR, false, false, "test" ) ); // this isn't caught in the uncaught error handler
private function onClickNonSparkDispatch():void {
var nonSparkDispatcher:EventDispatcher = new EventDispatcher();
nonSparkDispatcher.dispatchEvent( new ErrorEvent( ErrorEvent.ERROR, false, false, "test" ) ); // this is caught in the uncaught error handler
]]>
</fx:Script>
<s:HGroup>
<s:Button label="Module Spark Dispatch (broken)" click="onClickSparkDispatch()" />
<s:Button label="Module Non-Spark Dispatch" click="onClickNonSparkDispatch()" />
</s:HGroup>
</s:Module>
Using Flex 4.6
My application statically links in the Flex SDK ("merged into code" in Flash Builder).
My applications works around these two exsiting bugs:
https://bugs.adobe.com/jira/browse/SDK-28018
http://blogs.adobe.com/aharui/2011/04/catching-uncaughterror-in-flex-modules.html
Is this a bug?
Thanks,
RickIt’s been reported. Here is more information and a workaround. http://blogs.adobe.com/aharui/2011/04/catching-uncaughterror-in-flex-modules.html
-
Global event handler for preinitialize
Is there anyway to add a global event handler on the
components preinitialize event?
What I need to do is to be able to enable / disable, and show
/ hide component dynamically based on a access list. My plan was to
have a global event handler that listens to the preinitialize
event, at that time, checks if the user has access to the component
or not. If not, I'll disable / hide the component.
What I did so far is:
in my main app.mxml file, I have:
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
preinitialize="preinit(event)"
so the preinit() function is invoked on the app's
preinitialize event.
Then I have the preinit() function (see attached code below).
However, it does work as there is no trace message printed.
I changed to use KeyBoardEvent.KEY_DOWN and that seems
working when I press any key.
I also tried to use the app.stage.addEventListener() but the
stage object is null in the preinitialize event.
Thanks in advance for your help.Thank you for follow up on my question.
I do know these two properties. But that does not solve the
problem. Let me explain it with an example.
That's say, when the user logs in, I loads the access list.
Then the app displays a panel with some form entries. If I am able
to register a global event listener for the component
initialization events, I can check the permission and optionally
hide some components. Otherwise, I would need to programmatically
travels my component tree to evaluate each component individually
to set there visible/includeInLayout properties, which is error
prone.
The problem is that the component is visible to one user but
would be hidden to another, so it can not be set at the design
time.
The approach I am using right now is to extend the default
components to add an event listener. But I'd like to know if it is
possible to register a global event listener to be notified when
any component is created. As my first post says, I tried to use the
systemManager and listen to the PREINITIALIZE event, but that
didn't get always get invoked. -
A few days ago I very happily discovered the new global error handling available in flash-player (FP) 10.1
Now while all works well in Firefox (using Adobe's FP 10.1.102.64), nothing happens in Chrome (using Google's FP 10.1.103.22).
I can disable Google's FP using the "about:plugins" page in Chrome, restart the browser, and then everything works since the browser falls back to the other flash plugin installed, which is again Adobe's FP 10.1.102.64.
Is this a known bug?Don't tell me the uncaught error handler only works for a debugger version....??
The documentation, which I read quite carefully, doesn't have a word on this. It suggests rather the opposite:
"When content is running in a debugger version of the runtime, such as the debugger version of Flash Player or the AIR Debug Launcher (ADL), an uncaught error dialog appears when an uncaught error happens. For those runtime versions, the error dialog appears even when a listener is registered for the uncaughtError event. To prevent the dialog from appearing in that situation, call the UncaughtErrorEvent object's preventDefault() method." -
Global Error Handling - Possible?
Hi there!
Does anyone know if it's possible to catch unhandled errors
that occur in a flex application globally?
The Application.error event allows you to capture Error
Events that arise when communication with the outside world fails
for one reason or another, but as much as I've googled I haven't
been able to find anything for capturing coding errors such as
nullpointers etc. at runtime without wrapping every single line of
code with a try-catch.
In an ideal world I would like to catch these errors and
report them for logging on the server. Has anyone managed to
achieve this without resorting to try-catch-spamming?
The Flex-application in question is a central part of an
e-commerse system so it's rather silly that live errors remain
largely untracked...
Your thoughts would be highly appreciated!Hi,
Try referring the below links...
http://www.summa-tech.com/blog/2010/01/04/global-error-handling-in-flex/
http://livedocs.adobe.com/flex/3/html/help.html?content=11_Handling_errors_06.html
You have one sample demo with source in first link.
Hope this will be helpful.
If this post answers your question or helps, please kindly mark it as such.
Thanks,
Bhasker Chari -
Hello All,
I want to know if there is away to do Global Error Handling in Flex so that in case of any error, the pop-up (showing the exception stack trace) on the client machine should not come, instead I would be able to handle the exception in a more subtle manner.
Can I do something at the application level to prevent this ?? or should it be handled in each Flex method individually, code enclosed between try-catch blocks ?
Thanks & Regards,
AgrajHi,
Try referring the below links...
http://www.summa-tech.com/blog/2010/01/04/global-error-handling-in-flex/
http://livedocs.adobe.com/flex/3/html/help.html?content=11_Handling_errors_06.html
You have one sample demo with source in first link.
Hope this will be helpful.
If this post answers your question or helps, please kindly mark it as such.
Thanks,
Bhasker Chari -
How to get running Daqmx task handles
HI,
We are creating a TestStand module using CVI 8.5, in that module we have to close all the running Daqmx tasks, please provide help on how to get running Daqmx task handles. We could not find any API function which can return list of running Daqmx task handles so that we can close one by one.
Thanks in advance for the helpI just had a similar issue. Stumbled on this forum in the hopes of getting an answer and found no reply to the original message. I think this is what we are both looking for DAQmxGetSysTasks.
I havent used it yet. Still in the excited I found something stage. -
Hello,
I've implemented the Global Exception Handler how is saying at http://www.adobe.com/devnet/flex/articles/global-exception-handling.html
Some errors are being catched by it, and others not.
I looked at another thread here, but for him, the Debug Dialog was not appearing because another place was catching the exception for him.
There are some way to catch all errors in just on place?
I need this, because sometimes in production happen errors that we didn't find in development, but stills there.
The SDK is 4.1 and minimum Flash Player for the applications is 10.1.
Regards,
Fredy.How to reproduce the error not being catched.
Main Application:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955"
minHeight="600"
xmlns:views="views.*"
applicationComplete="onApplicationComplete()">
<s:layout>
<s:VerticalLayout />
</s:layout>
<fx:Script>
<![CDATA[
import com.adobe.ac.logging.GlobalExceptionHandler;
import com.adobe.ac.logging.LogHandlerAction;
private var globalExceptionHandler:GlobalExceptionHandler;
private function onApplicationComplete():void {
globalExceptionHandler = new GlobalExceptionHandler();
globalExceptionHandler.preventDefault = true;
var lha:LogHandlerAction = new LogHandlerAction();
globalExceptionHandler.handlerActions = [];
globalExceptionHandler.handlerActions.push(lha);
]]>
</fx:Script>
<mx:ViewStack id="vs" creationPolicy="none">
<views:FirstView />
<views:SecondView />
</mx:ViewStack>
<s:Button label="Call Second View" click="vs.createDeferredContent()"/>
</s:Application>
First View:
<?xml version="1.0" encoding="utf-8"?>
<s:NavigatorContent xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"
creationComplete="onCreationComplete()">
<fx:Script>
<![CDATA[
import mx.rpc.remoting.RemoteObject;
private function onCreationComplete():void {
trace("First Created!");
]]>
</fx:Script>
</s:NavigatorContent>
Second View:
<?xml version="1.0" encoding="utf-8"?>
<s:NavigatorContent xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"
creationComplete="onCreationComplete()">
<fx:Script>
<![CDATA[
import mx.rpc.remoting.RemoteObject;
private function onCreationComplete():void {
trace("Second View created!");
var ro:RemoteObject;
ro.destination = "";
]]>
</fx:Script>
</s:NavigatorContent>
Regards,
Fredy. -
Calling EJBs from Global Exception Handler
Hi, I'm using Weblogic Workshop 8.1.4.
I have a JPF which calls a EJB to set a lock flag (to prevent the JPF being executed twice at the same time.)
I want to reset the lock flag in the global exception handler, however, if I call an EJB (Entity or Session) in a perform node in the exception handler, I get a NullPointerException.
Is this because it's being called in the exception handler? Is there any way to work around this (without building a POJO which does all the persistance logic and SQL calling manually?)
Thanks.You can redirect stdout to wherever you want by using
System.setOut(PrintStream out). Also, you can give
printStackTrace a PrintStream.
hth,
mI think to solve this problem you should call System.setErr(PrintStream err); -
Global exception handler not being called
Hi,
I have a wli process that has a global excepton handler. One of the controls throws a NullPointerException but it is not being handled by the group exception handler nor the global exception handler.
Does anyone have any idea what may be causing this behaviour?
Thanks,
DaleI have discovered that using -memalign=Ns with N greater than 1 does not work for me. For example, if I remove a VME card from the system and try to use an unsigned short pointer to access a 16-bit register in the card's vacated VME address space, my signal handler gets called when I compile the code with N=1, but for any other N, my handler is ignored and my program cores.
Unfortunately, using N=1 causes other code that works with higher N to fail. I have one VME card where I need to access a register as a 16-bit read. The code the compiler generates to access the unsigned short pointer value results in two single-byte load instructions - this causes the device to cry foul and as a result, the driver raises SIGBUS, which my program handles. For higher N, the compiler generates one two-byte load instruction, and the device is happy to send back the data.
So it would appear there is some kind of problem with -xmemalign=Ns for N > 1. It seems like the SIGBUS handler typically imployed by the compiler to handle the misalignment problems when -xmemalign=Ni is used is being invoked.
Any other ideas? -
hi
My application needs to clear the existing task handle
before creating another task.
i need acheive this, how can i find the task handle "id"
and clear that.
do let me know.
regards
ragsDAQmxClearTask
int32 DAQmxClearTask (TaskHandle taskHandle);
Clears the task. Before clearing, this function stops the task, if necessary, and releases any resources reserved by the task. You cannot use a task once you clear the task without recreating or reloading the task.
If you use the DAQmxCreateTask function or any of the NI-DAQmx Create Channel functions within a loop, use this function within the loop after you finish with the task to avoid allocating unnecessary memory.
The task handle is the same value of type TaskHandle you used when you created the task
Elijah Kerry
Senior Product Manager, LabVIEW
Follow my Software Engineering for LabVIEW Blog -
I need to make sure I am handling all (my code and SDKs) errors in my Flex application. What's a way of global error management in Flex? Thanks
Here is my code:
in main appication:
creationComplete="globalErrorHandler(event)"
protected function globalErrorHandler(event:Event):void
systemManager.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT _ERROR, onUncaughtError);
systemManager.loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onUncaughtError);
systemManager.loaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onUncaughtError);
Somewhere at the run time I am generating an unhandled error. I see FP's popup error window and the same error goes into flashlog.txt, but I dont see it getting into onUncaughtError function. What am I doing wrong?
Thanks -
I am writing a program that needs to detect keystrokes and mouseclicks globally. Right now I am using KeyListener and MouseListener to keep track of all keystrokes and mouseclicks, but that only handles keystrokes and mouseclicks in the window of my application. How can I detect global keystrokes and mouseclicks? I want to be able to open another Windows application (say Notepad) and have my application detect all the keystrokes occuring within that application.
ThanksYou will need to research native methods in order to do this. Essentially you will have to have the OS inform your application of these events.
-
Disable J2EE Local Auth Task Handler in policy agent 2.2
Hi,
Is there a way of disabling the j2ee local authentication handler for a policy agent 2.2 running in filter mode ALL ?
If not, is there a way to configure local authentication without session-binding? I am specially interested in the agent for WebLogic Server 8.1.
Thanks,
Andrei DumitruHi,
Is there a way of disabling the j2ee local authentication handler for a policy agent 2.2 running in filter mode ALL ?
If not, is there a way to configure local authentication without session-binding? I am specially interested in the agent for WebLogic Server 8.1.
Thanks,
Andrei Dumitru
Maybe you are looking for
-
I've updated my phone and lost my music but I can't seem to sync it back on!!
Please help me!! I've updated my phone and have lost all my music but I can't seem to sync it back on! An error message has popped up asking me if i'd risk losing my apps so I've clicked yes but nothing seems to be happening!!?? Helpp!! i need my mus
-
Ethernet was gone suddenly.
Hello everyone: I'm experiencing a strange phenomenon which began yesterday. I have three macs in my home; 1 mac mini, 1 mac mini server, and 1 macbook (pro). They were purchased within 1 year, and softwares were updated recently. Until the event, th
-
Submit a batch of documents for review all at once?
Hi all, I've been trying to see if Acrobat 9 or X has the ability to automate the submittal of multiple documents for shared review but haven't had much luck so far. I don't want to combine them all into one PDF, they need to be separate. Does anyone
-
I want to download iwork for my imac mini
i am new with my imac min and want t now to download iworks but it does not work. what can i do?
-
Change profile value from pl/sql
nm Edited by: Jason ORCL on Jun 2, 2009 9:11 AM