variables

Why can't I use a Perl variable's value to access a lexical variable name?

Why does this print 42: $answer = 42; $variable = "answer"; print ${$variable} . "\n"; but this doesn't: my $answer = 42; my $variable = "answer"; print ${$variable} . "\n"; ...

Access a Javascript variable from PHP

I need to access a javascript variable with php. Here's a stripped-down version of the code I'm currently trying, which isn't working: <script type="text/javascript" charset="utf-8"> var test = "tester"; </script> <?php echo $_GET['test']; ?> I'm a complete noob at both js and php, so would really appreciate any advice. UPDAT...

Php variables end up NULL (but the code works)!

I use the following code to change the language in my website: <?php session_start(); header('Cache-control: private'); // IE 6 FIX function get_lang(){ if(!empty($_GET['lang'])) return $_GET['lang']; if(!empty($_SESSION['lang'])) return $_SESSION['lang']; if(!empty($_COOKIE['lang'])) return $_COOKIE['lang']; return 'en...

How to get method name from VariableDeclarationStatement

hi, i have a variable of type VariableDeclarationStatement. I want to get the name of the method from this variable . How can i do that?Help ...

How do I store the results of my select statement in a variable?

My code so far is this. The last line gives me a compile error: "expected end of statement". Dim strSql As String Dim groupId As String strSql = "Select ID from RevenueGroup where description = '" & ListO.Value & "'" groupId = CurrentProject.Connection.Execute strSql ...

how do I find the h&w of an image and convert to vars, then use those vars

ok, here's the deal: I'm using a nice plugin I got from http://www.webmotionuk.co.uk/php-jquery-image-upload-and-crop/ It's nice and all, but it doesn't solve a particular problem: I'll have users uploading images of differing sizes and aspect ratios, so, here's what they provided: function preview(img, selection) { var scaleX = 160...

Getting real-time variables from a java runtime environment's (virtual machine) memory?

Say I have a couple of java runtime environments running on my system which are used by several applications. I would like to programmatically interact with these applications by reading their memory. A typical approach would be to directly look into this application's memory, however for java applications this seems to be practically i...

Pointers and Variables

I just need some clarification on variables A normal variable has 2 "parts" to it? one part is the actual value and the other part is the location of that value in the memory Is that right? So a pointer variable is just the location part of a normal variable, and it doesn't have value itself? ...

[PHP | MySQL] multi-page forms and SESSIONS vs HIDDEN form data

I'm working on a 2 page form that POSTs a query to a database. Read-only, no writing. None of the information is confidential, nor will it every be. The site must be 100% non-JS compliant, so Ajax and the like are not available. All I got is PHP, baby! FORM-2's content is dependent on a fraction of the data in FORM-1, but ALL of the da...

How to get all returned lines with each oracle errror message into one variable using perl

How do i get all of the lines of "$dblink is down" into one $l_msg string? Ideally I would like to get the error returned by oracle on failure and I cannot see a way to solve this. my $dblinks = $l_dbh->selectcol_arrayref("select dbname from db_link"); for my $dblink (@$dblinks) { my $l_results = eval { my ($l_erg) = $l_dbh->s...

how to set a variable for external javascript file?

I am trying to figure out how to set my session_id variable to to be used in an external js file. Here is what I have. php file: $output = '<script src="test.js"> var session_id = '.$_SESSION['id'].' </script>'; print $output; js file: alert(session_id); With this I am getting an error saying session_id is not defined. Is the...

Using a regular expression in perl to list variables from another perl script

My thoughts on how to grab all scalers and arrays out of perl file went along the lines of: open (InFile, "SomeScript.pl"); @InArray = <InFile>; @OutArray = {}; close (InFile); $ArrayCount = @InArray; open (OutFile, ">outfile.txt"); for ($x=0; $x<=$ArrayCount; $x++){ $Testline = @InArray[$x]; if($Testline =~ m/((@|\$)[A-Z]+)/i){ $O...

javascript variable?

I have this: function OpenVote(id, stemme) { var postThis = 'infoaboutvote.php?id='+id+'&stemme='+stemme; } and this: <script type="text/javascript"> OpenVote(10, CripO); </script> Why have i done wrong? as you see i want 10 to be "id" and CripO to be "stemme" ...

How do I categorize user input in C#

I've learned how to store a single input of data and return a value based on it. What I want to do is obtain multiple inputs from the user, then return a result. But how do I define each input? Like, if I want the first input to be known as 'stock', and the second as 'value', how do I do that? I hope I explained my question properly....

Why does the Java compiler complain about a local variable not having been initialized here?

int a = 1, b; if(a > 0) b = 1; if(a <= 0) b = 2; System.out.println(b); If I run this, I receive: Exception in thread "main" java.lang.Error: Unresolved compilation problem: The local variable b may not have been initialized at Broom.main(Broom.java:9) I know that the local variables are not initialized and is your duty to do t...

Dynamically Creating Variables In Actionscript 3.0?

i'm loading several sound files, and want to error check each load. however, instead programming each one with their own complete/error functions, i would like them to all use the same complete/error handler functions. a successfully loaded sound should create a new sound channel variable, while an unsuccessfully loaded sound will prod...

jQuery detect keystrokes and set variables accordingly

I have created a rudimentary EasterEgg within my code to activate when the following keystrokes are made (not simultaneously) Enter + c + o + l + o + r + s with the following code: isEnter = 0; isC = 0; isO = 0; isL = 0; isR = 0; isS = 0; $(window).keydown(function(e){ if(e.which==13) isEnter = 1; if(e.which==67) isC = 1; if(e.which...

Pass model from url to create_object generic input view

I have multiple models that I want to create generic inputs for. My first pass used two separate urls: url(r'^create_actor/$, create_object, {'model': Actor, 'template_name': 'create.html', 'post_save_redirect': '/library/', 'extra_context': {'func': 'Create Actor'}, 'login_required': 'True'}), url(r'^create_movie/$, create_object, {'...

jQuery global variable problem

var id = $(this).children().html(); // id is 5 $.ajax({ url: 'ajax.php?id=' + id, success: function(data) { id = data; // id is 1 } }); if(id == 1){ // id is again 5 ... } Why in the following example I can't reinitialize the id variable? What is wrong? Thanks. ...

Tinyxml to print attributes

I'm trying to get std::string from attribute's value with TinyXml. The only thing I can get is a const char * val, and I can't find any way to convert from const char * to a std::string. so two possible answers to that: 1. How to get a string of an attribute with TinyXml? 2. How to convert const char * val to string val. this is the co...