38 Topics
|
|
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 … |
|
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 … |
|
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 |
|
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. … |
|
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 … |
|
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 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, … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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. … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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, … |
|
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 … |
|
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 … |
|
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 { … |
|
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. … |
|
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 … |
|
Nevermind, I wanted to delete this post, but did not want to bother emailing the moderator. Sorry. |
The End.