scope

#Define's scope throughout library?

风流意气都作罢 提交于 2019-12-24 10:44:29
问题 Say I have a constant: #define PI 3.14 Say I have a static library with multiple header and source files. If I declare this in the header file, will its scope apply to all of the source files? Or do the source files need to include the header with the declaration of PI ? 回答1: They will need to include the file which contains #define PI 3.14, otherwise the preprocessor will not read the #define line, and subsequently the compile will fail. In C++, a good way to think of the compile process is

Breaking the Powershell namespace limit of global,script

爷,独闯天下 提交于 2019-12-24 10:40:42
问题 How can I create namespaces or "providers" in a script without writing any C#, or using anything not already inside the Windows Box? - Alternately put, can I reference variables in a script by the name of the script I dot-sourced them from? I want to avoid clashes when dot sourcing a generated PoSH script. Set-Variable cmdlet does not give any clues as to where to look next, is there perhaps a cmdlet to create providers with all the framework done for you? At the moment I am using a "global"

Accessing Variable within JButton ActionListener

冷暖自知 提交于 2019-12-24 09:29:32
问题 This seems like a very simple problem, but I'm having a lot of trouble figuring out how to deal with it. Sample Scenario: final int number = 0; JFrame frame = new JFrame(); frame.setVisible(true); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setSize(400, 400); final JTextArea text = new JTextArea(); frame.add(text, BorderLayout.NORTH); JButton button = new JButton(number + ""); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { number++; //

java local variable unavailable

南笙酒味 提交于 2019-12-24 09:22:47
问题 I'm getting the following error from the eclipse debugger: local variable unavailable. Tried to trim the code as much as possible. The problem is pretty simple, I have to use the DivisiveUI UpdateLog() method, from the Divise class, using variables from the Cluster class. The Divise has a list containing all of the clusters. Divisive and DivisiveUI has a reference to each other. How can I get access to the variables: sumDistance, avgDistance from the Divisive class? Tried writing a method in

BeanManager always returns same reference

拟墨画扇 提交于 2019-12-24 09:07:35
问题 I am creating a custom CDI scope and am using the BeanManager to get an injection of my NavigationHandler custom class. But the beans it returns are quite strange. So I use the BeanManager that way : public class ScreenContext implements Context { private NavigationHandler getNavigationHandler() { final Set<Bean<?>> beans = m_beanManager.getBeans(NavigationHandler.class); final Bean<?> bean = m_beanManager.resolve(beans); NavigationHandler reference = (NavigationHandler) m_beanManager

Use same directive in same view and bind different data

谁说胖子不能爱 提交于 2019-12-24 08:24:14
问题 I have created a custom directive for displaying a charts made with the Highcharts library. Now I want to build upon this directive and create multiple charts in the same view. This is not possible with the current code I have, as you can see below. How can I organize my code so that it's possible to bind different data to it in the same view? Below is some example code to illustrate the problem. Directive function dateChart() { return { restrict: 'AE', scope: { title: '@' }, template: '<div

Coldfusion Scopes Clarification

ε祈祈猫儿з 提交于 2019-12-24 06:53:58
问题 I have been reading about the CF Scopes, and am comfortable with the CFC scopes and their implications (detailed here), however, whenever I search for CF scopes it almost always references in the context of a CFC - So I was hoping for some clarification around scopes in CFM pages. I am working with CF 9/10 so only really interested in how the scopes behave in these releases. What scopes are available on a CFM page - do CFM pages have the same concurrency problems as can happen elsewhere, or

Coldfusion Scopes Clarification

喜夏-厌秋 提交于 2019-12-24 06:53:36
问题 I have been reading about the CF Scopes, and am comfortable with the CFC scopes and their implications (detailed here), however, whenever I search for CF scopes it almost always references in the context of a CFC - So I was hoping for some clarification around scopes in CFM pages. I am working with CF 9/10 so only really interested in how the scopes behave in these releases. What scopes are available on a CFM page - do CFM pages have the same concurrency problems as can happen elsewhere, or

Prolog arithmetic in foreach

*爱你&永不变心* 提交于 2019-12-24 06:39:02
问题 So I'm learning Prolog. One of the things I've found to be really obnoxious is demonstrated in the following example: foreach( between(1,10,X), somePredicate(X,X+Y,Result) ). This does not work. I am well aware that X+Y is not evaluated, here, and instead I'd have to do: foreach( between(1,10,X), ( XPlusY is X + Y, somePredicate(X, XPlusY, Result) ) ). Except, that doesn't work, either. As near as I can tell, the scope of XPlusY extends outside of foreach - i.e., XPlusY is 1 + Y, XPlusY is 2

Define a scope for javascript Function constructor

99封情书 提交于 2019-12-24 06:34:08
问题 I'm trying to create some dynamic functions that require an enclosing scope. Currently this works: eval("with (scope) (function () {return scope.prop})") This approach seems a bit hacky. User supplied code is nowhere near this so I'm not worried about security, it's just that it seems like there should be a better way. I know the Function constructor does not include anything apart from the global scope, but I was hoping there was some way to 'inject' scope into the Function constructor. Not