今天有一同学在群上聊到一个比较好玩的题目(本人看书不多,后面才知是《C++模板元编程》第二章里面的一道习题),
我也抱着试一试的态度去完成它, 这道题也体现了c++模板元编程的基础和精髓: 类型就是数据。题目如下所述:Write a ternary
metafunctionreplace_typet...
分类:
其他好文 时间:
2014-05-06 00:27:15
阅读次数:
333
Problem Description
Given an positive integer A (1
For example, given A = 26, we can write A in binary form as 11010, so the lowest bit of A is 10, so the output should be 2.
Another example...
分类:
其他好文 时间:
2014-05-05 13:22:39
阅读次数:
394
今天给大家来的得失LVM相关的备份一、LVM快照写时复制的特性(copy-on-write,COW)写时复制快照在快照时间点之后,没有物理数据复制发生,仅仅复制了原始数据物理位置的元数据。因此,快照创建非常快,可以瞬间完成。然后,快照副本跟踪原始卷的数据变化(即原始卷写操作),..
分类:
系统相关 时间:
2014-05-05 12:27:20
阅读次数:
561
Birthday Candles
The chef is preparing a birthday cake for one of his guests,
and his decided to write the age of the guest in candles on the cake.
There are 10 types of candles, one for each o...
分类:
其他好文 时间:
2014-05-04 18:46:55
阅读次数:
416
在执行该命令时出现下列错误SYS@PROD>altersystemsetUTL_FILE_DIR=‘/home/oracle‘,‘/home/oracle/temp‘,‘/home/oracle/scripts‘scope=spfile;altersystemsetUTL_FILE_DIR=‘/home/oracle‘,‘/home/oracle/temp‘,‘/home/oracle/scripts‘scope=spfile*ERRORatline1:ORA-32001:wr..
分类:
其他好文 时间:
2014-05-04 17:08:06
阅读次数:
386
最近在学scala语言,scala代码如下:
import scala.collection.JavaConversions._
import scala.util.control.Breaks._
object Solution {
def solution(A: Array[Int]): Int = {
// write your code in Scala 2.10...
分类:
其他好文 时间:
2014-05-04 09:42:56
阅读次数:
372
最近在学scala语言,scala代码如下:
import scala.collection.JavaConversions._
object Solution {
def solution(A: Array[Int]): Int = {
// write your code in Scala 2.10
// using quick sort to so...
分类:
其他好文 时间:
2014-05-04 09:22:37
阅读次数:
341
最近在学scala语言,scala代码如下:
import scala.collection.JavaConversions._
object Solution {
def solution(A: Int, B: Int, K: Int): Int = {
// write your code in Scala 2.10
var cnt: Int = 0...
分类:
其他好文 时间:
2014-05-04 09:06:08
阅读次数:
307
今天凑巧去W3School扫了一遍JavaScript教程,发现从中看到了不少自己以前没有注意过的细节。
我这些细节列在这里,分享给可能同样不知道的朋友:
1、使用 document.write() 仅仅向文档输出写内容。如果在文档已完成加载后执行 document.write,整个 HTML 页面将被覆盖:
实例
My First Web Page
My...
分类:
编程语言 时间:
2014-05-03 21:30:52
阅读次数:
344
Lease 的机制:hdfs支持write-once-read-many,也就是说不支持并行写,那么对读写的互斥同步就是靠Lease实现的。Lease说白了就是一个有时间约束的锁。客户端写文件时需要先申请一个Lease,对应到namenode中的LeaseManager,客户端的client name就作为一个lease的holder,即租约持有者。LeaseManager起什么作用呢?
读写过程的容错是怎么做的?数据块是如何复制的?数据块的恢复机制?本文都有涉及。...
分类:
其他好文 时间:
2014-05-02 23:22:14
阅读次数:
450