function

C++ What using for lexicographical_compare?

I wan to user the function lexicographical_compare in algorithms library in c++. But I do not know what to write as far as the using statement. For example using std::lexicographical_compare ?? How can I figure this out for my self in the future? Thanks ...

How do you guys work around the need for apostrophes in certain function names?

When I'm programming, I often find myself writing functions that -should- (to be proper english) contain apostrophes (too bad C started everyone thinking that an apostrophe was an appropriate delimiter). For example: get_user's_group() -> get_users_group() . What do you guys do with that forced-bad-english ambiguous english? Just igno...

jquery calling a function from var value

(function($) { $.fn.myFoo= function (o){ this.element = $(this) options = jQuery.extend({ name: "defaultName", size: 5, global: true }, o); _min = function (){ //am i private method? alert('dud'); } max = function (){ //am i public method? alert('max'); } ret...

jquery passing $(this) to other functions

High! What i want to do is the following: i have a table with a onclick attached to a link that resides in the table of an even row. every odd row is hidden. on a click on that link, the odd row is shown and data is loaded into that row. Works fine Now what i want to do is that whenever that process is done, i want to attach a new clic...

Overloaded function in classic asp JScript

Is it possible to have an overloaded function in classic asp JScript ...

print last -n lines of input

#include <stdio.h> #define MAXLINES 5000 /* Maximum number of lines to display. */ char *lineptr[MAXLINES]; /* Pointer to input lines. */ #define BUFFERSIZE 1000 #define DEFAULT_LAST 10 int readlines(char *lineptr[], char *buffer, int maxlines); static void unwrap(char *buffer, int index); static void reverse(char *lineptr[...

pointers to functions: cant compile

#include <stdio.h> #include <string.h> #define MAXLINES 5000 char *lineptr[MAXLINES]; int readlines(char *lineptr[], int nlines); void writelines(char *lineptr[], int nlines); void qsort(void *lineptr[], int left, int right, int (*comp)(void *, void *)); int numcmp(char *, char *); int main(int argc, char *argv[]) { int nlines; ...

return address of memory allocated in function

Hi, When memory is allocated in a function, isn't it impossible to use that memory outside the function by returning its address? Are there exceptions? It seems the following is such an "example": const char * f() { return "HELLO"; } How to explain it? Thanks! ...

PHP function to generate v4 UUID

So I've been doing some digging around and I've been trying to piece together a function that generates a valid v4 UUID in PHP. This is the closest I've been able to come. My knowledge in hex, decimal, binary, PHP's bitwise operators and the like is nearly non existant. This function generates a valid v4 UUID up until one area. A v4 UUID...

XSLT : getting the prefix of an element ?

In XSLT 1.0, you can get the local name or the namespaceUri of an XML element using the functions: string local-name (node) and string namespace-uri(node) but is there a standard function to get the prefix of an element having a qualified name ? ...

System.Array GetLength and Length

How do you use the Array.GetLength function in C#? What is the difference between the Length property and the GetLength function? ...

Is it possible to run function in a subprocess without threading or writing a separate file/script.

import subprocess def my_function(x): return x + 100 output = subprocess.Popen(my_function, 1) #I would like to pass the function object and its arguments print output #desired output: 101 I have only found documentation on opening subprocesses using separate scripts. Does anyone know how to pass function objects or even an easy...

How to properly declare variables in the function call - Codeigniter

Hello, I am using CodeIgniter and in my controller I have function index($var_22) { // BLABLA } So if I dont pass the $var_22 variable I will get an error: A PHP Error was encountered Severity: Warning Message: Missing argument 1 for Claims::index() But I dont need to pass it all of the time, what should I use when I do not pas...

Javascript function to validate time 00:00 with regular expression.

I am trying to create a javascript function with regular expression to validate and format the time 24 hours, accepting times without semicolon and removing spaces. Examples: If the user types "0100", " 100" or "100 " it would be accepted but formatted to "01:00" If the user types "01:00" it would be accepted, with no need to format. Th...

Get No. of pages to print on web with javascript

Hi all, How can I detect the number of printing page will be on a form using JavaScript? I need to get the number of pages that a form would be so I can stick a watermark per page to be printed. Thanks. ...

Including PHP functions from another file

I would like to access some functions defined in another PHP file, but that file also outputs content that I don't want to display. Is there any way to access the functions without "running" the whole file? Perhaps by redirecting the output from that file to somewhere hiddeN? ...

c function pointers

This program sorts lines alphabetically/numerically depending on the arguments passed to main. And im working on this exercise from k&R now: Add the option -f to fold upper and lower case together, so that case distinctions are not made during sorting; for example, a and A compare equal. Is what i wrote in my_strcmp good? And will it w...

Javascript replace a function with a new one containing dynamic contents

My Javascript knowledge is less experienced, so I might use wrong descriptions in the following. I have an object in a static .js file: var Info = { methodA: function() { // Call methodB. this.methodB('test'); }, methodB: function(value) { // Do stuff } } Now, in an .aspx file, I create a func...

Restart the first function after finished the second

Hi there I have 2 functions in my script: function ShowAltTag(){ var CurrentImage = $("#ShowImage img").attr("src"); if( $.browser.msie ) { IECurrentImage (CurrentImage); } if ($(".ImageRoller img[src='" +CurrentImage+ "']").attr("alt")){ var alt = $(".ImageRoller img[src='" +CurrentImage+ "']").a...

C pointers to functions

I am working on a program that sorts its input lines alphabetically/numericaly depending on the arguments passed to main. And this is the follow-up exercise: Add a field-handling capability, so sorting may be done on fields within lines, each field sorted according to an independent set of options. (The index for this book was sorted wi...