function

java function - print(collection c) ?

Hi. I'm trying to learn java better and I got one question. Say I got two collections, an ArrayList and a LinkedHashSet. Is it possible to make a function like this: void print(collection c) { for (object tmp:c) { System.out.println(tmp); } } ...

Why doesn't this code sort lines containing numbers correctly?

I'm looking at this program that reads input lines and then sorts them, from K&R. And I can't figure out why it doesn't sort them correctly if I enter for example 1234532 first line abc second line It won't sort them in increasing order. Basically it doesn't work if the input lines contains numbers or something other then letters, I ...

Validate a JavaScript function name

What would be a regular expression which I can use to match a valid JavaScript function name... E.g. myfunction would be valid but my<\fun\>ction would be invalid. [a-zA-Z0-9_])? ...

PHP - Can names of private functions inside classes be repeated?

class One { private function thisfn() {} } class Two { private function thisfn() {} } is this legit? btw does it matter if it's a private/public function inside a class? And also, can I create a new function named thisfn() outside of any class (and make it public)? like: function thisfn() {} ...

Problem in calling a virtual function across Symbian DLLs.

My IM application setup is like below: User Interface module (exe) Plugin module ( A polymorphic DLL that provides an abstract interface for different protocols to the UI module ) Several Protocol DLLs ( Shared library DLLs that implement the respective protocols, like Jabber, ICQ etc ) Now, I was asked to implement contact list cach...

How can I call a mysql function using MysqlConnector?

I'm using: MySqlCommand comHash = new MySqlCommand("MY_FUNCTION", con); comHash.CommandType = CommandType.StoredProcedure; // ?? comHash.Parameters.AddWithValue("my_parameter", "value1"); comHash.???? I need return the value from function. ...

jquery init function

I got a simple UI widget and i'd like it to alert() the "hello world!!!" when initialised. $.widget("ui.myWidget", { _init: function() { //start alert('Hello World!!!'); } } could some one explain how this init or _init function works.? if i was to call the ui just like the dialog ui would $('#selector').dialog() in...

Tracking down use of functions marked for deprecation

Following this thread: How to handle functions deprecation in library? I want to find a way to track all calls to the deprecated function so I can make sure I get them all replaced before the function is removed. Given the following PHP methods /* @deprecated - just use getBar() */ function getFoo(){ return getBar(); } function ...

Stacking Static Classes in PHP

Is there a way to make a static class where it has another static class as a member? E.G. Parent_Class::Child_Class::Member_function(); ...

Real-world examples of nested functions

I asked previously how the nested functions work, but unfortunately I still don't quite get it. To understand it better, can someone please show some real-wold, practical usage examples of nested functions? Many thanks ...

How to Copy an Object in PHP?

I have a simple 'dimensions' class containing a width/height property and a constructor to set them. I have a function (to re-size dimensions) that takes two dimensions objects -- one to be re-sized, and one containing the max size. It should reduce the dimensions in the first parameter such that they 'fit into' the second parameter. T...

WordPress: PHP: How to perform a nested sort within a category for the desired results.

There is a plugin that I am trying to adapt for my meta_tags for use with WordPress. It is called Categories by Title by http://www.mikesmullin.com. What I am trying to achieve is a nested sort. I have three meta_keys. A selection-no, release-month, and release-year. I would like to sort posts within their category by release-year (as...

how to modify detab to accept list of arguments

#include <stdio.h> #include <stdlib.h> #include <ctype.h> #define TAB_STOP 8 /* replaces tabs from input with the proper amount of blank spots */ int Detab() { int c, x; int column; x = column = 0; while((c=getchar())!=EOF) { if(c == '\n') /* reseting counter if newline */ { putchar(...

How do I use the onselect method of Jquery to goto a URL?

What I want to to is pretty basic. I have files that are number with dates, and when someone clicks a date on the calendar it should open that file. For example, if someone clicks november 20th it should go to nov/20.htm or generally {month}/{day}.htm. I've looked at the documentation and it mentions something about being able to call ...

Access to elements of a multidimensional array, with a function

Hi, I need a function with variable number of arguments, to access to the elements of a multidimensional array. I have done in this way ($this->_config is the array)... function item() { if(func_num_args() != 0){ $config = $this->_config; $args = func_get_args(); foreach($args as $item){ $config =...

mysql join table on itself

I am having problems with this and I'm hoping it's possible. I have a table from wordpress which stores post meta data, so the columns and field data cannot be changed (Easily). The table structure is thus post_id meta_key meta_value the meta key stores a field name and the meta_value, the value for that field. I need to group thes...

sybase user defined function - "non deterministic" or "illegal built-in function" error

When trying to create a user-defined functions (UDFs) on sybase 15+, you may get the following error: "illegal built-in function statement in scalar SQL function" This is b/c "non deterministic" functions such as getdate(), rand(), newid() are not allowed in UDFs. Is there a way around this limitation? Note that I plan answer my own qu...

C: Passing Struct to a Function doesn't result in a call by value operation

Hello! I have the following problem with a program which I wrote in Visual C++ and I hope that anyone can help me please: typedef struct spielfeld { int ** Matrix; int height; int width; Walker walker; Verlauf history; } Spielfeld; void show(Spielfeld fieldToShow); //Prototype of the Function where I have this ...

Why am I getting this error? Error #1006: draw is not a function.

I have 2 classes with a draw function in them, my Background class and VideoDisplay class. I'm not done with the VideoDisplay class, but I put simple traces in it to test. I call both the Background and VideoDisplay the same way in my document class, but when I try to call the draw function of the VideoDisplay class I get this error: Er...

C++ virtual function execution efficiency

hello I am trying to get a better idea of performance of virtual functions here is an example code: struct Foo { virtual void function1(); virtual void function2() { function1(); } }; struct Bar : Foo { virtual void function1(); } Bar b; Foo b.function2(); b.function1(); f.function2(); for each of three calls in the...