function

OO and PHP Classes vs functions

hello everybody. Does anyone know if OO and php classes are more resource consuming than normal functions that have the same result. And is there a simple php script that can give me exact RAM and CPU consumption by any given script so that I can monitor and limit resources usage, to code better for shared hosting. Thank You. ...

Function Declaration/Function Definition.

Does it matter if the function definition is before the int (main) or after the int main? I've seen it both ways and am trying to find the proper way to display the function definition and declaration. ...

Select all rows from SQL based upon existence of multiple rows (sequence numbers)

Let's say I have table data similar to the following: 123456 John Doe 1 Green 2001 234567 Jane Doe 1 Yellow 2001 234567 Jane Doe 2 Red 2001 345678 Jim Doe 1 Red 2001 What I am attempting to do is only isolate the records for Jane Doe based upon the fact that she has more than one row in this table. (More that one seque...

Override default php function

Hello, I have script wherein basename() is used 100-1000s of time, I was just thinking if we can override the function rather than changing the function name to something else in all scripts. The problem with basename() is that it doesnt works well with names of files in foreign languages. I found one on php site http://php.net/manual/...

Equivalent of include() in HTML

I was wondering wether there is a way to include some html content inside another html using only html? A replacement to PHP's <?php include("file.php"); ?> Is this possible? EDIT: This has brought up some confusion, what I needed was "almost an html tag" that had the functionality of including a html document in another. ...

Schinke Latin stemming algorithm in PHP

This website offers the "Schinke Latin stemming algorithm" for download to use it in the Snowball stemming system. I want to use this algorithm, but I don't want to use Snowball. The good thing: There's some pseudocode on that page which you could translate to a PHP function. This is what I've tried: <?php function stemLatin($word) { ...

PHP Query String Manipulation

Any one have the ultimate PHP function(s) to add/remove parameters from a query string? It needs to handle all possible cases, Ive seen ones that handle some cases, but not all. Some example cases: http://mysite.com?param1=1&amp;param2=2 http://www.mysite.com/?param1[]=1&amp;param1[]=2 ftp://user:[email protected]/files/uploads/?param1=...

How should I replace my naughty JSLint-shy function defs within loops?

I'm getting a few "Don't make functions within a loop." errors from JSLint, anyone got any tidy suggestions on how to fix this stuff up? Perhaps my naughtiness is excusable because of my YAHOO dependencies (yd. below)? I can safely say that the only time I've done the following: for( var i=0; i<FLN.revealers.length;i++ ) { var revE...

function javascript help

im new to programming and i need help on my code ? i want my page to prompt me if there will be available rooms left. im using the onload function on the admin page. so far here is my code function prompt() { < ?php include("dbconfig.php"); $sql = "SELECT COUNT(*) FROM rooms WHERE status = 'available'"; $result = @mysql_query($sql) o...

How is C++ VIRTUAL function not redundant?

Possible Duplicates: Overriding vs Virtual How am i overriding this C++ inherited member function without the virtual keyword being used? I am learning C++ at this moment, but I'm not completely in the dark when it comes to programming languages. Something makes no sense to me. My understanding is that a VIRTUAL function in ...

What is a practical use for PHP's sleep() ?

I just had a look at the docs on sleep(). Where would you use this function? Is it there to give the CPU a break in an expensive function? Any common pitfalls? Cheers. ...

C++ - binding function

Hello! I have some (library API, so I can't change the function prototype) function which is written the following way: void FreeContext(Context c); Now, at some moment of my execution I have Context* local_context; variable and this is also not a subject to change. I wish to use boost::bind with FreeContext function, but I need to ...

Split function in objective-c (card game)

Hi, i'm beginner in objective c, i'm creating a card game for iPhone and I've a problem with a function: I create a deck of cards, shuffle it and now I need to split the deck in 4 hands (for the 4 players) Here is my function : -(void) split(int i1, int i2, int i3) { NSMutableArray *list1; NSMutableArray *list2; NSMutable...

Find and replace in CSV files with Python

Related to a previous question, I'm trying to do replacements over a number of large CSV files. The column order (and contents) change between files, but for each file there are about 10 columns that I want and can identify by the column header names. I also have 1-2 dictionaries for each column I want. So for the columns I want, I want...

Calling an executable's function code

I have the location/offset of a particular function present inside an executable. Would it be possible to call such a function (while suppressing the CRT's execution of the executable's entry point, hopefully) ? ...

Trying to pass an array outside the scope into a function for echo'ing.

Hello my fellow programmers, I have a problem (other than not knowing enough) I need to know how to pass an array from outside the scope to then back inside, in a function which then echo's a specific array index. I have trowlled through the net trying to find solutions, asked fellow programmers for help but nothing thus far has worked...

C++: Is it possible to call an object's function before constructor completes?

In C++, is it possible to call a function of an instance before the constructor of that instance completes? e.g. if A's constructor instantiates B and B's constructor calls one of A's functions. ...

What does the C function bit_get do in DES encryption?

Hi there, I stumbled upon this piece of code while reading about DES encryption. I wonder what it does do exactly? I see that it returns either 1 or 0 according to the result of the last if. I also understand that mask is in hexadecimal and equals 128 in decimal (why this particular value?). The for loop starts from 0 until pos%8, why?...

guidelines for testing a statistical function in R?

Question: I am testing functions in a package that I am developing and would like to know if you can suggest some general guidelines for how to do this. The functions include a large range of statistical modeling, transformations, subsetting, and plotting. Is there a 'standard' or some sufficient test? An Example: the test that prompted...

how does C know dimensions of 2d dynamic array in a function?

I saw this example when I was trying to figure out how to pass pointers to dynamically allocated 2d arrays to functions: void zeroit(int **array, int nrows, int ncolumns) { int i, j; for(i = 0; i < nrows; i++) { for(j = 0; j < ncolumns; j++) array[i][j] = 0; } } I tried it and it works, but I don't understand how. How doe...