由买买提看人间百态

topics

全部话题 - 话题: snippets
首页 上页 1 2 3 4 5 下页 末页 (共5页)
s*****g
发帖数: 1055
1
来自主题: EmergingNetworking版 - Linux running on commoditized switches
大拿不敢当,大家讨论而已.
The scenario you described is not a problem at all for puppet, puppet has a
concept of "template", which are Ruby snippets that can generates
configuration on the fly based on conditions.
Think in server management land, there are a lot configuration duplication
across servers, which configurations go before/after which configurations,
what configuration depend on what other configuration is well taken care of.
I can not imagine any large scale data center deployment will need huma... 阅读全帖
o******l
发帖数: 828
2
You are right on. This has been taking place; the new Yoga 2 Pro has so
called gesture recognition.A snippet from some reviews,
"The Yoga 2 Pro will be the first Lenovo PC equipped with gesture
recognition. Lenovo Motion Control lets users wave their hands to perform
some basic actions, like swiping to the next screen — handy if you're
trying to follow a recipe with sticky hands."
w**********k
发帖数: 1135
3
来自主题: Java版 - JAVA 一族
SUN心比天高,可要累死我们了。
Servlets 2.2
javax.servlets and javax.servlets.http
Lets you extend a server program to enhance its functionality. Servlets
are commonly used to extend a web server
by providing dynamic content.
JavaServer PagesTM 1.1
javax.servlets.jsp and javax.servlets.jxp.tagext
Lets you put snippets of servlet code directly into a static HTML page.
Enterprise JavaBeansTM 1.1
javax.ejb and javax.ejb.deployment
Lets you write a body of code with fields
s*********n
发帖数: 13
4
来自主题: Java版 - Stupid IBM JDK
hehe, funny. the owner of this snippet must be veli stupid.
s***m
发帖数: 28
5

gif/png
format
Another way is to use a servlet to generate an image. In your html page, use
an image tag to convert the image object to output stream pipe.Here is the code snippet.
Just a references. Look up the details to suit your needs.
/*********************************************************/
ServletOutputStream out = response.getOutputStream();
Frame f
j******n
发帖数: 1
6
来自主题: Java版 - Help! An Exception about JMS
looks like a prob bw weblogic and XP. reason could be the native JMS
implementation in weblogic doesn't work in XP (typical runtime errors in
MS-"EXCEPTION_ACCESS_VIOLATION"). based on your simple code snippets, you may
have nothing to do but ask weblogic, see similiar prob occurs before or they
have a patch.

exception:
at
at
weblogic.jms.dispatcher.DispatcherImpl.dispatchAsync(DispatcherImpl.java:149)
weblogic.jms.dispatcher.DispatcherImpl.dispatchOneWay(DispatcherImpl.java:429)
at
weblogic.rm
x***n
发帖数: 39
7
来自主题: Java版 - 库里有一个函数名也叫Time
why don't u show the snippet of ur Time, remember to show the
Ctor(s) also.
x***n
发帖数: 39
8
来自主题: Java版 - [转载] a question on XML parser
my guess is ur file operation takes long time.
post the snippet where you chop down the files into pieces.
R*******r
发帖数: 104
9
Maybe I didn't say it clearly. Right now F3 does open declaration,
that's what I want. But I want it to open the entire file containing
that declaration, not the snippet only.
y********o
发帖数: 2565
10
At the very bottom of the following page:
http://java.sun.com/docs/books/tutorial/collections/interfaces/collection.ht
ml

Suppose that c is known to contain only strings (perhaps because c is of typ
e Collection). The following snippet dumps the contents of c into a
newly allocated array of String whose length is identical to the number of e
lements in c.
String[] a = c.toArray(new String[0]);

