function

PHP strange behavior in function nl2br.

I was dealing with refactoring of my small web app. all night. Today when I started testing, first bug what I found was problem with system PHP function nl2br(). On my localhost I have PHP version 5.2.9 and as I see on PHP site from version 4.0.5 nl2br() is XHTML compliant. Then I absolutely don't understand why does my nl2br() return ...

Is this a valid jquery callback function call?

I executing a function like this, <script type="text/javascript"> $(document).ready(function() { getEntities("Clients/GetClients", 0, formatClientsResult); var maxvalues = $("#HfId").val(); $(".pager").pagination(maxvalues, { callback: getEntities("Clients/GetClients", formatClientsResult), ...

jquery custom use to set values. any idea how to add database save function??

var iNettuts = { jQuery : $, settings : { columns : '.column', widgetSelector: '.widget', handleSelector: '.widget-head', contentSelector: '.widget-content', widgetDefault : { movable: true, removable: true, collapsible: true, editable: true, colorClasses : ['color-yellow', 'c...

Find out what type of form field was used to enter info in a form with PHP

Using PHP; is there a way to check what type of form field was used to enter info in a form. For example: was it submitted via a list/menu, radio button, text field, textarea, or checkbox. I have this info stored in the database; but I'm trying to see if there is a way to do it without querying the database or using hidden form fields ...

What are the most common uses of static class functions in C++?

I am learning today about static class functions in C++ and I can't really understand what are they good for? Does anyone have some good examples where they can be applied successfully? Thanks, Boda Cydo. ...

how create function with argumet as subselect?

Hello I like create function for select and changed me data CREATE OR REPLACE FUNCTION PublicatedTask( argument ) RETURNS SETOF task AS $$DECLARE f task%ROWTYPE; BEGIN FOR f IN SELECT * FROM Task where layer IN $1 and publicationin<>0 ORDER BY id LOOP if (f.publicationIN = 1) then f.description=''; end if; ...

Executing system command in Vala

Hi. I would like to execute a command (like ls) in Vala, like the Python os.system function, or, better, the popen function. Any idea ? ...

what is the system function in python

I want to play with system command in python . for example we have this function in perl : system("ls -la"); and its run ls -la what is the system function in python ? Thanks in Advance . ...

Jquery: Perform function when user comes out of focus

I need to perform a function when a user comes out of focus. So far I can do it when they go into focus but how do I do it the other way round: $("input.default-value").focus(function() { $(this).css("color", active_color); }); ...

How to call a Javascript after a div is replaced ?

Hi, I dynamically have to call a Javascript after a tag is rendered. Is it possible? I am doing some Ajax call which on return should repaint a DIV tag. And it is repainting successfully. I need to fire a Javascript method AFTER the DIV tag is repainted. How to do that? Thanks ...

How do I get a SQL function to return a list to be used by the IN statement in a WHERE clause?

Hey guys I have a complex SQL Query, that needs to be filtered further. Part of the WHERE clause looks like this: Where P.PeriodID in (36, 37) I need to get it to look more like this: Where P.PeriodID in dbo.GetPeriodsInRange(@startDate, @endDate) The function must return a list of PeriodIDs to be used by the IN statement. I reall...

jQuery get source element in callback

$('.myElem').live('click', function() { $(this).hide(500, function() { $(this).siblings('.myOtherElem').show(); }); }); The above doesn't work because $(this) is no longer in correct scope in the callback. How do I pass my original source element into the callback? ...

Atomically get value on Mac OS

I need some function to atomically get int value. Something called OSAtomicGet(). Analog of g_atomic_int_get(). ...

function return not assigned to a variable

What if you call a (non-void) function, but don't assign its return value to a variable? e.g., getchar(); I've always wondered what happens to such a value. I've heard humorous explanations like "its gone to the ether" and so forth, but I'd really like to know really. Would there be any way to recover such a value? Thanks ...

Recreate Excel RATE function using Newton's Method

Hi all, I'm working on converting a mortgage calculator in PHP, but I don't necessarily need a PHP solution. I'm looking for the logic needed to replicate the Excel RATE function. I've found a solution which uses bisection, and if worse comes to worse, I use that. I know someone out there in the interwebs world has knowledge of such a ...

Function expects 2 arguments when should only one

I have a function friend_exists like this: def friend_exists(request, pid): result = False try: user = Friend.objects.get(pid=pid) except Friend.DoesNotExist: pass if user: result = True return result I'm calling it from my other function like this: exists = friend_exists(form.cleaned_da...

Simple random string generation function in C, please. Show me your art!

Hi folks, I'm working on a little (not so little actually) project in C (ref. this question) , and I need a little function in C that'd generate a unique and random string. I need a small one that I can include as a utility function in a .c file. Please help me with your brains, and show me how smart this could be done! Thanks and a v...

"Mirroring" an angle.

I need to obtain the supplement of an angle. Exactly what I need to do is to implement some kind of code that mirror the angle, let's say, I have 45 degrees -> 135, another example: 80 ->100, 0 degrees -> 180, and so on. Solved: I implemented this just a moment ago, and it worked perfectly, I use 180 - angle if angle < 180, and 360 - a...

Function within a Function TSQL

Hi, Can I call a scalar function within a table-valued function? Thanks ...

How to create default value for function argument in Clojure.

...