function

Python Data Descriptor With Pass-through __set__ command

I'm having a bit of an issue solving a problem I'm looking at. I have a specialized set of functions which are going to be in use across a program, which are basically dynamic callables which can replace functions and methods. Due to the need to have them work properly to emulate the functionality of methods, these functions override _...

Delphi: Program Execution and internal procedure/function calling from CMD or using Doubleclick on associated extension

So - recently I run on some problems determining from which way program was called, if in both times parameters is the same - like: /something /something. I associate icon with program at runetime and i can use cmd to call it, but, whenever i doubleclikc on associated file ( with the icon ), progam simply opens, but does not calls neede...

PHP - mysql_real_escape_string not working

Hey, I have this strange problem. I have this script: echo $comment_content = $_POST['comment_content']; echo $comment_content = mysql_real_escape_string($comment_content); When I run it on my website server, it outputs the value only 1 time (not the second one), but when I run it anywhere else, it outputs right (2 times). However, I...

Delphi Function to Display Number of Bytes as Windows Does

This is a simple one (I think). Is there a system built in function, or a function that someone has created that can be called from Delphi, that will display a number of bytes (e.g. a filesize), the way Windows displays in a file's Properties box? e.g. This is how Windows property box displays various sizes: 539 bytes (539 bytes) 35....

Function format in a C program

I'm writing some functions that manipulate strings in C and return extracts from the string. What are your thoughts on good styles for returning values from the functions. Referring to Steve McConnell's Code Complete (section 5.8 in 1993 edition) he suggests I use the following format: void my_function ( char *p_in_string, char *p_ou...

PHP functions help

Hi there! I'm sorry for asking this question, but I'm not good in php (beginner). Could you please explain what $arg means in this piece of code? (it's from one of drupal modules) function node_add_review_load($arg) { global $user; $add_review = FALSE; $current_node = node_load($arg); $type =$current_node->type; $axes_count =...

Using the same decorator (with arguments) with functions and methods.

I have been trying to create a decorator that can be used with both functions and methods in python. This on it's own is not that hard, but when creating a decorator that takes arguments, it seems to be. class methods(object): def __init__(self, *_methods): self.methods = _methods def __call__(self, func): def...

Adding a custom function to an already instantiated object in PHP?

What's the best way to do something like this in PHP?: $a = new CustomClass(); $a->customFunction = function() { return 'Hello World'; } echo $a->customFunction(); (The above code is not valid.) ...

How to cast a string to a function pointer in C?

Possible Duplicates: call a function named in a string variable in c Dynamically invoking any function by passing function name as string I have certain functions.. say, double fA1B1C1( .. ) { ... } double fA2B2C3( .. ) { ... } double (*fptr)( .. ); fptr myfunc; These functions are already defined. So...

jQuery tooltip not working as expected - REVISED

Hello all, Ok I fixed the original problem but I would like now is to add the title value back to the anchor tag of id="contact" from the id="contact-info" popup before I remove the popup The JS this.contactPreview = function() { jQuery("a.contact").click(function(e){ this.t = this.title; this.title = ""; var c...

Simple JavaScript function with immediate invocation does not work... why?

Can anybody explain why this works: var sayHello = function (name) { alert("Hello there " + name + "!"); }("Mike"); While this does not: function sayHello (name) { alert("Hello there " + name + "!"); }("Mike"); Mike Peat ...

How can I call a sqlserver function from VB.net(or C#) ? Is there some syntax like stored procedure?

Public Sub cleanTables(ByVal prOKDel As Short) Dim sqlParams(1) As SqlParameter Dim sqlProcName As String sqlProcName = "db.dbo.sp_mySP" sqlParams(1) = New SqlParameter("@OKDel", prOKDel) Try dbConn.SetCommandTimeOut(0) dbConn.ExecuteNonQuery(CommandType.StoredProcedure, sqlProcName, sqlParams) ...

MYSQL: self written string-manipulation function returns unexpected result

I'm trying to implement a MYSQL function MY_LEFT_STR(STRING x,INT position) in such a way that MY_LEFT_STR('HELLO', 4) => returns 'HELL' (same as internal LEFT function) MY_LEFT_STR('HELLO',-1) => returns 'HELL' DROP FUNCTION IF EXISTS MY_LEFT_STR; CREATE FUNCTION MY_LEFT_STR( in_str VARCHAR(255), pos INT ) RETURNS VARCHAR(255)...

Why i can't declare following function in Visual C++ "string timeToStr(string);"?

When i'm trying to declare a function with a string parameter in .h file an error occurs. I haven't forgot to include string.h =) Everything builds fine when i'm using char[], but the i want the argument to be a string. ...

Naming conventions for function parameter variables?

Is there a naming convention or maybe some guideline on how to name function parameters? Since forever, I have been doing it like this: function divide( $pDividend, $pDivisor ) { ... } That way I'll always know which variables were passed as parameters. (This one's PHP, but it should be applicable to most programming languages) Is ...

Running function 5 seconds after pygtk widget is shown

How to run function 5 seconds after pygtk widget is shown? ...

PHP Function Comments

Just a quick question: I've seen that some PHP functions are commented at the top, using a format that is unknown to me: /** * * Convert an object to an array * * @param object $object The object to convert * @return array * */ My IDE gives me a dropdown selection for the things such as @param and @return, so it must b...

Get Calling function name from Called function in C#

Possible Duplicate: How can I find the method that called the current method? How can I get the calling function name from the called function in c#? ...

ACCESS Jet SQL INT() Function -> SQL Server Function

Hey guys, I am converting an Access Jet-SQL query into T-SQL and I came upon the Int() function. Now, I would like to convert it into T-SQL, and this is what I have so far: --Works for Positive Select CONVERT(INT, 1.2) --Answer = 1 --Not the same as Access SELECT CONVERT(INT, -1.2) --Answer = -1 Now, according to this, I need it to...

How can I pass a function to a Perl sub?

How would I write a function that accepts something like the map function does? Example: $func = sub { print $_[0], "hi\n" }; &something($f); sub something { my $func = shift; for ($i = 0; $i < 5; $i++) { $func->($i); } } works fine. but then if I did &something( { print $_[0], "hi\n" } ); it wont work and says ...