l*********8 发帖数: 4642 | 1 pass by reference 好吧
static local variables 看起来不好理解 |
|
|
a********m 发帖数: 15480 | 3 如果是static,下次重新调用同一个计算的时候怎么办?还要弄一个 bool first_time
的变量? |
|
U*********y 发帖数: 54 | 4 同意这个, static local variable可能不好还原成初始状态.
time |
|
a********m 发帖数: 15480 | 5 很简单的一个代码,计算一个二茶树的高度,不用参数用static试试看。 |
|
a**********0 发帖数: 422 | 6 上次一个帖子中学习到了professional的代码要使用单独的一个class来盛放这些
static field 但是不是很知道原因 |
|
d******b 发帖数: 73 | 7 因为本质上是全局的,在规模变大后,会造成混乱。放在单独的一个类里,可能是便于
管理。
我的观点是 static Field 必须 加 final |
|
a**********0 发帖数: 422 | 8 大规模情况下造成混乱是说 lose track of how it is changed and what the
current value it is 对吧
教科书经常具的例子是比如生成一个 human class 于是定义一个 static field 是
population 每construct 一个人 就加一 这样可以自动统计人数 这样的例子不实用
吗》 |
|
|
g*****g 发帖数: 34805 | 10 In practice, if you need some data to support singleton, you are better off
with a DI framework, Spring IoC, Guice etc. Beyond that scope, static field
is pretty much limited to constant. |
|
g*****g 发帖数: 34805 | 11 DI is more flexible, e.g. you can extend and have hierarchy. You can have
precise control of life cycle.
After all, static -> single copy of data/method in the JVM. Singleton means
the same thing. And DI is recommended way to implement Singleton. |
|
t**r 发帖数: 3428 | 12 c++最变态的是 头文件,模板,const, static 这几件事情。
可惜c++11, 14, 17没有在这几方面改进。
没有任何理由回到c++的世界。
底层编程c足以。linus 用c写linux也不需要cpp.
上层编程就是jvm的天下。
客户端就是js.
写测试用python.
写机器学习用scala。
c++只会慢慢衰退 |
|
a********m 发帖数: 15480 | 13 前两个不争论。const和static有啥问题。。。。 |
|
I*******g 发帖数: 7600 | 14 地址哪里?
薪水范围?
有没有股票?
static
/* */ |
|
w****l 发帖数: 269 | 15 These are all text books required by courses:
Linear Algebra and its applications (4th edition), price $70
Introductory Nuclear Reactor Statics, price $60
Introductory Nuclear Reactor Dynamics, price $60
condition: almost new
contact: 765-491-7284 or w*******[email protected] |
|
a*****0 发帖数: 3319 | 16 60D录的像在电脑上看,出现很多big static noise画面。LCD上是看正常的。
请问这是为什么?多谢。 |
|
x****c 发帖数: 25662 | 17 什么是big static noise?
是不是播放器的原因。 |
|
a*****n 发帖数: 5158 | 18 right click on the image, then copy the image url (chrome)
then u will get a link,
then change "/sxxx/" in the link (change xxx to the size of the image)
such as "..../s1500/....
static |
|
|
L****8 发帖数: 3938 | 20 不就是把棋谱数据库增大了么 然后欺负人的记忆力
算个屁的人工智能
在合理的时间内分析出下一步最优的走法。1997年IBM超级计算机“深蓝”则利用了蒙
特卡洛搜索树的方式做到了这一点。“深蓝”能够预测出对手下一步会怎么走,而且计
算力远高于人类。但是,围棋要复杂得多。国际象棋每一步平均只有35种可能性的走法
,但是围棋呢——在19*19的棋盘内,共有361个点,就机器学习的角度而言,围棋的计
算最大有3361种局面,大致的体量是10170,而已经观测到的宇宙中,原子的数量才
1080。国际象棋最大只有2155种局面,称为香农数,大�: 率�1047。
使用蒙特卡洛树搜索技术,Crazystone等系统能够进行更长远的计算。而结合其他技术
的话,它们能够对可能性走法进行刷选,然后选择出最优的策略。在大多数情况下,它
们能够战胜人类选手,但不是最厉害的那一个。顶级大师中,走法很多时候依靠直觉—
—做棋除了需要计算,还有棋感——棋手能够根据棋形分析攻防线路。“好的棋形看起
来顺手多了,”Hassabis本身也是一名围棋手,“这其中不只有计算角力,还有审美。
这也... 阅读全帖 |
|
c*******9 发帖数: 6411 | 21 if only have one static IP, and I have multiple machine, and plan to use one
machine to host a website and other machines for personal uses. will that
going to work? can multiple machines share the same IP?
thanks |
|
p******w 发帖数: 62 | 22 本人新手,自己有一个static ip,是comcast的business class,server在路由器后面
,目前可以通过ip address access。
最近买了一个域名,没有买hosting,请问怎么绑定我的域名和ip address?我自己要
设一个dns server么?还是要用comcast的dns?
多谢了! |
|
c*o 发帖数: 70 | 23 Then waht are the drawbacks of using static in this senario?
.
in-depth
postback,a
ur
field
to
in
from |
|
e***i 发帖数: 43 | 24 我正在做一个板子,需要做一个static ram,用来存取一个参数,加上一个芯片以后,
开机后,时有时无。断电4小时后,里面存的参数也是消失了。换了3家芯片都这样。
不知道那个大虾懂?
可以有报酬 |
|
e****c 发帖数: 10 | 25 I am goint to set up a FTP server, so i want a static IP with Cable modem,
does anybody have experience on it ? thanks |
|
G**T 发帖数: 388 | 26
u can ask a static IP, but u need pay more |
|
s******e 发帖数: 63 | 27 in one web application(resin server), I put string constants in one class
Constants, those string constants are like:
public final static String UPPER="...."
when other classes use this constants, just call Constants.UPPER etc.
but when I changed some string value, recompiled, even restarted resin server,
in the places where uses changed constants, it still uses old constants.
how could this happen? if changes was taken inside jsp, I could understant
there's some cache issue. do java classes als |
|
s******e 发帖数: 63 | 28 normaly those web service urls don't change, so it does not make sense
to put them in database. if I do it this way, it will cost many testing
time also. I just need a quick, safe way to make the change.
thanks.
so even 'static' won't solve the problem? I could not test now, have to try
tomorrow? |
|
R*******r 发帖数: 104 | 29 I don't understand why Graphics.getFontMetrics() is not a static method.
if I want to use this method in the start of application when getGraphics()
is not awailable, what do you do other than create a dummy image. |
|
h*****0 发帖数: 4889 | 30 static initiator? 静态初始化器?
你不是已经写得很明白了吗? |
|
c******n 发帖数: 4965 | 31 static initialization block |
|
N*D 发帖数: 3641 | 32 java是要求在初始化前,包括static initializer或者constructor都可以 |
|
N*D 发帖数: 3641 | 33 我是说:
如果是class fields,it如果是static,必须在class load时initialize一次;如果是
instance,必须在instance initialze时复值一次;
local variable就是随便了,只能一次。 |
|
h*****0 发帖数: 4889 | 34 好吧。这个可以理解,因为static field如果class load之后的赋值编译时是不知道的
,同样一般的field在instance被创建之后的赋值也是编译时不知道的。无法保证是一
次。 |
|
b******y 发帖数: 9224 | 35 I did some research. It seems to me that static variables, if they are
primitives, are stored in permgen, also object references.
Objects could be allocated in any heap. |
|
r*****l 发帖数: 2859 | 36 This is inline with what I thought. Thanks.
Now there is something more interesting. If I have a class Singleton, look
at the code below:
private static final Singleton instance_ = new Singleton();
Suppose reference to the Singleton class (value of "instance_") is stored in
permgen, then what about the Singleton object. It has the same life cycle
as instance_ so it makes sense to store it in permgen. However, I do believe
they will be stored in normal heap (finally tenured) cause otherwise the
p... 阅读全帖 |
|
r*****l 发帖数: 2859 | 37 Read the JVM Specs. All field metadata is stored in the permgen (method area
). Static variable each has a reference to a ConstanceValue data structure,
also in permgen. The value can be of type long, float, double, int (short,
char, etc.), and string. The Specs does not specify how a object reference
is stored (or at least I did not find it). Maybe it's like this: if the type
of the field is not primitive, then the value stored in the ConstantValue
data structure is interpreted as an object ref... 阅读全帖 |
|
r*****l 发帖数: 2859 | 38 This is too vague and most people know it.
My two specific questions are:
1, If static variable is stored in permgen
2, Proof whether the answer is yes or no. |
|
b***i 发帖数: 3043 | 39 public class zzz {
private xxx ok=new xxx();
private class xxx {
private static final int[] aa={1,2,3};// this one |
|
N***m 发帖数: 4460 | 40 我想是因为每个zzz object有自己不同的class xxx definition,
所以想按照你原来意思那么用的话,可以把xxx声明为static. |
|
f*******n 发帖数: 12623 | 41 这个是inner class的问题。inner class的static只可以是constant。
不放在inner class就行了 |
|
|
b***i 发帖数: 3043 | 43 就是想吧,每次initialize xxx的对象,不想生成那么多数组,因为就是常数,不会改
变。而且就在private class里面用,要把数组放进xxx里面非常合理。但是,xxx里面
确实要对外面的class对象进行操作,所以不能整个class都static.
挪数组到外面也可以。
有没有可能本来private class里面的final int[]就不会有多个copy? |
|
s******e 发帖数: 493 | 44 Maybe I misunderstood you. But I do not think this is the case for the
facade. I do not think you are coding a facade even you call it so.
Maybe what you really need is the factory method or abstract factory.
Usually a static variable can be coupled with the abstract factory. |
|
|
Y**G 发帖数: 1089 | 46 很多时候static是需要的,比如singleton pattern |
|
g*****g 发帖数: 34805 | 47 Everything is within an object is a good design. You avoid the namespace
conflict of C/C++ automatically.
And main is static because you call it without creating the wrapping object. |
|
w*s 发帖数: 7227 | 48 Hi, someone mentioned this last time,
the latest ubuntu is using network-manager to set static/dhcp.
So i cannot use command line to change this anymore ?
BTW,
in /etc/network/interfaces,
i only see
auto lo
iface lo inet loopback
nothing configured for eth0.
But when i boot up, it's using dhcp ?
Where does it get the configuration now ? |
|
R*********r 发帖数: 225 | 49 昨天通过network-manager改了static ip,然后查了下 /etc/network/interfaces
发现里面的内容没变,猜测可能得修改其他的文件。 |
|
b*****n 发帖数: 2324 | 50 dynamic link好查,ldd就可以了。
一直没搞明白static link的有什么办法可以查看,有时候这功能还挺有用。谢谢。 |
|