The API doc for public T[] toArray(T[] a) says:
k***r
发帖数: 4260
11
This looks interesting. It could be what I am looking for.
http://www.source-code.biz/snippets/java/7.htm
b******y
发帖数: 9224
12
yes, install firebug on firefox, pretty good. you can navigate the DOM tree
and see snippets of the javascript code.
m******t
发帖数: 2416
13
来自主题: Java版 - Design thought.. Sugguestions?
I finished reading the long post, but this stuff is so specialized that
the only question I can come up with is - how did you manage the
indentation in these code snippets?
h******3
发帖数: 351
14
来自主题: Java版 - hash function question
hash function is important in implementing hash table. I know that in java
Object has its hash code, which might be generated from weak hash function.
Following is one snippet that is "supplement hash function"
static int hash(Object x) {
int h = x.hashCode();
h += ~(h << 9);
h ^= (h >>> 14);
h += (h << 4);
h ^= (h >>> 10);
return h;
}
Can anybody help to explain what is the fundamental idea of a hash algorithm
? to generate non-duplicate
r*****l
发帖数: 2859
15
You need to initiate an ajax get request and then program against the return
data. Two possible solutions:
1, Return json and you program the innerHTML of the dialog.
2, Return html snippet and put it as innerHTML of the dialog.
I did not use extJs. However, if you know javascript pretty well, this
should not be a big task.
b*****l
发帖数: 9499
16
来自主题: Linux版 - 继续批评 gentoo
因为后来成功了,所以具体错误记录被抹了。问题应当是 broken mysql headers。
在 summary.log 里找到这个:
>>> Messages generated by process 13246 on 2009-09-08 12:07:53 EDT for packa
ge sci-mathematics/glpk-4.35:
ERROR: compile
ERROR: sci-mathematics/glpk-4.35 failed.
Call stack:
ebuild.sh, line 49: Called src_compile
environment, line 2508: Called die
The specific snippet of code:
emake || die "emake failed"
The die message:
emake failed
If you need support, post the topmost build error, and t
l*******G
发帖数: 1191
17
来自主题: Linux版 - perl 高手看过来
想要把程序的patch 转成html 格式,这样code 的前后变化一目了然,便于交流,
却找不到合适的工具,
找到了一个patch2html.pl
http://david.decotigny.free.fr/snippets/patch2html.pl
下载后,运行却出错,程序很短,这里全贴出来,高手们试一试,看能否解决。(我想
很可能是程序经http下载后个别特殊字符出了问题。
错误信息如下:
Name "main::FH" used only once: possible typo at
patch2html.pl line 312.
Use of uninitialized value $string in substitution (s///)patch2html.pl line 71, line 2.
Use of uninitialized value $string in substitution (s///) patch2html.pl line 76, line 2.
---原程序 -------------------------
wy
发帖数: 14511
18
来自主题: Linux版 - 问个html的问题
这个要靠server side。很久没有用php,
不知道php有没有partial的概念,就是一段html snippet
shared by pages.

一个
容。
j*****z
发帖数: 11
19
来自主题: Programming版 - Three C/C++ Programming Questions
Can anyone help me to answer the following questions:
1) Given the following code snippet, what does the function DoesWhat() do?
And what, if any, assumptions are made about the input to the function.
struct _tagElement
{
int m_cRef;
unsigned char m_bData[20];
struct _tagElement * m_next;

} NODE, * PNODE;
PNODE DoesWhat (PNODE pn1, PNODE pn2)
{
PNODE * ppnV = &pn1;
PNODE * ppn1 = &pn1;
PNODE * ppn2 = &pn2;
for ( ; *ppn1 || *ppn2; ppn1 = &((
m***t
发帖数: 254
20
来自主题: Programming版 - question about const reference
That is absolutely correct. However, that was not the point of the question.
Unfortunately Stroustrup did
not give a ctor for this code snippet, but I assume the reference has been
safely initialized. The main
question i am having is if c is a regular const reference, then c.valid=true
in string_rep will be a violation
of constness, thus resulting in undefined behavior, right?
b*****a
发帖数: 11
21
来自主题: Programming版 - 请教一个design的问题
我有一些程序share了一些common code:
same code 1
try {
same code 2
different code 1
same code 3
different code 2
}
same code 4
我怎么能最好的design好把这些same code只放一处?
我现在用的是GoF的template method pattern,
在base class里面写进上面的code,
然后child class override 那几个different code snippet.
这样子class数量暴多
感觉这些被我当作child class的实际上更像是不同的object。
当然另外一个方案就是switch了,这个也太难看了。
但是除了inheritance 实在想不出其他好的办法。
那位高手帮我看看?谢谢
另外,我用的是C#
wy
发帖数: 14511
22
来自主题: Programming版 - 问个问题
在google blogger有什么办法可以自动syntax highlight你的code snippet?
q********e
发帖数: 161
23
来自主题: Programming版 - Looking for code example to get stock data
Hi friends,
I am looking for code example to get market data into my application? Anyone
know any free/cheap webservice/api available? Or if you have any code
snippets to grap the data directly from web?
Many Thanks !
quick
e******r
发帖数: 220
24
来自主题: Programming版 - visual stdio 2005 question
When right click mouse on some variable name, then two options show up.
surround with
insert snippet
What is the meaning of them ? thanks
k**f
发帖数: 372
25
来自主题: Programming版 - What is automatic space allocation in C++?
Your question is not clear.
You may want to explain what is "automatic space allocation", probably using
the example of another language.
In your code snippet
int i, a[100];
the compiler will allocation space on the stack for an integer i, and space
for integer array a of 100 integers.
h*******e
发帖数: 225
26
pls post the real code snippet esp the loops.
b***y
发帖数: 2799
27
☆─────────────────────────────────────☆
ilvch (From here to eternity) 于 (Sat Jul 12 23:45:03 2008) 提到:
一个code snippet:
while (a!=1){
if even(a) a=a/2;
else a=3*a+1;
}
问这个程序会不会在某种输入(a>0)时陷入死循环?
☆─────────────────────────────────────☆
repast (xebec) 于 (Sun Jul 13 00:11:47 2008) 提到:
这个是一 countable markov chain, but definitive,
u need to judge if it is recurrent/transient for every initial state.

☆─────────────────────────────────────☆
goodbug (好虫) 于 (Sun Jul 13 00:14:22 2008) 提到:
我猜
v*****r
发帖数: 2325
28
thanks. could you paste some c code snippet opening gzip and read line by
line.
open from pipe will be slower than using zlib i believe, but the code is
easier to write.
N***m
发帖数: 4460
29
来自主题: Programming版 - compile error
for this snippet, no error was reported on gcc.
It could be some error elsewhere. As C2784 says:
'declaration' : could not deduce template argument for 'type' from 'type.'
The compiler cannot deduce a template argument from the supplied
function arguments.
N***m
发帖数: 4460
30
来自主题: Programming版 - 问个问题
对于一个数n,把它因式分解,可以得到一个list,比如
12=2*2*3,list=[2,2,3]。
我现在做个循环
for(int i=0;i<100;i++) {
FactorizerCounter counter = new FactorizerCounter(2000*i+1,2000*(i+1));
...
得到 list in this range;
}
where the above snippet inside the loop obtains a list with maximum length
in the given range (2000*i+1,2000*(i+1)), both inclusive.
我发现因式分解的长度有点涨落,但是变化不大(O(logN)?),
不知道有没有啥简单的解释?
运行结果如下:
===============================
2*2*2*2*2*2*2*2*2*2=1024
2*2*2*2*2*2*2*2*2*2*2=2048
2*2*2*2*2*2*2*2*2*2*2*2=4096
2*2*2*2*2*2*2... 阅读全帖
L******r
发帖数: 33
31
来自主题: Programming版 - 请教这段Code到底是哪错了?
Find, correct and explain the defect in the following code snippet.
Mutex mA;
Mutex mB;
Take(mA);
Take(mB);
DoSomething();
Release(mA);
Release(mB);
g*****g
发帖数: 34805
32
来自主题: Programming版 - 从今天开始起,学C++!
Good article, you can also take a look at this one.
http://www.infoq.com/news/2008/06/scala-vs-erlang
I think it has an unbiased conclusion. At the end of the day though,
I think Scala's access to Java libraries, and less steep learning
curve makes it more attractive for Java developers that are widely available.
[Snippet]
Both Scala and Erlang are languages that target the multi-core crises. They
come from different background and eras and thereby approach some problems
differently, but in many... 阅读全帖
r****y
发帖数: 26819
33
eclipse里有code snippet testing功能
建一个.jpage页面,代码敲进去直接运行测试

c
d****n
发帖数: 1637
34
来自主题: Programming版 - 请教一个C++问题
我就是写个snippet.
那些,getter setter 都 save 了。也不是重点啊。
你不会介意吧?
t****t
发帖数: 6806
35
no, when i said "current" thread, means the thread executing the code
snippet you provide. it starts t1 and t2 and waits for t1 and t2. it can
never be t1 or t2.
b***i
发帖数: 3043
36
来自主题: Programming版 - vector的析构问题
这就对了,你写好一个snippet,然后我们放到codepad.org上运行,就可以继续讨论了
另外,你那个A::~A里面的swap是谁跟谁?什么目的?
b***i
发帖数: 3043
37
来自主题: Programming版 - vector的析构问题
那你就作出一个能出错的snippet,放到codepad上出错,再贴出来代码,好吗?
另外,你怎么不用delete,而是直接~?
b***i
发帖数: 3043
38
来自主题: Programming版 - map析构
什么是 ~pair?
写个snippeT
b***i
发帖数: 3043
39
来自主题: Programming版 - map析构
if you use map ..... * param=new ...., then you use delete param in
destructor of testGA. if you use auto, then no need to write anything. The
destructor of map will be called.
Show us more code before you make a snippet: including:
testGA yourvariable, what did you do to this variable
anythign done with params inside testGA,
where did you do insert, where is node
what did you do in destructor of testGA.

make
b***i
发帖数: 3043
40
来自主题: Programming版 - map析构
基本上,主程序就调用了dll的函数,在dll里面进行类的生成和使用,毕竟param是
private的,你没有跨dll使用类。不管怎么样,还要找出到底怎么样才能让snippet出
错。你原来说params.clear()在析构,现在看来不在析构里面。
再想想,还有没有别的什么不同?比如,你使用了几次那个函数?
c****e
发帖数: 1453
41
来自主题: Programming版 - 老板嫌我C++太差!请推荐。
Some semi-cheating tricks that could help you immediately:
(1) Don't try to write your own code, try to find existing snippet to copy.
(2) Use std/boost as much as you can. It can somehow make your code "look"
better in many cases. And yes usually it does "run" better. It also makes
your code more "c++"
(3) Search on internet for "c++ coding standards/guidelines". You will find
yourself is less likely to be embarrassed during code review by your boss.
r*****3
发帖数: 143
42
来自主题: Programming版 - Python应用核心编程 (第3版)
中文名: Python应用核心编程 (第3版)
原名: Core Python Applications Programming, 3rd Edition
作者: Wesley Chun
资源格式: PDF
版本: 英文文字版/EPUB
出版社: Prentice Hall
书号: 0132678209
发行时间: 2012年3月
地区: 美国
语言: 英文
内容介绍:
The Complete Developer’s Guide to Python
Python is an agile, robust, and expressive programming language that
continues to build momentum. It combines the power of compiled languages
with the simplicity and rapid development of scripting languages. In Core
Python Applications Programming, Third Edition, leading ... 阅读全帖
y****e
发帖数: 23939
43
来自主题: Programming版 - 问一个简单C++问题
Which of the following statements describe the results of executing the
code snippet below in C++?
int var = 1;
void main() {
int i = i;
}
A. The i within main will have an undefined value.
B. The compiler will allow this statement, but the linker will not be able
to resolve the declaration of i.
C. The i within main will have a value of 1.
D. The compiler will not allow this statement.
E. The result is compiler-dependent.
正确答案应该是什么?为什么?
觉得A和E都对。
H****S
发帖数: 1359
44
来自主题: Programming版 - 今天跟公司confirm了,没有人用Scala
play的话用vim毫无压力,Scala code和markup混在一起写,就没有什么type check的
必要了。这也是个人认为用Scala做web开发,还是Lift更好的原因,通过写snippet/
view来实现function,compiler will help you make way fewer mistakes,这个在工
程量变大以后尤其重要。即便performance wise来讲,我不知道play和lift相比较如何
,Lift是比ror要快很多的。
c*****y
发帖数: 562
45
来自主题: Programming版 - node.js又赢了
老赵你还是平时少灌点水,稍微学点吧。这种带code snippet的JSP真正projects哪有
用的
L*****e
发帖数: 8347
46
来自主题: Programming版 - Java题求指导 (转载)
这个题是多选题还是单选题啊?
首先,这肯定不是什么decorator pattern,但是古德霸说的D也是错的,因为
FileReader, BufferedReader都只能read stream of characters。
我觉得是题目有问题,他的snippet大概是想这么写:
BufferedReader br = new BufferedReader(new InputStreamReader(new
FileInputStream(file.in)));
这样,就只有C是错的。。。

★ 发自iPhone App: ChineseWeb 8.2.2
c******f
发帖数: 243
47
The following snippet of catalina.properties shows how to set values for the
variables used in the preceding server.xml file.
bio.http.port=8080
bio.https.port=8443
http static.springsource com projects tc-server 2.5 admin html manual-simple
html
v******y
发帖数: 84
48
这是我做的10题,大家试试
以后公布答案
Which of the following is the most portable way to declare a C preprocessor
constant for the number of seconds in a (non-leap) calendar year?
Response:
#define SECONDS_PER_YEAR 60 * 60 * 24 * 365
#define SECONDS_PER_YEAR 60 * 60 * 24 * 365;
#define SECONDS_PER_YEAR (60 * 60 * 24 * 365UL)
#define SECONDS_PER_YEAR (60 * 60 * 24 * 365)
Score 1 of 1
Question:
Which of the following is the most flexible way to declare a C preprocessor
macro that takes two arguments and returns th... 阅读全帖
首页 上页 1 2 3 4 5 下页 末页 (共5页)