invoke

How to iterate over inputs of certain class with Prototype

Hi, I want to iterate over an array of inputs that belong to certain class (eg."required"). How can I traverse it and get their values ? Something like $$('input required').invoke(function(e){ alert(?input value?) }); thanks ...

RemoteRef.invoke implementation

Just finished a basic implementation of RMI for a class project, and now I am interested in how it is actually done. Sun is kind enough to provide the source for the majority of the Java classes with the JDK, however an implementation of RemoteRef doesn't seem to be there. I have the source for the interface RemoteRef along with the Serv...

How to access a field's value via reflection (Scala 2.8)

Consider the following code: class Foo(var name: String = "bar") Now i try to get the value and the correct type of it via reflection: val foo = new Foo val field = foo.getClass.getDeclaredField("name") field.setAccessible(true) //This is where it doesn't work val value = field.get(????) I tried things like field.get(foo), but that...

How can a PHP script detect if it has been invoked as a script or from the shell?

I have a PHP script on a webserver. This file is invoked via the shell by another program but it could still be run by the webserver in response to an HTTP request. How can the script determine the way it was invoked? ...

How to get PowerShell to wait for Invoke-Item completion?

How do I get PowerShell to wait until the Invoke-Item call has finished? I'm invoking a non-executable item, so I need to use Invoke-Item to open it. ...

How to use Delegate in C# for Dictionary<int, List<string>>

The code: [1] private delegate void ThreadStatusCallback(ReceiveMessageAction action, Dictionary<int, List<string>> message); [2] Dictionary<int, List<string>> messagesForNotification = new Dictionary<int, List<string>>(); [3] Invoke(new ThreadStatusCallback(ReceivesMessagesStatus), ReceiveMessageAction.Notif...

Why does VS2010 always break on exception from MethodInfo.Invoke?

I have a try/catch around a MethodInfo.Invoke(o,null), and VS2010 is set to never break on Exceptions, but unfortunately the debugger continues to break inside the Invoked method. The method is static, and I've got the Phone Developer Beta installed. Is this a bug or developer error? Thx!! ...

Do I need to invoke MessageBox calls?

To pop-up a message box, I'm using MessageBox.Show(...). I usually wrap the call in an Invoke: BeginInvoke (new Action (() => { MessageBox.Show ()); })); (I removed a part of the original question which was answered elsewhere) Do I always need to wrap the MessageBox call in an (Begin-)Invoke if I'm calling from a non-GUI thread? ...

.NET: Control Invoke() in Reflector

So, I was getting back into some .NET programming, and through a new feature in VS.NET 2010, it detected a case where I was trying to modify a control from a thread that didn't create that control, and pointed me to an article on MSDN about how you do this correctly... ' HOW TO WRITE TO A FORM CONTROL FROM A THREAD THAT DIDN'T CREATE TH...

Diffrernce between BackgroundWorker.ReportProgress() and Control.BeginInvoke()

What is the difference between options 1 and 2 in the following? private void BGW_DoWork(object sender, DoWorkEventArgs e) { for (int i=1; i<=100; i++) { string txt = i.ToString(); if (Test_Check.Checked) //OPTION 1 Test_BackgroundWorker.ReportProgress(i, tx...

How to invoke a delegate with a null parameter?

I get a null exception if I try to pass a null parameter to a delegate during an invoke. Here's what the code looks like: public void RequestPhoto() { WCF.Service.BeginGetUserPhoto(Contact.UserID, new AsyncCallback(RequestPhotoCB), null); } public void RequestPhotoCB(IAsyncR...

BeginInvoke not invoking the target method in Release build

I have a method, which I wish to execute on the UI message pump and thus do the following: private void SomeMethod() { BeginInvoke(new MethodInvoker(MethodToInvoke)); } private void MethodToInvoke() { // This method contains code that I wish to execute on UI message pump. } Now, the above works just fine when I create a Debu...

What's wrong with my cross-thread call in Windows Forms?

Hi, I encounter a problem with a Windows Forms application. A form must be displayed from another thread. So in the form class, I have the following code: private delegate void DisplayDialogCallback(); public void DisplayDialog() { if (this.InvokeRequired) { this.Invoke(new DisplayDialogCallback(DisplayDialog)); }...

The uncatchable exception, pt 2

Update: I've filed a bug report on Microsoft Connect: https://connect.microsoft.com/VisualStudio/feedback/details/568271/debugger-halting-on-exception-thrown-inside-methodinfo-invoke#details If you can reproduce this problem on your machine, please upvote the bug so it can be fixed! Ok I've done some testing and I've reduced the prob...

How do I find out if an object can be Invoke()'d?

Consider the following class: public class Event<T> { public delegate void Handler<t>(t msg); private event Handler<T> E; public void connect(Delegate handler) { E += delegate(T msg) { object target = handler.Target; if (Invokable(target) { target.BeginInvoke(handler, new obj...

How to invoke the Android calculator from an app.

I want to invoke the android calculator from within my app. I don't want to pass anything to it, just provide a quick launch button to it. Can anyone show me how or point me to an example of how to do this? ...

Dispatcher.Invoke blocks forever

I'm trying to invoke a dialog on the UI dispatcher : class DialogService : IDialogService { private readonly Dispatcher _dispatcher = Application.Current.Dispatcher; public bool? Show(IDialogViewModel viewModel) { if (_dispatcher.CheckAccess()) { var dialogWindow = new DialogWindow(); ...

Using Invoke with a UI element that extends Application Context?

I have a taskBarIcon element extending Application Context from which my entire UI is designed. This is because the original functionality of the application was to run a background process and simply provide the icon as a confirmation that the app was running. However, I am now adding additional functionality in the form of a menu that ...

PHP5.3: "Call to undefined method" error when calling invoke from class variable

I have been doing some tests (to replace old code) with the __invoke magic method and I'm not sure this is a bug or not: Lets suppose we have a class: class Calc { function __invoke($a,$b){ return $a*$b; } } The following is possible and works without any problem: $c = new Calc; $k = $c; echo $k(4,5); //outputs 20 ...

Which C# assembly contains Invoke?

Alternate question: Why is VS10 so keen to complain about Invoke? In my continuing quest to make my app work become the worlds best C# programmer, I have decided that threads are a Good Thing™. MSDN has a helpful article on making thread-safe calls to controls, but it (and seemingly every other article on the subject) obliquely referen...