今天有一同学在群上聊到一个比较好玩的题目(本人看书不多,后面才知是《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
昨儿一小美女拿我的手机听歌,说她不知道iPod怎么下载歌曲,因为还在上学家里不肯给买智能机,怕会影响学业。她的iPod
shuffle刚买没多久还不会往里传歌曲,让我帮看看怎么整,心想她应该是没装iTunes,苹果系产品很多都是要用iTunes传文件或同步。
网上很多教程都是用iTunes s...
分类:
其他好文 时间:
2014-05-04 20:24:48
阅读次数:
551
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
最近在学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
本文将介绍Hadoop中的重点MapReduce的入门知识。(1)MapReduce概述MapReduce是一种分布式计算模型,由Google提出,主要用于搜索领域,解决海量数据的计算问题。MR由两个阶段组成:Map和Reduce,在Hadoop中用户只需要实现map()和reduce()两个函数,即可实现分布式计算,非常简单..
分类:
其他好文 时间:
2014-05-03 01:53:48
阅读次数:
519
Lease 的机制:hdfs支持write-once-read-many,也就是说不支持并行写,那么对读写的互斥同步就是靠Lease实现的。Lease说白了就是一个有时间约束的锁。客户端写文件时需要先申请一个Lease,对应到namenode中的LeaseManager,客户端的client name就作为一个lease的holder,即租约持有者。LeaseManager起什么作用呢?
读写过程的容错是怎么做的?数据块是如何复制的?数据块的恢复机制?本文都有涉及。...
分类:
其他好文 时间:
2014-05-02 23:22:14
阅读次数:
450