What is the difference between onClick=”javascript: function(‘value’)'” and onClick=”function(‘value’);”? [duplicate]

In an element’s inline event handler, like onclick, onchange, onsubmit, etc., you do not need the javascript: prefix – the reason you often see it is because people confuse it with the href syntax that I explain below. It doesn’t cause an error – I believe it is interpreted as a label – but it … Read more

php: determine where function was called from

You can use debug_backtrace(). Example: <?php function epic( $a, $b ) { fail( $a . ‘ ‘ . $b ); } function fail( $string ) { $backtrace = debug_backtrace(); print_r( $backtrace ); } epic( ‘Hello’, ‘World’ ); Output: Array ( [0] => Array ( [file] => /Users/romac/Desktop/test.php [line] => 5 [function] => fail [args] => … Read more

Call a function by an external application without opening a new instance of Matlab

Based on the not-working, but well thought, idea of @Ilya Kobelevskiy here the final workaround: function pipeConnection(numIterations,inputFile) for i=1:numIterations while(exist(‘inputfile’,’file’)) load inputfile; % read inputfile -> inputdata output = myFunction(inputdata); delete(‘inputfile’); end % Write output to file % Call external application to process output data % generate new inputfile end; Another convenient solution would be … Read more

How to call C# DLL function from VBScript

You need to mark your assembly as COM visible by setting the COMVisibleAttribute to true (either at assembly level or at class level if you want to expose only a single type). Next you register it with: regasm /codebase MyAssembly.dll and finally call it from VBScript: dim myObj Set myObj = CreateObject(“MyNamespace.MyObject”)

When passing an array to a function in C++, why won’t sizeof() work the same as in the main function?

The problem is here: int length_of_array(int some_list[]); Basically, whenever you pass an array as the argument of a function, no matter if you pass it like int arr[] or int arr[42], the array decays to a pointer (with ONE EXCEPTION, see below), so the signature above is equivalent to int length_of_array(int* some_list); So of course … Read more

Calling a function from a string in C#

Yes. You can use reflection. Something like this: Type thisType = this.GetType(); MethodInfo theMethod = thisType.GetMethod(TheCommandString); theMethod.Invoke(this, userParameters); With the above code, the method which is invoked must have access modifier public. If calling a non-public method, one needs to use the BindingFlags parameter, e.g. BindingFlags.NonPublic | BindingFlags.Instance: Type thisType = this.GetType(); MethodInfo theMethod = … Read more