- 博客(56)
- 资源 (7)
- 收藏
- 关注
原创 Problem 20:Factorial digit sum
原题链接:http://projecteuler.net/problem=20n! means n (n 1) ... 3 2 1For example, 10! = 10 9 ... 3 2 1 = 3628800,and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 +
2013-09-11 23:35:11
1126
原创 Problem 19:Counting Sundays
原题链接:http://projecteuler.net/problem=19You are given the following information, but you may prefer to do some research for yourself.1 Jan 1900 was a Monday.Thirty days has September,Apri
2013-09-11 23:09:36
936
原创 Problem 18:Maximum path sum I
原题链接:http://projecteuler.net/problem=18By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.37 42 4 6
2013-09-08 23:06:59
1268
原创 Problem 17:Number letter counts
原题链接:http://projecteuler.net/problem=17If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.If all the n
2013-09-08 22:36:51
1363
原创 Problem 16:Power digit sum
原题链接:http://projecteuler.net/problem=16215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.What is the sum of the digits of the number 21000?题目大意是:215 = 32768 并且其各位之和为 is 3
2013-09-08 22:15:01
929
原创 Problem 15:Lattice paths
原题链接:http://projecteuler.net/problem=15Starting in the top left corner of a 22 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.
2013-09-08 20:51:11
1076
原创 Problem 14:Longest Collatz sequence
原题链接:http://projecteuler.net/problem=14The following iterative sequence is defined for the set of positive integers:n n/2 (n is even)n 3n + 1 (n is odd)Using the rule above and sta
2013-09-08 19:38:29
967
原创 Problem 13:Large sum
原题链接:http://projecteuler.net/problem=13Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.37107287533902102798797998220837590246510135740250463769376774
2013-09-08 18:57:51
784
原创 Problem 12:Highly divisible triangular number
原题链接:http://projecteuler.net/problem=12The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The firs
2013-09-08 18:20:48
1135
原创 Problem 11:Largest product in a grid
原文地址:http://projecteuler.net/problem=11Largest product in a gridProblem 11In the 2020 grid below, four numbers along a diagonal line have been marked in red.08 02 22 97 38 15 00 40
2013-08-04 00:06:45
1062
原创 Problem 10:Summation of primes
原文地址:http://projecteuler.net/problem=10Summation of primesProblem 10The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million.
2013-08-03 23:52:28
644
原创 Problem 9:Special Pythagorean triplet
原文地址:http://projecteuler.net/problem=9Special Pythagorean tripletProblem 9A Pythagorean triplet is a set of three natural numbers, a b c, for which,a2 + b2 = c2For example, 3
2013-08-02 23:58:21
758
原创 Problem 8:Largest product in a series
原文地址:http://projecteuler.net/problem=8Largest product in a seriesProblem 8Find the greatest product of five consecutive digits in the 1000-digit number.7316717653133062491922511967
2013-08-02 23:34:41
1049
原创 Problem 7:10001st prime
原文地址:http://projecteuler.net/problem=710001st primeProblem 7By 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
2013-08-02 23:17:18
983
2
原创 Problem 5:Smallest multiple
原文地址:http://projecteuler.net/problem=5Smallest multipleProblem 52520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.What is th
2013-08-02 23:05:17
859
原创 Problem 4:Largest palindrome product
原文地址:http://projecteuler.net/problem=4Largest palindrome productProblem 4A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit nu
2013-08-01 23:53:09
1035
原创 Problem 3:Largest prime factor
原文地址:http://projecteuler.net/problem=3Largest prime factorProblem 3The prime factors of 13195 are 5, 7, 13 and 29.What is the largest prime factor of the number 600851475143 ?
2013-08-01 23:42:19
1114
原创 Problem 2:Even Fibonacci numbers
原文地址:http://projecteuler.net/problem=2Even Fibonacci numbersProblem 2Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2,
2013-08-01 23:31:18
847
原创 Problem 1:Multiples of 3 and 5
原始地址:http://projecteuler.net/problem=1Multiples of 3 and 5Problem 1If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these mu
2013-08-01 23:05:32
1042
原创 Kafka的Producer和Consumer的示例(使用java语言)
我使用的kafka版本是:0.7.2jdk版本是:1.6.0_20http://kafka.apache.org/07/quickstart.html官方给的示例并不是很完整,以下代码是经过我补充的并且编译后能运行的。Producer Codeimport java.util.*;import kafka.message.Message;import kafka.pro
2013-05-17 14:35:55
14918
原创 配置Apache Kafka的zookeeper配置文件zookeeper.properties时的一个注意事项
我使用Apache Kafka的版本是0.7.2Kafka默认的zookeeper.properties文件如下所示:dataDir,clientPort的意义显而易见,就不用说了,对于maxClientCnxns选项,如果不设置或者设置为0,则每个ip连接zookeeper时的连接数没有限制。需要注意的是,设置maxClientCnxns的值时需要把kafka serve
2013-05-16 12:25:57
12904
翻译 MongoDB副本集的配置示例
以下是我在2012年8月初对mongodb副本集的一个实践,mongodb的版本是2.0.4原文是:http://www.mongodb.org/download/attachments/9830402/mongodb+replica+sets+intro.pdfPS:原文链接打不开了,原文的文档在http://download.youkuaiyun.com/detail/cfeibiao
2013-05-08 16:06:57
912
原创 lua table转成xml字符串
local function table_to_xml_table(old_table,new_table) for key,value in pairs(old_table) do if "table" == type(value) then table.insert(new_table,"<") table.insert(new_table,key)
2013-02-27 15:55:58
2849
原创 使用Enterprise Architect画UML类图
以下是我用使用Enterprise Architect 10 (build1005)试用版画UML类图的过程:首先,点击File菜单选择New Project菜单项,新建一个工程,选择路径保存之后,会弹出以下对话框,选择“Basic UML 2 Technology”,勾选"Class"打开Project Browser,如下图然后,右击"Cl
2013-01-26 19:42:40
52087
18
翻译 BSON规范
英文原文:http://bsonspec.org/#/specification1. 版本 1.0 BSON以二进制格式存储零个或多个键值对作为一个实体。我们称这个实体为“文档”。 下面所说的语法指的是1.0版本的BSON标准。我们使用伪BNF来写BSON语法。有效的BSON数据由非终结文档表示。2. 基本类型 部分语法由以下基本类型作为终结符来构成。每种类型都
2012-12-23 14:43:47
1599
原创 在linux下安装ngx_lua模块,iconv模块
1.下载LUAJIT2.0,ngx_lua,nginx等文件,地址如下:LUAJIT2.0:http://luajit.org/download/LuaJIT-2.0.0.tar.gzngx_lua:https://github.com/chaoslawful/lua-nginx-module/archive/master.zipnginx:http://nginx.org/dow
2012-12-22 22:20:52
3459
原创 lua的table排序
首先来个简单的例子local test_table = {2,1,3}table.sort(test_table)for key,value in pairs(test_table) do print(key,value)end结果是>lua -e "io.stdout:setvbuf 'no'" "test.lua"1 12 23 3来个字符串数
2012-12-21 22:21:28
6873
原创 lua在web开发中获取GET或POST参数
使用ngx_lua模块(http://wiki.nginx.org/HttpLuaModule):local request_method = ngx.var.request_methodlocal args = nillocal param = nillocal param2 = nil--获取参数的值if "GET" == request_method then
2012-12-18 17:09:36
19989
原创 使用360电脑门诊软件修复Netbeans图标显示异常
本来在“开始”菜单,任务栏里等地方的Netbeans的图标显示是正常的,在安装了VMware8.0以后,这些地方的Netbeans图标变成未知文件图标,重新安装Netbeans软件也不管用,重启电脑也还是一样。后来使用360电脑门诊软件给修复了。首先,在360安全卫士找到电脑门诊并启动它然后,选择“系统图标”这一项,并找到“图标显示异常”这个解决方案,点击“立即修复”。
2012-12-16 20:17:49
1617
原创 PHP的一些注意事项
(1)PDOStatement::bindParam()和PDOStatement::bindValue() 这两个方法作用差不多,但是使用时建议用PDOStatement::bindValue()。这两个方法的声明如下:boolPDOStatement::bindValue (mixed$parameter , mixed$value [,int$data_type = PD
2012-12-06 10:44:02
610
原创 Netbeans使用xdebug插件调试PHP程序的一个注意事项
例如,你的PHP项目配置如下: index.php文件并不在PHP项目的根目录下,而是在项目的某个目录下,例如hosts目录,并且在服务器上test.com域名映射的目录就是你的项目下的hosts目录,这样看起来可以用xdebug调试代码,但是其实是不行的。从下图里的”索引文件必须是有效的相对 URL。“这个警告可以看出,目前这样的项目配置是调试不了代码的。 但
2012-12-06 10:17:00
1649
原创 绝对定位的元素的水平居中的一个方法
方法如下:{ position: absolute; top: 140px; left: 50%; width: 800px; margin-left: -400px;}top,width,margin-left的大小可以自定义,但是margin-left得等于width的大小乘以(-0.5).
2012-12-03 15:34:27
804
翻译 redis之安全
原文:http://redis.io/topics/security 1. Redis的安全模式 可信环境下的可信用户才可访问redis。这意味着,将redis服务器直接暴露在Internet或者不可信用户可直接访问Redis的tcp端口或Unix套接字的环境,是不安全的。使用redis的web应用程序的常用场景是将redis作为数据库,缓存,消息系统,应用程序
2012-07-12 16:00:09
4819
原创 DelayQueue的简单使用
我最近想用一个数据结构,可以定时从它里面取出数据,发现java提供了DelayQueue,使用DelayQueue需要实现Delayed这个接口,而实现Delayed这个接口主要就是实现它的getDelay()和compareTo()这两个方法,示例代码如下:import java.util.ArrayList;import java.util.concurrent.DelayQueue
2012-04-02 20:39:57
2179
原创 解决本机无法访问虚拟机里centos的memcached服务
在虚拟机里安装了centos,在centos里安装memcached服务器,可是在本机里使用memcached的php扩展来访问虚拟机里centos的memcached服务时,没有响应,发现PHP的日志里有以下信息:[29-Mar-2012 19:01:37] PHP Notice: Memcache::set() [memcache.set]: Server 192.168.98.63 (
2012-03-30 10:15:50
2076
原创 课程设计:用wininet接口写的FTP Client
题目1 FTP客户端编写一个简单的FTP客户机程序,要求能够向FTP服务器发送命令,并接收FTP服务器返回的响应与数据。程序设计的具体要求如下:1)要求实现的程序为图形化界面(如图下所示),可以输入FTP服务的相关信息(包括IP地址、用户名与密码),输出交互过程中的FTP命令与响应信息,以及从FTP服务器的根目录获得的文件(或目录)列表。2)要求遵循RFC959的相关FTP协议规
2011-12-24 10:43:13
1824
原创 网络工程的实验:中小企业园区网建设
一、实验目的:通过实施项目,了解如何对中小企业建设网络的需求进行分析,给出解决方案,并进行实施。二、实验背景:以企业为计划建设自己的企业园区网络,希望对通过新建的网络提供一个安全可靠可扩展性以及高效的网络环境,将两个办公地点连接在一起,使企业内能够实现方便快捷的网络资源共享,全网接入Internet等目标,同时要想实现公司内部的信息隔离以及对公网的安全访问,为了确保这些关键应用的正常运行和安全
2011-12-15 14:19:52
18673
4
原创 在linux下使用valgrind检查wireshark的内存泄露情况
1. 安装valgrind(官网:http://valgrind.org/)(1) 解压源代码文件:tar xjf valgrind-3.7.0.tar.bz2(2) 进入解压后的目录:cd valgrind-3.7.0(3)编译:./configuremake2. 编译wireshark源代码(官网:http://www.wireshark.org/)(1) 解压源
2011-12-15 13:54:07
762
转载 可重入函数与不可重入函数
转自:http://www.cppblog.com/franksunny/archive/2007/08/03/29269.html主要用于多任务环境中,一个可重入的函数简单来说就是可以被中断的函数,也就是说,可以在这个函数执行的任何时刻中断它,转入OS调度下去执行另外一段代码,而返回控制时不会出现什么错误;而不可重入的函数由于使用了一些系统资源,比如全局变量区,中断向量表等,所以
2011-10-22 19:23:57
425
转载 Lucene:基于Java的全文检索引擎简介
转自:http://www.chedong.com/tech/lucene.htmlLucene是一个基于Java的全文索引工具包。基于Java的全文索引引擎Lucene简介:关于作者和Lucene的历史全文检索的实现:Luene全文索引和数据库索引的比较中文切分词机制简介:基于词库和自动切分词算法的比较具体的安装和使用简介:系统结构介绍和演示Hacking Lucen
2011-10-03 21:31:18
752
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人