variables

Does Perl have something similar to PHP's constant()?

I have done some digging through perldoc and the O'Reilly books but haven't found any way to do this. Am I relegated to using something like Readonly? UPDATE: I have nothing against Readonly. I just wanted to be able to do something like PHP's constant(). Example if Perl had constant(): use constant { FIELD_EXAMPLE_O => 345, ...

Pass POST variables to PHP executable

I have been writing an HTTP server in C#, and I've gotten to the point where I want to implement PHP. However, I cannot seem to find a way to pass POST variables to the PHP-CGI executable. I know that I am supposed to use environment variables to communicate with the executable, and most importantly the QUERY_STRING variable. This one ju...

How to refer to a static constant member variable in PHP

I have a class with member variables. What is the syntax in PHP to access the member variables from within the class when the class is being called from a static context? Basically I want to call a class method (but not create a new object), but when the class method is called, I want a handful of static constant variables to be initia...

Are there any programming languages where variables are really functions?

For example, I would write: x = 2 y = x + 4 print(y) x = 5 print(y) And it would output: 6 (=2+4) 9 (=5+4) Also, are there any cases where this could actually be useful? Clarification: Yes, lambdas etc. solve this problem (they were how I arrived at this idea); I was wondering if there were specific languages where this was the de...

Reading in long double in the C programming language.

How do I read in a long double in C? ...

Override variable or force usage?

I want to force a class to define a certain variable from the class it implements. e.g. class Fruit{ String name; // Cause each fruit has a name } //Apple wants to get an error if it does not use the name variable class Apple implements Fruit { String name = "Apple"; } Is there a way to do that? Just like java.io.Serializab...

What does (int **array;) create?

I want to know what is happening in memory when you declare: int **array; ...

Convert Variable Name to String?

I would like to convert a python variable name into the string equivalent as shown. Any ideas how? var = {} print ??? # Would like to see 'var' something_else = 3 print ??? # Would print 'something_else' ...

What's the life span of a variable in a program (in Java)?

Can you tell me how long a variable lives in a program (in Java). i.e. variables declared inside methods, variables used in parameters, STATIC variables, variables used to return from a method, etc. Thanks. ...

JS: Entering a TRUE value into a prompt box and having it alert its variable.

I'm wondering if it's possible to enter a value of a variable into a prompt box have it return to me in an alert of its original variable. Say: var myGoal = "answer"; If I enter "answer" into a prompt, what would a good method be of taking my value of "answer" ,searching, and having it return myGoal in an alert? ...

Static variables in JavaScript

How can I create static variables in Javascript? ...

i18n on a variable

I would like to know if I can use a gt function on a variable with php? eg. : echo _($var); ...

simple template engine help

I've build a simple templating engine for a friend, however i have a problem which i think is a simple one the script looks for these values in a template $find = array("{$body}", "{$page_title}"); and replaces them with some other values. However because they look like php variables I'm getting all sorts of errors and them being un...

Declaration of variables?

Case:1 class A { private int i=0; public void display() { this.getValue(); } private int getValue() { return i+2; } } Case:2 class B { public void display() { int i=0; this. getValue(i); ...

Storing Session Variables in Lift Scala

Hi all- I am trying to store a session variable and then use it to modify the menu in Boot.scala. Here is how I am storing the variable in a snippet: object sessionUserType extends SessionVar[String](null) def list (xhtml : NodeSeq) : NodeSeq = { Helpers.bind("sendTo", xhtml, "provider" -> SHtml.link("/provid...

Entering Dates into mysql database using sql INSERT

A better suggestion on how to approach this then what I have done so far would be appreciated. Right now the dates have to be entered in the correct format year-month-day. Is there a way to automate this task more, with drop downs, just not sure how you would combine the information from the drop downs to submit to one field with my sql ...

Incrementing variables in ASP.net on button click

I am new to asp.net. I am creating a ASP.net website using VB.net. So here's my problem Dim myCounter as Integer = 0 Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles Button1.Click myCounter = myCounter + 1 Label1.Text = myCounter.ToString() end Sub As expect...

Adding buttons dynamically to a uitableviewcell - iPhone app

I have a verb conjugation app that displays verb translations in the first cell of a table. At present the translation list is just a string (comma-separated list) but I'd like to change it to have clickable buttons. I had a play around adding buttons to the cell view without too much success but my only experience with custom cells has ...

Set Dynamic Variable name In ActionScript 3.0

I need to set custom variable name for every iteration. Why this isn't possible? for (var i:uint = 0; i < 50; i++) { var ['name' +i] = new Sprite(); } *//1840: Syntax error: expecting identifier before left bracket* ...

C# How to dump all variables & current values during runtime

Are there any in-built or 3rd party libraries that allow you to simply dump all variables in memory during run time? What I would like is to be able to view variables & current values similarly to viewing them by hitting a break point and hovering over variables, but without actually having to halt the program execution (i.e. just get a...