由买买提看人间百态

topics

全部话题 - 话题: templates
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
h****n
发帖数: 2552
1
【 以下文字转载自 Biology 讨论区 】
发信人: midwestPstD (中西部博士后), 信区: Biology
标 题: 请教CRISPR行家-HDR Template Design
发信站: BBS 未名空间站 (Tue Nov 18 16:24:10 2014, 美东)
看了Zhang Feng的Nature Protocol关于CRISPR的文章,Figure 6里面的ssDNA
template明显的效率比plasmid作template高。文章并没有明确说明哪个template好。
想了一下,ssDNA分子量比plasmid小多了,同样的ug template, ssDNA的分子数肯定多
多了,也许这是一个解释。
我自己在设计HDR template,想两边各一个Kb的homologous arm,中间有60-70bp 的
mutation insertion。这个两kb的DNA准备克隆到一个plasmid里面,sequencing确定
mutation后,就可以用作HDR template了。
想请教的是:需要把这个两Kb的template从plasmid里... 阅读全帖
c*****t
发帖数: 1879
2
来自主题: BuildingWeb版 - DreamWeaver template 问题
我想做的是
Template M = master web site template
Template P = a sub-project template that uses template M
HTML H = a page in the sub-project that uses template P
其中,Template M 中某些允许 edit 的地方 Template P 已经填了。
不让 HTML H 修改这些地方。
这个能在 Dreamweaver 8 中实现么?如果可以,如何?
thx
w***g
发帖数: 5958
3
来自主题: Programming版 - CNN和template matching到底有啥区别
是template matching, 如果光从预测算法来看, 甚至还不如传统的template matching.
deep learning的template matching就是内积+threshold, 可以认为是最最最土的
template matching. 传统的template matching算法往往比这个复杂, 而且也更
robust, 比如允许一定程度上的warping. 有时候对象一抖, template就匹配不上了.
Deep learning的对应方法是redundancy, 搞好多好多templates. 这个匹配不上了,
那个或许能匹配上. 以上不是关键.
deep learning牛x的地方是能够训练这些template, 而且是:
1. 一锅子训练. (2012年以前是一层一层训练, 当时甚至认为要deep必须一层一层
训练, 现在看来是不对的.) 一锅子的好处是层与层之间是配套的. 解的是一个
全局最优化问题, 而不是一系列局部最优化问题然后拼起来.
(注意不是全剧最优解. 不管是全局问题还是局部问题, 往往都得不到最优解.
但是全局次优解... 阅读全帖
b****r
发帖数: 86
4

1



2


3


product是vendor的child.
是1,2,3还是1,3,2?
m*********D
发帖数: 1727
5
来自主题: Biology版 - 请教CRISPR行家-HDR Template Design
看了Zhang Feng的Nature Protocol关于CRISPR的文章,Figure 6里面的ssDNA
template明显的效率比plasmid作template高。文章并没有明确说明哪个template好。
想了一下,ssDNA分子量比plasmid小多了,同样的ug template, ssDNA的分子数肯定多
多了,也许这是一个解释。
我自己在设计HDR template,想两边各一个Kb的homologous arm,中间有60-70bp 的
mutation insertion。这个两kb的DNA准备克隆到一个plasmid里面,sequencing确定
mutation后,就可以用作HDR template了。
想请教的是:需要把这个两Kb的template从plasmid里面酶切出来,gel纯化后再和cas9
plasmid一起co-transfect吗?要作ssDNA太难了一点,还没考虑。:(。
很多年前作过ssDNA的transfection(pUC18?phage-ssDNA纯化的),记得当时发现
ssDNA在真核细胞内不如dsDNA的plasmid稳定... 阅读全帖
n*****r
发帖数: 159
6
来自主题: Programming版 - a c++ question for template
Templates are often thought to be very similar to C-style macros. Which
one of the following statements about templates is true?
Choice 1 Macros have static linkage; templates have external linkage.
Choice 2 Templates are strongly typed; macros are not.
Choice 3 Macros are evaluated at compile time; templates are at runtime.
Choice 4 Class templates are less efficient than class macros.
Choice 5 You can inherit from a macro.
I know 1,3 is not correct. How about 2,4,5?
n**d
发帖数: 9764
7
来自主题: Programming版 - Default function template arguments
"You can provide default arguments for template parameters in class
templates, but not function templates."
the words are from "Thinking in C++" V2. The first part is easy understood,
which is something like this
template class Stack {...}
But how to understand the 2nd part, "not funtion templates". Is it something
like this, which should be illegal according to this rule?
template T sum(T* a) {...}
c*******3
发帖数: 21
8
来自主题: Programming版 - C++ template problem
Answer from http://www.cplusplus.com/doc/tutorial/templates.html:
Templates and multiple-file projects
From the point of view of the compiler, templates are not normal functions
or classes. They are
compiled on demand, meaning that the code of a template function is not
compiled until an
instantiation with specific template arguments is required. At that moment,
when an instantiation is
required, the compiler generates a function specifically for those arguments
from the template.
When projects
l**b
发帖数: 1
9
来自主题: Programming版 - template 类的继承问题
When compiler encounters a template, it does name look up in two steps. For
all types that are non-template dependent, it checks at the time the
template is defined. For all template dependent types, it has to wait until
the template is instantiated to do name loop up. Since your array does not
have any qualifier to tell compiler that it is template type dependent,
compiler assumes it is not and tried to resolve the name look up and
declared error.
That is also why if you add this or Base<_tp>::
c**********e
发帖数: 2007
10
【 以下文字转载自 JobHunting 讨论区 】
发信人: careerchange (Stupid), 信区: JobHunting
标 题: C++ Q89: function template and overloading
发信站: BBS 未名空间站 (Fri Oct 14 19:45:23 2011, 美东)
What range of functions does a single function template define?
A. Related overloaded functions called function templates
B. Related overloaded functions called template functions
C. Unrelated overloaded functions called function template
D. Unrelated overloaded functions called template functions
P*******e
发帖数: 65
11
If the function inherited from the base template class has paramters as the
type of the base template class, the "this->" can be avoided. Otherwise, "
this->" is necessary to tell the compiler the type used in the base template.
template
class BaseClass {
public:
BaseClass() {};
~BaseClass() {};
void Write(T var);
T Read(void);
private:
T variable;
};
template
class ChildClass : public BaseClass {
public:
ChildClass() {};
~ChildClass() {};
void WriteA
c**********e
发帖数: 2007
12
来自主题: JobHunting版 - C++ Q72: template (skillport)
What range of functions does a single function template define?
a) Related overloaded functions called function templates
b) Related overloaded functions called template functions
c) Unrelated overloaded functions called template functions
d) Unrelated overloaded functions called function templates
c**********e
发帖数: 2007
13
来自主题: JobHunting版 - C++ Q89: function template and overloading
What range of functions does a single function template define?
A. Related overloaded functions called function templates
B. Related overloaded functions called template functions
C. Unrelated overloaded functions called function template
D. Unrelated overloaded functions called template functions
l*********8
发帖数: 4642
14
你是不明白语法? 还是不明白这段程序的意义?
从语法上来说, There are three kinds of template parameters:
Type template parameters (C++ only)
Non-type template parameters (C++ only)
Template template parameters (C++ only)
https://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%
2Fcom.ibm.xlcpp8a.doc%2Flanguage%2Fref%2Ftemplate_arguments.htm
q**1
发帖数: 193
15
来自主题: BuildingWeb版 - DreamWeaver template 问题
你要的template是不是像word文档里面的template,每个文件都在这些自动生成的
template的基础上写。。这个应该只能做静态的HTML文件吧。。
我现在用的工具比较爽,网站所有文件都可以自动继承一个layout(缺省放在根目录的
一个文件),每个子目录下还可以做单独设置(用一个同名文件),可以是在上级目录
的基础上添加新的公用元素,可以只局部继承上级目录,或者完全开始个新的layout。
所有公用元素都不必出现在其他HTML文档中,所以极大地减少了HTML code的维护量。
。。。。
不过估计你说的template和我想的完全不是一回事,呵呵。。
whatsoever,像这种template,layout wrapper的东西用 Perl 和 vim 绰绰有余,除
了要做些fancy的外表,那就不是我熟悉的了。。
p**e
发帖数: 335
16
来自主题: Programming版 - C++ template question
template
class test
{

test();
~test();
friend bool operator== (const test &p1, const test &p2); //line 7
};
I will get:
test.h:7: warning: friend declaration 'bool operator==(const test&, const
test&)' declares a
non-template function
test.h:7: warning: (if this is not what you intended, make sure the function
template has already been
declared and add <> after the function name here) -Wno-non-template-friend
disables this warning
template
class t
a****d
发帖数: 114
17
来自主题: Programming版 - 一个关于C++ template和overload的问题
下面这个程序为什么选择的是template version呢?
/******** 程序1 ********/
#include
using namespace std;
#include
using namespace std;
template
void f(const T a) {
cout<<"Template version."< }
void f(const int* a) {
cout<<"Plain version."< }
int main() {
int x=2;
int *a= &x;
f(a);
return 0;
}
/************************/
但是把所有的 int* 换成 int 之后选的是non-template version:
/********* 程序2 ************/
#include
using namespace std;
template
void f(const
p********7
发帖数: 549
18
来自主题: Programming版 - 问个C++ TEMPLATE 的问题
template<> class stack
{
public:
int Push(char);
char Pop();
}
第一行template<> 是表示什么这个class is an example of which of following:
a.an empty template declaration
b.a virtual template class
c.template specialization
d.忘记了
a****o
发帖数: 686
19
来自主题: Programming版 - C++ Q73: template (skillport) (转载)
【 以下文字转载自 JobHunting 讨论区 】
发信人: careerchange (Stupid), 信区: JobHunting
标 题: C++ Q73: template (skillport)
发信站: BBS 未名空间站 (Mon Oct 11 20:04:18 2010, 美东)
Which of the following statements are true? Multiple choices.
a) Non-template classes can be nested
b) It is possible to nest one class template inside another
c) Class templates cannot be nested
d) Class templates can be nested
j*******e
发帖数: 674
20
来自主题: Programming版 - C++ class template specialization question
By looking at the following code, I am confused by line 3.
Line 3 is not a special case of the base template, it is more like a "class
overload".But it can be compiled successfully.
The obj1 in line 7 is defined acorrding to line 3, but failed to compile.
How come?
=========================
template class Bar{}; //Base template
template class Bar{}; // Specialization, which is good
template class Bar阅读全帖
c**********e
发帖数: 2007
21
来自主题: Programming版 - C++ Q88: nested non-template class (转载)
【 以下文字转载自 JobHunting 讨论区 】
发信人: careerchange (Stupid), 信区: JobHunting
标 题: C++ Q88: nested non-template class
发信站: BBS 未名空间站 (Fri Oct 14 19:41:34 2011, 美东)
Multiple choice: Which of the following statements are true?
A. Non-template classes can be nested.
B. It is possible to nest one class template inside another.
C. Class templates cannot be nested.
D. Class templates can be nested.
m******u
发帖数: 12400
22
RNA polymerase一般需要双链template---assume大家用的是T7或SP6的polymerase。你
200nt template指的是单链模板么?至少promoter区要双链的。
而PCR产物则是双链的,你的问题会不会是这个原因。
发信人: reallyloveme (ray), 信区: Biology
标 题: Re: in vitro transcription for short template
发信站: BBS 未名空间站 (Tue Jun 20 12:46:24 2017, 美东)
很感激
我做了200nt oligo为template的IVT,压根不work
而PCR product作为template还可以
我不知道是我技术的问题,还是oligo本来就很难work呢?
c**********e
发帖数: 2007
23
来自主题: JobHunting版 - C++ Q73: template (skillport)
Which of the following statements are true? Multiple choices.
a) Non-template classes can be nested
b) It is possible to nest one class template inside another
c) Class templates cannot be nested
d) Class templates can be nested
c**********e
发帖数: 2007
24
来自主题: JobHunting版 - C++ Q88: nested non-template class
Multiple choice: Which of the following statements are true?
A. Non-template classes can be nested.
B. It is possible to nest one class template inside another.
C. Class templates cannot be nested.
D. Class templates can be nested.
c**********e
发帖数: 2007
25
来自主题: JobHunting版 - C++ Q88: nested non-template class
More explanation from the study material:
"One thing to keep in mind when writing class templates is that although non
-template classes can be nested, class templates cannot."
"Nesting one class template inside another generates a syntax error."
But I am not sure.
h*****f
发帖数: 248
26
来自主题: JobHunting版 - C++ template
1. Compile time because template initialization is done during the compile
time and the initialization is based on the "known" template parameter(s)
during the compile time.
2. A way to prove:
#include
#include
template class Buffer {
char internal[max];
public:
void printSize() {
printf("buffer size=%lu\n", sizeof(internal));
}
};
int main() {
Buffer<512> my512;
my512.printSize();
size_t v;
std::cin >> v;
printf("my input=%lu\... 阅读全帖
g**u
发帖数: 15
27
来自主题: Programming版 - Help C++ Template function link error .
Hi,
i am learning C++ template now. I decleared serveral template functions in a
head file and implemented them in a cpp file. In main function located in
mainfile I call these template functions, but everytime I tried, there was a
link error Lni 2001. When I move the declear and implementment to mainfile and
then call them, it's fine. In another way, I changed all the template
functions to normal functions in the head file and cpp file, the program works
well. So what's the problem?
Thanks
s*******y
发帖数: 558
28
来自主题: Programming版 - Help C++ Template function link error .
For .Net, you can't include .cpp in .h.
Just put template definition and implementation together
in the same file and name it as .hpp (means header and cpp),
and then include this .hpp in ur other .cpp file.
Under Linux or Cygwin, u can separate the declaration and
implementation of template. But u have to include .cpp of
the template in .h. For example, to declare a template class
myTemplate.H
#ifndef MY_TEMPLATE_
#define MY_TEMPLATE_
temaplate
class example{
...
};
#include "myTempla
g****n
发帖数: 14
29
来自主题: Programming版 - C++ template question
You should write:
template
class test
{
public:
test() {}
~test() {}
template <> friend bool operator== (const test &p1, const
test &p2); //line 7
};
In this case, only a specialized instance of operator== is the friend of
test.
If you write
class test
{
public:
test() {}
~test() {}
template friend bool operator== (const test &
p1, const test &p2); //line 7
};
All the instances of template operator=
F*******i
发帖数: 190
30
来自主题: Programming版 - c++ template question:
trying a sample code from template complete:
template
class IsClassT {
private:
typedef char One;
typedef struct { char a[2]; } Two;
template static One test(int C::*);
template static Two test((B!DB);
public:
enum { Yes = sizeof(IsClassT::test(0)) == 1 }; //ERROR LINE
enum { No = !Yes };
};
It is supposed to work from the book, however, the g++ complains as:
line 21: error: expected primary-expression before '>' token
do not
h*********o
发帖数: 62
31
来自主题: Programming版 - How does template work in C++
Java generic is totally different from C++ template under hood. Does C++
use also sharing and type erasure when dealling template? If not, do you
see any problem/benefit to do the template in a way that Java does? Or why
didn't java use C++ template to do its generics?
i***h
发帖数: 12655
32
来自主题: Programming版 - 一个C++ template的问题
在Effective STL 书里看到的, 但是不太清楚.
为什么在第二段code里可以直接用DeleteObject,
而第一个里面一定要DeleteObject呢?
第一段Code:
template
struct DeleteObject:
public unary_function {
void operator()(const T* ptr) const
delete ptr;
}
};
void doSomething()
{
for_each(vwp.begin(), vwp.end(), DeleteObject);
}
第二段Code:
struct DeleteObject { // templatization and base
// class removed here
template II templatization added here
void operator()(const T* ptr) const
{
delete ptr;
}
}
b**n
发帖数: 289
33
我有一个GVector 的Class,它有一个copy constructor是用template的。
template
class GVector{
public:
template GVector (const GVector& rhs): length_(rhs.length()
){
ptr_ = new (nothrow) T[length_];
assert(ptr_);
std::copy(&rhs(0), &rhs(0) + length_, ptr_);
}
但我每次在下列情况下(X = T)都会出现运行期的内存错误
GVector v(3);
GVector v2(v);
但如果在X != T时,就没有问题,比如:
GVector v(3);
GVector vi(v);
请问这是怎么回事? 我现在在把我以前写的一些class改成template的,结果问题好多
啊!
谢谢帮忙。
t****t
发帖数: 6806
34
This is due to the incorrect use of terminology.
"它有一个copy constructor是用template的。"
1. "Copy constructor" means the special, non-template constructor, if the
first parameter is of type X&, const X&, volatile X&, or const volatile X&(,
and other parameter can be omitted). Therefore, if the parameter is of type
T& (T!=X), it is not a copy constructor; if a constructor is a template, it
is not a copy constructor. Repeat: copy constructor is never a template.
2. Copy constructor is implicitly define
a****d
发帖数: 114
35
来自主题: Programming版 - 一个关于C++ template和overload的问题
多谢!
程序2我能够理解。在程序1里面,template里面把T置换成int*之后得到和non-
template一样的函数:
void f(const int*);
但是为什么选择的是template呢?按照section 16.7里面的说法,当都是viable
function的时候应该选择non-template。
[哦,难道是先把"const T"里面的const去掉, 然后再instantiation?]

determining
j***i
发帖数: 1278
36
来自主题: Programming版 - 一个关于C++ template和overload的问题
这个c++ primer 里面有
template 一般不会有conversion 直接会生成一个新的instantion
但是如果 T 是指向const 元素的指针或者reference,可以用非const的match,这就是
说,const 和non const 共用一个实现
第一个程序,template吧 吧T 替换为 int * 是perfect match,
因为 const int * 和 int* 对于template都一样的,
plain 的版本还有一个implicit 的转换从 int* 到const int* 所以选了template
你可以去找找c++ primer 解释的很清楚的
s*****e
发帖数: 33
37
来自主题: Programming版 - One c++ non-type template question
Sorry, this is the original intention, what I want to achieve is some kind
of automatic dispatch, say we have 3 specialized functions:
like:
template
void set()
{
std::cout << "set " << N << " is called\n";
}
template<>
void set<1>()
{
}
template<>
void set<2>()
{
}
template<>
void set<3>()
{
std::cout << "3 called" << std::endl;
}
int main()
{
int n;
// read n from somewhere, e.g.,network or disk
switch (n)
{
case 0: set<0>(); break;
case 1: set<1)(); bre... 阅读全帖
n*******r
发帖数: 22
38
来自主题: JobHunting版 - C++ Singleton Template - 编译通不过
在Visual Studio上编译总是有错,哪位大侠能不能帮我看看是什么原因?
error LNK2019: unresolved external symbol "private: __thiscall
Singleton2::Singleton2(void)" (??0?$Singleton2@H@@AAE@XZ)
referenced in function "public: static class Singleton2 * __cdecl
Singleton2::GetInstance(void)" (?
GetInstance@$Singleton2@H@@SAPAV1@XZ)
// Singleton.h
template class Singleton2
{
private:
Singleton2(void);
~Singleton2(void);
Singleton2(const Singleton2&);
Singleton2& operator=(const Si... 阅读全帖
c*****t
发帖数: 1879
39
来自主题: BuildingWeb版 - DreamWeaver template 问题
我找到了需要的功能。Dreamweaver 有。有了 nested template 以后,我
可以先设计一个 master site template,再给每个 project 稍微改一些
地方,比如每个 project 独立的 menu 等。每个 project 里的文章只要
填空就是了。如果还有小节要细分,可以继续。
虽然是静态,其实事实上很多动态的网页大部分其实也是静态的,只有少数
的 data 是动态的。用 template 的好处是总可以有全局观,没有一堆小文
件时间长了忘了不知道是干什么的。同时,想给整个网页改头换面也很容易。
BR
发帖数: 4151
40
【 以下文字转载自 Windows 讨论区 】
发信人: BR (everyday life), 信区: Windows
标 题: 用了一下frontpage template,磁盘空间一下子减少了很多
发信站: BBS 未名空间站 (Mon Aug 18 08:26:38 2008)
今天打开frontpage,想做个网页,看看有没有什么template,发现其中有个personal
webpage 的template,就点击了一下,结果frontpage 就运行了很久,然后发现c 盘空
间一下子少了600多m。我的笔记本有点老,空间不大,这个600m 还是很重要的。不知
道怎么恢复这些空间?我看了一下c 盘,也没发现突然增加了什么啊?
急,非常感谢!
g*****n
发帖数: 239
41
【 以下文字转载自 TeX 讨论区 】
发信人: gujason (gujason), 信区: TeX
标 题: 请教Gnuplot 画的图在不同latex template 下legend显示的问题
发信站: BBS 未名空间站 (Sat Oct 31 14:38:58 2009, 美东)
gnuplot画的图,在有的template下,图没有问题。但在别的template下,legend里单
词之间没有了空格。 是因为出现了dvips: font ??? used in file ??? is not in
the mapping file 的error吗?有什么解决的方法吗?多谢了!
mw
发帖数: 525
42
来自主题: Programming版 - why use template?
Now i am quite confused about template
we are supposed to use it for some sort of paramiterized stuff,
template f(T)
however, if more than one classes can be fed to a certain function, they must
share certain similar properties and thus can be modeled as a hierarchy. Then
we can just define the function as f(class A) where A is the base.
Then , is template only useful in containers?
can anyone give me some corrections?
thanks lot!
X****r
发帖数: 3557
43
来自主题: Programming版 - why use template?
Template in C++ is a (rough) realization of generic programming,
which is totally a different approach against object-oriented programming.
Also, as a side effect, template allows (limited) compile-time computation.
Nevertheless, your question is a good one. Whether it's better to use
templates or polymorphism for a function or an algorithm really depends
on individual situation.
For example, let's say your function is to quick-sort. The most basic
implementation only requires the elements being
h****e
发帖数: 2125
44
来自主题: Programming版 - template metaprogramming 的问题
大家都知道STL里面有个valarray,definition是
template
class valarray
{
...
}
有人说有个更efficient的definition就是
template
class valarray
{
static const unsigned int count = N;
...
}
说因为array size在compile time就知道了,所以可以使用例如
valarray a = { 1, 2, 3 };
我比较confused的是,如果程序中都是valarry这类的东东,是比
valarray a(3);要efficient。但是code如果都是象
void func(const unsigned int size)
{
valarray a;
...
}
这样的,有何efficiency可言呢?这只是一个小例子来反映我
对template metaprogramming的很
t****t
发帖数: 6806
45
来自主题: Programming版 - template metaprogramming 的问题
first thing you need to know:
(non-type, non-template> template parameter must be either (integral)
constant, or some object with external linkage. In other words, it must be
either constant value, or has constant address, at least (string literals
are exception, they are not allowed). So it is not possible to have a
template with auto variable as parameter.
second, std::valarray does not allow size parameter.
f****n
发帖数: 20
46
来自主题: Programming版 - 如何使用这个template?
boost里有这么一个生成正态分布随机数的template.
template
class normal_distribution
{
public:
typedef RealType input_type;
typedef RealType result_type;
explicit normal_distribution(const result_type& mean = 0,
const result_type& sigma = 1);
RealType mean() const;
RealType sigma() const;
void reset();
template
result_type operator()(UniformRandomNumberGenerator& urng);
};
如果想把UniformRandomNumberGenerator指定为lagged_fibon
f****n
发帖数: 20
47
来自主题: Programming版 - 如何使用这个template?
主要问题是这个class template有个member是function template,而且template
parameters在两个位置出现,哪位同学给解释一下?多谢
p**e
发帖数: 335
48
来自主题: Programming版 - C++ template question
thanks
template //line1
class test
{

test();
~test();
template friend bool operator==(const test& p1, const test& p2
); //line 9
};
it will be
test.h:9: error: declaration of 'class T'
test.h:1: error: shadows template parm 'class T'
F*******i
发帖数: 190
49
来自主题: Programming版 - c++ template question:
I am trying to test a template function to print out all
the elements of stl containers:
template class T > void print( const T > & coll )
{
copy (coll.begin(), coll.end(), // source
ostream_iterator(cout," ")); // destination
cout << endl;
}
list coll;
// insert elements from 6 to 1 and 1 to 6
for (int i=1; i<=6; ++i) {
coll.push_front(i);
coll.push_back(i);
}
print >(coll); /
t****t
发帖数: 6806
50
来自主题: Programming版 - c++ template question:
//print >(coll);
change to
print (coll);
or
print(coll);
or avoid template template parameter at all:
template
void print(const V& coll)
{
copy (coll.begin(), coll.end(),
ostream_iterator(cout, " "));
}

1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)