上一篇Django模板3最后的问题,我们需要把数据和展现分离开。你可能首先考虑把模板保存在文件系统的某个位置并用 Python 内建的文件操作函数来读取文件内容。 假设文件保存在E:\djangosite\mysite\mysite\templates\tempTime.html中的话,代码就会像下...
分类:
其他好文 时间:
2014-07-16 19:56:22
阅读次数:
274
经验:Traits classes 使得"类型相关信息"在编译期可用。它们以 templates 和 "templates 特化"完成实现
示例:
template
class deque{
public:
class iterator{
public:
typedef random_access_iterator_tag iterator_category;
};
};
//template
template
struct iterator_trai...
分类:
编程语言 时间:
2014-07-15 22:40:20
阅读次数:
372
经验:请使用 member function templates(成员函数模板)生成"可接受所有兼容类型"的函数
示例:泛化 copy 构造函数
temmplate
class SmartPtr{
public:
template
SmartPtr(const SmartPtr &other) //member template, 为了生成 copy 构造函数
: heldPtr(other.get()){...}
T *get() const...
分类:
编程语言 时间:
2014-07-15 13:10:24
阅读次数:
319
经验:可在derived class templates 内通过 "this->" 指涉 base class templates 内的成员名称,或藉由一个明白写出的 "base class 资格修饰符"完成。
示例:
class CompanyA{
public:
//...
void sendCleartext(const std::string &msg);
void sendEncrypted(const std::string &msg);
//...
};
class Company...
分类:
编程语言 时间:
2014-07-14 13:20:25
阅读次数:
263
经验:class 和 templates 都支持接口和多态。
对 classes 而言接口是显式的,以函数签名为中心。多态则是通过 virtual 函数发生于运行期
对 templates 参数而言,接口是隐式的,奠基于有效表达式。多态则是通过 templates 具体化和函数重载解析(function overloading resolution)发生于编译期。
示例1:显式接口和运行期多态
class Widget{
public:
Widget();
virtual ~Widget();
vir...
分类:
编程语言 时间:
2014-07-14 12:54:57
阅读次数:
195
仅收集我在开发过程中觉得对我个人很有帮助的ctrl + e ;查看最近打开的工程文件ctrl+shift+n比如要跳转到templates/default/index.html基本上输入te/de/in,就可以出现上面的文件了,当然输入的越详细,给出的结果越准确,支持模糊查询
分类:
Web程序 时间:
2014-07-13 17:52:59
阅读次数:
200
之前我用了比较多的call-template,后来说着说着,突然发现apply-templates在大部分的场景下比call-template好用,也更安全一些。 比如,apply-templates可以通过select属性来选择具体要匹配的node-set,如果不存在这样的node-set,就不进...
分类:
移动开发 时间:
2014-07-10 14:39:23
阅读次数:
287
近期研究 rtsp http stream 流获取方式vlc over live555 是个很不错的选择,当然了 andorid framework av也是支持rtsp http的,相同不错的选择1.编译https://wiki.videolan.org/AndroidCompile我是ubunt...
分类:
移动开发 时间:
2014-07-09 19:28:06
阅读次数:
249
andriod中修改对话框的风格,可以通过设置theme来实现,部分元素需要通过Java代码来修改,下面以修改对话框的标题为例说明各步骤。
1、编写一个文本样式。
DIALOG的标题是一个textview,在sytles.xml中,添加如下代码来设置你自己的文本样式:
22sp
@color/font_dark_grey
2、设置对话框的标题主题...
分类:
移动开发 时间:
2014-07-08 10:58:43
阅读次数:
232
Differences Between Xcode Project Templates for iOS AppsWhen you create a new iOS app project in Xcode, you get to choose between several project temp...
分类:
移动开发 时间:
2014-07-08 10:17:14
阅读次数:
367