scope

do I have to scope query output in Coldfusion?

余生长醉 提交于 2019-12-23 20:25:48
问题 If I'm a running a database query/stored procedure in Coldfusion, what is the proper way to reference fields returned from the query? <cfstoredproc procedure="proc_select_extern" datasource="stokkers"> <cfprocparam type="in" value="#Session.Extern#" cfsqltype="cf_sql_varchar" maxlength="13"> <cfprocresult name="extern"> </cfstoredproc> <cfoutput query="extern"> <cfset variables.some = extern.foo> OR <cfset variables.some = foo> </cfouput> Say extern includes foo, bar and foobar. Is it allowed

How to pass Regexp.last_match to a block in Ruby

北城余情 提交于 2019-12-23 20:08:00
问题 Is there any way to pass the last match (practically Regexp.last_match ) to a block (iterator) in Ruby? Here is a sample method as a kind of wrapper of Srring#sub to demonstrate the problem. It accepts both the standard arguments and a block: def newsub(str, *rest, &bloc) str.sub(*rest, &bloc) end It works in the standard arguments-only case and it can take a block; however the positional special variable like $1, $2, etc are not usable inside the block. Here are some examples: newsub("abcd",

Maven依赖中的scope详解

混江龙づ霸主 提交于 2019-12-23 18:44:33
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> Maven的一个哲学是惯例优于配置(Convention Over Configuration), Maven默认的依赖配置项中,scope的默认值是compile,项目中经常傻傻的分不清,直接默认了。今天梳理一下maven的scope。 scope的分类 compile 默认就是compile ,什么都不配置也就是意味着compile。compile表示被依赖项目需要参与当前项目的编译,当然后续的测试,运行周期也参与其中,是一个比较强的依赖。打包的时候通常需要包含进去。 test scope为test表示依赖项目仅仅参与测试相关的工作,包括测试代码的编译,执行。比较典型的如junit。 runntime runntime表示被依赖项目无需参与项目的编译,不过后期的测试和运行周期需要其参与。与compile相比, 跳过编译 而已,说实话在终端的项目(非开源,企业内部系统)中,和compile区别不是很大。比较常见的如JSR×××的实现,对应的API jar是compile的,具体实现是runtime的,compile只需要知道接口就足够了。oracle jdbc驱动架包就是一个很好的例子,一般scope为runntime。另外runntime的依赖通常和optional搭配使用,optional为true

javascript - global variable not in scope after being defined in callback?

若如初见. 提交于 2019-12-23 18:05:34
问题 whenever i try to run something like the following, firebug tells me that "markers is undefined" at the line "for (var i=0 ..." but i declared markers as a global variable at the top right...? var markers; function load() { $.get("phpsqlajax_genxml.php", function(data) { markers = data.documentElement.getElementsByTagName("marker"); }); for (var i = 0; i < markers.length; i++) { var name = markers[i].getAttribute("name") //do more stuff } } but when i do this, it works. var markers; function

Scoping of environment variables when using Jupyter cell magics

為{幸葍}努か 提交于 2019-12-23 17:43:14
问题 I would like to understand how variable scoping works in Jupyter notebooks. When I create a bash notebook with two cells, environment variables that are exported are visible across cell boundaries: In [1]: export PATH=$PATH:~/samplepath In [2]: echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/myuser/samplepath But if I create a Python notebook and use cell magics to achieve the same result, variables do not seem to be visible across cell boundaries any more: In [1

Javascript var hoisting issue

霸气de小男生 提交于 2019-12-23 17:38:19
问题 I have a very simple Javascript function that hits a MS SQL server and returns some records back. There is a cell that i want to only display in the top table row when it is unique. I believe my problem is var hoisting because the variable that i assign within the while loop does not work because the value is not carried from the last records to compare. Here is the code function searchIndex() { var termcounter = ""; flyoutHTML = '<table>'; var adOpenDynamic = 2 var adLockOptimistic = 3 var

Does Argument-Dependent Lookup go before normal scope lookup?

牧云@^-^@ 提交于 2019-12-23 17:33:53
问题 This is the code in question that appears in §13.3 of "C++ Primer", 5ed: void swap(Foo &lhs, Foo &rhs) { using std::swap; swap(lhs.h, rhs.h); // uses the HasPtr version of swap // swap other members of type Foo } The book mentions the phenomenon of the class-specific swap not being hidden by the using declaration, and refers reader to §18.2.3: I read that section and realized that this may be related to Argument-Dependent Lookup (ADL). The following is the excerption: But I still have some

View generation and reserved names in PHP

隐身守侯 提交于 2019-12-23 17:33:35
问题 This is a bit of a peculiar one; I don't think this is in fact possible, however the SO community has surprised me time and time again; so here goes. Given in PHP; I have the following snippet: $path = 'path/to/file.php'; $buffer = call_user_func(function() use($path){ ob_start(); require $path; return ob_get_clean(); }); When included, path/to/file.php will have $path in it's scope. Is there any way to prevent this variable from being available in the context of the included file? For

How to refer to a global type from within a class that has a nested type with the same name?

对着背影说爱祢 提交于 2019-12-23 17:17:59
问题 I have a class declared at the global scope and another class with the same name that is nested within some class. class Address { var someProperty: String? } class ThirdPartyAPI { class Address { var someOtherProperty: String? init(fromAddress address: Address) { self.someOtherProperty = address.someProperty } } } The question is: how can I refer to a global class instead of the inner one from its initialiser? In the example given I've got an error Value of type 'ThirdPartyAPI.Address' has

How to restrict child classes from modifying the scope of a method in Abstract class?

拟墨画扇 提交于 2019-12-23 15:22:40
问题 How can I restrict the implementation class of my Abstract class from modifying the scope of a method from protected to public? For example : Suppose I have a Abstract Class package com.rao.test; public abstract class AbstractTEClass { protected abstract void function1(); protected abstract void function2(); protected void doWork() //I want to call the abstract methods from this method. { function1(); //implementation classes will give implementation of these methods function2(); } } Now, I