function

Need way to alter common fields in different structs.

I'm programming in C here, for Windows and various Unix platforms. I have a set of structs that have common fields, but also fields that are different. For example: typedef struct { char street[10]; char city[10]; char lat[10]; char long[10]; } ADDR_A; typedef struct { char street[10]; char city[10]; char z...

Is Resharper's recommendation to make my private method static a good recommendation?

I've recently noticed that when I create private methods that set a few fields in the objects passed to them that Resharper puts up a hint stating that the method can be made static. Here's a greatly simplified example of the sort of method I might have. private void MakeStatusTheSame(MyClass mc, MySecondClass msc) { mc.Status = ms...

Can you declare facultative function arguments in Javascript ?

Like you can in php <?php function whatever($var='') { } ?> can you do that in javascript? ...

Splitting up jquery functions across files?

Hi all, I have several functions which use jquery that are called across different pages. I'm wondering if it's possible to define these functions in a single file, and then call them in different files which are included after the initial file. Here's an example: ## default.js $(function() { // jquery specific functions here... ...

Invert function: base 38 conversion

Hello! Can you tell me how the invert function for the following PHP function is? <?php function id2secure($old_number) { $alphabet_en = '1357902468acegikmoqsuwybdfhjlnprtvxz-_'; $new_number = ''; while ($old_number > 0) { $rest = $old_number%38; if ($rest >= 38) { return FALSE; } $new_number .= $alphabet_en[$rest]; $old_num...

Run a jquery without click function

I use expose in one link, with this code and it works: $(document).ready(function() { var triggers = $("a[rel]").overlay({ expose: { color: '#212121', loadSpeed: 200, opacity: 0.9 }, closeOnClick: false }); }); The link is: <div id="triggers"><a href="" rel="#pop_member">Click here</a></div> But I...

fire a function whose name is in a string

Hi everyone, I'd like to fire a function. Unfortunately I can't call it directly as the functions' name is provided as a string. Example: function myFunction() { alert('I am myFunction'); } function anotherFunction() { alert('I am anotherFunction'); } var func_name = 'myFunction'; $obj = jQuery('a'); $obj.each(function(){ ...

OCaml: bound expressions v. functions

Here we have a function definition: let f x = x + 3;; Here is an expression: let g = 4;; Could g just be thought of as constant function that takes no arguments? Is there any difference? ...

Jquery expose overlay function

This function is not working, the popup (div #pop_member) doesn't show. I'm using jQuery Tools library. function run_expire(){ $("#pop_member").overlay({ expose: { color: '#212121', loadSpeed: 200, opacity: 0.9 }, closeOnClick: false }); } run_expire(); I want this popup to show when the page i...

How to Conditionally Retrieve Rows from the Database in PHP?

Ok, I have a database full of values with one field value for prospects and another for clients... I'd like to retrieve only the clients information... How do I write the function??? UPDATE Here is the script I tried to write: <?php try { $sql = "SELECT * FROM clients" // WHERE history" or die(mysql_error()); forea...

__attribute__ in C

Hi, I was just wondering why and how is __attribute__ used in C programs. thanks, ...

How can this python function code work?

this is from the source code of csv2rec in matplotlib how can this function work, if its only parameters are 'func, default'? def with_default_value(func, default): def newfunc(name, val): if ismissing(name, val): return default else: return func(val) return newfunc ismissing takes a na...

Creating your own jquery plugin - function problem

Hi all, I'm trying to pass a function as an option through a jquery plugin that I'm building myself. At the moment when initializing my plugin with the following option: $.fitAjaxSubmit({ formId: "new_team", postUrl: "/teams/create.json", redirectUrl: "/teams/", saveBoxText: "Saving Team...", beforeSubmi...

Simple Jquery function fails in Safari, Chrome and IE

Hi all, Here is my simple function $('#save_button').click(function() { $(this).attr('disabled',true).val('Saving'); $('#new_record_form').ajaxForm({ url: '/', type: "POST", dataType: "json", beforeSubmit: function(){ alert('Boo!'); }, success: function(){ alert('Hello!'); } })...

Are Oracle Analytic Functions costly?

Has anyone encountered slow performance when using oracle analytic functions? The lead() oracle analytic function was used to generate a new field in the table. Basically, it would allow the previous row's field value to be used as the value of the current row's new field. The explain plan indicates a full table scan is performed on t...

Turn array into independent function arguments - howto?

I want to use values in an array as independent arguments in a function call. Example: // Values "a" and "b" $arr = array("alpha", "beta"); // ... are to be inserted as $a and $b. my_func($a, $b) function my_func($a,$b=NULL) { echo "{$a} - {$b}"; } The number of values in the array are unknown. Possible solutions: I can pass the ar...

How does this work?

So I'm trying to comprehend the source file for csv2rec in matplotlib.mlab. It is used to take a csv file and parse the data into certain formats. So it may take a string '234' and convert it to int. or take a date string and make it into python datetimes. def get_converters(reader): converters = None for i, row in enumera...

jquery firing issue

I am using a function to equalise the height of li tags returned from a database. I am also using jquery to assign certain li new classes dependant on their position in a row. Basocally my problem is that the positioning part of the jquery statement always works but the equal heights part will sometimes not fire, in fact it generally do...

Is there any way to access all of the Clib functions from one file?

I'd like to include just one file instead of all of them, because the compiler I have to use does not include them by default. ...

xslt to operate on element value before displaying?

The default behavior of the xsl on the right-hand side of http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&amp;xsltfile=cdcatalog is to display a 2-column table with the title and artist of each CD in the XML on the left-hand side. (This is shown by the default output under "Your Result" at the bottom.) I want to modify the ...