function

Python 2.6: containment hierarchy issue: Same Values :S

Hey Everyone, If you've seen my previous post you'll know im working on an airline program using Python. Another issue that poped up was that after I launch one flight, it calculates the duration of the flight and replaces the button which is used to launch the flight. But when I buy another aircraft, it changes both flight statuses to ...

Oracle wm_concat query returns result set with odd characters

My Oracle query produces the correct result set, but data is being presented with odd characters as you can see by the blocks in the picture below. Any reason that you can think of as to why it would do this and what these characters actually are? Below is the query I'm using. Thanks in advance. SELECT wmsys.wm_concat(userFirstName) ...

Pass MySQL connection to function

I am trying to set up a MySQL connection in a main script, and then call various functions depending on what I want to do. I am having trouble passing the connection information to the function. I have a class "queries" which contains various functions, all which return an array. This is what the code looks like in my main script (calli...

Storing a Function to Run Later

I've got a loop that will need to "mark" functions to run later, after the loop is completed. Is that possible to do? Thanks, Tyler ...

javascript - document.write error ??

Hello, Consider the script.. <html> <head> <script type="text/javascript"> document.write('TEST'); </script> </head> <body> Some body content ... </body> </html> This works fine and the word 'TEST' is added to the <body> But when <script type="text/javascript"> window.onload = function(){ document.w...

How to return a string value from a bash function

I'd like to return a string from a bash function. I'll write the example in java to show what I'd like to do: public String getSomeString() { return "tadaa"; } String variable = getSomeString(); The example below works in bash, but is there a better way to do this? function getSomeString { echo "tadaa" } VARIABLE=$(getSomeS...

Is there anything like 'whereis' in MATLAB?

I have a line in the code I'm working on like this: feval('func_name', myArg); And it works, but I want to know where func_name is. I can't step into feval to see where it is finding func_name. Instead of (or in addition to) just doing func_name, how can I get MATLAB to tell me where it found it? ...

How can I obtain Function objects from methods in Scala?

Suppose I have a simple class in Scala: class Simple { def doit(a: String): Int = 42 } How can I store in a val the Function2[Simple, String, Int] that takes two arguments (the target Simple object, the String argument), and can call doit() get me the result back? ...

Why isn't a function's arguments object an array in Javascript?

Since it seems like the first thing people do is convert arguments into a real array, I'm interested in why the Javascript language authors and implementers decided, and continue to think, that arguments should not be a real Array. I don't mean this as flamebait, I'm sincerely interested in the thinking behind it. Since the function is n...

Algorithm to locate local maxima

I have data that always looks something like this: I need an algorithm to locate the three peaks. The x-axis is actually a camera position and the y-axis is a measure of image focus/contrast at that position. There are features at three different distances that can be in focus and I need to determine the x-values for these three poi...

Javascript syntax I haven't seen till now, what does it do really?

Today I saw a javascript syntax (when invoking a function) that is unfamiliar to me. It was like: def('Person') ({ init: function(name) {this.name=name;} ,speak: function(text) {alert(text || 'Hi, my name is ' + this.name);} }); , and def('Ninja') << Person ({ kick: function() {this.speak('I kick u!');} }); 1: What happens ...

How does Smarty work when I define my Cache Function Handler?

I am trying to use my Smarty Cache Handler Function. At the beginning, I use the same example function that is posted in the Smarty manual. function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=null, $cache_id=null, $compile_id=null, $exp_time=null); The problem is that, when I try to do $sma...

c++ return reference / stack memory

A basic question that I'm not sure of the answer. Is the follow function valid? std::vector<int> & test_function() { std::vector<int> x; // do whatever return x; } If so, why? Shouldn't the program delete x from the stack after the function returns? Thanks. ...

javascript: call an embedded function from a GM script

On a webpage there's <script> function fn982734() { // some code } </script> In my Greasemonkey script, I have the following code: var fn = fields[5].getElementsByTagName("a")[0].getAttribute('onclick').substr(7,11); console.log(fn); // outputs fn982734 to the firebug console window[fn](); This code does not work, and s...

My Javascript (and Mootools) function is not returning true or false

Hi Guys/Gals I have the following function: function validateField(query) { new Request.JSON({ onRequest : function() { }, onSuccess : function(json){ return true; }, data : query + '&validate=true', url : base + 'ninjquiry.php' }).send(); } N...

Sql Like to RegEx

Hi, Is there a good way to convert Regular Expression into LIKE inside a Function (MSSQL)? The sproc does not get more complicated than this: (country\=)(?<Country>[\w\d]+)(\&sessionid\=)(?<SessionId>.+) The groups will not be used in the LIKE, they are there for another purpose. I would like to use this inside a sproc late like: ...

What does & before the function name signify?

What does the & before the function name signify? Does that mean that the $result is returned by reference rather than by value? If yes then is it correct? As I remember you cannot return a reference to a local variable as it vanishes once the function exits. function &query($sql) { // ... $result = mysql_query($sql); return $result...

Determining how many functions are declared at the global scope

Is there any way to determine how many or what functions are defined at certain scope?, let's say the global scope... I don't think so, but I give it a try here EDIT: looping through window properties does not work in IE for this purpose. Is it doable in IE? ...

Preserving quotes in bash function parameters

What I'd like to do is take, as an input to a function, a line that may include quotes (single or double) and echo that line exactly as it was provided to the function. For instance: function doit { printf "%s " ${@} eval "${@}" printf " # [%3d]\n" ${?} } Which, given the following input doit VAR=42 doit echo 'single quote ...

Using arguments passed into a function iphone SDK

Hi, Wondering what I am doing wrong here. I am trying to pass an integer to my custom class and when I output the argument in the function is is some random number instead of what I pass. Here is my method call in RootViewController.m: int orgID = organObj.organID; NSLog(@"OrganID from RVC: %d", orgID); // this outputs the correct...