- 博客(17)
- 资源 (8)
- 收藏
- 关注
原创 Spring Boot打包可执行的jar或者war文件
首先pom文件中包含有spring-boot-maven-plugin:<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocatio
2017-03-29 13:57:21 8711
原创 Word Pattern
题目地址:https://leetcode.com/problems/word-pattern/#/descriptionGiven a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection betwee
2017-03-23 16:50:30 290
原创 K-diff Pairs in an Array
题目地址:https://leetcode.com/problems/k-diff-pairs-in-an-array/#/descriptionGiven an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair
2017-03-23 15:51:59 436
原创 Encode and Decode TinyURL
题目地址:TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns a short URL such as http://tinyurl.com/4e9iAk.Design the encode and de
2017-03-23 13:36:49 368
原创 sed对文件的读操作
原始数据:$ cat dataline 1line 2line 3line 4line 5line 6line 7line 8line 9line 10$ cat tdata This is a joke.将tdata中的数据插入到data中指定的行后:$ sed '4r tdata' dataline 1line 2line 3line 4This is a jo
2017-03-22 11:59:32 1240
原创 sed对文件的写操作
原始数据:$ cat data line 1line 2line 3line 4line 5line 6line 7line 8line 9line 10将第1,2行保存到新文件中:$ sed '1,2w test' dataline 1line 2line 3line 4line 5line 6line 7line 8line 9line 10$ cat
2017-03-22 11:18:04 636
原创 sed命令修改行
原始数据:$ cat data line 1line 2line 3line 4line 5line 6line 7line 8line 9line 10修改第三行:$ sed '3c\> this line has been changed.' dataline 1line 2this line has been changed.line 4line 5line
2017-03-22 10:58:21 1052
原创 sed命令删除行操作
原始数据$ cat data line 1line 2line 3line 4line 5line 6line 7line 8line 9line 10删除第3行:$ sed '3d' dataline 1line 2line 4line 5line 6line 7line 8line 9line 10注意,此时data本身没有改变,删除2,3行:$ sed '
2017-03-22 10:30:51 10243
原创 判断一个整数是否能被11整除
如果一个整数在整型范围内,那么这个题目就很简单了,直接用求余符号就能搞定,但是如果这个整数比较大怎么办呢?传说有一种神奇的算法叫做“奇偶位差法”,啥意思呢,就是在奇数位上的数字和与偶数位上的数字和做差,如果这个差的绝对值能被11整除,那么这个数字就可以被11整除。举个栗子:11奇数位:1偶数位:1差的绝对值:1-1=0因为0%11=0,所以11可以被11整除1837奇数位和:7+8=15
2017-03-21 16:00:18 10214
原创 /usr/bin/env: ‘node’: No such file or directory
解决办法:ln -s /usr/bin/nodejs /usr/bin/node
2017-03-17 16:25:25 1776
原创 利用Python下载文件
利用Python下载文件也是十分方便的:小文件下载下载小文件的话考虑的因素比较少,给了链接直接下载就好了:import requestsimage_url = "https://www.python.org/static/community_logos/python-logo-master-v3-TM.png"r = requests.get(image_url) # create HTTP re
2017-03-16 16:32:47 46730 3
原创 bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib
使用BeautifulSoup的时候提示以下错误:bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib. Do you need to install a parser library?解决方案:pip install html5lib
2017-03-16 16:22:16 6411
原创 利用Python对文件进行解压缩
对文件进行解压缩是我们日常工作中最平常不过的行为了,压缩过的文件不仅可以节省磁盘空间,而且在网络传输中也可以节省不少时间。Python为我们提供了zipfile模块,这使得我们可以十分方便地对文件进行解压缩操作,而且代码书写也十分简单:对文件进行压缩:from zipfile import ZipFileimport osdef get_all_file_paths(directory):
2017-03-16 15:32:55 8437
翻译 朴素贝叶斯分类器(Naive Bayes Classifiers)
原文地址:Naive Bayes Classifiers 本文讨论的是朴素贝叶斯分类器( Naive Bayes classifiers)背后的理论以及其的实现。朴素贝叶斯分类器是分类算法集合中基于贝叶斯理论的一种算法。它不是单一存在的,而是一个算法家族,在这个算法家族中它们都有共同的规则。例如每个被分类的特征对与其他的特征对都是相互独立的。开始之前,先看一下数据集。这是一个虚构的数据集,这个
2017-03-03 15:22:04 53167 6
原创 在一个数组中找到三元组,使得三元组内的三个元素加和为0。
这是一道Google面试题目,题目比较容易理解:看例子:Input : arr[] = {0, -1, 2, -3, 1}Output : 0 -1 1 2 -3 1Input : arr[] = {1, -2, 1, 0, 5}Output : 1 -2 1其中一个最简单的想法就是3层循环,对数组进行遍历,找到加和等于0的三个元素,但是这个方法时间复杂度是O(n3)O(n^
2017-03-03 11:31:14 7282
原创 Linux下环境变量PATH设置错误,导致命令都找不到
吓人啊,PATH设置出错,所有的命令全部找到不到了,提示说在/usr/bin/下面可以找到,课时cd过去以后还是不行。系统里面各种配置,各种下载,这是逼我重装系统吗?虽说是虚拟机,但也足够喝一壶了!幸亏export命令还能用:export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin这样所有的命令就都回来了,如果以
2017-03-02 16:56:28 10942 5
原创 Ubuntu下安装MySQL出错(dpkg: dependency problems prevent configuration of mysql-community-server)
安装MySQL最后一步,输入命令:sudo dpkg -i mysql-{common,community-client,client,community-server,server}_*.deb输出:(Reading database ... 160146 files and directories currently installed.)Preparing to unpack mysql-c
2017-03-02 13:41:48 10180 1
OSGi in Action
2017-10-05
apt-mirror-api-0.1.jar
2016-11-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人