- 博客(212)
- 资源 (8)
- 收藏
- 关注
原创 大文件去重
01.项目中涉及到50亿+的数据去重操作,大概的情景就是一个超大文件(200G+),文件中的数据为每行是一个字符串,现在要求对字符串进行去重操作,重新生成文件02.显然内存不足于容纳文件的大小,即使容纳的话你会这么做么 :) 。一般而言对于这种超大文件去重都会采用外部排序将相同的数据对排在一起,然后再进行去重操作。如果你对 shell 命令熟悉的话,相信你会很快想到 sort | u...
2018-07-25 18:47:49
6917
1
原创 OWAP Top 10
2013 Top 10 List A1-InjectionInjection flaws, such as SQL, OS, and LDAP injection occur when untrusted data is sent to an interpreter as part of a command or query.
2014-11-10 18:26:28
13034
原创 linux(fedora) 下dvwa 环境的搭建
linux(fedora)下dvwa的配置1.下载httpd,dvwa,mysql,mysqlserver, php-mysql,php除了dvwa 是进官网下之外,其余的服务都是通过install 安装yum install httpd, mysql, php-mysql, php如果出现安装的问题,可以先yum search xxx 2.安装完之后,检查
2014-11-08 09:50:54
4223
原创 emacs config for my
(global-set-key [C-tab] 'other-window) ; 切换窗口(global-set-key [f9] 'compile) ; 编译(global-set-key [C-f9] 'gdb) ; 调试;; For Linux(global-set-key (kbd "") 'text-scale-increase)(global-set-key (kbd "
2014-11-04 16:27:38
863
1
转载 emacs config
觉得这篇博文发表出来后,可能会引起一些争议,很多人眼中Emacs已经太陈旧了,根本无法和自己心目中的IDE齐驱并驾,最开始接触Emacs是在前年的这个时候,当时公司里面来了一群linux高人,当时还在做.NET的开发,天成的VS程序员看到了Emacs这个界面酷酷的编辑器悠然心动,最开始以为是VIM后来发现它叫Emacs。 我认为Emacs迷人的地方在于他的扩展性以及unix哲学的渗透
2014-10-28 17:48:47
1253
原创 Vulnerability checks
Cross-site scripting (XSS) is a type ofcomputer security vulnerability typically found in Web applications. XSS enables attackers to inject client-side script into Web pages viewed by ot
2014-10-23 16:53:17
1061
原创 LeetCode Search in Rotated Sorted Array II
Search in Rotated Sorted Array II Total Accepted: 18488 Total Submissions: 59914My SubmissionsFollow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this
2014-10-10 14:37:27
964
原创 LeetCode Search in Rotated Sorted Array
Search in Rotated Sorted Array Total Accepted: 27955 Total Submissions: 97929My SubmissionsSuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6
2014-10-09 10:15:42
914
原创 LeetCode Remove Duplicates from Sorted Array II
title 描述 Follow up for ”Remove Duplicates”: What if duplicates are allowed at most twice? For example, Given sorted array A = [1,1,1,2,2,3], Your function should return length = 5, and A is no
2014-10-08 18:03:47
945
1
原创 LeetCode Remove Duplicates from Sorted Array
问题描述:Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place
2014-10-08 17:59:27
931
原创 projecteuler---->problem=34----Digit factorials
Problem 34145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.Find the sum of all numbers which are equal to the sum of the factorial of their digits.Note: as 1! = 1 and 2! = 2 are
2014-08-25 10:05:11
1160
原创 projecteuler---->problem=36----Double-base palindromes
Problem 36The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.(Please
2014-08-25 09:21:20
1169
原创 projecteuler---->problem=35----Circular primes
Problem 35The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13,
2014-08-22 17:05:15
1413
原创 projecteuler---->problem=33----Digit canceling fractions
Problem 33The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that49/98 = 4/8, which is correct, is obtained by cance
2014-08-22 16:07:49
1266
原创 projecteuler---->problem=32----Pandigital products
Problem 32We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigital.The produ
2014-08-22 15:28:57
1464
原创 projecteuler---->problem=31----Coin sums 无限背包计算可能存在的次数
Problem 31In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).It is possible to
2014-08-21 11:09:46
1468
原创 projecteuler---->problem=30----Digit fifth powers
Problem 30Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:1634 = 14 + 64 + 34 + 448208 = 84 + 24 + 04 + 849474 = 94 + 44 + 74 + 44
2014-08-21 09:36:07
1190
原创 projecteuler---->problem=29----Distinct powers
Problem 29Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:22=4, 23=8, 24=16, 25=3232=9, 33=27, 34=81, 35=24342=16, 43=64, 44=256, 45=102452=25, 53=125, 54=625, 55=312
2014-08-21 08:21:10
1152
转载 Python集合(set)类型的操作
python的set和其他语言类似, 是一个无序不重复元素集, 基本功能包括关系测试和消除重复元素. 集合对象还支持union(联合), intersection(交), difference(差)和sysmmetric difference(对称差集)等数学运算.sets 支持 x in set, len(set),和 for x in set。作为一个无序的集合,sets不记录元素位置或者
2014-08-21 08:07:28
613
原创 projecteuler---->problem=28----Number spiral diagonals
Problem 28Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:21 22 23 24 2520 7 8 9 1019 6 1 2 1118 5 4 3 1217 16
2014-08-20 17:00:28
1019
原创 projecteuler---->problem=27----Quadratic primes
Euler discovered the remarkable quadratic formula:n² + n + 41It turns out that the formula will produce 40 primes for the consecutive values n = 0 to 39. However, when n = 40, 402 + 40 + 41 = 40
2014-08-20 16:06:43
1141
原创 Project Euler 26 计算小数位循环的位数
A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given:1/2= 0.51/3= 0.(3)1/4= 0.251/5
2014-08-20 15:34:30
1605
转载 mac 配置 tomcat
第一步:下载Tomcat 这里Himi下载的tomcat version:7.0.27直接上下载地址:http://tomcat.apache.org/download-70.cgi直接下载如下选中即可:第二步: 下载完成后 ,然后随意放目录吧,这里Himi放入 /usr/local/右键你的mac的Finder->前往文件夹->
2014-08-20 08:45:03
2491
原创 LeetCode 2 Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1",
2014-08-18 16:42:31
792
原创 LeetCode 第一题剪彩自己的leetCode之路
Reverse Words in a String Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".click to show clarification.
2014-08-18 16:01:18
1369
原创 编译器DIY——词法分析
在上一篇文章中已经介绍了读文件的操作,那么这一篇文章中将会仔细解释词法分析。在源文件中解析出的单词流必须识别为保留字,标识符,常量,操作符和界符五大类1.显然我们需要列举出所有的保留字,而这里与保留字相似的那么就是标识符,在C语言中,保留字都是以小写字母开头,而且其中的字母只能是小写字母,而标识符的第一个字母则必须为字符(小写大写皆可)后面可以接大小写字母和字符 ‘_’, 在我写的这个编译
2014-06-14 16:01:05
1959
原创 编译器DIY——读文件
编译器的前端词法分析:将源文件解析成一个个的单词流,为语法分析做准备。在词法分析阶段,我们要做的就是将词分出来,并且确定单词的类型,一般的程序设计语言的单词符号可以份为以下5种:1.关键字,如int,long等2.标识符,用来表示各种名字,如常量名,变量名等3.常数,各种类型的常数,如12,1.2等4.运算符:如+,-,*,/等5.界符,如“,”“;”等那么在实际的过程
2014-06-12 09:44:10
1306
原创 编译器DIY之———统计英文文本中的单词数,字符数和行数
咳咳,这一章节应该是连载编译器的DIY的,可是在做DIY之前先用flex 来练练手,对于后面的理解有帮助作用。在word 中我经常看到有一个单词统计的功能,那么是怎么来实现的了,当然第一个念头就是遍历整个文本依据换行和空格对字符串进行分析,那么这是可行的。可是能不能简单点了,其实对文本做单词分析,大家都知道怎么做,难得地方可能就是代码的实现了,那么现在如果使用正则表达式来实现的话,那么一切问题
2014-06-10 09:31:34
4265
原创 projecteuler---->problem=25----1000-digit Fibonacci number
问题描述:The Fibonacci sequence is defined by the recurrence relation:Fn = Fn1 + Fn2, where F1 = 1 and F2 = 1.Hence the first 12 terms will be:F1 = 1F2 = 1F3 = 2F4 = 3F5 = 5F6 = 8
2014-06-09 17:07:54
1149
原创 projecteuler---->problem=24----Lexicographic permutations
问题描述:A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabeti
2014-06-09 16:50:01
1176
原创 projecteuler---->problem=23----Non-abundant sums
A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means th
2014-06-07 11:19:34
1250
原创 projecteuler---->problem=22----Names scores
sing names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical v
2014-06-05 10:19:32
1328
原创 projecteuler---->problem=21----Amicable numbers
Let d(n) be defined as the sum of proper divisors of n (numbers less thann which divide evenly into n).If d(a) = b and d(b) = a, where a b, then a and b are an amicable pair and each of a andb
2014-06-05 08:50:31
1150
原创 projecteuler---->problem=20----Factorial digit sum
n! 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 + 0 + 0 = 27.Find the sum of the digits
2014-06-05 08:26:43
1325
原创 projecteuler---->problem=19----Counting Sundays
You 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,April, June and November.All the rest have thirty
2014-06-05 07:55:42
1143
原创 projecteuler---->problem=18----Maximum path sum I
By 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 68 5 9 3That is, 3 + 7 + 4 + 9 = 23.Find th
2014-06-04 22:48:16
1222
原创 projecteuler---->problem=15----Lattice paths
Starting 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.How many such routes are there through a 20
2014-06-03 16:43:24
1244
原创 projecteuler---->problem=16----Power digit sum
215 = 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的各位数之和为3 + 2 + 7 + 6 + 8 = 26。那么21000的各位数之和为……?import
2014-06-03 15:47:31
1157
原创 projecteuler---->problem=14----Longest Collatz sequence
title:The 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 starting with 13, we generate the followi
2014-06-03 10:16:43
1305
原创 projecteuler---->problem=13----Large sum
title:Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.371072875339021027987979982208375902465101357402504637693767749000971264812489697007805041701826053
2014-05-31 15:51:43
1027
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人