variables

Calling a variable by name, which isn't known while compiling

Is it possible to set a variable, if i want to have it flexible? I think an exmaple makes it easier to understand. String hallo1; String hallo2; for(int i = 0; i < 2; i++) { hallo & i = Integer.toString(i); } ...

How to dynamically create arguments for a method?

Being still somewhat new to Ruby, I'm not sure how to do this... Let's say I have a method that takes a variable number of arguments: def mytest(*args) puts args.to_json end Obviously I can call it with whatever I like, such as: mytest('one', 'two', 'three') No problem. But what I need to do is call it with a dynamically-created se...

When to release/retain an object that is passed to a secondary Thread?

Hello, I am passing an object to a secondary thread using the following code: (void)login:(id)sender { platformMsgs_LoginRequest *loginRequest = [[[platformMsgs_LoginRequest alloc] init] autorelease]; //more code... [NSThread detachNewThreadSelector:@selector(sendLoginRequest:) toTarget:self withObject:loginRequest]; //more code......

How do I change a variable based on a checkbox during validation

I've successfully pulled the checked value from a radio button group with jQuery 1.4 using the following code: var myFirstVar = $("input[name='myFirstVar']:checked").val(); How would I alter this code to find out whether a check-box was checked, and to change the value of the var based on whether it is checked or not. I tried many th...

Can excessive use of final hurt more than do good?

Why are people so emphatic about making every variable within a class "final"? I don't believe that there is any true benefit to adding final to private local variables, or really to use final for anything other than constants and passing variables into anonymous inner classes. I'm not looking to start any sort of flame war, I just hon...

Please tell me what is error in this javascript code

i have written following code to access public variable of asp.net onclick event on button but its not giving me desired output.. please check it: <asp:Button runat="server" CssClass="txtdisplay" ID="Button1" Text="Browse all jobs in area" OnClientClick="return navigateURL('index.aspx?c=<%=cityid %>')" /> ...

JavaScript passing varibles between functions and processing them....

Hello, I'm working on a JavaScript based page that returns the cost of delivery, depending on what the user selects(Region, service(pre 12, etc) and weight). I have muddled my way through as I just dont know JS. My questions are: Can I pass the varible between functions - as detailed in the script below? Once the above has been achie...

How to print name of variable in PHP?

I'm writing a simple script for my webby that would send me an e-mail in case error 500 happens. I want to dump all possible variables, sessions, POSTs or whatever, present at time when error happened, so I can analyze the problem as precise as I can. Here's the code I have for now: function variable_name( &$var ) { $var_name = arr...

Reading and Writing Configuration Files

Hello everybody! I'm writing a small script which generates some configuration for devices. I want to have separate file, where I'm storing configuration, and change some strings during printing the content of the configuration to the browser. How can I replace string in a line of the file with a variable from $_POST['somevariable']? --...

variable conversion and explaination in php and vb.net

hi I have some php code as below. <?php $value = -1924050635; echo "before:".$value; echo "<br/>"; $value = sprintf('%u', $value); echo "<br/>"; echo "after:".$value; ?> Before value is -1924050635 after value is 2370916661 My problem is that what the sprintf is doing here. What i need to do if i want ...

Using php variables to manipulate the html's title and the body's Id (is anybody doing this?)

I basically use php variables to store the value of the title and the body's ID. This last one is a technique to have my button (pressed) in the navigation according to which section of the page the user is (in this case the user will know he is currently at "home"). Beginning of my index.php: <?php $title = "New Project"; $bod...

Regex for parsing comment variables in PHP

I have a comment block that can look like this; /** * variable1: value * variable2: value */ or like this; /* variable1: value variable2: value */ What I need is to be able to match any number of variable/value pairs and add them to an array. I can't seem to figure it out though, I keep matching the wrong things. All variables ...

Build Javascript Variable Using jquery Manipulation

I need to build a string variable using jQuery to find all the text nodes surrounded by span tags. Importantly I need to separate each segment of text with the pipe character "|". For example take the following html: <div id="myDiv"> <span>this</span> <span>is</span> <span>the</span> <span>text</span> </div> Using jQuery I need to pr...

Rails .scan won't work with a model variable using nokogiri

Hello, I 'll try to be as explicit as possible I am using nokogiri to parse links from paths and rules out of a database I have this model: --- !ruby/object:Content attributes: id: "2" name: http://www.****** try description: try url_base: http://www.****** scan_flv: /"file","([^<>]*flv)"\);/imu source_site_id: "2" con...

is local static variable provided by embedded compilers?

im working on a c lib which would be nice to also work on embedded systems but im not very deep into embedded development so my question are most embedded compilers able to cope with local static variables - which i would then just assume in further development OR is there a #define which i can use for a #ifdef to create a global variab...

Running Javascript function after variables are set

Hi and thanks. I have the following functions: // NATION var x, y, z; function flag(nation,area) { x = nation; this.nation=nation; var el=document.getElementById("desc"); el.innerHTML='The region you have selected is <b>'+area+'</b>'; document.getElementById("flag").innerHTML='<img src="images/flags/'+nation+'.jpg">'; } // SERVICE func...

PHP Class Variables emptied in While Loop

I've been dabbling in writing a PHP Class for a few weeks now and I like to think I've got a handle on he basics but I'm a little stumped. As a simplified example of what I'm doing: I have declared and instantiated a public variable ($myURL) in my class (someClass) and in a external file (config.php) to the class filled the variable wi...

Different ways to declare/define variables?

Hello This is a VB.Net newbie question. I'm confused at the different ways to declare and define variables. Here's an example: Dim URL As String = http://www.c-sharpcorner.com/default.asp Dim request As HttpWebRequest = WebRequest.Create(URL) Dim response As HttpWebResponse = request.GetResponse() Dim reader As StreamReader = New Stre...

How do I pass a variable into a jQuery query?

For some reason, this works: var oldText = $("#tayke li:eq(" + theIndex + ")" ).text(); But this doesn't: var tayke_li = "#tayke li:eq(" + theIndex + ")" var oldTest = $( tayke_li ).text(); Note: theIndex is an integer. ...

type of int * (*) (int * , int * (*)())

hi , int * (*) (int * , int * (*)()) I'd like to know what type is it ? , can someone give an example of a declaration using this type. any help would be great. thanks. ...