摘要: C语言定义INT_MIN和INTMAX如下: #define INT_MAX 2147483647 #define INT_MIN (-INT_MAX - 1) 为什么不直接定义INT_MIN为-2147483648呢? 如果你运行如下代码:if (-2147483648 > 0) printf(“TRUE”); else printf(“FALSE”); 你... 阅读全文
posted @ 2016-04-18 10:53 luckysimple 阅读(623) 评论(0) 推荐(0) 编辑
摘要: Late binding,或者dynamic binding,是指在运行时才确定对象的方法或者函数。 在面向对象的语言中,early binding, 或者static binding,是指在编译阶段函数就确定了所有类型的变量和表达式。编译后的函数通常存储在虚拟函数表(v-table)中。而在late binding,编译器没有足够的信息确定函数,所以使得v-table的有些项为空。在运行时... 阅读全文
posted @ 2016-04-14 18:21 luckysimple 阅读(1197) 评论(0) 推荐(0) 编辑
摘要: 1) extendList 下面这段代码的输出是什么?#!/usr/bin/python3 # -*- coding: UTF-8 -*- def extendList(val, list=[]): list.append(val) return list list1 = extendList(10) list2 = extendList(123,[]) list3 = ext... 阅读全文
posted @ 2016-04-13 13:55 luckysimple 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 为了避免多个线程同时访问同一个数据而产生不可预料的结果,需要将各个线程对同一数据的访问同步。同步最常见的方法就是用锁。 接下来介绍常用的锁。 二元信号量(Binary Semaphore) Binary Semaphore是最简单的一种锁,只有两种状态:占用与非占用。适合只能被唯一一个线程独占访问的资源。 多元信号量(简称Semaphore ) Semaphore允许多个线程并发访问资源。初始值为... 阅读全文
posted @ 2016-03-31 11:59 luckysimple 阅读(290) 评论(0) 推荐(0) 编辑
摘要: Install npm $ sudo apt-get install npm $ sudo npm install npm –g // upgrade npm to latest version You may encounter the following error: /usr/bin/env: node: No such file or directory This is often ... 阅读全文
posted @ 2016-03-10 11:49 luckysimple 阅读(638) 评论(0) 推荐(0) 编辑
摘要: Bob有公钥和私钥。 Bob的公钥是公开的,任何人都可以得到。但是只有Bob有自己的私钥。公钥和私钥都可以分别用来加密信息,相应地可以用另一把钥匙解密加密后的信息。 例如,上图中Susan用Bob的公钥加密信息后,发给Bob。Bob收到信息后用自己的私钥解密,得到了Susan的信息。其他人即使获取到了信息,由于没有Bob的私钥,也不能知道信息的内容。 另外一种情况,如果Bob给Susan... 阅读全文
posted @ 2016-03-09 14:43 luckysimple 阅读(361) 评论(0) 推荐(0) 编辑
摘要: Installing MySQL and rsyslog-MySQL sudo apt-get install mysql-server rsyslog-mysql Set the root MySQL password when prompted and remember this password, since you will be using it in future; When in... 阅读全文
posted @ 2016-03-08 14:35 luckysimple 阅读(382) 评论(0) 推荐(0) 编辑
摘要: It is exciting to know Sogou input method is available on ubuntu. Download the install file from 搜狗输入法 for Linux. After Sogou input method is installed, Ubuntu need to be configured. Configure fcitx ... 阅读全文
posted @ 2016-03-03 13:25 luckysimple 阅读(1812) 评论(0) 推荐(0) 编辑
摘要: After install redmine 3.2, you may import the data of old version redmine to redmine 3.2. 1) Create a new clean database sudo mysql -u root -p drop database redmine;CREATE DATABASE redmine character S... 阅读全文
posted @ 2016-02-27 21:10 luckysimple 阅读(469) 评论(0) 推荐(0) 编辑
摘要: To install redmine 3.2.0 on Ubuntu 14.04, mainly follow the tutorial: HowTo Install Redmine 3.0.x on Ubuntu 14.04 with Apache2, Phusion Passenger, MySQL, Subversion and Git (Gitolite) During the insta... 阅读全文
posted @ 2016-02-27 17:23 luckysimple 阅读(1181) 评论(0) 推荐(0) 编辑