10001st prime
Problem 7
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
使用埃拉托斯特尼筛法,不懂得自行Wiki
我的py...
分类:
其他好文 时间:
2014-05-26 05:35:25
阅读次数:
248
上一篇博文可以实现基本的网络通信,但是只能服务给一个人,我们可以通过给每个客户端fork()一个子进程,来实现一对多的服务。
方法:
客户端连到服务器以后,服务器启动一个新创建的套接字对话,也就是说父进程可以继续连接下一个客户端,而子进程来需要处理
accept()创建的副套接字,实现通信功能。父进程克隆子进程后可以关闭副套接字close(connect_d),而子进程可以关闭主监听套...
分类:
其他好文 时间:
2014-05-26 05:02:14
阅读次数:
228
Set集合的配置
数据表的创建:
create table EMPLOYEE ( id INT NOT NULL auto_increment, first_name VARCHAR(20) default NULL, last_name VARCHAR(20) default NULL, salary INT default NULL, PRIMARY KEY (id) );
c...
分类:
系统相关 时间:
2014-05-26 03:43:18
阅读次数:
365
服务器连接网络四部曲。
为了与外界沟通,c程序用数据流读写字节,比较常用的数据流有标准输入、标准输出、文件等。
如果想写一个与网络通信的程序,就需要一种新的数据流----------套接字。
使用套接字与客户端程序通信前,服务器需要历经四个阶段:绑定、监听、接受、开始。
1.绑定端口
计算机可能同时运行多个服务器程序,为了放置不同的对话混淆,每项服务必须使用不...
分类:
其他好文 时间:
2014-05-25 01:01:09
阅读次数:
317
通过顺序来选择
顺序选择的过滤器(filter)有
:first 第一个元素:last 最后一个元素:even 序号为偶数的元素:odd 序号为奇数的元素:eq(n) 序号等于n的元素 :lt(n)序号小于n的元素 :gt(n)序号大于n的元素
如果有如下的表格
0
even
1
odd
2
even
3
odd
4
even...
分类:
Web程序 时间:
2014-05-24 23:00:48
阅读次数:
381
It seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is the first year after the old 1987 with only distinct digits.
Now you are suggested to solve the f...
分类:
其他好文 时间:
2014-05-24 21:52:34
阅读次数:
320
【题目】
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine if you are able to reach the last index.
For example:...
分类:
其他好文 时间:
2014-05-24 20:44:39
阅读次数:
221
1. WebSocket概念
WebSocket是HTML5开始提供的一种Client与Server间进行全双工(full-duplex)通讯的网络技术
双工(duplex), 指二台通讯设备之间,允许有双向的资料传输
Client和Server通过WebSocket Protocol建立连接后,双方可以互传数据并且双方都可以关闭连接
2. HTTP概念
HTTP Protoco...
分类:
Web程序 时间:
2014-05-24 19:11:12
阅读次数:
416
1.如何创建线程
用pthread_create创建线程...
分类:
编程语言 时间:
2014-05-24 18:35:03
阅读次数:
410
【题目】
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Given a collection of intervals, merge all overlapping intervals.
For example,
Given [1,3],[2,6],[8,10],[15,18],
return [1,6],[8,10],[15,18].
...
分类:
其他好文 时间:
2014-05-24 14:18:27
阅读次数:
193