variables

Global Variables in Objective C

I have a counter which I use to get an object at that counters index and I need to access it in another class. How are static variables declared in Objective C? ...

What's the easiest way to fill gaps in a list of numbers?

Dear reader, I'm having some trouble explaining the question in a single line for the title, but hopefully this description will provide you with enough insight to fully understand my question: I have a few variables in a Word document. Every variable has a Value which is a number (starting from 0 up to the number of variables). A Sort...

Grab/Fetch content and giving specific text a variable using php.

Using php coding, I'm attempting to make a script which will grab content from another URL and give each word/number a php variable. I'm unsure whether this is possible, hence the reason why I've come onto stackoverflow and hoping for assistance from other members. This is what I've currently got: <?php $searchdata = file_get_contents...

How to make the view simpler, the controller more useful?

This question relates to cleaning up the view and giving the controller more of the work. I have many cases in my project where I have nested variables being displayed in my view. For example: # controller @customers = Customer.find_all_by_active(true) render :layout => 'forms' # view <% @customers.each do |c| %> <%= c.name %> <% ...

iPhone Application Delegate variable is not being retained

I am having a very odd issue retrieving/retaining a variable in my iPhone application delegate (AppDelegate). Initially, I can step through and see that my values are passed to logfile (the NSString variable in question), but when logfile is retrieved from another class (see the code below), it faults. Here is my AppDelegate.h file: ...

Can list.findall reference a variable?

Such as: mylist.FindAll(Function(item) item.property = variable) The reason I ask is if I use syntax like this, I tend to get a string to whatevever conversion error, which makes me think "variable" is being treated literally as a string. Thanks. ...

How to update a Ruby hash item inside of a loop over that hash?

I am migrating my PHP code to Ruby and at some point I need to update hash elements inside of a loop. For example: compositions.each_pair do |element,params| params['composition'].each_pair do |item,data| data['af'] /= params['af sum'] data['mf'] /= params['mass'] end end I could make it using item indexes, but it will be...

Storing variables from queries in stored procedures

I have a stored procedure with a username parameter. I want to use one query to grab a userid, then use this variable in further queries. Here's what I have so far. It compiles OK, but on execution I get an error "Error converting data type varchar to uniqueidentifier." ALTER PROCEDURE [dbo].[sp_User_delete] @username uniqueidentif...

first thing i do in my php function is define an array why is undefined later in the function?

Hi. I have a long function with many if statements and such. The first thing i do in my function is this: $text = file($read_text_file); The $text array contain all text in the site therefor I need this array to be available in my entire function and I though I would accomplice this by defining the variable first thing in the function, ...

Targeting multiple variables in jQuery

I know this is probably a very simple fix. I need to use 2 variables for this function and with the current code it only fires on the first variable. Variables MUST be used for the function in question. var a = $(h1), b = $(h2); $(a, b).hover(function(){ ...stuff happens here }); please DO NOT suggest something lik...

simultaneous variable assignation in pascal

I wish to do simultaneous variable assignment in Pascal. As far as I know, it's not possible. Googling on the issue, I can see that many programming languages implement that, but I can't find how to do it in Pascal. For example, in Python I can do this: (x, y) = (y, x) In Pascal, I need an additional variable to hold the value of x ...

Predetermining redirect_to for awesome navigation

I have a slightly complex navigational system with numerous landing pages, multipage forms, and multiple ways of accessing the standard CRUD functions. Objective: To maintain a variable such as (params[:target]) throughout the system such that each controller knows where to redirect a user based on the location and circumstances of the ...

functions in require("x.php") works in some of the code, but cannot be called in the next?

Hi. I have this code ` require("db_connect.php"); function xx() { $conn = db_connect(); //here it works (...) date_default_timezone_set('Europe/Paris'); if(time() <= $x[0]){ (...) }else { (...) for...

Java Variables Basics

Ok, so I am about to embarrass my self here but I am working on a project that I will need to get some help on so I need to get some conventions down so I don't look too stupid. I have only been doing java for 2 months and 100% of that has been on Android. I need some help understanding setting up variables and why I should do it a cer...

Update variables inside the jQuery $(document).ready() base scope?

I'm trying to find a way to minimize the number of Selector look-ups. My issue is that I have a variable defined with base $(document).ready() that needs to be updated inside functions nested inside $(document).ready() Consider this example (EDIT: I updated it to be more explanatory) <script> //var $current_page = $home_page; **<--I ...

MOOTOOLS variable scope

I'm using mootools: I can't figure out how to use a variable when using an addEvent. I want to use a for next loop to set values in a loop: for (x=0;x<num;x++){ var onclickText = 'function (){onclick="addPageMoveEvent('+x+'"); }'; $('pageNum'+x).addEvent('click', onclickText); } > I've search forums but not found any help. Any help...

PHP - temporary variable

Hi I have a function that retrieves some data from the database, formats it as html and then stores this html into a variable, $output. The problem is that $output cannot be echoed on the screen now, only later, after other functions run. Also this data must be retrieved at this stage, not later. so how can I call this $output variable...

SQL Scalar UDF to get number of days in Year

I writing code to determine how many days in a year. I am trying to keep it really simple. I found code that I think is very clean to determine a leap year. I am passing the inputted date using DATEPART(Y,@Year) to the leap year program and some how am not getting the correct results so I has to be in my SQL code to process the input da...

How can I add GET variables to end of the current url in php?

I am trying to add a few different GET variables to the url. I could easily do a header redirect to the current page url and then just add the $_GET['test'] in the url. My problem is that I have some GET variables that are in the url already. What I want to do is: Check if there are any GET variables in the url If there is not, the...

Stopping jQuery cycle function on hover

Hi everyone, I have a function called testimonials() that basically cycles through a set of divs, whereas it animates a div in, animates it out and animates the next one in. Now, I wanted to make it stop on the current DIV once the mouse is on it, otherwise known as hovering it. And I've made it work using a code I got from another pos...