Issue I have a simple scoping issue that is eluding me. Here is a simpler version of the code but employs the same principle. function myFunction(){ $(‘.selector_1, .selector_2’).click(function(e){ var $trgt = $(e.target); var myVAR; if ($trgt.is(‘.selector_1’)){ myVAR = ‘selector_1’; }
Continue readingTag: scoping
Javascript variable scope issue
Issue I have a simple scoping issue that is eluding me. Here is a simpler version of the code but employs the same principle. function myFunction(){ $(‘.selector_1, .selector_2’).click(function(e){ var $trgt = $(e.target); var myVAR; if ($trgt.is(‘.selector_1’)){ myVAR = ‘selector_1’; }
Continue readingJavascript variable scope issue
Issue I have a simple scoping issue that is eluding me. Here is a simpler version of the code but employs the same principle. function myFunction(){ $(‘.selector_1, .selector_2’).click(function(e){ var $trgt = $(e.target); var myVAR; if ($trgt.is(‘.selector_1’)){ myVAR = ‘selector_1’; }
Continue readingJavascript variable scope issue
Issue I have a simple scoping issue that is eluding me. Here is a simpler version of the code but employs the same principle. function myFunction(){ $(‘.selector_1, .selector_2’).click(function(e){ var $trgt = $(e.target); var myVAR; if ($trgt.is(‘.selector_1’)){ myVAR = ‘selector_1’; }
Continue readingJavascript variable scope issue
Issue I have a simple scoping issue that is eluding me. Here is a simpler version of the code but employs the same principle. function myFunction(){ $(‘.selector_1, .selector_2’).click(function(e){ var $trgt = $(e.target); var myVAR; if ($trgt.is(‘.selector_1’)){ myVAR = ‘selector_1’; }
Continue readingJavascript variable scope issue
Issue I have a simple scoping issue that is eluding me. Here is a simpler version of the code but employs the same principle. function myFunction(){ $(‘.selector_1, .selector_2’).click(function(e){ var $trgt = $(e.target); var myVAR; if ($trgt.is(‘.selector_1’)){ myVAR = ‘selector_1’; }
Continue readingJavascript variable scope issue
Issue I have a simple scoping issue that is eluding me. Here is a simpler version of the code but employs the same principle. function myFunction(){ $(‘.selector_1, .selector_2’).click(function(e){ var $trgt = $(e.target); var myVAR; if ($trgt.is(‘.selector_1’)){ myVAR = ‘selector_1’; }
Continue readingJavascript variable scope issue
Issue I have a simple scoping issue that is eluding me. Here is a simpler version of the code but employs the same principle. function myFunction(){ $(‘.selector_1, .selector_2’).click(function(e){ var $trgt = $(e.target); var myVAR; if ($trgt.is(‘.selector_1’)){ myVAR = ‘selector_1’; }
Continue readingJavascript variable scope issue
Issue I have a simple scoping issue that is eluding me. Here is a simpler version of the code but employs the same principle. function myFunction(){ $(‘.selector_1, .selector_2’).click(function(e){ var $trgt = $(e.target); var myVAR; if ($trgt.is(‘.selector_1’)){ myVAR = ‘selector_1’; }
Continue readingjavascript: How to make a module to behave like and object and a function simultaneously?
Issue I’m trying to build myself a little helper library. first, for learning purposes, then that later I can extend it so it may come in handy in projects. I understand somewhat the prototype referencing, closures, and scoping. I also
Continue readingType of variable scoping in vba language
Issue I try to understand the VBA scope type, it’s impossible to make this such of thing in VBA, but it’s possible in other language (java,scala,etc): public sub try() dim myVar as String myvar = “hello world” Call displayVar() end
Continue readingin-clause scoping
Issue I am doing some work for a company that has SQL Server 2008. One of their stored procedures references (or appears to reference) a column that does not exist, and yet there is no error. The query has this
Continue readingJavascript: z = z || [] throws an error when not using VAR – why?
Issue Out of just intellectual curiosity, why does javascript accept var z = z || []; to initialize z (as z may defined initially) but without var, it throws an error (in global space) z = z || []; (if
Continue readingruby variable scoping across classes
Issue RuNubie here. I’ve got a class Login that logs into gmail using the net/IMAP library. What is happening is that I create a new instance of that class, such as: a = Login.new(“username”, “gmail.com”, “passw”) Then, I’m working on
Continue readingHow do I emit to an eventListener from inside a nested function in Node.js (javascript scoping issue)
Issue I am writing code below that parses a sites API one at a time, than tells an event queue it is ready for the next object to parse. I am having issues since I am still new to javascript
Continue readingScoping and passing classes by value?
Issue Possible Duplicate: What is The Rule of Three? The following code outputs garbage at best or crashes: #include <stdio.h> #include <stdlib.h> #include <string.h> class C { public: char* s; C(char* s_) { s=(char *)calloc(strlen(s_)+1,1); strcpy(s,s_); }; ~C() { free(s);
Continue readingIs it possible to explicitly access instance members of a nested class's containing class?
Issue Is there a keyword in java to allow explicit invocation of members of the containing instance (or of its superclass) from within a nested class? SCENARIO public class Superclass { public void doSomething() { // do something that’s of
Continue readingHow to have a different value in a variable per each different instance of a form?
Issue i got a mdi form which display contact address. Since it is Mdi, i could open multiple copies of the form. However, apparently the variables used gets “copied” accross the forms. Therefore in the code below, the ContactTypeId will
Continue readingScoping Issue: value is lost
Issue I am trying to return a JSON object from a method (pollServiceForInfo), but it seems to get “lost” when I alert it once the method has finished. I know this is a scoping issue, however I am stumped as
Continue readingWhy is my jQuery variable empty?
Issue I am new to jQuery and I ran into a problem that is probably easy to spot for most of the frontend gurus out here. I created the following script $(document).ready(function() { $(“#facet_properties input[type=’checkbox’]”).each(function() { $(this).click(function() { var queryString
Continue readingWhy is this Javascript setInterval with object calling function not evaluating the inner parameter when passing in a callback?
Issue The following script outputs 1 2 3 4 5 6 7.. I would assume it would output 0 1 2 3 4 5 … In fact, in my actual code I believe the print(lostCnt) always is connected to the
Continue readingExposing objects through properties in C#
Issue I want to write a static utility class which only has a set of properties, which expose functionality to the user For example I could call: Utils.String.GetHexString(“Hello World”); or Utils.Stream.CopyBytes(instream, outstream); The closest thing I could liken this to
Continue readingInitialized in a function and is not initialized in main
Issue I am trying to allocate memory in a function and I am not sure what I am doing wrong. I want this: int main() { int* test= 0; initialize(test, 10); int test2 = test[2]; delete[] test; } void initialize(int*
Continue readingCoffeeScript Adding object to an array
Issue I have the following code: class Number number = null constructor: (num) -> number = num getNumber: -> number class Sequence numbers = [] constructor: -> addNumber: (n) -> numbers.push new Number n displaySequence: -> for number in numbers
Continue readingStrange fold scoping issue
Issue I ran into this head scratcher while debugging a transactional query block. For some reason, despite the connection rollback occurring in the fold left/fail operation, success/right outcomes were getting rolled back as well. Example: // returns Either[String, Int] db.handle
Continue readingCode style – 'hiding' functions inside other functions
Issue Recently I’ve been doing things like this: import Tkinter class C(object): def __init__(self): self.root = Tkinter.Tk() def f(): print ‘hello’ self.button = Tkinter.Button(master=self.root, command=f, text=’say hello’) as opposed to something like this: import Tkinter class C(object): def __init__(self): self.root
Continue readingWhen creating a new object why does it update the old one?
Issue When i create a new object from an existing object, then append a new attribute, why does it update the earlier one? Is their a solution that does not involve changing my code much? Here is my example jsfiddle.
Continue readingWhat's the difference between static and dynamic scoping in this exercise?
Issue I get confused when dealing with the static scope and dynamic scope, and for this pseudocode I have to find both. For both I believe it should print out: 9 4 2 3 however, I’m not entirely sure. Any
Continue readingScoping in javascript
Issue <html> <head> <title></title> <script type=”text/javascript”> var a = 1; function b() { a = 10; return; function a() {} } </script> </head> <body> <script type=”text/javascript”> b(); alert(a); </script> </body> </html> I am coming from c and java background .
Continue readingModel fitting functions and environemnts
Issue Here is a kind of minimal example for a problem I stumbled upon: mylm <- function(formula,data,subset=NULL){ mysubset <- subset # some other clever manipulation lm(formula,data,mysubset) } mydata <- data.frame(x=rnorm(10),y=rnorm(10)) mylm(y~x,mydata) # this fails! The reason why the last line
Continue readingHow can a non-imported method in a not-attached package be found by calls to functions not having it in their namespace?
Issue An R namespace acts as the immediate environment for all functions in its associated package. In other words, when function bar() from package foo calls another function, the R evaluator first searches for the other function in <environment: namespace:foo>,
Continue readingReasons for putting C/C++ variables in an unnamed scope?
Issue Possible Duplicate: Can I use blocks to manage scope of variables in C++? I came across some C++ code that resembled: int main(void) { int foo; float qux; /* do some stuff */ { int bar; bar = foo
Continue readingAccessing Rails Controller instance variables in CSS
Issue So I’ve seen lots of discussion on SO about using erb in your CSS files. I can get ERB to process the CSS files by using the <%= %> syntax and adding .erb to the file, but what I
Continue readinggetting nil:NilClass when scoping dates in Rails
Issue I’m a bit dumfounded – getting an ‘undefined method `each’ for nil:NilClass’ error. I’ve created a pretty straight-forward scope in the model def self.just_added where(‘created_at > ?’, Time.now-7.days.ago).order(“created_at desc”).first(4) end And a loop in my view <% @just_added_jobs.each do
Continue readingWeird scope behavior in node or am I sleeping?
Issue My js is as follows, /* * GET home page. */ var MongoClient = require(‘mongodb’); exports.index = function(req, res){ var studentObj = {}; MongoClient.connect(“mongodb://localhost:27017/MY_DB_TEST”, function(err, db) { if(!err) { console.log(“We are connected”); var collection = db.collection(‘test’); var stream =
Continue readingHow to reference an object instance in callable decorator object with python?
Issue Context: I’d like to be able to decorate functions so that I can track their stats. Using this post as a reference I went about trying to make my own callable decorator objects. Here is what I ended up
Continue readingJavaScript Scoping – Passing callback to already defined function
Issue The title is a bit weird, don’t quite know the best way to explain it in a sentence… At present there is an object with 3 functions; func, funcSuccess, and funcFailure. func contains a jQuery ajax request, with this.funcSuccess
Continue readingScoped case statement in C++: purpose of cross-scope case labels?
Issue I have a bug in my current code that I have been banging my head against for a couple days. I’ll post the summary version of the code below (not my actual code, but it still compiles). #include <iostream>
Continue readingJavaScript scoping not assign variable
Issue I’m writing a function in JS, but I have a problem with the variabile marker. The code: function piano(numero, link) { var marker; this.marker = marker; var immagine = loadImage(link, marker); this.immagine = immagine function createMarker() { return new
Continue readingHow to reset ruby class accessors between requests?
Issue I’m working on ecommerce solution, which provides few different shops within a single rails application. There I have a class to hold shop-specific settings. # models/shop.rb class Shop < Settingslogic source “#{Rails.root}/config/shop.yml” def self.init!(shop) namespace shop.to_s load! end end
Continue readingdealing with javascript scoping using inline functions
Issue Because I’m used to C and Java, I’ve found Javascript’s lack of block scope a little irksome. Sometimes I find myself wanting to declare and then immediately execute an inline function just to overcome this issue. For example: …
Continue readingHow do I access other methods from within an event function?
Issue I’m starting to learn more about jQuery plugin patterns, but I’ve run into something. See code below. I want to access my plugins options/defaults from with an onclick function, but I’m not sure how. function SomePlugin(element,options) { this.$el =
Continue readingIssue with child scoping of this in Typescript
Issue This is ALMOST the same as every other this scoping question I have read so far other than one slight difference which makes it relevant (imo) to ask this question. Now originally my problem was scoping of this with
Continue readingAny way to access function installed by makeActiveBinding?
Issue The title basically says it all. If I do this … makeActiveBinding(“x”, function() runif(2), .GlobalEnv) x # [1] 0.7332872 0.4707796 x # [1] 0.5500310 0.5013099 … is there then any way for me to examine x to learn what
Continue readingNested foreach loops in perl and variable scoping
Issue Ok this is a little weird and it doesn’t seem to should work this way. I have a foreach nested in another and I need it to only grab the values that correspond to the outer loop. foreach my
Continue readingPython scoping problem
Issue I have a trivial example: def func1(): local_var = None def func(args): print args, print “local_var:”, local_var local_var = “local” func(“first”) func(“second”) func1() I expect the output to be: first local_var: None second local_var: local However, my actual output
Continue readingXtext DSL grammar scoping customization
Issue I know there is a simple solution for this but I have no idea how to implement it. I’m looking for how to implement the answer rather than what I need to do. Half the answer is already on
Continue readingxtext importURI external file
Issue i am very lost with how importing global scope is working. I am writing a parser with xtext for a well structure language and I cannot depend on workspace or project concepts. In my language I have include statements
Continue readingPassing object reference inside of another object
Issue I’m declaring an object method in javascript. Inside of this method I want to do an ajax call and, when the call is done, to modify some attributes of this object. Bubble.prototype.draw = function(){ console.log(this.attribute) // -> works fine
Continue readingstrange scoping in cpp
Issue My cpp program is doing something strange with scoping when I use it string streams. When I place initialization of the strings and string streams in the same block as where I use it, there are no problems. But
Continue readingShould you create a var inside a for-in loop?
Issue for(var key in object){ //process object[key] } or just for(key in object) { //process object[key] } Is there a difference? Solution Yes, there’s a difference. Whether you use var or not key will still be a variable, and its
Continue readingJavascript Odd Scoping Behavior
Issue I’ve been going through Javascript function scope and have run into this: var scope = “global”; function f(){ console.log(scope); var scope = “local”; console.log(scope); } f(); Now I understand that the output of the first log is “undefined” because
Continue readingWhy does this scoping example from ANSI Common Lisp not work as expected?
Issue I’m new to lisp and going through ANSI Common Lisp by Paul Graham and one of the exercises is to define a function like apply where any number printed out before it returns will be printed by default in
Continue readingSubtlety about Common Lisp scoping (dynamic vs lexical)
Issue After reading documentation about the declaration SPECIAL, the special operator LET, the macro DEFVAR, and several questions here at StackOverflow about the dynamic versus lexical scoping in Common Lisp, as, for instance, this, I still can’t understand the following
Continue readingHow to properly scope User attributes in rails
Issue How to achieve simple scoping in your views such as: <% if @user.admin %> where “admin” is the following scope in user.rb: scope :admin, where(role: “admin”) there is a column Role which is a string in the Users table
Continue readingWhy angularjs context inherits only first level objects
Issue In case below changing of any input will cause changing in all of them. As I understood, it happens because data object is common for all of 3 scopes <div class=”content-container” ng-app=””> <input type=”text” ng-model=”data.message”> <h1>{{data.message}}</h1> <div ng-controller=”FirstController”> <input
Continue readingHave many functions add to same array variable
Issue I have some pseudo code similar to the below $funcValues = @(New-Object -TypeName psobject -Property @{‘Function’ = ”; ‘Value’ = ”;}) function func1(){ while($i -lt 5){ $funcValues += @(New-Object -TypeName psobject -Property @{‘Function’ = ‘func1’; ‘Value’ = $i;}) $i++
Continue readingUsing variables from two different while loops
Issue How do I use variables from different while loops and insert them in a print statement? public class Squares{ public static void main (String [] args){ int counterA = 0; int counterB= 0; while (counterA<51){ counterA++; if (counterA %
Continue readingError in eval(expr, envir, enclos) : object * not found when wrapping qplot()
Issue I don’t understand why my oh-so-minimal wrapper function produces the subject error. The below should reproduce it. My goal is to do a bunch of plots from data in a single dataframe, each of which lives in a new
Continue readingCant access variable inside jQuery $.post
Issue I went through many posts about this, but didnt find any solution working for me – cleaned up code: $(‘#form-new’).submit(function(e){ e.preventDefault(); $curForm = $(this); $textbox = $( ‘.new-box’ ,this); window.tmp_input_ok = false; var wasError = false; if( $.trim($textbox.val()) ==
Continue readingJavascript scope issue
Issue I thought I understood how javascript scope worked until now. This is what I have function MFCommentsHandler(node, type, item) { this.get = function(returnType){ … } function getButton(){ var button = document.createElement(‘button’), get = this.get; button.innerHTML = ‘Load more comments’;
Continue readingPhp class not allowing class-wide scoping
Issue I can’t figure out the below code, why it isn’t working. /classes/ContentManager.php <?php class ContentManager{ protected $sql; protected $host = “<correct host>”; protected $username = “<correct username>”; protected $password = “<correct password”; protected $dbname = “<correct dbname>”; protected $query;
Continue readingScoping issue with anonymous functions in JavaScript
Issue I’m learning some WebGL concepts using javascript and the Three.js library, but I’ve hit a bit of a snag trying to figure out how to use the OBJLoader to load a .obj file using classes. Heres the code: Model.prototype.loadModel
Continue readingR: Scoping rules are getting me into murky waters
Issue Any help with this problem I’m having would be greatly appreciated. I am a moderately advanced R programmer, but so far all my solutions have failed me. I start with the logic behind what I am trying to do,
Continue readingJavaScript in Node.js scoping
Issue I do have an issue with scoping variables in Javascript (Node.js / Express) Can someone please explain to me why is the “out” variable not being scoped to the last line in the following script? exports.last = function(req, res){
Continue readingAccess object members when using the locals-gathering FUNCTION instead of FUNC
Issue The low-level primitives in Rebol for functions and closures are FUNC and CLOS. Without explicitly telling the FUNC or CLOS to make something local, then assignments will not be local. x: 10 y: 20 foo: func [/local x] [
Continue readingWhy can't I increment global variable
Issue I created a variable q outside of any function. From within my function I am attempting to simply increment it with a ++. Will this increment the global q or is this simply appending the value to a local
Continue readingDealing with memory, when using std::vector
Issue I’m using vector with my own class type: std::vector<CItem> m_vItems; In my class I’m initializing SFML types like texture and sprite: class CItem { (…) sf::Texture m_Texture; sf::Sprite m_Sprite; sf::IntRect* m_pRect; (…) } I’m trying to pass object to
Continue readingHow to bind local context block to global context in Rebol2?
Issue As I understand it, you are supposed to be able to bind any block to any context. In particular you can bind a global context block to a local context: >> a: context [ print: does [rebol/words/print “yeah!”] f:
Continue readingScoping Problems with Backbone.js
Issue I have no idea as to why I no longer have access to my variables. Basically, I am under the assumption that when the appendUnitsIfHasValue function runs, it should have access to width, length, height, and weight. I should
Continue readingReferring to a class defined inside a function scope
Issue In C++1y, it is possible for a function’s return type to involve locally defined types: auto foo(void) { class C {}; return C(); } The class name C is not in scope outside the body of foo, so you
Continue readingWhich element in a web app should be responsible for loading applicationscoped data?
Issue Consider a web application, constructed from the Front Controller design pattern, included the strategy-pattern based actions, .jsp pages, javabeans and database connection, like the picture below: How do I assign responsibilities in my code, for loading, initializing and updating
Continue readingScoping issue with using function to add rows to data frame?
Issue I wonder if this might be a scoping problem. I am new to R and am trying to use a function on a series of columns and outputing the results to a new data frame. The function should add
Continue readingPython scoping issue with dictionary comprehension inside class level code
Issue Minimal example class foo: loadings = dict(hi=1) if ‘hi’ in loadings: print(loadings[‘hi’]) # works print({e : loadings[e] for e in loadings}) # NameError global name ‘loadings’ not defined I tried referencing the class namespace as well but that isn’t
Continue readingDoes visual basic use static/lexical or dynamic scoping?
Issue could anyone tell me if Visual Basic uses dynamic scoping or lexical scoping? Think it’s static scoping but not sure! Thanks! Solution Vb6 uses static scoping. It resolves scope in the following order: Local symbols Module symbols Global symbols
Continue readingEnvironments in R Shiny
Issue At http://shiny.rstudio.com/articles/scoping.html the rules for scoping in shiny are well explained. There are 3 environments or levels nested inside each other: objects available within a function, within a session and within all sessions. Using <- will change the object
Continue readingWhen should i be opening and closing MongoDB connections?
Issue i am very new to MongoDB and NoSQL in general and i’ve just started building a site with MongoDB / Norm / ASP.NET MVC 3. I am wondering how i should be scoping the connections to my Mongo database.
Continue readingxtext importURI references cannot be resolved
Issue I’m developing a DSL which reuses types that are defined in another DSL. Basically I have two file extensions let’s say .A and .B, some entities are declared in the .A and I need to access them in .B.
Continue readingWhy use a do-end block in Lua?
Issue I keep trying to find answers for this but fail to do so. I wanted to know, what is the do-end block actually used for? It just says values are used when needed in my book so how could
Continue readingunderstanding scoping in javascript – using the same temporary element in two different functions
Issue I was working on a jQuery plugin where I did something like this: function MyPlugin() { … } MyPlugin.prototype = { foo: function() { … }, bar: function() { … }, baz: function() { … } } Now the
Continue readingBlocks, scoping and setting variables Objective C
Issue I am using AFNetworking AFHTTPSessionManager to make a GET request. When I log the response object, the responseObject is logged. When I try to log my locationIDsDictionary, I get null. Scoping issue? Does locationIDsDictionary need to be a _block
Continue readingHow to pass out of scope variables to anonymous function
Issue I am new in PHP. I want to create a function link this. public static function cat_post($category, $limit, $top) { $posts = Post::whereHas(‘categories’, function($q) { $q->where(‘name’, ‘like’, $name); $q->where(‘top’, ‘like’, $top); })->take($limit)->get(); } But i got Undefined variable “name”
Continue readingReferencing instance member from anonymous function
Issue I’m trying to define a class whose instances have a String and a function. In the function the String parameter is used. class Tenant(val name: String, exclusion: Map[String, Int] => Boolean) val rule1 = new Tenant(name = “Baker3”, (suggestedFloor:
Continue readingVariable Scoping in Python
Issue Currently, I’m writing a simple Python program for doing the k-medians clustering, however I encountered a problem which I thought related to the variable scoping. Here is my clustering method class Cluster(object): center = None points = [] def
Continue readingCan you enable an R function to see the values of its own formals on evaluation?
Issue In the R, language, suppose I have a function ff(jj, kk, mm). I would like the calling function (or calling human being in an interactive session) to be able to make mm depend in arbitrary ways on jj and
Continue readingAccessing the $_SESSION variable from pthreads
Issue I’m having an issue accessing the session variable from functions called from Thread objects using the pthreads library for PHP. When the function is called from the main thread, no errors occur and everything runs fine. When run from
Continue readingwhy if statement isn't looking for a variable in global scope
Issue I am trying to understand scoping in JS.Here i have an example which has a variable in global scope called check.It has a truthy value i mean 1.Then inside a function called main which doesn’t have a variable called
Continue readingprocedural language understanding – static vs dynamic scoping
Issue I am having trouble understanding the answer to a homework we got back. I believe I am getting confused on the concepts of functions being “nested”, but maybe that is wrong. I am looking for some help in regards
Continue readingscope of the object literal methods
Issue I am currently doing some experiment about scoping and hoisting in JS.Here i have two example which confusing me in a different way.First i have assigned a anonymous function to a variable named parent.Obviously returned child function has access
Continue readingTrouble with basic todo app angular js
Issue I am a newbie to this framework struggling to understand scope . I followed the basic steps for creating a todo app given in the yeoman website. Here is my code : Index.Html <!doctype html> <html class=”no-js”> <head> <meta
Continue readingGradle variable scoping
Issue I my root project I defined a variable and a method using it like // An immediately executed closure (I hope) def myvar = ({-> do something})() def myfun() { println myvar + “:” + project } and called
Continue readingSwift scoping issue
Issue I have an app that is pulling info from a parse.com database and passing it into an array. When I println() this array from inside the while loop, it prints fine. When I try to print it outside the
Continue readingpython reassigment of variable
Issue I’m new to python (using 2.7.6) and I’m sure this has been asked before, but I can’t find an answer anywhere. I’ve looked at the python scoping rules and I don’t understand what is happening in the following code
Continue readingError "Cyclic linking detected" while calling a referenced object in a ScopeProvider
Issue I am currently implementing cross-referencing for my Xtext dsl. A dsl file can contain more then one XImportSection and in some special case an XImportSection does not necessariely contain all import statements. It means I need to customize the
Continue readingbackbone.js Model.get() returns undefined, scope using coffeescript + coffee toaster?
Issue I’m writing an app using coffeescript with coffee toaster (an awesome NPM module for stitching) that builds my app.js file. Lots of my application classes and templates require info about the current user so I have an instance of
Continue readingJavaScript local scoping: var vs. this
Issue I can’t seem to get my head around a specific case of scoping for JavaScript variables. Different from other examples and questions I have found, I am interested in the scoping for nested functions. I’ve set up an example
Continue readingupdate function in R and variables access
Issue I need to update a model formula inside a function. This is an example: A <- runif(n = 200) # generate some data B <- runif(n = 200) P <- 1/(1+exp(.5-A)) # generate event probability outcome <- runif(n =
Continue readingc++ class setter sets variables different when argumentname and variable name are equal
Issue I’m completly new to c++ and I found something I don’t understand and which I cannot find the answer for(also I’m sure it has been asked a lot, so point me to a thread would also be nice). Example
Continue readingRcpp scoping of free variables
Issue Say that I have a C++ function dosomething(z) that has a single input variable z, but also a “free” variable located within it (say y). I want to be able to design the scoping so that when I run
Continue readingC – extern, static, include
Issue Scoping in C is confusing as hell. I have a variable: “int qwe”. This var should be visible in one or more files – f1.c in this case, but not the another f2.c . Say i have: main.c, f1.c,
Continue reading