I am trying to find out which is the proper way to fetch data from my database. Either way works, but what's the difference; an in-depth explanation?
$sql = mysql_query("SELECT * FROM _$setprofile");
while($row = mysql_fetch_array($sql)) {
$username = $row['user'];
$password = $row['pass'];
echo "$username:$password";
}
ve...
Suppose i have this ($ = jquery):
$.fn.my_function = function() {
function foo()
{
//do something
};
function bar()
{
//do something other
};
}
I lauch this with $('.my_class').my_function();
Now, i need to call foo and bar on callback to certain events.
How can i call them?
...
I'm wondering if anyone if aware of a language that has support for variables (that could be considered 'global'), and subroutines (functions), but without a concept of parameter passing, local scope, etc. Something where every subroutine has access to every global variable, and only global variables.
...
Hey,
I have a problem returning a variable in my function, the below script works fine:
function sessionStatus(){
$(document).ready(function(){
$.getJSON(scriptRoot+"sessionStatus.php",function(status){
alert(status);
});
});
}
sessionStatus();
Bet when I try the following I get a message box with the message...
Hi-
I am trying to build a small program and I have my own library libfoo. I have a camera class that is calling a static function from my Vector3 class (i.e. crossProduct). My camera class and Vector3 class compile ok and are built into libfoo. However when I am linking like so:
g++ -g -O2 -o test1 main.o -lfoo
I get this:
libfo...
Hi!
I'm new to generic class programming so maybe my question is silly - sorry for that. I'd like to know whether the following thing is possible and - if so, how to do it
I have a simple generic class Provider, which provides values of the generic type:
template <class A_Type> class Provider{
public:
A_Type getValue();
void setSu...
Does anybody know? Couldn't find this question asked before, even though it seems fairly basic.
...
I have a C program called opencv2.0 function :
cvSaveImage( out_img_name, img);
Compiler gcc reports that
too few arguments to function cvSaveImage
The prototype of cvSaveImage in highgui.h is
CVAPI(int) cvSaveImage( const char* filename, const CvArr* image, const int* params CV_DEFAULT(0) )
After I change my call to be
...
I have a list of type Instruction*. Instruction is a class that I made. This class has a function called execute().
I create a list of Instruction*
list<Instruction*> instList;
I create an Instruction*
Instruction* instPtr;
instPtr = new Instruction("test",10);
If I call
instPtr.execute();
the function will be executed correct...
Hi,
I've just started with C#. I'm running an object's function as a thread (new Thread(myFunc).Start()).
Does the thread kill itself when the function is finished or must I manually get rid of it? If I must, what is the best way to do it (I may not know when it finishes etc)?
Thanx!
...
I am editing PROSS.py to work with .cif files for protein structures. Inside the existing PROSS.py, there is the following functions (I believe that's the correct name if it's not associated with any class?), just existing within the .py file:
...
def unpack_pdb_line(line, ATOF=_atof, ATOI=_atoi, STRIP=string.strip):
...
...
def read_pd...
I have a function:
int get_symbol(tab *tp, FILE *fp, char delim)
and I call it like this:
get_symbol(tp, fp, ';')
I always have it declared in the header as:
int get_symbol(tab *, FILE *, char);
No this all works fine, I can execute the code in the function and the delim is set.
But if I try to add one more char to the function'...
Dear all!
I am not too familiar with C programming, and I have to do few modifications on a source code, here is the problem:
I have this in a header file :
typedef struct word {
long wnum;
float weight;
} WORD;
typedef struct svector {
WORD *words;
double norm;
} SVECTOR;
In my file.c , I have a function like
doubl...
Python's len() and padding functions like string.ljust() are not tabstop-aware, i.e. they treat '\t' like any other single-width character, and don't round len up to the nearest multiple of tabstop.
Example:
len('Bear\tnecessities\t')
is 17 instead of 24 ( i.e. 4+(8-4)+11+(8-3) )
and say I also want a function pad_with_tabs(s) such ...
I am trying to figure out why I can't include a function into this. I am trying to make it so $client will make it's way into the request string. http://test.com/next.xml?file=$client&test=againtest
$client IS DEFINED as text from my database.
function update($pro){
$request = 'http://test.com/next.xml?file='.$client'&'.'te...
I am attempting to access a web service using SOAP through Perl and am having issues calling the service's functions that require parameters. The XSD that dictates the SOAP call says,
<xs:complexType name="getVersion">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="getVersionResponse">
<xs:sequence>
<xs:element minOccurs="0...
Hi,
I wonder if we can do that in python, let's suppose we have 3 differents functions to processing datas
like this:
def main():
def process(data):
.....
def process1(data):
.....
def process2(data):
.....
def run():
test = choice([process,process1,process2])
test(data)
run()
main()
Can we choice...
The following script produces "Hello", "undefined", "Hello" message boxes:
function action(callback) {
window.setTimeout(callback, 1000);
}
var obj = {
text: "Hello",
f: function() { window.alert(this.text); }
};
obj.f(); // Line 1
action(obj.f); // Line 2
action(function() { obj.f(); }); // Line 3
I looking for explanation...
Hi all,
An excel sheet (sheet 1), gets updated on a daily basis by the Admin dept. I need to copy this data in sheet 1 to sheet 2 automatically in the same workbook.
Is this possible?
If so, pls help me with this.
Thanks in advance.
...
Let us say we have a function of the form:
const SomeObject& SomeScope::ReturnOurObject()
{
if( ! SomeCondition )
{
// return early
return ;
}
return ourObject;
}
Clearly the code above has an issue, if the condition fails then we have a problem as to how to return from this function.
The crux of my ...