i would like to create a function which accepts a constant like
the datepart function accepts yy/mm/dd/hh/
like:
select datepart(dd, getdate())
i would like to create my own function that accepts dd
not char like 'dd'
i want
select MyFunc(dd, getdate())
and not
select MyFunc('dd', getdate())
...
I have the following constant defined in my PHP script:
define("MODULE_PATH", "D:\\modules\\");
Whenever I try and assign the constant to a variable or as a function argument, I get a PHP parse error (with no explanation).
var $jim = MODULE_PATH;
var $fh = fopen(MODULE_PATH . "module1.xml");
Both above lines throw the parse erro...
I need to define the constant in the module that use the method from the class that includes this module:
module B
def self.included(base)
class << base
CONST = self.find
end
end
end
class A
def self.find
"AAA"
end
include B
end
puts A::CONST
But the compiler gives the error on the 4th line.
Is there any ...
When writing Cocoa apps, I do the majority of the user interface layout programmatically. For example:
NSRect popUpFrame = NSMakeRect(10, 10, 100, kDefaultPopUpButtonHeight);
NSPopUpButton * popUp = [[NSPopUpButton alloc] initWithFrame:popUpFrame];
//...
My question is about that kDefaultPopUpButtonHeight constant. I currently maintai...
Hi,
I want to define a constant in objective-c.
Previously I had the following function:
+(NSString *) getDocumentsDir {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES);
NSString *documentsDir = [paths objectAtIndex: 0];
paths = nil;
return documentsDir;
}
I'd like to...
I am coming to Objective-C from C# without any intermediate knowledge of C. (Yes, yes, I will need to learn C at some point and I fully intend to.) In Apple's Certificate, Key, and Trust Services Programming Guide, there is the following code:
static const UInt8 publicKeyIdentifier[] = "com.apple.sample.publickey\0";
static const UInt8 ...
I'd like to offer a list of constants within my DLL.
Example usage:
MyDLL.AddHouse( HouseName, MyDll.HOUSETYPES.Big)
MyDLL.AddHouse( HouseName, MyDll.HOUSETYPES.Small)
Tried:
public static readonly string[] HOUSETYPES =
{
"Big", "Small"
};
But that only gets me:
MyDLL.AddHouse( HouseName, MyDll.HOUSETYPES.ToString())
Any idea...
Constants are beautiful people - they can hold in a unique place a value that is used everywhere in your code. Changing that value requires only one simple modification.
Life is cool.
Well, this is the promise. Reality is sometime different :
You change the LogCompleteFileName constant value from L:\LOGS\MyApp.log to \\Traces\App208....
In a Ruby on Rails 2.3.2 application, where is the best place to define a constant?
I have an array of constant data that I need available across all the controllers in my application.
...
I'm designing some classes and for some data I want to use fields that are constant.
Now, AS USUAL, IE does not support the key const so
const T = 10;
not work.
I could create a property via __defineGetter__ and __defineSetter__ to mime that but
, AS USUAL, IE does not support that syntax (IE 8 has Object.defineProperty but not work...
I am currently writing a plugin to a CAD style software. The plugin does calculations based on data read from the CAD model and a lot of table lookups (think printed tables in a calculation guide). I inherited this plugin and the current solution defines a class Constant which has a bunch of static struct members and two-dimensional arra...
I have a class which hold an array "float ** table". Now I want to have member function to return it, but don't want it to be modified outside of the class. So I did this:
class sometable
{
public:
...
void updateTable(......);
float **getTable() const {return table;}
private:
...
float **table;
}
This compiles O...
Hello everybody,
I know that you can easily pass an array to a function, like the code below shows
Private Sub SomeFunction(ByVal PassedArray() As String)
For i As Integer = 0 To PassedArray.Count - 1
Debug.WriteLine(PassedArray(i))
Next
End Sub
Public Sub Test()
Dim MyArray As String() = {"some", "array", "members...
I have a static class representing a connection pool that I want to unit test using Visual Studio 2008's built-in unit testing framework. The static class has some constants in it, like for the maximum allowed connections. I want to decrease this value for my unit test so I don't have to have a lot of connections open in order to hit a...
Is there a line number constant or way to dynamically trace the line number in actionscript?
Does actionscript have the equivalent of
__LINE__
in PHP?
...
I want to do, in Perl, the equivalent of the following Ruby code:
class Foo
MY_CONST = {
'foo' => 'bar',
'baz' => {
'innerbar' => 'bleh'
},
}
def some_method
a = MY_CONST[ 'foo' ]
end
end
# In some other file which uses Foo...
b = Foo::MY_CONST[ 'baz' ][ 'innerbar' ]
That is, I just want to declare a ...
Hi,
I'm using Memcached PHP library (based on libmemcached) and I'm wondering how can I change predefined constants in PHP. I'd like to use key distribution based on ketama.
Memcached is compiled as a PHP extension.
Thank you.
...
Is this legal?
<?php
function ftw($foo = 'pwnage', $nub = MENU_DEFAULT_VALUE, $odp = ODP_DEFAULT_VALUE) {
//lots_of_awesome_code
}
?>
where MENU_DEFAULT_VALUE and ODP_DEFAULT_VALUE are previously constants defined previously in the file.
Thanks.
...
How how constants in all examplese I've seen always start with k? And should I #define constants in header or .m file? I'm new to objective c, and I don't know c. All tutorials and books assume you know c, so I don't understand these things, is there some tutorial somewhere that explains stuff like this?
Thanks.
...
Hi guys
I am trying how figure how to setup like for instance
Color.RGG.Black which equal to "#000000"
I am trying to make it similar like that and implement into my Constants Class. How do I do this?
Constants.Page.Title.MyCase equal to "My Case";
Thanks
...