The sqlps module's behavior is to leave you in the psdrive that it creates. I'm fairly certain that people have asked Microsoft to fix this, as it's very annoying and disruptive. The automatic importing of modules introduced by PowerShell 3.0 makes this even more annoying, because you may not even...
java,oracle,javafx,main,invoke
You need to call the static method of the class which extends Application. You can call it from anywhere, not mandatory to call it from main( ) . Use the following : OpenSite.launch(OpenSite.class); For background knowledge on how JavaFX Application works, please go through Application JavaDoc. It is very well...
javascript,angularjs,function,invoke
Try to add the $scope object like this: $scope.checkTotal(); ...
xcode,function,swift,nstimer,invoke
The parameters do not take an int, int. They take an int, and a closure. https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Closures.html You need to fix your Timer code as well; class Timer { var timer = NSTimer() var handler: (x:Int) -> () let duration: Int var elapsedTime: Int = 0 init(duration: Int, handler: (Int) ->...
First of all - you need to make sure that your 'wrapper' function supports WhatIf. Another thing: you can expand the scriptBlock, but I'm not really convinced that is smart thing to do: e.g. if $test = 'Some path with spaces', it would stop working after expansion. That being said:...
What you are trying in your example is to get the functionToCall method which takes a String as parameter from java.lang.Object class. It won't happen. However you can use getMethod() and the invoke() combination like this: The class to work with: public class MyClass { public void myMethod(final String pString)...
reflection,ios8,invoke,nsinvocation
[invocation setArgument:(__bridge void *)(self.valoresEntrada) atIndex:2]; is wrong. You need to pass a pointer to the value being passed. Something like // I don't know the type of self.valoresEntrada, but you can use the type directly typeof(self.valoresEntrada) temp = self.valoresEntrada; [invocation setArgument:&temp atIndex:2]; Also, if you are going to store the...
Finaly I solved my problem, my code was correct, just Hide old controls to show new ones, using this nice function : private void SetControlPropertyValue(Control oControl, string propName, object propValue) { if (oControl.InvokeRequired) { SetControlValueCallback d = new SetControlValueCallback(SetControlPropertyValue); oControl.Invoke(d, new object[] { oControl, propName, propValue }); } else {...
linux,command-line,executable,invoke,system-calls
I believe it simply can be found by parsing argv[0] from int main(int argc, char *argv[]). If it contains /, it is called from its path, otherwise it is called from command-line.
You can add the parameters after the invoke: Action<string> d = RefreshTextBoxResults; this.Invoke(d, profileString + "\n"); Or invoke an action where the parameter is already included (which is this case is suitable regarding re usability) Action d= () =>RefreshTextBoxResults(profileString + "\n"); if (this.InvokeRequired) { Invoke(d); } else { d(); }...
Then I ask if this doing of invoke usage will harm my code and may cause unpredicted sequences or it is totally safe ? what would be the other solution ? This is the most common means of handling this. That being said, if the Thread you create does...
java,compiler-construction,invoke
When you detect the language of the code this becomes pretty easy: String compiler = ""; switch(compilerCode) { case JAVA: compiler = "javac"; break; case C: compiler = "javac"; break; ... } Process p = Runtime.getRuntime().exec(compiler + " " + file); p.waitFor(); file will be the name of the file...
powershell,parameters,command,invoke,named
One option: $params = @{ P1 = 1 P2 = 2 P3 = 3 } $ScriptPath = 'D:\Test.ps1' $sb = [scriptblock]::create(".{$(get-content $ScriptPath -Raw)} $(&{$args} @params)") Invoke-Command -ComputerName server -ScriptBlock $sb ...
You would use this.Invoke when you need the action to be executed on the UI thread. For instance, if you were updating a UI element this would need to be executed on the Main UI thread. Otherwise you would get an exception along the lines of: Cross-thread operation not valid:...
.net,vb.net,multithreading,thread-safety,invoke
Since .Net Framework 4.0 we have been able to use a Lambda sub for delegating. You can even call methods inside this Sub. Example: Private Sub Update() Me.Invoke(Sub() 'update controls or form in here - thread safe End Sub) ...
I had a look at the reference source for System.Windows.Forms.Control, and the code that deals with Invoke looks like this: try { InvokeMarshaledCallback(current); } catch (Exception t) { current.exception = t.GetBaseException(); } GetBaseException: public virtual Exception GetBaseException() { Exception inner = InnerException; Exception back = this; while (inner != null)...
.net,multithreading,delegates,invoke,ui-thread
Why isn't the MethodInvoker.Invoke() method documented anywhere? What am I missing? It's documented. It's generated by C# compiler for each declared System.Delegate together with BeginInvoke()/EndInvoke(). You seldom (or never) will have to call it directly because you simply can use function-style invocation: MethodInvoker func = ... func(this, EventArgs.Empty); Moreover...
c#,multithreading,winforms,invoke
You would need to let your request propagate upwards from the business layer and then invoke it from the presentation layer in your UI. One way to do this, as you've suggested in your comment, is to use an event that fires from the business layer and is dealt with...
Form1.displaytable(); does not work, because displaytable is an instance method. Remember that Form1 is a class, i.e. a type. You cannot call it on the type Form1, instead you must call it on an instance of it. You can pass an instance of Form1 to Form2 through constructor injection. Add...
I think you want too much from reflection, see for example: Is it possible in java to create 'blank' instance of class without no-arg constructor using reflection? The following works, but only if you add constructors to the classes. When there are no constructors, I could not get it working:...
rest,powershell,scripting,invoke
As arco444 said, you should define the URI in a variable and pass it to the Invoke-RestMethod. You're trying to insert a variable ($env:computername) in a place where only a literal string is allowed. This code should work for you: $URI = "http://rm44:8081/conf.fapi-1.4.0/client/machine/$env:computername" Invoke-RestMethod -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Uri...
c#,.net,multithreading,backgroundworker,invoke
SetPropertyThreadSafe is not a method built in to .NET, if you are using this implmentation public static TResult GetPropertyThreadSafe<TControl, TResult>(this TControl self, Func<TControl, TResult> getter) where TControl: Control { if (self.InvokeRequired) { return (TResult)self.Invoke(getter, self); } else { return getter(self); } } Then the two examples you posted are doing...
c#,reflection,invoke,methodinfo
If the method is static you do just invoke the method, and in those cases, you pass null to that argument of Invoke. For instance methods, you call the method on an instance of the object, not just on "nothing". The object instance that you would normally be calling the...
If you are confident that a particular route can only be reached by a callback thread, then I'd be inclined to agree with you - not really for the purpose of avoiding the Invoke, but simply to avoid any duplication. If a path can be reached from multiple routes, it...
You should move Gdx.app.info("1", thm); // error this line next to new LwjglApplication(new GameLaunching("8","night", false, true), cfg); in your main method Reason being in Libgdx, the initialization of the library isn't complete until just before the start of the create method (which will be invoked by the Libgdx infrastructure to...
Multi-threading is hard, so you should try making it as simple as possible. One, there's no reason to have any of the splashscreen code outside of the splashscreen class itself. Second, you should always know what you're doing, so InvokeRequired is just a code smell that says "I have no...
c#,exception,reflection,try-catch,invoke
Take a look at the InnerException. In .NET reflection will wrap the exception - which can be useful for knowing how the exception was called. See the inner exception property has the exception you are looking for. So to have the same exception just call Console.WriteLine(e.InnerException.Message) instead....
It all depends on how the method is called. There is a property InvokeRequired property on some objects (Controls) that can be used to selectively invoke when needed. In a WinForms application, any method that changes the form will have to be run within the Form UI thread to avoid...
c#,winforms,exception,invoke,ui-thread
That's because Close method closes the form and destroys it's handle and then the MessageBox is invoked in the Closed form with no handle, so the error message shows up. I don't understand your purpose, but you should either move the code after Close out of invoke, or move the...
c#,multithreading,thread-safety,invoke,autoresetevent
It seems you are looking for a way to report progress in the UI during the course of the parallel operation and wait for the final result (synchronize) to do something with it. This could easily be accomplished using Async/Await, without having to run manual threads, synchronization constructs or thread...
.net,visual-studio,reflection,c++-cli,invoke
That's accurate, there is no boxing conversion for a native pointer. Reflection will happily accept an IntPtr instead. A sample program that demonstrates this: #include "stdafx.h" using namespace System; using namespace System::Reflection; ref class Example { public: long Invoked_Function(Int32 a, Int32* pb) { Console::WriteLine("Invoked with {0}, {1}", a, *pb); return...
javascript,jquery,dom,methods,invoke
You do not need to use jQuery. You can use document.getElementById('MyObject') to get a reference to the DOM node. To run your doSomething function on it, you would need to add a node parameter to it something like this: function doSomething(input) { // do something with input DOM element }...
c#,.net,methods,invoke,optional-parameters
You can determine the number of parameters from the MethodInfo: MethodInfo mi = this.GetType().GetMethod("name"); mi.Invoke(this, mi.GetParameters().Select(p => Type.Missing).ToArray()); ...
Appointment[] creates an entirely new object type: an array of appointment objects. It no longer is just an appointment object and thus does not inherit the setTitle member. You have to get an appointment object from the array and then invoke the setTitle function on it: For example Appointment a...
c#,task-parallel-library,deadlock,invoke
this.Invoke(d, new object[] { text }); The point of using a Task is to not wait for it. If you do anyway then you'll hang the UI thread. It goes catatonic, no longer being responsive to notifications from Windows. Including the ones that your own code generates, like the...
There are 2 problems: dim myForm1 as frmChart This just declares that myForm1 will be of the Type frmChart if/when one is created (instanced). To create an actual instance of frmChart: dim myForm1 as New frmChart Since myFormN is now an instance of frmChart, you can call those procedures directly...
Invoke requires you to use a delegate as first parameter. ListBox.Items.Add is a method, not a delegate. You can, however, use this: this.Invoke((Action)delegate() { listBox1.Items.Add(e.Data.ToString()); }); ...
Just posting this for future reference (And so the question can be marked solved), the problem was for some reason, Java didn't like that you were trying to run python by calling it python, and it wanted you to do Process p = Runtime.getRuntime().exec("Path\\To\\Python.exe " + file); ...
c#,multithreading,user-interface,backgroundworker,invoke
Can this be done only with BackgroundWorker? No. BackgroundWorker is just a helper class which delegates the work to threadpool only. Then what is wrong with your code? You're sleeping in UI thread which is responsible for running the message loop. When you block it with Sleep, it can't...
Per the comments: here is how it can be done from CIL, which can be generated from C#. I was hoping to use a DynamicMethod, but I cannot manage to get this working without creating a custom delegate type at runtime, so I needed to use AssemblyBuilder instead. using System;...
The issue you have is that the class is likely not accessible. By default, C# classes have the accessibility of internal, which means if the two classes you've shown are in the same assembly (i.e. the same project), then it will work. If they're not in the same assembly, then...
in the showDialog, you can set the parent form which causes the child to become modal: Public Class MainForm Dim frm2 As Form2 Private Sub MainForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load frm2 = New Form2() Dim frmHandle As IntPtr = frm2.Handle frm2.Button1.Text = "test" System.Threading.ThreadPool.QueueUserWorkItem(New System.Threading.WaitCallback(AddressOf DoSomething), 0)...
vb.net,multithreading,delegates,invoke
Rather than creating a delegate I would suggest using the existing methods offered from a backgroundworker. The backgroundworker provides two methods to access the main thread: The ProgressChanged event to update the main thread during backgroundworker processing and the RunWorkerCompleted event to update the main thread once the backgroundworker process...
javascript,jquery,html,anchor,invoke
If I understand correctly, you don't want to trigger the click event for the anchors, but instead you want to trigger the click event of the corresponding navigation element when an anchor is clicked. You can do that by adding the following code inside your document-ready function: $('.nav a').click(function() {...
c#,.net,multithreading,backgroundworker,invoke
It's a rather simple explanation. Invoke is a blocking call. If you want to queue work on the UI message loop asynchronously, use BeginInvoke instead: Executes the specified delegate asynchronously on the thread that the control's underlying handle was created on. void bgrw_DoWork(object sender, DoWorkEventArgs e) { Console.WriteLine(DateTime.Now); this.BeginInvoke(new Action(()...
Try, and change to this class func processLogin() { } ...