Till now I was expecting that there in no block level scope in Javascript. But after reading this article I came to know that block-scoped variables are introduced in javascript. Although this article <[Everything you need to know about Javascript variable scope](http://www.coolcoder.in/2014/03/everything-you-need-to-know-about.html) > has a very good explaination about the javascript variable scope, I am still wondering the list of browsers and their versions where we can start using block-scoped variables. It would be great if you could add to the information about block-scope variable in javascript.

Member Avatar
Member Avatar
+0 forum 3

I am a programmer. That's why I'm receiving a paycheck. I sit alone in a small cubicle and do my work. I don't do desktop support and I'm not interested in working closely with users. So my boss says to me today that I am being signed up for a FIVE day course in..... Microsoft OUTLOOK. You heard right. A five day course learning how to email. And the purpose of this? So I can teach classes to everyone at my job how to use Outlook. Am I a teacher? Nope. Am I a desktop support person? Nope. Do I …

Member Avatar
Member Avatar
+2 forum 13

how to make a bean application scoped so that it will persist as long as the web application is running??? and how can we access it in our controller?? thank you

Member Avatar
Member Avatar
+0 forum 3

I stumbled on upon this anomaly in one of my programs and can't figure out why this is happening. I made a small test function that exhibits the same behavoir. It's like the local variables of my function are being saved after the function exits. The exclude_ids variable keeps growing. This same behavoir is apparent in IDLE, from cmd line, and when compiled. Tested on windows XP & 8. Python 2.7.4 >>> def is_running(exe_name, by_path=False, exclude_ids=[], exclude_this_process=False): from os import getpid from os.path import basename, abspath if exclude_this_process: exclude_ids.append(getpid()) print "exluded ids %s" % exclude_ids return "-----------------" >>> for x …

Member Avatar
Member Avatar
+0 forum 6

How can an array be accessed from within another function? Here is an example of some code. editarray can not seem to access values of the array from outside of the writetofile function. Is there any way to change the scope of the array? #!/bin/sh writetofile() { templine=`cat /dev/stdin` export templine echo "templine is: $templine" var1=$(echo $templine | gawk '{print $1}') var2=$(echo $templine | gawk '{print $2}') var3=$(echo $templine | gawk '{print $3}') var4=$(echo $templine | gawk '{print $4}') var5=$(echo $templine | gawk '{print $5}') echo $var1" "$var2" "$var3" "$var4" "$var5" " export var1 var2 var3 var4 var5 arrayfunction #some …

Member Avatar
Member Avatar
+0 forum 4

Hello! So I currently have a class titled Appliciation which contains a method called start. <?php class Application { /* * Application class */ public function __construct($IceTray){ $this->IceTray = $IceTray; } /* Starts application */ public function start(){ /* Confiures error reporting */ $this->IceTray->Error->configure(); $Path = $IceTray->Path; include APPDIR.'/paths.php'; $Path->start(); } } I'm including this file that will only use the Path object. When the script is run I get this error: Fatal error: Call to a member function set() on a non-object in C:\wamp\www\IceTray\application\paths.php on line 16 So obviously the Path variable/object isn't in the scope of the included …

Member Avatar
Member Avatar
+0 forum 5

I have declared a local variable inside of getAddress. When I try to access that variable inside a local function it falls outside its scope. What am I doing wrong? function getAddress(latlon, map) { var data = ""; $("#map-canvas").gmap3({ marker: { latLng: latlon, options:{ draggable:false, }, }, getaddress:{ latLng: latlon, callback: function(results){ data = results && results[1] ? results && results[1].formatted_address : "no address"; }, }, }); console.log(data); // Outputs empty string }

Member Avatar
Member Avatar
+0 forum 13

Hello, I am new in trying to figure out how to use two classes together. One class is called circle, and is supposed to hold attributes of radius and area. It is also supposed to have the methods of print and computeArea. public class Circle { //global data private double radius; private double area; //constructor /** * <pre> * Description: This is a constructor * * Pre: None * * Post: Creates an object of type circle * </pre> */ public Circle() { } //work methods /** * <pre> * Description: This computes the area * * Pre: None * …

Member Avatar
Member Avatar
+0 forum 4

Ok, so currently I've been trying to recreate missile command, an old atari game. While I've had help from a group in creating the graphics for the game i.e menu, plotter class, etc. I've basically been flying solo as of the game's logic i.e missile detection, health, missiles spawning and all that good stuff. The problem I've come accross is that while I have a *what I think* is a good basis for what classes to have, and how different tasks should be seperated; I'm not quite sure how the classes *located in different files* should be "communicating" with each …

Member Avatar
Member Avatar
+0 forum 7

Can you please help me and tell me what I am doing wrong? I have been looking at the program for two hours and need help. I keep getting this error: 'triangle' was not declared in this scope. Also, that is the only error, so I don't have anymore. Thank you. #include <iostream> using namespace std; int main() { typedef unsigned short USHORT; int shape; cout << "What shape do you want: "; cin >> shape; USHORT shape1 = triangle, square, rectangle, circle; if (shape = triangle) { int triangle; cout << "What is the height: "; cin >> triangle; …

Member Avatar
Member Avatar
+0 forum 13

Based off some stuff from my last thread I tried to write a search results page using maximum 3 parameters. I used a couple of function to try and get everything organized. One: sort_mysql_results has no defined parameters so I can put in as many parameters as needed. The code itself doesn't throw any errors but it obviously doesn't work. I tried debugging by adding echo to each function to see what is being executed. I find only one executes. Code: (kinda long, sorry) <?php function get_soundex_query($str,$member) { $ss = sprintf("SELECT *, SOUNDEX('%s') AS src, SOUNDEX(%s) AS src2",$str,$member); $ss = …

Member Avatar
Member Avatar
+0 forum 15

Hello, I'm in a pickle. (Please observe the code) In the actionPerformed method, I don't know how I can get the value of the variable 'minutes'. I can get 'hours' by e.getActionCommand(), but can't do minutes that way. I need to get both 'hours' and 'minutes' at the same action. Please help. import java.awt.FlowLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.JLabel; public class OuterClass extends JFrame{ private JLabel hours; private JLabel minutes; public OuterClass(){ hours = new JLabel("Hours?"); minutes = new JLabel("Minutes?"); add(hours); add(minutes); InnerClass actionHandler = new InnerClass(); hours.addActionListener(actionHandler); minutes.addActionListener(actionHandler); } private class InnerClass implements ActionListener{ …

Member Avatar
Member Avatar
+0 forum 2

consider public class awah{ private int x=0; private int y; private int w; public awah(int width){ w=width; } public void sety(){ y=(Int)(Math.random()*4);}//meth1 public int gety(){ return y; } public void setx (){ x+=this.gety(); } public int getx(){ return x; } public void showUpdate(){ System.out.println(x); } }//end of awah public static void main(String[] args){ awah m = new awah(5); m.showUpdate(); } I expected the update to show the updated value of x+y but it doesn't I want to be able to update the variable x whenever y is set to some random number //frustrated

Member Avatar
Member Avatar
+0 forum 1

Hello all, I'm new to programming in Objective-C and have some C++ under my belt. As one of my first programs, I'm trying to make a fairly simple app that can record the user's heart rate. I made a class to store all of this information in (called HeartRate), from which I want to make an object. However, I am having issues with the scope and initializing the object. I am trying to initialize it within a method called 'buttonPressed', but the object is not accessible outside of this function. I looked into using the AppDelgate, but didn't have much …

Member Avatar
Member Avatar
+0 forum 1

Hey all, I have created a mail script in PHP for a contact form on my website. I have a message that displays when the message has been sent. I would like this message to display below my form but am having some trouble with this. The message is currently being displayed at the very top of my page. Here is what I have; <?php //mail form code here $variable = 'some text'; ?> <html> <head> <body> blah blah blah <?php echo $variable; ?> blah blah blah This gives me an error saying that the variable does not exist. I …

Member Avatar
Member Avatar
+0 forum 1

I'm having a small problem with a variable in one of my PHP scripts. The variable is `$isSubMenu`. It gets set using a function that runs recursively called createNavigationMenu. However, even though I have set it, the interpreter keeps telling me that the variable is undefined. I really don't know what's going on because I've checked several times and I'm sure that it IS defined. Does this have anything to do with the fact that the function is being called recursively? Any input would be greatly appreciated. Thanks for your help in advance. Dodzi P.S. How do you turn on …

Member Avatar
Member Avatar
+0 forum 17

i am ensuring on both pages i have first of all called session_start(); on one page i declared $_SESSION["username"]=$username; the link of another page is on this page. and another page i tried to print it by echo $_SESSION["username"]; but it showed nothing. i am using php 5.4 with apache and mysql. lookin for your reply. thanks in advance.

Member Avatar
Member Avatar
+0 forum 5

Hey, I get confused when dealing with the static scope and dynamic scope, and for this pseudocode I have to find both. For static I believe it should print out: 9 4 2 3 however, I'm not entirely sure. Any help would be appreciated, thanks. [CODE]Procedure main g:integer procedure B(a : integer) x:integer procedure A(n:integer) g:=n procedure R(m:integer) write_integer(x) x/:=2—integer division if x>1 R(m + 1) else A(m) --body of B x:=a X a R(1) --body of main B(3) write_integer(g) [/CODE]

Member Avatar
+0 forum 0

This is the project I am reading from . [url]https://github.com/sasatomislav/PHP5-OOP-Cart[/url] [CODE] class Cart { <snip> private function __construct() {} /** * Fetch Cart instance * * @return Cart */ public function getInstance() { if (NULL === self::$_instance) { self::$_instance = new self; } return self::$_instance; } } <snip> // initialize shopping cart // note that Cart implements Singleton pattern $cart = Cart::getInstance(); [/CODE] How is getInstance which is not a static method, called using :: . [QUOTE]the double colon, is a token that allows access to static, constant, and overridden properties or methods of a class.[/QUOTE] getInstance is neither static …

Member Avatar
Member Avatar
+0 forum 8

I was working on a project when I thought that maybe a ::. operator would look funny in some code. Just for fun I typed that into the global scope area like this: [CODE]::. int main() { //etc...[/CODE] and my code completion software said too many results to display. My question is what results could it be talking about? Is it possible to define global operators?

Member Avatar
Member Avatar
+0 forum 4

Hello everyone, I am creating UDF using CREATE FUNCTION statement. The question is how can I make them globally accessible to all the databases, rather than specific database? Regards,

Member Avatar
Member Avatar
+0 forum 3

Hi Guys, What is the scope of the exception variables when I catch them by reference. [CODE] try{ throw AnExceptionObect("Exception message"); } catch(AnExceptionObect &exp){ logger << exp.what(); //logger is a dummy object throw; //what will happend now? is it going to be throwen by value? and what if I catch this object on seperate module/so/dll as reference again? } [/CODE] Thanks in advance. S

Member Avatar
Member Avatar
+0 forum 4

Hello, please can I have some clarification to check I am not doing something very stupid? It seems sensible with all that I have read, but I'm not confident. I suspect I have memory leaks and want to make sure some fundamentals are correct before I start looking deeper. My code is very big so I can't reproduce it here. Instead, I have tried to illustrate with a simpler example. In my code I have a class: [CODE] class MyClass { ... int Member; public: setMember(int value); ... } MyClass::setMember(int value) { Member=value; } [/CODE] Originally, when I passed my …

Member Avatar
Member Avatar
+0 forum 7

Dear all I am brand new to C# and have previously only written programs in Javascript, so go easy on me ! I have written an "app launcher" program which reads a text file line by line. Each line is just a path to a program e.g. C:\Users\Matt\Desktop\Gravity.exe So far, my program can successfully read each line and produce a list of links. As intended, each link appears as the path itself. The problem I am having is that these links will not work. However they WILL work if they are all just given the same fixed path. I would …

Member Avatar
Member Avatar
+0 forum 5

I have a nested class declared as: [CODE]class A { class B { // members }; // members }; [/CODE] Is there a good way to avoid typing A::B every time I need to access B's members? I'd just like to do this in one .cpp file. I tried "using namespace A;" but I found out that class scopes and namespace scopes are not the same thing.

Member Avatar
Member Avatar
+0 forum 3

Even after looking at a lot of books, I am not able to understand the problem in the following code: [CODE] //1.c static int y=23; void abc(int a){ printf("%d\n",a); } [/CODE] [CODE] //2.c #include<stdio.h> #include "1.c" int main(){ abc(12); printf("\n"); printf("%d\n",y); return 0; } [/CODE] I can understand that the functions abc is accessible to this file, but how is this variable y accessible here? [QUOTE]The static declaration, applied to an external variable or function, limits the scope of that object to the rest of the source file being compiled. from: dennis ritchie[/QUOTE] So, how is this static variable in …

Member Avatar
Member Avatar
+0 forum 9

Is there any way to implement a scope change for the template keyword? I have a templated class with almost 100 different functions and my code looks disgusting with my external declarations. Is there any way to implement a scope increase for template? EG: [CODE]template <typename Type> class TypeClass { public: Type a(); Type b(); Type c(); }; //Without template scope: template <typename Type> TypeClass<Type> A(); template <typename Type> TypeClass<Type> B(); template <typename Type> TypeClass<Type> C(); //With template scope: template w/ scope <typename Type> TypeClass<Type> A(); TypeClass<Type> B(); TypeClass<Type> C(); [/CODE] Is this at all possible, or should I just …

Member Avatar
Member Avatar
+0 forum 3

Hello all, I'm taking a intro computer science course, yet somehow I'm much better at c++ than python. My professor is essentially useless. Can anyone show me how to let these variables persist into global scope? I assumed declaring them globally would make them persist, yet it appears to not. Thank you. (There are a few things that are irrelevant at this point-- just thinking ahead. Example is the strAlpha list) [CODE] # Riveter -- Justin M strPlayer1 = "" strPlayer2 = "" nHeight = 0 nWidth = 0 strAlpha = "a b c d e f g h i …

Member Avatar
Member Avatar
+0 forum 8

Hi, I'm working on a linked list filled with class objects and I've encountered a weird problem that I cannot see how to resolve. I declare 2 self-referential pointers within my 2 classes and the error: In file included from prog2.cpp:16: employeedatalist.cpp: In function âvoid getData(std::fstream&)â: employeedatalist.cpp:15: error: âheadâ was not declared in this scope employeedatalist.cpp:19: error: ânextâ was not declared in this scope Here is the code with the error: [CODE]#include <iostream> #include "employeedatalist.h" using namespace std; /** This function creates an EmployeeDataList Object from a file. This is the linked list to be used! */ void getData(fstream& dataFile) …

Member Avatar
Member Avatar
+0 forum 14

Nevermind, I wanted to delete this post, but did not want to bother emailing the moderator. Sorry.

Member Avatar
Member Avatar
+0 forum 5

The End.