d*******r 发帖数: 3299 | 1 一个帖子,转来大家讨论一下
最近使用 closure 和 anonymous function 遇到些问题, 大家探讨一下。
简单说就是当临时写一个 closure 或者 anonymous function 当 callback 使用时候
,如果让这个 closure access 了 external scope 里面的 variable, 就容易出现 "
access mutable variable " 的问题 (WebStorm 就会报 warning).
比如这个帖子里面描述的例子:
http://samwize.com/2013/09/01/how-you-can-pass-a-variable-into-
里面的 callback 引用并使用了 external scope 里面的 i, 所以出错了。
他是通过用 bind( {i: i} ) 将 i 的值传入注册时候的 callback 来解决的,当然也
有其他方案, 比如将 dummy(i, function(response)) 改成 dummy(i, function(
response, i)) 也行。
我在想... 阅读全帖 |
|
a*****i 发帖数: 1045 | 2 在spss里面做linear regression, 有一个是原始数据,还有另一个是根据这个原始数
据的dummy variable 由(0,1)构成(低于某个值是0,高于某个值是1),做linear
regression的时候可以不可以直接用这个dummy variable来做,还是需要改成(1,2)
如果牵扯到interaction term, 一个factor是一个continous variable,另一个是dummy
variable (0.1), 在spss里面,需要把两个variable 想乘,得到一个新的variable算
interaction term,那么可以把dummy variable和另外一个continous variable 乘在一
起嘛?因为dummy variable 有一个数字是0.会不会有影响?还是需要原始的数据。
多谢了。 |
|
t****g 发帖数: 715 | 3 1.在independent variable 里使用 lagged dependent variable 是为了校正 serial
autocorrelation 的吧?在 STATA 里,如果我使用了 xtregar 【Fixed- and random-
effects linear models with an AR(1) disturbance】,修正了 autoregressive (1)
的问题,那么我的 IV 里还需要用 lagged dependent variable么?如果同时使用
lagged dependent variable 和 xtregar 我的结果会显著很多,可以同时用这个东东
么?
No idea about STATA, but I could not see why using lagged dependent variable
could fix AR(1).
2.在回归中使用 lagged independent variable 是为了避免内生性问题和因果不确定
问题吧?我大概看了一下书,好像用 instrumental variable |
|
y*****n 发帖数: 5016 | 4 if you have eminer, then you can use the "interactive grouping node". it can
not only bin each variable into woe, but also calculate the information
value and Gini for each variable. you can prescreen variables there. some
may argue that variables with low IV may still be picked up in the stepwise
regression. However, your bosses may want to see the "stand alone"
relationship between each model attribute and the target. therefore, you
want to make sure that each candidate variables has high IV b... 阅读全帖 |
|
m****t 发帖数: 754 | 5 请教大家一个问题:
survey data里有上千的受访者,每个受访者对应一个sampling weight variable。我
只知道在stratified random sample里, 每个受访者被选到的概率是不一样的。这个
sampling weight=1/probability.
那么在我用统计软件run linear regression的时候,这么sampling weight variable
怎么用啊?
(1)先run linear regression里其他的independent variables without the
sampling weight variable,得到 linear regression equation之后再加进这个
sampling weight variable。
(2)run linear regression的时候就加上这个sampling weight variable。
我感觉应该是(1),但不知道得到linear regression equation之后怎么加这个
sampling weight variable啊。... 阅读全帖 |
|
n*******n 发帖数: 407 | 6 Let X be a Poisson variable with parameter λ with a probability mass
function, f(k), where k = 0, 1, 2 … We know the index of log-concavity is
the function rf(k) = f(k)^2/(f(k-1)f(k+1) = (k+1)/k>1. So, Poisson is log-
concave.
Many books have: "The random variable Y is dispersive if, and only if, Y has
a logconcave density."
Poisson variable is discrete. Do we have: A Poisson variable X is dispersive?
Or, more specifically, let X be a Poisson variable with parameter λ1 with a
probability mass fu... 阅读全帖 |
|
n**d 发帖数: 9764 | 7 Which book?
Thinking in C++ V3 one:
Register variables
...
There are restrictions to the use of register variables. You cannot take or
compute the address of a register variable. A
register variable can be declared only within a block (you cannot have
global or static register variables). You can, however, use a register
variable as a formal argument in a function (i.e., in the argument list). |
|
x********u 发帖数: 411 | 8 在自己看关于 panel data 的书,同时也在请教别人,因为问太多问题不好意思,所以
还是发贴问吧(凡是回答的都给包子一枚,聊表谢意~):
1.在independent variable 里使用 lagged dependent variable 是为了校正 serial
autocorrelation 的吧?在 STATA 里,如果我使用了 xtregar 【Fixed- and random-
effects linear models with an AR(1) disturbance】,修正了 autoregressive (1)
的问题,那么我的 IV 里还需要用 lagged dependent variable么?如果同时使用
lagged dependent variable 和 xtregar 我的结果会显著很多,可以同时用这个东东
么?
2.在回归中使用 lagged independent variable 是为了避免内生性问题和因果不确定
问题吧?我大概看了一下书,好像用 instrumental variable 是最好的解决内生性问
题的方法,但是 in |
|
s**********l 发帖数: 395 | 9 Sorry, I should mention Genmod rather than GLM in SAS.
I think in Generalized liner model, if the dependent variable follows a
gamma distribution, the predictors can not be categorical variables, can
they?
There are totally 120 categorical variables and each of them have 20 levels.
Therefore, I tried to convert these categorical variables into continuous
variables so that I can build the model; however, I did not know how to do
so.
Who knows? Thanks. |
|
I*****a 发帖数: 5425 | 10 hi guys, i have a question about clustering analysis with both numerical
variables and categorical(nominal) variables. I am not very familiar with
clustering analysis. Any feedback will be appreciated.Can only type chinese
using phone, which is too much pain... sorry.
1) What are the standard ways to deal with categorical variables ? Do we
simply transform them to a lot of dummy variables ? In my particular problem
, I have a pretty large dataset, where some variables may have hundred
thousands ... 阅读全帖 |
|
B*****g 发帖数: 34098 | 11 dynamic variable:
比如说我想用variable "varA". The word "varA" retrieved from database, how
can I use this word to get the variable value? 我现在想的是建一个lookup.
dynamic functions:
比如说我想trim一个variable. The word ".trim()" retrieved from
database, "" will be replaced by real variable and ".trim()" will be
excuted, how can I do that?
Thanks |
|
c**********e 发帖数: 2007 | 12 Which one of the following statements about const variables is true?
a) The address of a const variable can only be assigned to a float variable.
b) A pointer to a non-const cannot be assigned the address of a const
variable.
c) A pointer to a const can be assigned to multiple objects at compile time.
d) Pointers to const objects must be initialized to NULL before they can be
referenced.
e) A pointer to a non-const cannot be assigned the address of a volatile
variable. |
|
j***i 发帖数: 1278 | 13 你哪里找的这么多题呀
Which one of the following statements about const variables is true?
a) The address of a const variable can only be assigned to a float variable.
b) A pointer to a non-const cannot be assigned the address of a const
variable.
c) A pointer to a const can be assigned to multiple objects at compile time.
d) Pointers to const objects must be initialized to NULL before they can be
referenced.
e) A pointer to a non-const cannot be assigned the address of a volatile
variable. |
|
d*******r 发帖数: 3299 | 14 没说多线程呀,帖子说的是 "因为 single threaded 只是可以让 Node 的代码 access
shared variables 时候不用 lock"。都不用 lock 了,所以所谓 "平行执行的
callbacks" 还是在 single threaded 的主 thread 执行的 (可以算是虚拟平行执行)
,这些执行流程 access shared variable 的问题,是说如果那个 shared variable
是 mutable 的话,多个 (虚拟平行执行的) callbacks 可能修改这个 variable 而不
互相通知。
所以用 closure access external mutable variable 才是有可能有危险的。
我觉得 WebStorm 的 warning 还是挺靠谱的。 |
|
F****r 发帖数: 345 | 15 在自己看关于 panel data 的书,同时也在请教别人,因为问太多问题不好意思,所以
还是发贴问吧(凡是回答的都给包子一枚,聊表谢意~):
1.在independent variable 里使用 lagged dependent variable 是为了校正 serial
autocorrelation 的吧?在 STATA 里,如果我使用了 xtregar 【Fixed- and random-
effects linear models with an AR(1) disturbance】,修正了 autoregressive (1)
的问题,那么我的 IV 里还需要用 lagged dependent variable么?如果同时使用
lagged dependent variable 和 xtregar 我的结果会显著很多,可以同时用这个东东
么?
First you need to check to see if adding lagged dependent variable indeed
fixes any serial correlation in the equa |
|
f****e 发帖数: 8 | 16 1.在independent variable 里使用 lagged dependent variable 是为了校正
serialautocorrelation 的吧?
主要是为了消除endogeneity,另外如果足够多的lag的话,可以实现dynamically
complete model, then there is no autocorrelation.
在 STATA 里,如果我使用了 xtregar 【Fixed- and random-
effects linear models with an AR(1) disturbance】,修正了 autoregressive (1)
的问题,那么我的 IV 里还需要用 lagged dependent variable么?如果同时使用
lagged dependent variable 和 xtregar 我的结果会显著很多,可以同时用这个东东
么?
这个不知道了。
2.在回归中使用 lagged independent variable 是为了避免内生性问题和因果不确定
问题吧?我大概看了一下书,好像用 instrume |
|
o******6 发帖数: 538 | 17 Is there any simple way to write a code to only list the character variables
by their logical position in the dataset? I need detect some variables
which are in fact numeric but stored as character variable in excel. So I
can use input function to convert them to the numeric variables. My code is
listed below but the variables are not in the logical position. Any possible
to list them in logical position in the dataset? Thanks.
proc contents data=cog position out=cogct;run;
data cogct(keep=name |
|
C********n 发帖数: 346 | 18 Thank you! So there's no way to do a combined test for both categorical and
numerical variables at the same time?
I suppose that the test for categorical variables in your code is Fisher's
exact test? I know that it can be done for individual variables. Can it be
done jointly for a group of variables?
What about the test for the numerical variables? What is the name of the
test? Is it F-test for means? Is there a test that does not assume normality, or a joint test for difference in median |
|
t**i 发帖数: 688 | 19 I have a sas macro variable with the variable name fruit, suppose it can be
resolved to anything but the char string fruit itself.
I have other sas macro variables called fruit1, fruit2, ..., fruit5, ...,
and these variables are to be resolved as apple, orange, etc.
Now I want to keep chosen columns, say apple, orange, banana, but I have had
a problem to have the "concatnated" macro variable correctly resolved?
I have tried
&fruit&i
&&fruit&i
&&&fruit&i
&.fruit&i
&&.fruit&i
None above works.
Doe |
|
w*********r 发帖数: 488 | 20 那头问:如何把一个variable convert 成 dummy variables?
我答:举例说,dumx=(x='NY').这是以前编过得一段SAS code里面涉及到的dummy
variable问题.就是把char type转成num type的dummy variable.
然后那头又问:如果有大量的dummy conversion要做怎么办?比如有50个.
我没答上来.因为不知道这样问具体什么意思.每个conversion转换条件都不一样啊.有
的不是转换type,是比如考试60分以上算1,60分以下算0,就是及格和不及格这个dummy
variable.显然不能批处理啊.
求解,面试方是想考察哪个方面呢? |
|
d******g 发帖数: 130 | 21 向各位请教,我现在有大约1000个variables,那么SAS中的哪个function或者syntax能
够找到包含某些特定character值的variables?我的意思是这些variables的
observations中包含这些特定的值。我以前用过index,但是对于这么多variables不知
道怎么处理才能return我要找的特定variables.
非常感谢大家的各种建议。 |
|
g****v 发帖数: 971 | 22 电面时候问我python中的class variable和object variable的区别,当时就蒙了,
class variable是什么意思?网上也没查到,class还有variable么? |
|
y****9 发帖数: 144 | 23 I have a need to declare variable dynamically, i.e. variable name and type
will be known at run time; I am trying to use sp_executesql. But the
following test failed:
use testdata
go
exec sp_executesql 'declare @col_1 int' --failed
-- declare @col_1 int -- this is ok
set @col_1=1
print @col_1
Any idea why it fails or any suggestions on how to do declaring variable
dynamically?
For example, I want to do:
declare @col_1 int
declare @col_2 varchar(10)
declare @col_3 varchar(100)
but the number of ... 阅读全帖 |
|
l*****o 发帖数: 214 | 24 I am maintaining a legacy SDK. The SDK will behave differently for different
platform. It's using a static variable and requires the static variable to
be created before any API call like the following:
Example for static variable (OLD CODE):
SDKContext.init();
VideoManager manager = new VideoManager();
public void VideoManager#search() {
SDKContext.search();
}
Components like VideoManager are all over the place. My gut feeling tells me
I should use Facade pattern instead, but can't be sure.... 阅读全帖 |
|
g***l 发帖数: 2753 | 25 sorry no Chinese input here.
The issue is:
1. A process will add new device with name as /dev/input/eventX
2. B process needs to know the new device name as /dev/input/eventX
Initially I thought A process can export a system environment variable via
setenv(), for example set INPUT_DEVICE=/dev/input/eventX, but I found this http://docstore.mik.ua/orelly/unix/upt/ch06_02.htm. It seems you cannot share the environment variables between two different processes.
"Sooner or later, almost everyone writ... 阅读全帖 |
|
j*c 发帖数: 97 | 26 I don't know if this is a properiate board to post this question, but here it
is:
In perl, one can always read the system environment variable from pre-defined
hash %ENV. If one runs a perl script from a shell, it will inherit all the
environment variables available in the shell, including the system variables
like ARCH, USER, HOSTNAME etc. However, my problem is that if I submit a
job(in perl) to a job manager(Condor as we use), I can't get these variables
in %ENV. I suspect that Condor use a s |
|
l****q 发帖数: 767 | 27 Hi Guys,
Got a question on Becker B5-11 (2007 edition)
Its says Electricity - used in the mfg. process could be variable costs or
fixed costs.
My question is: Why don't they include electricity - used in the mfg process
into Semi-Variable chategory. Do you see Becker puts Indirect labor,
Fringe benedtis and Mantenance an repairs of building into Semi-Variable
costs. I don't know why they don't do the same thing to Electricity.
Thanks! |
|
l****q 发帖数: 767 | 28 Hi Guys,
Got a question on Becker CPA Business B5-11 (2007 edition)
Its says "Electricity - used in the mfg. process" could be variable costs or
fixed costs.
My question is: Why don't they include "electricity - Used in the mfg
process" into Semi-Variable chategory. Becker puts "Indirect labor", "
Fringe benedtis" and "Mantenance an repairs of building" into Semi-Variable
costs. I don't know why they don't do the same thing to "Electricity - Used
in the mfg porcess".
Please help! Thanks! |
|
l****i 发帖数: 81 | 29 Global Control Variables
The following global variables are used to control various graphics elements.
Default values are provided. Any or all of these variables can be set before
calling one of the main graphing routines. The default values can be modified
by changing the declarations in pgraph.dec and the statements in the procedure
graphset in pgraph.src. graphset can be called whenever the user wants to
reset these variables to their default values.
_pageshf 2x1 vector, the graph will be shi |
|
y****n 发帖数: 2 | 30 看到一篇文章里写到:“identifying a high-quality instrument is extremely
challenging both because it is often difficult to find an instrument that is
conceptually plausible and because there is no analytical method for
testing the quality of an instrument.....
又写道:
A variable must satisfy two criteria if it is to serve as a valid instrument
for Varible X by Variable Y. First, it must strongly predict Variable X.
Second, net of its effect on Variable X, it should be unrelated to Varible Y.
The first criteri |
|
l****q 发帖数: 767 | 31 Hi,
Got a question on Becker CPA Business B5-11 (2007 edition)
Its says "Electricity - used in the mfg. process" could be variable costs or
fixed costs.
My question is: Why don't they include "electricity - Used in the mfg
process" into Semi-Variable chategory. Becker puts "Indirect labor", "
Fringe benedtis" and "Mantenance an repairs of building" into Semi-Variable
costs. I don't know why they don't do the same thing to "Electricity - Used
in the mfg porcess".
Please help! Thanks! |
|
C********n 发帖数: 346 | 32 I want to do a joint test for overall difference in a group of variables
between two random samples. These variables include BOTH numerical AND
categorical variables. The null hypothesis is that there is no significant
difference between the two samples in the categorical and numerical variables.
What is the name of the test? Also, if you know how to implement the test
in SAS, it's even better.
Thanks a lot~~ |
|
P**********i 发帖数: 65 | 33 我写一个macro,其中包含两个macro variables。一般情况下,如果我调用这个macro,我首先要
给这两个macro variables赋确定的值。现在的case是:这两个macro variables对应已有的一张
dataset的两个variables。我想要对这张已有dataset的每个obs都run一次macro,应该如何实现
呢?
非常非常感谢! |
|
t**i 发帖数: 688 | 34 49 data a;
50 set b;
51 do I = 1 to 3;
SYMBOLGEN: && resolves to &.
WARNING: Apparent symbolic reference I not resolved.
SYMBOLGEN: Unable to resolve the macro variable reference &i
SYMBOLGEN: Macro variable FRUIT resolves to good
SYMBOLGEN: Unable to resolve the macro variable reference &i
52 keep &&fruit&i ;
NOTE: Line generated by the macro variable "I".
52 good&
-
22
200
WARNING: Apparent symbolic reference I not resolved.
ERROR 22 |
|
o******6 发帖数: 538 | 35 ☆─────────────────────────────────────☆
Emilyxue (雪) 于 (Thu May 15 14:12:39 2008) 提到:
急问用SAS 分析LOGISTIC regression, 有fix variable &random variable应该用什么
MODEL?非常感谢
☆─────────────────────────────────────☆
statcompute (statcompute) 于 (Thu May 15 21:22:46 2008) 提到:
there is nothing called "fix variable & random variable" in logistic reg.
Instead, there are "fixed effect" and "random effect". This type of model is
also called "generalized linear mixed model", which can be analyzed with "
pr |
|
p***r 发帖数: 920 | 36 Recently, aware many problems when programming macros. The scope of macro
variables (global/local) are sometimes in in-explicit to me. It there any
articles systematically covering this topic.
1. In a macro, if you use SYMPUT in data step, the macro variable you
created is global.
2. If you want to use SYMGET to input the value to the data set, then the
macro variable must be global. Then here is the problem, locally produced
macro variable will disappear, and will not be an valid argument durin... 阅读全帖 |
|
s**********l 发帖数: 395 | 37 Now for each categorical variable, it has 20 levels 1-20.
In order to use GLM, I need to convert more than 100 categorical variables
into continuous variables.
Who knows how to do this in SAS? Thanks. |
|
s******r 发帖数: 27 | 38 本人刚毕业,小广告公司有数据,但是都是categorical data ,例如city,publisher
,network 之类 。比如city有5千多种,另外也有一些variable也有有数千种的level.
这些variable都很重要,我要怎么根据这些variable做Classification。普通的logit
好像不可以把?你们说SVM, decision tree ,k-means clustering可以吗?我以前没
学过这些 .这组数据里完全没有continue ariable,全是Character Variables.这样的
数据应该怎么做啊。有人做过能介绍下具体流程。谢谢哦。 |
|
c**********e 发帖数: 2007 | 39 Suppose one of the inputs is a macro variable. The macro variable is a list
of variable name separated by space.
For example, in the macro, the list of predictors is the input:
%macro regression(ind_var);
proc reg data=mydata;
model y = &ind_var.;
run;
%mend;
A call of the macro takes the following form:
%regression(x1 x2 x3 w1 w2);
My question is how to get the number of predictors. In the above macro call,
I want to get the number 5, which is the number of independent variables.
How to do... 阅读全帖 |
|
h***b 发帖数: 43 | 40 Sorry I can not input Chinese now.
I have some character variables, abc_1_ok,......,abc_50_ok. The numbers are
in the middle of the name, instead of at the end. When I run ARRAY, there
are two ERRORs shown as the following. I think the reason for the following
two errors is the variable name. If so, could any one of you tell me how to
deal with it? Thanks much!
ERROR: Alphabetic prefixes for enumerated variables {abc_1_ok - abc_50_ok}
are different.
ERROR: Too few variables defined for the dimen... 阅读全帖 |
|
E**********e 发帖数: 1736 | 41 说到categorical variable, 一般已经是numerical categorical了(1,2,3,。。。
)。 textbook 好像很少讲到mixture的continuous 和 categorical variables。 事
实是很多时候modeling的时候, 都是mixture。 这种情况用pca来降维或者找出
significant的variabels是不是就有问题。
当然也许可以试correspendse analysis, 就是把continous variable group, 然后
用contigency table来找出关联。但是也很少说用了选significant variabels。
问这个问题是因为面试是碰到这个问题。 所以pca来选variables的话,好像不是那么
可信。 lasso也许是个更好方法。 |
|
w***y 发帖数: 6251 | 42 data science interview那本书里的
一个SQL题目,给一个‘logs’ table, 里面的数据是timestamp和jobID,譬如
timestamp jobID
1 1
2 2
3 1
4 1
5 3
6 2
7 1
8 4
要求是find all the jobIDs that appear at least twice consecutively. ‘
consecutively’是timestamp连续的意思,这个例子里找到的结果就是1
答案提到用variable做是O(n),但是看不懂答案,完全不会用sql的variable的语法啊
,有什么好的tutorial网页推荐嘛? 也不理解为什么这样子是O(n), 是不是因为
subquery不需要做join?
用local varia... 阅读全帖 |
|
l**e 发帖数: 41 | 43 Hi,
Now I have a php file,which call another php file and post some variables in
the url:
document.frm_review.action=("Review.php?aper_id="+p_id+"&Paper_title="+p_title
);
But I do not want the variables show in the URL. Then I need use POST to
transfer those variables, right?
But I do not know how to modify the code. Any one have an example? Or where
can I search the relative documents?
Thanks! |
|
V*P 发帖数: 155 | 44 【 以下文字转载自 Statistics 讨论区 】
发信人: VlP (VlP), 信区: Statistics
标 题: Excel 能否写个 equation with an independent variable
发信站: BBS 未名空间站 (Thu Sep 5 07:05:24 2013, 美东)
比如我有: A1=2, A2=x, A3=6, A1*A2=A6
正常情况下,我可以用 A3/A1 来得到 x 的值,但是我想用一种像calculator那种的输
入求解,类似这样的 f ( x, A1 * x = A3 ) . An equation A1 * x = A3 with
independent variable x, and solve for x.
我需要在excel 的一个 cell输入x的值(A1和A3是随时需要变化的,所以x的值也会随
着变化),我不是不想用 A3/A1 这样的formula ,而是因为formula太太复杂,如果我
写一个equation,再求求x的formula,很容易出现 algebra mistake,太长太复杂的
equat... 阅读全帖 |
|
f*******w 发帖数: 407 | 45 我是刚接触actionscript没到一个星期的新手,请版上的高手指教:
I use following flash actionscript code, got from online, to load the "
Loading.txt" file:
var myTextLoader:URLLoader = new URLLoader();
myTextLoader.addEventListener(Event.COMPLETE, onLoaded);
function onLoaded(e:Event):void {
var myArrayOfLines:Array = e.target.data.split(/\n/,",");
}
myTextLoader.load(new URLRequest("Loading.txt"));
In "Loading.txt", the data of object in a row is (Dim1 Dim2 Dim3 OX OY OZ)
is:
60,12,9,-50,-50,50
84,12,9, 50, 50,50
Then... 阅读全帖 |
|
c*****t 发帖数: 1879 | 46 Both Eclipse and IDEA can auto generate setXXX and getXXX for variables
with prefixes automatically. I don't think that's a problem at all.
Of course, this rule does not apply to PUBLIC/package variables (which
should only be used in cases of very simple data structures). Using
protected is a bad design. So using m_ is really for private instance
variables.
In my experience, one often times cannot always open a Java file in
an IDE and read. For example, you wanted to quickly checkout the
sou |
|
y***y 发帖数: 224 | 47 From wiki:
This is because the local class instance must maintain a separate copy of
the variable, as it may out-live the function; so as not to have the
confusion of two modifiable variables with the same name in the same scope,
the variable is forced to be non-modifiable
感觉必须加final更像一个硬性规定? |
|
l*****n 发帖数: 72 | 48 I get a very subtle question about regular expression in Perl.
for example, I have a data.txt like below:
440|34|56
44|33|56
441|23|56
442|31|56
443|30|56
0440|74|56
1441|53|56
2442|84|56
3443|92|56
The first field is the ID number.
for example, I need to find a line start exactly with ID=44, to avoid
finding some ID 440, 441, ... etc. I need to put delimiter "|" after the
ID. i.e., I am looking for a line starting with ID, and also ID
followed by delimiter "|".
1: $trackData = "data... 阅读全帖 |
|
d*******r 发帖数: 3299 | 49 closure accesses external mutable variables 挺危险的... WebStorm 是要报
warning 的呀
我觉得这个理解是对的:
如果想 callback 里的逻辑使用 callback 注册时候的 someObjectRef 的值,岂不是
传入 callback 的时候就得 copy/clone someObjectRef 当时的值?
... ...
这样做的话,就有点像其他 concurrent 模型里面的 "send a variable copy through
a message, but not give reference to the variable". |
|
d*******r 发帖数: 3299 | 50 我是觉得这个理解比较有意思:
如果想 callback 里的逻辑使用 callback 注册时候的 someObjectRef 的值,岂不是
传入 callback 的时候就得 copy/clone someObjectRef 当时的值?
这样做的话,就有点像其他 concurrent 模型里面的 "send a variable copy through
a message, but not give reference to the variable". 也就是说,Node.js 这种
single threaded 的模型,其实也是要隐性处理 issue of accessing shared
variables 的. |
|