variables

Multiple views in codeigniter

Hello, I am working on a codeigniter site, in which a page is built using multiple views, I have come to a point where I need to work with a variable that is being set in another view is it possible to access it from another view? This is code I have Controller: public function index() { // $this->output->enable_profiler(TRUE); ...

Session is saving only records and it's not saving the rest of the records in PHP?

function mycart($mydate=null,$day=null) { $mycart= $this->session->userdata('mycart'); $totalprice=$this->session->userdata('totalprice'); if($this->limitation($mydate) && (!(isset($mycart[$mydate]))) ) { $mycart[$mydate] = array( 'meal' =>$this->session->userdata('meal'), 'day' =>$day, 'date'...

Singleton vs CodeIgniter -style $this to access variables

Hi, I wonder, what are the pros and the cons of these two approaches to access variables: 1) CodeIgniter -style (does this have a name?) public function doSomething() { $database = $this->database; // or just $this->database } 2) The Singleton pattern public function doSomething() { $database = Framework_Database::getInstance(); ...

derived class cannot display value of base class variables in C#

I am trying to execute the following code class A { protected int a; protected char b; public void Show() { a=5; MessageBox.Show(""+a); } } class B:A { public void Show() { b='z'; MessageBox...

Assign variable to manipulated data from jQuery getJSON results

How to assign a variable to returned JSON data that has been manipulated with .replace() as shown below. Purpose: build the URL for the video thumbnail image from video ID returned by JSON. Question: How to assign a video ID (ex. mVWhWsgHzKM) to a variable so thumbnail URL can be constructed. $.getJSON( 'http://gdata.youtube.com/fe...

Named arguments as local variables in Ruby

I find myself constantly writing what I see as unnecessary code in Ruby when using named arguments for methods. Take for example the following code: def my_method(args) orange = args[:orange] lemon = args[:lemon] grapefruit = args[:grapefruit] # code that uses # orange, lemon & grapefruit in this format which is way prettie...

batch file string concatenation

I have a directory for which I want to list all the .doc files with a ";" I know the following batch command echos all the files for /r %%i In (*.doc) DO echo %%i But know I want to put them all in a variable, add a ';' in between and echo them all at once. How can I do that? set myvar="the list: " for /r %%i In (*.doc) DO <what?> e...

XSLT Assignment of element value to variable: Works with Altova XML Spy, but fails in .NET app.

I want to tightly grasp the hair on the back of a Microsoft employee's head, using it as leverage to pound his head forcefully and repeatedly against a hard surface! That would make me feel nearly as good as solving this problem right now. I've got a simple XML message that looks like this: <?xml version="1.0" encoding="utf-8"?> <mess...

How to get all the variables in _level0 using ActionScript 2.0

I have a loader loading two files. One can be anything, and the other is the one im working on. It has a textField.text within which it should list the variables in _level0 for both files. I dont mean objects or info like what os im using (which is all i can get now). I mean the vars defined in the AS. Like what you get when you debug yo...

Unsetting a variable vs setting to ''

Is it better form to do one of the following? If not, is one of them faster than the other? unset($variable); or to do $variable = ''; ...

How do you override a Constant in Doctrine's Models?

In Doctrine you are provided with a Constant Variable that allows you to set a global Identifier column in all of the models that are generated by Doctrine's code. I am trying to figure out how I can override/shut off this value so that it does not create this column in a specific table. The Constant is: ATTR_DEFAULT_IDENTIFIER_OPTION...

Pythonize Me: how to manage caller context variables in Python? (Python/Django)

I'm trying to refactor a fairly hefty view function in Django. There are too many variables floating around and it's a huge function. Ideally, I want to modularize the view into logical functions. However, I have to pass the function context around to get easy access to the variables. For example, def complex_view(request, slug): ...

Can a variable like 'int' be considered a primitive/fundamental data structure?

A rough definition of a data structure is that it allows you to store data and apply a set of operations on that data while preserving consistency of data before and after the operation. However some people insist that a primitive variable like 'int' can also be considered as a data structure. I get that part where it allows you to store...

Creating a new variable from a conditional operation on 3 old variables in R

Hi, I have a dataset in R, which contains the results of a rapid diagnostic test. The test has a visible line if it is working properly (control line) and a visible line for each of the two parasite species it detects, if they are present in the patient sample. The dataset contains a logical column for each test line, as follows: (dat...

Django/Python - Try/except problem

Hello, i have code like this: try: var = request.POST['var'] except NameError: var = '' Why always code after "except" is executing? Even if request.POST['var'] exist. ...

[ASP.NET] Application variables global to Webgarden

Hello, I am currently trying to program an online drawing program using the HTML5 canvas. The thing is, I need to have the current canvas saved somewhere globally. Static variables work, but they do not get shared across a Webgarden. This results in two different drawings being created. I will have to somehow create a new application...

input field value in session variable in php

Can we use input type value in session variable without any form submitting like there is an input field now i want to save above input field value in a $_session['anyname']; when there is no form in page. ...

Converting: #define xxxxxx ((LPCSTR) 4)

In WinCrypt.h I see: #define CERT_CHAIN_POLICY_SSL ((LPCSTR) 4) WINCRYPT32API BOOL WINAPI CertVerifyCertificateChainPolicy( IN LPCSTR pszPolicyOID, IN PCCERT_CHAIN_CONTEXT pChainContext, IN PCERT_CHAIN_POLICY_PARA pPolicyPara, IN OUT PCERT_CHAIN_POLICY_STATUS pPolicyStatus ); The first argument takes CERT_CHAIN_...

Useage of variables in XML file

My XML file look like this: <?xml versiion="1.0" encoding "utf-8"?> <graph caption='chart' xAxisName='songs' yAxisName='votes' showNames='0' decimalPrecision='0' formatNumberScale='0'> <set name='song name' value='1233' color='AFD8F8' /> <set name='song name' value='857' color='F6BD0F' /> <set name='song name' value='671' color='8BB...

C#.net to Vb.net

I was trying to convert some C# code to Vb.net but there was a variable with an asterisk, which apparently VB.net doesn't support. (pointer variables I think they were called, were it refers or something) How would I convert that into VB.net ...