FAQ Database Discussion Community


'ViewController.Type' does not have a member named 'array'

arrays,class,swift,var
I see people are having this problem a lot. var array = [1,1] class arrays { var array2 = array //'ViewController.Type' does not have a member named 'array' } please help...

Javascript, require var

javascript,node.js,require,var
helper.js I usually program in Ruby. I want to get this info: var shopInfo = { "shopName": "The Coffee Connection", "address": "123 Lakeside Way", "phone": "16503600708", "prices": { "Cafe Latte": 4.75, "Flat White": 4.75, "Cappucino": 3.85, "Single Espresso": 2.05, "Double Espresso": 3.75, "Americano": 3.75, "Cortado": 4.55, "Tea": 3.65, "Choc...

Updating a variable when input changes in jquery

javascript,jquery,html,var
I'm trying to create a simple px to em converter that automatically calculates the values when one of the input fields is changed. I've got the code to calculate the values but it won't update when a value is changed. Heres the HTML <body> <h1>PX to EM converter</h1> <div id="base">...

node.js / typescript var vs import

javascript,import,typescript,var
What is the difference between import http = require('http'); and var http = require('http'); I am seeing both ways being used in code source, are they interchangeable?...

Run Function in original page from window.open javascript

javascript,jquery,function,var
how can I run Function in original page from window.open original_page.html <div id="Processing" style="display:none;"> <button onclick="window.open("Processing_window.html")">open</button> </div> <script language="JavaScript"> function submit_form() { var upgradeForm = document.getElementById('upgradeForm'); setTimeout("upgradeForm.submit()",3000); } </script> ======== Processing_window.html <script language="JavaScript"> function Processing_window() { var doc = window.opener.document,...

Get a PHP var with other PHP var

php,var
I know the title is not describing the problem very well, so I explain here: I have multiple $_POST with similar names, like question1,question2,question3... I have a for loop with $i. i want to get this vars ($question1, $question2), in help with $i. For example: $question.$i = $_POST['question' . $i];...

how can convert var to List c#

c#,list,var
I would like to convert var to list value . I am getting 'myobj' var value. Now how can i convert to CandidateResume list ?. JavaScriptSerializer jsSerializer = new JavaScriptSerializer() { MaxJsonLength = 86753090 }; var myobj = jsSerializer.Deserialize<List<List<CandidateResume>>>(description); My CandidateResume class like this public class CandidateResume { public string...

JS Script Returns NaN

javascript,jquery,variables,var,nan
I am having trouble with NaN - Not a Number. I have looked at multiple web resources and couple of questions here to try and find a solution but none of them worked. Any Ideas: var cur_lv = 1; var newscount = document.getElementById("newscount").value; var btn_up = document.getElementById("btn_up"); var btn_down =...

Meteor Timed variable resets

meteor,reset,clock,var,timed
I'm making a game with meteor and I want certain variables to reset at the end of everyday.. DO you know how I would go about doing that? Like at the end of everyday the amount of turns goes back to ten.

How do you print two variables within brackets in Python 3?

python,variables,printing,var
I have this line of code: print ("(x %s)(x %s)") % (var_p1, var_p2) But it does not work, I am new to programming and I don't know what I have done wrong. Any experts out there with a simple answer? I wanted it to randomly select an equation for a...

Default to original textarea val on Esc

jquery,textarea,keypress,var,revert
I'm trying to make an textarea default to the original value upon hitting esc. I can't seem to pass the origVal from the main code into the keypress if/else. Am I overthinking this or underthinking it? Fiddle: https://jsfiddle.net/kirkbross/brkbcr5c/1/ $(function() { var origVal = $("#textarea").val(); // set original value of textarea...

Swift var addition does not work

ios,swift,var,addition
I have multiple var Now I want my var totalScore to be = my other var added here's my code var section1score: Int = 0 var section2score: Int = 0 var section3score: Int = 0 var totalScore: Int = section1score + section2score + section3score This code is not working... in...

Reading a cookie into textbox (Javascript)

javascript,cookies,var,onunload
I wrote a cookie to hold the value of txtFirstName on the unload event. This is done on the unload event so it can be written without the need for a submit button: <head runat="server"> <title>Cookie Test</title> <script type="text/javascript"> function WriteCookies() { var d = new Date(); var n =...

what happens to a “local” var after expression?

swift,local,var
Note: "local" meaning contained with in {} What happens to localVar after func has been expressed? var constantVarHolder = Int() func NameOfFunc(){ var localVar = Int() if X = 0 { localVar = 3 } else { localVar = 4 } constantVarHolder = localVar } Does it become de-initialized, as...

PHP dynamic var from string

php,dynamic,var
I know how PHP dynamic vars work, I know I can access object property like $object->{'somethingWith$var'}; or like $object->$var; But what I try to accomplish is to access $object->property->subproperty from $object and the string $string = 'property->subproperty';. I tryed $object->$string, $object->{$string}, $object->$$string hahaha, none worked. Does anybody know how to...

How to insert an ID from an HTML document into a VAR function in JavaScript?

javascript,html,var,typeid
Im trying to make an 'online' (HTML document) file that has an input to solve math, and I need a way to type in the numbers, and insert a 'solve me' button. I have the button, and the form by ID and class as well. This is what I inserted...

How to read a variable value in the AppDelegate from a ViewController using Swift

swift,var
I would like to read the value of a variable contained in the AppDelegate from a ViewController. The variable contains the Device Token used to enable iOS Push Notifications and I would like to show it in a UILabel. This is my code so far: AppDelegate.swift import UIKit @UIApplicationMain class...

Keyword var performance for compilation

c#,visual-studio,compilation,resharper,var
Refactoring a big project (in term of code lines) I got to know ReSharper and the topic using var instead of the type which will only affect in compilation time. Does it makes a big impact in the compilation time? I would like to define a code style for it...

Update tag in page, when user changes his selection, with PHP and jQuery

php,jquery,ajax,var
I need to update a post image, whenever user changes his selection in a "select html tag". I'm trying to use jQuery and php in order to do that. I need to get the id of the option the user selected. than i want to use this id to get...

Need to convert code from c# to java

java,c#,select,foreach,var
I never learnt C#. Here I got in C# & I need to use this method into java. I tried with different combination & permutation. But I didn't get success into this. String word = "#############"; foreach(var c in from ch in word where ch >= 'B' && ch <=...

store a var local on a pc with javascript

javascript,var
I am trying to store the highscore of a player local, on his pc itself. I don't know if this is possible and I didn't find a question about it on this site. I just have a var wich contains a number. I want to store it on his pc...

php in external javascript file

javascript,php,var
I have a the code below in my js which obviously works if the js is in the php file filter: '<?php echo $my_cat>' how can i make a variable maybe in the php file and pull it in my external js file?...

Making var 's in a for-loop

c#,for-loop,var
It is hard to explain but I will show an example of what I want in my code: At the moment I do it this way: var something1 = new (Microsoft.Office.Interop.Excel.Worksheet)appExcel.Worksheets.Add(Type.Missing, appExcel.Worksheets[appExcel.Worksheets.Count], 1, XlSheetType.xlWorksheet); var something2 = new (Microsoft.Office.Interop.Excel.Worksheet)appExcel.Worksheets.Add(Type.Missing, appExcel.Worksheets[appExcel.Worksheets.Count], 1, XlSheetType.xlWorksheet); var something3 = new...

jquery get .offset value of a variable(element) then animate to it

jquery,jquery-animate,offset,var
I have a simple navigation. <nav> <a href="#section1">page 1</a> <a href="#section2">page 2</a> <a href="#section3">page 3</a> </nav> When the user clicks on one of the links, I want the page to animate to the corresponding section on the page. I can't seem to get the .offset().top value from a variable though....

How do I assign an INT from comboboxes to add them and display result in textbox1

c#,combobox,int,var
I am trying to have a dynamic set of comboboxes that change based on the last selection. However, I want them to create a custom string of numbers for each possible outcome. When I would like is to have each one add a value of 1s, 10s, 100s, and 1000s....

MySQL : Select three last item INNER JOIN [duplicate]

mysql,inner-join,union,var,multiple-tables
This question already has an answer here: Using LIMIT within GROUP BY to get N results per group? 11 answers Just have a tricky blockING with MySQL. I've 3 tables : TV | TV_ID | TV_name | ---------------------- | 1 | HBO | | 2 | BBC | |...

How to declare a variable in scala

scala,dictionary,var
I am new to scala. I come from a c++ a background. In c++ i was able declare a variable then initialize it later. int x; x=0; How do I do it scala. I have a Map variable. I want to declare without any value. Then later I want to...

string array remains blank after calling it

javascript,jquery,function,call,var
When call this from the file hfunc.js the var vid appears to be blank in my DOM. (I've checked it with alert(vid.length)): var vid = []; $(document).ready(function wfiller() { for (var n = 0; n < 1; n++) vid[0] = '<iframe width="560" height="315" src="https://www.youtube.com/embed/0xpAqxH2Kzw" frameborder="0" allowfullscreen></iframe>'; }); on head tag:...

“use strict”: Assign Value to Multiple Variables

javascript,variables,var
Is there any other way in "use strict"; javascript to initialize a value to multiple variables? Because doing this: var x = y = 14; will cause error: Uncaught ReferenceError: y is not defined Got my reference here: Set multiple variables to the same value in Javascript...

Get the combined value of multiple select menus jQuery

jquery,var
Working on a project with a vehicle selector. The idea is that the user selects their make, model, and year from select menus, and when they click the add button, it adds the combined value of the three (in a specific order) to an adjacent unordered list. I'm just now...

Is it important to define a var when you can define in a function?

javascript,var
I have questions about defining a var in Javascript. Here is a JS Bin var newText=document.getElementById("myinput").value; document.getElementById("changebutton").onclick=function(){ newText=document.getElementById("myinput").value; document.getElementById("firstdiv").innerHTML=newText; }; <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>JS Bin</title> </head> <body> <input id="myinput" type="text" value="test" /> <button...

JMeter - Using Variables from other BeanShell Pre/Post-Processors?

jmeter,var,beanshell
Is there a way to reference a variable from one BeanShell Pre/Post-Processor to another BeanShell Processor (they are within the same Thread Group)? If I create a String variable inside a BeanShell PreProcessor under an HTTP Request, can I then use or reference that variable inside a BeanShell PostProcessor under...

Block scope, function scope and local scope in Javascript

javascript,scope,var,let
Is block scope sometimes the same as function scope? I know function scope is for everything inside a function, but don't get what exactly a block scope is. For Javascript, is it currently recommended to use let / const instead of var for future maintenance? (This was from Airbnb...

Autohotkey get user domain variable

variables,dns,autohotkey,var
I'm wondering that there's no %userdomain% variable analog in Autohotkey. I've found some info about the registry-using-solution but maybe there's some other ways? There's a lot of variables such as "A_Username" included in AHK but nothing for the domain info....

Adding a int variable to a Label and give it +1

c#,int,var,counting
I'm busy with an maze and i currently run on this problem. I want when ever someone hits the wall he uses the method Movetostart and i want to let it count with the var death. So far i got this. int death = 0; private void MoveToStart() { Count.Text...

`po` gives `error: :1:1: error: use of unresolved identifier`

debugging,swift,console,var,po
I have this problem with po in the console where trying to output a function works in itself, but outputting a variable or constant doesn't. As you can see here, although you'd think the var/let holds the content of bar.boy(), Swift somehow can't find it......

PHP return values from Wordpress within loop

php,wordpress,function,return,var
I'm having some trouble returning values from a function. The function itself contains a loop that gets, and assigns, a bunch of variables from a wordpress blog. What I want to do is return the variables defined in the loop so I can simply echo them elsewhere. I need to...

Set ID as JavaScript var

javascript,var
This is probably very simple but isn't working for me. I need to reference and ID several times in my script, so want to use a var for the ID, in case I need to change the ID at a later date. My code is var dataID= '#dataID'; var inputData...

Is there any reason I wouldn't use “let”?

javascript,const,var,ecmascript-6,let
Now that we can write ES6 and deploy it to browsers (using Traceur or 6to5 to support legacy user agents), is there any reason why we wouldn't use let or const as our default keywords for variable declaration? Is var dead? And if it is, can I configure my linting...

Declare a var without initializing it… just yet

c#,.net,var
Is there a way or a trick to do something like: var existingUsers; // This is not possible, but i need it to be global :) try { existingUsers = Repo.GetAll(); // This may crash, and needs to be in a try } catch (Exception) { throw new Exception("some error,...

Very weird behavior when using “var” keyword in an ajax request

javascript,ajax,variables,var
I've been worrying about this for a while and I can't realize what's really happening. Explanation in code comments. There are 2 versions of an application, one of them throws weird results and the second one does the expected work. var id = "test1"; $.post("http://fiddle.jshell.net/echo/json/", {"data": "data"}, function(a) { alert(id);...