function

jQuery AJAX functions

I am using jQuery's load() function when getting a page to a div like that: content.php page is : <script type="text/javascript"> $(".content").load("asd.php"); </script> and asd.php is: <script type="text/javascript"> alert("Hello World"); </script> When load ajax finished alert() message appears 3 times. Actually it must...

PHP contact form, am I doing it wrong?

I'm learning PHP and I'm trying to write a simple email script. I have a function (checkEmpty) to check if all the forms are filled in and if the email adress is valid (isEmailValid). I'm not sure how to return true checkEmpty funciton. Here's my code: When the submit button is clicked: if (isset($_POST['submit'])) { //INSERT FORM VAL...

Advice/suggestions for my first project PHP Classes

Hi guys, Any advice is welcome! I have a very limited understanding of php classes but below is my starting point for the route I would like to take. The code is a reflection of what I see in my head and how I would like to go about business. Does my code even look ok, or am I way off base? What are your thoughts, how would you go ab...

Query with UDF works in Access but gives Undefined function in expression (Err 3085) in Excel

I have an Access table with a date/time field. I wanted to make a composite Key field out of the date/time field and 3 other text fields in the same format as the matching Key field in another database. So I concatenated the 3 text fields and wrote a User-Defined-Function in a Module to output the date field as a string in the format "Y...

javascript scope problem when lambda function refers to a variable in enclosing loop

First question on stackoverflow :) Hope I won't embarrass myself... I have a javascript function that loads a list of albums and then it creates a list item for each album. The list item should be clickable, so I call jQuery's click() with a function that does stuff. I do this in a loop. My problem is that all items seem to get the same...

C# DataGrid CSV Import moving any size array into defined column grid?

I have a function to which an array has a large sum of CSV imported split data. I currently have it set as the code below however I'm having some issues getting the data to go into the separate columns than into a single one. What I would like to achieve is a non-redundant means of supplying a function a string array of any size, and def...

How can I create C header files.

I want to be able to create a collection of functions in a header file that I could #include in one of my C Programs. ...

Disabling Text field with Javascript when value in drop down box is from mysql

Hi I have a simple script in HTML, using a dropdown menu. When the value 1 is selected, the user can write in the text field, if value 2 is selected, it disables the text field. However, i changed the values of the dropdown menu, so that one value was from a mysql table(using PHP) and the other remained 'option value='1''. Yet now neit...

WordPress: Only show posts according to their taxonomy

Hey, I am running WordPress with custom taxonomy, added through functions.php in my theme. I am calling posts of a certain post type in another template in my theme but want to restrict which ones it shows by only showing those posts if their taxonomy value equals the current post name that is calling it. So for example: if I'm on the ...

Is it possible to return a list of numbers from a Sybase function?

I'm trying to overcome a very serious performance issue in which Sybase refuses to use the primary key index on a large table because one of the required fields is specified indirectly through another table - or, in other words; SELECT ... FROM BIGTABLE WHERE KFIELD = 123 runs in ms but SELECT ... FROM BIGTABLE, LTLTBL WHERE KFIELD =...

WordPress Conditional: Only show if current page title is equal to post meta

Hey, I am calling a bunch of posts under a certain post type in WordPress which works but I am trying to add a conditional that will check first if those post's custom meta field (labeled "disc") is equal to the current post's title. Here is what I have but this conditional does not seem to work: <?php $pages = get_posts('numberpos...

how to return 2 values from a java function?

Here is my code: // Function code public static int something(){ int number1 = 1; int number2 = 2; return number1, number2; } // Main class code public static void main(String[] args) { something(); System.out.println(number1 + number2); } Error: Exception in thread "main" java.lang.RuntimeException: Uncompilable sou...

Why does a PHP function with no parameters require parentheses?

I just spent 3 hours wondering why I couldn't start a session, then realised that I used: session_start; when I should have used: session_start(); I received no error messages at all! Perhaps then, I thought, it's a lazy way to differentiate functions from variables - but then remembered that it can't be as variables require a $ ...

template function roundTo int, float -> truncation

Hi, according to this question: http://stackoverflow.com/questions/2833730/calling-template-function-without-type-inference the round function I will use in the future now looks like: template < typename TOut, typename TIn > TOut roundTo( TIn value ) { return static_cast<TOut>( value + 0.5 ); } double d = 1.54; int i = rountTo<...

C variable argument refactoring

I have a function irc_sendline that can be called like printf can irc_sendline(s, "A strange game.\nThe only %s is not to play.", "winning move"); It works perfectly, but I'm not happy with its implementation: int irc_sendline(irc *iobj, char *msg, ...) { char tmp_msg[BUFSIZE], fmsg[BUFSIZE]; va_list args; int len; va_st...

linq delegate function checking from objects

I am trying to find the list of objects which can be replaced. Class Letter{ int ID; string Name; string AdvCode; int isDeleted; } Class Replacers{ int ID; string MainAdvCode; string ReplacesAdvCode; } example data: Replacers 0 455 400 1 955 400 2 955 455 LettersA 0 pack 455 1 addon 400 LettersB 0 big 955 1 pack 455 LettersC 0...

(C++) What's the difference between these overloaded operator functions?

What is the difference between these two ways of overloading the != operator below. Which is consider better? Class Test { ...// private: int iTest public: BOOL operator==(const &Test test) const; BOOL operator!=(const &Test test) const; } BOOL operator==(const &Test test) const { return (iTest == test.iTest); } ...

can i quickly run entire page's text through a function on page load?

i have setup a profanity filter with bad words in a XML file and have the following function to run on my page to replace the words: BadWordFilter.Instance.GetCleanString(TextBox1.Text); i'm about to go through my entire site now wrapping that function around every little text variable one by one and it's going to be a huge pain in the...

C Programming: malloc() inside another function

I need help with malloc() inside another function. I'm passing a pointer and size to the function from my main() and I would like to allocate memory for that pointer dynamically using malloc() from inside that called function, but what I see is that.... the memory, which is getting allocated, is for the pointer declared within my called...

What's the most efficient query?

I have a table named Projects that has the following relationships: has many Contributions has many Payments In my result set, I need the following aggregate values: Number of unique contributors (DonorID on the Contribution table) Total contributed (SUM of Amount on Contribution table) Total paid (SUM of PaymentAmount on Payment tab...