scope

How to find Junit tests that are using a given Java method directly or indirectly

江枫思渺然 提交于 2020-01-03 10:07:27
问题 Assume there are Java project and Junit project in an Eclipse workspace. And All the unit tests are located in the Junit project and dependent on the application Java project. When making changes to a Java method, I need to find the unit tests that are using the method directly or indirectly, so that I can run the corresponding tests locally in my PC before checking into source control. I don't want to run the entire junit project since it takes time. I could use Eclipse call hierarchy to

ColdFusion non-scoped vs. VARIABLES scope: performance vs. readability?

时光毁灭记忆、已成空白 提交于 2020-01-03 08:58:28
问题 In my ColdFusion code, I have made it a habit to always treat the variables scope as my default scope (i.e., when another scope doesn't fit). My understanding is that this improves efficiency, since the ColdFusion processor doesn't have to spend cycles determining the scope in which the variable is contained. However, I've always been annoyed by how verbose this makes my code. So, my question is, realistically, is explicitly scoping every variable worth the verbosity? I understand that each

Updating the asp.net page from the asynchronous WCF duplex call - object scope - ASP.NET

牧云@^-^@ 提交于 2020-01-03 06:49:34
问题 I've the following doubt. I've a page "MyPage" and i've declared few dictionary objects in the page class. My doubt is If i declare the dictionary as a private non-static object i'm not able to use it across the functions in that page class (the object is getting nulled) But if i declare the dictionary to be static i'm able to across the object across the functions. But will that object be same across all the users who have opened the page right now (guessing that each user will have an

Javascript variable scope inside ajax function

冷暖自知 提交于 2020-01-03 05:29:10
问题 i know this is probably a stupid question and i know js scope questions are extremely common on SO, but could you possibly be kind enough to help me with this one anyway. Here is my function: function checkOpen(storeData) { if (storeData.menu === 'true') { var offerImgPath = '/wcsstore/ConsumerDirectStorefrontAssetStore/images/colors/color'+ Brand.styleColour + '/v3/', offer1, offer2; cafeTabContent = '<p>Cafe/Restaurant facilities are available in this store.</p>'; cafeTabContent += '<p

Rails - Use a class method from a another class method with one attribute of the second class

こ雲淡風輕ζ 提交于 2020-01-02 23:01:41
问题 Here is my problem : I have a class method in my User class. I'm calling it from a class method located in my Shop class. The thing is, the User class method needs the shop's attribute group_id (Group is a third class). My User class method is not working properly (see Rails 3 Scope - Find users not in a specific group) because it returns nothing although it should return something. My code currently looks like this : class User #... # Retrieve all users not in a specific group # example:

“if” statement gets executed when the condition is “false” in a Rust program, how to understand it?

送分小仙女□ 提交于 2020-01-02 22:41:28
问题 For the following Rust program: fn main() { let foo = "test".to_string(); if false { let _bar = foo; // value moved to _bar } println!("{}", foo); } I got this error when run it: error[E0382]: borrow of moved value: `foo` --> src\main.rs:6:20 | 2 | let foo = "test".to_string(); | --- move occurs because `foo` has type `std::string::String`, which does not implement the `Copy` trait 3 | if false { 4 | let _bar = foo; // value moved to _bar | --- value moved here 5 | } 6 | println!("{}", foo);

Why doesn't my Perl variable have the right value outside the if() block?

我怕爱的太早我们不能终老 提交于 2020-01-02 19:19:36
问题 I have a hash, where the keys and values are from matches in a regular expression. I'm having difficulty extracting the values given the keys. In the interest of brevity and honing in on the problem, my first version of this post I attempted to strip down my program to only the relevant parts, but it wasn't enough, so here's more. Variable and file names have been modified, but the syntax is true. Though the specific regular expressions are irrelevant, I have included them on request. use

Namespaces within a Python Class

纵饮孤独 提交于 2020-01-02 18:38:41
问题 I have this: class MyClass: """A simple example class""" i = 12345 def f(self): print i # self.i will work just fine return 'hello world' When I do: >>> x = MyClass() >>> >>> x.f() I get an error, as expected. My question is: Why do I get the error? Why is there no namespace between the namespace of the function(or method) definition and the global namespace of the module containing the class? Is there any other way to reference i inside f in this case other than using self? 回答1: You've got

Class loses “this” scope when calling prototype functions by reference

会有一股神秘感。 提交于 2020-01-02 14:30:29
问题 Can anyone explain to me why "b" returns undefined and how I can get around this problem? Why does the "this" scope get lost when I call prototype functions by reference? MyClass = function(test) { this.test = test; } MyClass.prototype.myfunc = function() { return this.test; } var a = new MyClass('asd').myfunc(); var b = new MyClass('asd').myfunc; // Returns "asd" correctly console.log(a) // Returns undefined?? console.log(b()) === EDIT / SOLUTION === As plalx writes, the correct solution in

How hoisting name resolution order works in JavaScript?

吃可爱长大的小学妹 提交于 2020-01-02 10:19:11
问题 I came across a interesting quiz function bar() { return foo; foo = 10; function foo() {} var foo = '11'; } alert(typeof bar()); My interpretation is like this (Which is wrong according to console :) ): var foo; // global variable function bar(){ function foo(){} var foo; // Here variable foo should override foo function return foo; // (according to me foo should be variable with undefined value) What is going on here, How JavaScript resolve naming order ? foo = 10; foo = "11"; } Here is a