function

Python - specify which function in file to use on command line

Hi guys, Assume you have a programme with multiple functions defined. Each function is called in a separate for loop. Is it possible to specify which function should be called via the command line? Example: python prog.py -x <<<filname>>> Where -x tells python to go to a particular for loop and then execute the function called in th...

calling a function in file1.as from file2.as?

How can I call a function in file1.as from file2.as? here is the code. package com.modestmaps { import com.modestmaps.overlays.MarkerClip; import flash.display.Graphics; import flash.display.Loader; import flash.display.Shape; import flash.display.Sprite; import flash.filters.BlurFilter; import flash...

javascript - detect end of chained functions?

Today I'm working on a pet project using chained function calls, and I'm curious how I might detect when the last function in the chain is executed. For example: func1('initial data').func2().func3().func4(); And after func2-4 have finished working on 'initial data' I'd like to detect when func4 is done. Since func4() isn't always the...

Indirectly calling non-const function on a const object

Given the following code: class foo; foo* instance = NULL; class foo { public: explicit foo(int j) : i(j) { instance = this; } void inc() { ++i; } private: int i; }; Is the following using defined behavior? const foo f(0); int main() { instance->inc(); } I'm asking because I'm using a cl...

To clone or not to clone

I wrote a Scale9Bitmap class in AS3 and it requires the dev to set the BitmapData and a Rectangle for the scale9Grid. I'm wondered what is customary for the public get functions of both. Do I return a clone of each to make it free of hanging references, but not as memory-friendly? or do I leave that up to the dev and return the original ...

javascript - arguments.callee.toString() and arguments.callee.name does not return function name

I'm trying to get the name of the currently running function. From what I've read, this should be possible using: (arguments.callee.toString()).match(/function\s+(\[^\s\(]+)/) However, when I run this in Firefox and Safari (latest versions on Mac) the name is not returned. console.log( arguments.callee ) returns the source of the fun...

Finding out the filename that called my function in PHP

How do I find out the filename of the script that called my function? For example, function sthing() { echo __FILE__; // echoes myself echo __CALLER_FILE__; // echoes the file that called me } ...

How to create a function and call it on event.

Hello, I've included code for my textbox/textarea counter I put together. (hope it doesn't get mangled in my post...) The script works quite well, however I know my code is ridiculously bloated due to my inexperience with jquery and javascript. I was hoping someone could show me how to take the repetitive code (//event one thru five) ...

Timestamp to internal day count

On one project, I have an internal calculation of times. The days since the launch are simply enumerated: 2009/10/19: launch day 2009/10/20: day 1 2009/10/21: day 2 etc. Now I would like to have a function which gives me the current day of the internal calculation of times. E.g. "day 129" on one day in 2010. But it is important to ha...

Using functions from within the same class

This is probably a really simple question however Google isn't my friend today. I have something like this but it says call to undefined function <?php class myClass{ function doSomething($str){ //Something is done here } function doAnother($str){ return doSomething($str); } } ?> ...

Including template files and dynamically changing variables within them

To make life a little easier for myself I would like to build a very simple template engine for my projects. Something I had in mind was to have .html files in a directory that get included to a page using PHP when I want them. So a typical index.php would look like this: <?php IncludeHeader("This is the title of the page"); IncludeBod...

I need a function to convert lower case to upper case in Java

Hi, I'd like to know how to convert to upper case the input from the keyboard either if they are letters or numbers (only). I'm learning to program and I'd like to do it in the Java language. I have to remove the accents if the input has it and convert the input in the upper case letter. I have an idea of this but I'd really appreciat...

performance difference between User Defined Function and Stored Procedures

If a statement return rows doing a simple select over the data base, is there performance difference between implement it using Function and Procedures? I know it is preferable to do it using function, but it is really faster? ...

SQLiteFunction Simple Not Working

I an attempting to use a SQLiteFunction from my C# and ADO.NET code. Can anyone say why I get this problem? An unhandled exception of type 'System.Data.SQLite.SQLiteException' occurred in System.Data.SQLite.dll Additional information: SQLite error near "DEMOIT": syntax error I am using .NET 3.5 x86 with SQLite ADO.NET 1.0.65 - Help!...

will file_exist() php function cause high server load ?

i am trying to check if user uploaded his or her avatar image and i use file_exist() php function to check if the user avatar image exist or not will this cause any server load problem with massive traffic websites ? thanks ...

Can I execute any program outside mysql through mysql triggers?

I’m building email notification service, requirement is to send an email to user when he is registered. Currently what I’m thinking of execution of some function defined in trigger, can be a java function, which have to be outside the mysql process, rather monitoring mysql from outside for row addition in database. Is there any function...

Reason for using .prototype in Javascript

What are the technical reasons for using .prototype instead of declaring functions and members inside the object itself. It is easiest to explain with code examples. What are the advantages of using: RobsObject = function(data){ this.instanceID = data.instanceID; this._formButton = document.getElementById('formSubmit_' + this.i...

Calling a PHP function

I've got the following function that generates and saves an image based a text parameter. How can I call this in my file? I tried INCLUDE 'outPrice.php'; to link to the external PHP and called it with this command, outPrice($text); To which I got the following response. Warning: Cannot modify header information - headers already...

C++ Function clarification

Given: x = MyFunc(2); My understanding: The variable x is assigned to the function MyFunc(2). First, MyFunc( ) is called. When it returns, its return value if any, is assigned to x.? ...

How do I call a function from a dll from php on windows?

Hi ! I'm using xampp. I search and it looks like for php 4.x, there was an extension called php_w32api.dll which seems to have vanished for php 5.x. Nevertheless, it's still in the documentation on php.net but marked as experimental. Some suggested to use win32std in pecl instead, but that just wraps some function of the win32 api, bu...