variables

Print all session/post/get variables in ASP.NET page

I am very new to ASP.NET, I'm quite used to PHP (which we unfortunately do not use at work) I'd like to print all the session variables. In PHP it's quite easy, I use: echo '<pre>' . print_r($_SESSION, true) . '</pre>'; for this, but is there an as-easy ASP.NET equivalent? ...

Literal initialization for const references

How does the following code work in C++? Is it logical? const int &ref = 9; const int &another_ref = ref + 6; Why does C++ allow literal initialization for const references when the same is not permitted for non-const references? E.g.: const int days_of_week = 7; int &dof = days_of_week; //error: non const reference to a const objec...

How do you format a 10 digit string into a phone number?

I have database records in the form of 10 character long strings, such as 4085551234. I wish to format these into this format: (408) 555-1234. I think this is regex related. I'm new to programming and completely self-taught here, so any sort of resource relating to performing text processing would be appreciated as well. Thanks! ...

Cocoa / Objective-C: Access a (Boolean) variable in different Classes

Hey People^^ Situation: Noob / Xcode 3.1 I have an AppView (NSView subclass) and an AppController (NSObject subclass) in AppView.h i declare a boolean (BOOL: booleanDraw), which i set to 'NO' in AppView.m When a button is clicked it 'launches' an action (AppController .h/.m) now i want to change booleanDraw to YES when the button is ...

Howto use variable attribute for Jquery lightbox plugin

Hello, I try to implement the JQuery Lightbox plugin with dynamic grouped of images (grouped in image popup), but i can not find the clue for popup grouped images. Can someone tell me what i'm doing wrong? HTML <a href="pic1.jpg" class="pic" rel="lightbox1"><img src="pic1.jpg"/></a> <a href="pic2.jpg" class="pic" rel="lightbox1"><img...

MySQL @variable

I'm trying to set up a MySQL trigger, but I can't figure out how exactly to get what I want done. I think I need to set up a MySQL @variable but what I've tried hasn't worked and I have not been able to find a good resource figure it out. I change the delimiter in phpMyAdmin, and the comment in the below is not used in the actual query. ...

is there a way for keeping a variable from changing inside recursions, in haskell?

i'm trying to define the isInfixOf function, and i came to a solution(hope it works good :-)), but because of the recursion nature of haskell, i wrote another (help) function that almost duplicate the code of the function isInfixOf. this is the code: myIsInfixOf :: (Eq a) => [a] -> [a] -> Bool myIsInfixOf [] [] = True myIsInfixOf [] ...

Pass multiple variables by reference to a foreach loop (PHP)

Scenario/Problem Isolation: Lets suppose my program uses MULTIPLE variables. At the program beginning I want to manipulate MANY of the variables AT ONCE through a general function with LITTLE CODE, before then later in the process using only distinctive few variables in specific functions. Question: How do I pass multiple variables by r...

JavaScript OR (||) variable assignment explanation

Hello, Given this snippet of JavaScript... var a; var b = null; var c = undefined; var d = 4; var e = 'five'; var f = a || b || c || d || e; alert(f); // 4 Can someone please explain to me what this technique is called (my best guess is in the title of this question!)? And how/why it works exactly? My understanding is that variab...

How to call a function and change a variable

Hello, I am calling a function several times as I am testing several responses. I am asking on how I call a function earlier in the program, changing a variable in this function and then calling it. Below is a snippet of the code. class AbsoluteMove(unittest.TestCase): def Ssh(self): p=pexpect.spawn('ssh [email protected]...

Final variable and synchronized block in java

What is final variable ? (if I write final int temp ; in function what is the meaning ?) For which goal use final variable(both class variable and in function variable) ? why variable in synchronized block must declare final ? ...

FLEX: XML to data array?

I need to get a grip on arrays and XML data but I'm having trouble understanding how to turn xml data into useful data. I was hoping these forums might provide some insight. I load my XML with this code: //set values for XML data file private var XML_URL:String = "http://www.mysite.com/media/locXML.xml"; private var locXML:XML = new XM...

Automate Post Of Login Details User & Password Into Safari For Scraping

Hi To All, I am wanting to automate the input of post variables on a login page for the purpose of webscraping. It would improve the process no end if I can get past the login page. Then I can schedule some functions to run on cycle automatically. (Had a go with some CURL commands but could not get the result) Thanks for any help,...

Grepping complex strings in variables.

All - I am trying to grep for a small string in a much larger string. Both strings are being stored as variables. This code is an example - #!/bin/bash long_str=$(man man) shrt_str="guide" if grep -q $shrt_str $long_str ; then echo "Found it!" fi I don't think variable expansion is working the way I expect it to. I have ...

Detecting unset variables in Django templates

As a long time PHP developer, I'm used to the idea of setting the error level for my application to warn me when I am using an uninitialized variable. I was wondering if a similar feature exists in Django, where I can detect at run-time that I am using a variable in my template that was not explicitly passed to the template via the view...

Problem using loop values in function

Hello - Beginners Javascript question here. I am trying to create a function that finds all the links in a given div and sets up an onclick event for each one. I can get the link hrefs correctly, but when I try using them in the onclick function, Javascript seems to only use the last value found: I.E I have these links #purpose #futu...

codeigniter array variable

Here is my code so far, it all works except when I try to make 'company' = $company there's something im missing, and id love to know what if($query) // if the user's credentials validated/// { $this->db->where('username'); $this->db->select('company'); $company = $this->db->get('user'); $data = arra...

Redeclaring function parameters as variables?

I can't seem to find an answer for this anywhere on the 'Net... Is there any reason, advantage, or disadvantage to redeclaring function parameters as local variables? Example: function(param1, param2) { var param1, param2; ...etc... } Seems extremely redundant to me, but maybe I'm missing something...? Thanks, Brian ...

How to assig a PHP variable a value inside a JavaScript block?

if ($page_title->exists()) { //the rest of the code is in php.here i insert a javascript for the confirm box. echo'<script type= "text/javascript" > var b=confirm("This page already exists.would you want to edit"); if(b == true) //here i want to assign a php variable , say for eg. $a to 1 so that i can use that value of $a...

PHP - Worth including the data type in the variable name?

Hello! I'm trying to write my code as maintainable and easy to understand as possible, and I thought of including the type of data a variable holds in its name. e.g: $intCurrentLine = 1; instead of $currentLine = 1; $strUser = 'blah'; instead of $user = 'blah'; I don't think it is really necessary in the above example, but may it be...