Hello!
Is there any way to make a function call only once?
Suppose I have some class
struct A {
void MainRoutine(Params) {
// Want to call other routine only once
}
void OtherRoutine(Params) {
// Do something that should be done only once and
// what depends on the params
}
};
I want to call Other...
I have a MySQL table called "invoice_prod" :
id | qte | price | id_tva
And another table called "tva" :
id_tva | content
Now, I want to find the total of an invoice, so I made this query and it works.
$sql_mnt = mysql_query("
SELECT SUM( (qte * price) * ( 1 + (tva / 100))) AS total_un_prod
FROM invoice_prod
WHERE i...
I'm trying to write a little CLI Hangman game, just to create something in C using my very limited set of language features, making the information so far stick.
I haven't got to strings in the book yet, so I've created a so-called dictionary, which is a multi-dimensional array of characters, each row representing a word, and each colum...
i want put this perl code in another perl file :
my $ua = new LWP::UserAgent(agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5');
for example : i want open UP.PL and this perl file copy the above perl code in another perl file (ex:send it into another.pl)
what am i going to do ?
T...
I have made a class in which there are 3 functions.
def maxvalue
def min value
def getAction
In the def maxvalue function, I have made a list of actions. I want that list to be accessed in def getaction function so that I can reverse the list and then take out the first entry from it. How can do i that??
def getAction(self,gamesta...
i have a function:
I need to first reverse the list and then take an entry from it.
Earlier, I was making the 3 functions but now I am defining the main function and the other 2 functions in it.
...
I have got 2 javascript variables:
var list1 = "john doe|bill williams|poll bregg|michael jordan";
var list2 = "analytic|trader|doctor|athlete";
We have to take in mind, that relations between this two variables are that names and professions are placed in the same order, eg. poll bregg is a doctor, but john doe is an analytic.
Than ...
Hi there,
Is it possible to have a function automatically contain the line number and the file that the function was CALLED in,
as if i call __LINE__ or __FILE__ in the function it will use the line and file the function definition is in.
but i dont want to have to pass __LINE__ and __FILE__ into the function every time.
so if i set ...
Hey everyone,
I am writing some PHP code to create PDFs using the FPDF library. And I basically use the same 4 lines of code to print every line of the document. I was wondering which is more efficient, repeating these 4 lines over and over, or would making it into a function be better? I'm curious because it feels like a function woul...
Are they the same thing?
...
class AlphaBetaAgent(MultiAgentSearchAgent):
def action(self,gamestate):
self.alpha= -9999
self.beta = 9999
def abc(gamestate, depth, alpha, beta):
def bvc(gamestate, depth, alpha, beta):
return abc(gamestate, 0, alpha, beta)
I am calling the getAction function which itself calling the abc funct and abc funct...
Hello!
Code inside Function is working, but as i want to process more then one Url i wanted to make it a function using a array to get the urls to process. Here is the Code:
<?php
$site = array("http://www.ihr-apotheker.de/cs1.html", "http://www.ihr-apotheker.de/cs2.html", "http://www.ihr-apotheker.de/cs3.html");
fu...
I'm just getting started on F#, and when playing around with operator overloading, I've run into something I don't quite understand. Now, I understand that you can't use, for example, +* as an overloaded prefix operator; it can only be an infix operator. Here's where I get confused, however:
let (+*) a = a + a * a;;
If I run this, fsi...
I was just inquiring about standard practices of argument validation syntax. I'm working with PHP as of currently, but anything that's considered a platform/language agnostic solution would be great.
As of currently, I'm aware of two pretty common syntax. For example (my preference):
function foo($a, $b, $c){
if(!$a){ throw new Exc...
Normally, if I want to pass arguments from $myarray to $somefunction I can do this in php using
call_user_func_array($somefunction, $myarray);
However this does not work when the function one wishes to call is the constructor for an object. For fairly obvious reasons it does not work to do:
$myobj = new call_user_func_array($classna...
As a complete Javascript novice I'm challenged by what may seem like simple concepts to the almighty javascript overlords that call Stackoverflow home.
My problem isn't really problem. When I'm doing my javascript up in my code editor down at the ghetto I'll often see stuff like this
function name(e) {
if(e.KeyCode) {
.....
I'm trying to create a user defined function in Oracle that will return a DATE when given a text argument containing a date substring. I've tried a couple ways of writing this, and all seem to throw the same error:
CREATE OR REPLACE FUNCTION lm_date_convert (lm_date_in IN VARCHAR2(50))
RETURN DATE DETERMINISTIC IS
BEGIN
RETURN(TO_D...
In the book Clean Code the author recommends breaking large methods into small functions that do one specific thing. In languages like Java this translates to pretty, readable code.
public static String renderPage(PageData pageData)
{
includeHeader(pageData);
includeContent(pageData);
includeFooter(pageData);
return page...
was the idea of nested functions considered to be useless during the time of developing older c++ standard, because its usage is basically covered by another concept like object-oriented programming; or it wasn't implemented just as a matter of simplification?
...
I have a generic items list class to create a more specific listing using it as base class, something like this..
ref class ItemBase { }
ref class ItemA : ItemBase { }
ref class ItemList abstract {
public:
virtual void add(ItemBase ^p);
}
ref class ItemListA : ItemList {
public:
virtual void add(ItemA ^p) override; // it doesn't w...