自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(181)
  • 资源 (5)
  • 收藏
  • 关注

原创 【从零之六&完结】android口语对话系统(RavenClaw java版 含全部源码)

做了一个半月终于完成了,下面这个就是我参考Olympus/RavenClaw系统编写的对话管理系统,目前实现了一个简单的航班查询,部分截图目前能实现的功能:1.航班查询,具体的航班信息是我自己编的,下一步可以写个爬虫把真实的数据爬下来。编的数据放到了res/raw/flightinfo.txt中。航班查询就设定了三个要素,时间,起始地和目的地,想更全面的话可以增加任

2014-05-10 13:48:49 3335 4

原创 excel数据表导入远程mysql数据库

解决的问题mysql数据库在公司内网服务器,而excel数据表在本地,需要堡垒机跳转才能访问,无法直连,因此在本地任何客户端导入数据表的方法都不好使。数据库只开放了一个端口,无法将数据表传到数据库服务器上,再登入数据库利用load data infile命令导入。解决办法登陆内网任意一台可以链接数据库的服务器,将excel文件导出为.sql文件,然后使用mysql -h ho

2018-01-24 14:42:44 2883

原创 按日期每天切割、定期删除tomcat的catalina.out日志

自动切割:http://blog.csdn.net/hanzheng260561728/article/details/51236131定期删除:http://825536458.blog.51cto.com/4417836/1841389

2017-02-27 14:33:29 13809

转载 maven阿里云中央仓库

maven作为一个项目管理工具确实非常好用,但是在国内这个网络条件下实在是让人恼火。之前oschina的中央仓库可用,现在oschina的maven服务器关了,一直没找到国内镜像来替代。今天发现阿里云公开了一个中央仓库,大家可以试试。配置 修改maven根目录下的conf文件夹中的setting.xml文件,内容如下: alimaven aliyun mav

2017-02-24 21:31:00 1268

原创 Spring AOP IOC 实现原理,面试问到如何回答

IOC:控制反转也叫依赖注入,IOC利用java反射机制,AOP利用代理模式。所谓控制反转是指,本来被调用者的实例是有调用者来创建的,这样的缺点是耦合性太强,IOC则是统一交给spring来管理创建,将对象交给容器管理,你只需要在spring配置文件总配置相应的bean,以及设置相关的属性,让spring容器来生成类的实例对象以及管理对象。在spring容器启动的时候,spring会把你在配置文件中

2017-01-11 16:29:06 54269 9

原创 [LeetCode]Basic Calculator II

题目不难,但是想做对却也需要考虑很多细节。 没有括号的运算就是先乘除后加减,思路是把➕和➖看作分隔符,先计算分隔符隔开的一个个term,再把term相加。 举个例子:a+b*c/d-e,在这个例子中,读到第一个➕时,term是a,并且我们可以认为a已经被➕分割开了,可以加到总和里去了,所以sum现在是a,term往后读一个数,是b。然后往后读一个符号是✖️,所以term=term*c,即term

2016-10-11 12:05:44 906

原创 先序遍历中序遍历后序遍历确定一棵二叉树(递归、非递归)

先序遍历和中序遍历确定二叉树后序遍历和中序遍历确定二叉树

2016-09-16 14:04:46 1513 1

原创 LeetCode总结

终于把LeetCode免费题目都做完了,接下来要做第二遍,想把第一遍不会做的题目整理一下思路,为接下来的google面试准备一下,万一过了呢,哈哈。315 Count of Smaller Numbers After Self 题意:计算每个元素右面有多少个元素小于它 从后向前遍历,维护一个排好序的数组,每次插入新元素时确定其在有序数组的位置,就是要求的右面有多少个元素小

2016-09-02 10:26:04 1445 1

原创 git ignore 添加后不生效 解决办法

问题在repo中已经上传了很多配置文件,后来发现不需要,但是在gitignore添加之后并没有作用,在每次add后依然会出现。解决办法执行如下代码,把它们从repo中删除git rm --cached `git ls-files -i --exclude-from=.gitignore`

2016-07-11 11:42:58 1513

原创 Install NumPy, SciPy, scikit-learn on Mac OS X

Add on and summarized from blog http://penandpants.com/2012/02/24/install-python/Outline1. install Xcode –> 2. install pip –> 3. install brew –> 4. install NumPy –> 5. install gfortran (important!) –

2016-06-16 11:41:03 1867

原创 Linux统计某文件夹下文件、文件夹的个数

统计某文件夹下文件的个数ls -l |grep "^-"|wc -l统计某文件夹下目录的个数ls -l |grep "^d"|wc -l统计文件夹下文件的个数,包括子文件夹里的ls -lR|grep "^-"|wc -l如统计/home/han目录(包含子目录)下的所有js文件则:ls -lR /home/han|grep js|wc -l 或 ls -l "/home/han"|grep "js"

2016-06-16 09:40:26 6220

原创 【LeetCode】31. Next Permutation

题目思路找到下一个排列,比较好的思路是 O(n)O(n) ,从尾向前遍历,找到第一个nums[i-1]代码void nextPermutation(vector<int>& nums) { int N = nums.size(); bool flag = false; int i,j; for (i=N-1;i>=1;--i){

2016-06-05 12:19:03 526

原创 【LeetCode】310. Minimum Height Trees

题目链接思路我想到了n个点构成树,那么一定会有n-1条边,构成的树深度最大的情况发生在所有点位于一条链上,此时深度为 n/2n/2 或 n/2+1n/2 + 1 ,这取决于n的奇偶性。树深度最浅的情况发生在一个根节点,所有其它节点都与根节点直接相连,此时深度为2。我还发现一个规律,就是叶子节点的数目+树的最长路径为一定值,为节点数+2。这样统计出有多少个叶子节点后,再走最长路径的一半所到达的节点就是

2016-06-04 14:29:09 983

原创 【LeetCode】82. Remove Duplicates from Sorted List II

思路很简单的一道题,思路也没什么特别的,就是设置一个prehead节点代码 ListNode* deleteDuplicates(ListNode* head) { ListNode nHead(0); ListNode* phead = &nHead; ListNode* tmp = &nHead; bool flag;

2016-05-31 20:19:58 490

原创 【LeetCode】209. Minimum Size Subarray Sum

题目Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn’t one, return 0 instead.For example, given the array [2,3,1,2,

2016-05-31 19:45:30 611

原创 【LeetCode】207. Course Schedule

题目There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pai

2016-05-30 23:40:09 1722

原创 【LeetCode】134. Gas Station

题目There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its n

2016-05-29 23:36:36 2074

原创 【LeetCode】40. Combination Sum II

题目Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in the combination.

2016-05-22 22:37:24 860

原创 【LeetCode】50. Pow(x, n)

题目Implement pow(x, n).Subscribe to see which companies asked this question思路两种方法,一:一个一个乘,最多乘INT_MAX次,显然不太好。 二:每次求n/2n/2次幂,最多32次陷阱此题陷阱非常多,主要需要考虑几种特殊情况: 1. n 为 0:结果为1 2. n 为负数,需要先求再求倒数,或者直接求1/x1/x的-n次

2016-05-22 14:33:53 514

原创 【LeetCode】92. Reverse Linked List II

题目Reverse a linked list from position m to n. Do it in-place and in one-pass.For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note: Given m, n satisfy the following

2016-05-22 13:32:32 487

原创 【LeetCode】55. Jump Game

题目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 a

2016-05-22 10:48:55 714

原创 【LeetCode】264. Ugly Number II

题目Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first 10 ug

2016-05-21 15:06:58 653

原创 【LeetCode】234. Palindrome Linked List

题目Given a singly linked list, determine if it is a palindrome.Follow up: Could you do it in O(n) time and O(1) space?Subscribe to see which companies asked this question思路我的思路想了半天没有想出空间为1的解法,就用了最先考虑到的

2016-05-21 11:34:47 454

原创 【LeetCode】72. Edit Distance

题目Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:a)

2016-05-21 10:51:23 557

原创 【LeetCode】115. Distinct Subsequences

题目Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be none)

2016-05-17 21:16:08 561

原创 【LeetCode】95. Unique Binary Search Trees II

题目Given n, generate all structurally unique BST’s (binary search trees) that store values 1…n.For example, Given n = 3, your program should return all 5 unique BST’s shown below.思路此题最好想的思路是递归,当确定根节点是

2016-05-15 17:11:24 630

原创 【LeetCode】16. 3Sum Closest

题目Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactl

2016-05-14 16:30:21 400

原创 【LeetCode】330. Patching Array

题目Given a sorted positive integer array nums and an integer n, add/patch elements to the array such that any number in range [1, n] inclusive can be formed by the sum of some elements in the array. Ret

2016-05-14 11:59:36 665

原创 【LeetCode】290. Word Pattern

题目Given 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 between a letter in pattern and a non-empty word in str.Examples:

2016-05-14 10:52:03 480

转载 Linux vi/vim 多行注释

多行注释:进入命令行模式,按ctrl + v进入 visual block模式,然后按j, 或者k选中多行,把需要注释的行标记起来按大写字母I,再插入注释符,例如//按esc键就会全部注释了取消多行注释:进入命令行模式,按ctrl + v进入 visual block模式,按字母l横向选中列的个数,例如 // 需要选中2列按字母j,或者k选中注释符号按d键就可全部取消注释

2016-03-25 16:47:26 2054

原创 linux rename命令批量修改文件名

修改文件名可以用mv命令来实现mv filename1 filename2但如果批量修改还是使用rename命令更为方便 现在我们有a b c d 四个文件增加后缀rename 's/$/\.txt/' *a.txt b.txt c.txt d.txt修改后缀rename 's/\.txt/\.dat/' *a.dat b.dat c.dat d.dat删除后缀rename 's/\.dat//'

2016-01-04 19:54:59 22627

原创 [Leetcode]287. Find the Duplicate Number简单解法及解释 双指针复杂度O(n)

题目链接:Find the Duplicate Number Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there

2016-01-01 11:34:20 14766 8

原创 opensmile读取wav出错:bogus wave/riff header or file in wrong format解决办法

错误描述读取demo中的wav示例的时候没有问题,但是在执行SMILExtract提取自己准备的wav文件时却出现bogus wave/riff header or file in wrong format的错误提示,(maybe you are trying to read a 32-bit wave file which is not yet supported (new header type

2015-09-14 14:56:42 4802 3

原创 【LeetCode】triangle求最小和路径

今天闲来无事,做了三道leetcode水题,怒更两发博客,也挺不错。今天更新的两篇都是dp解法的简单题。题目要求如下。Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, giv

2015-08-14 18:15:40 1604

原创 【LeetCode】Best Time to Buy and Sell Stock IV 动态规划dp解法(C++)

乍看此题有难度,实则解法有规律。

2015-08-14 14:14:14 2485

原创 Django1.8 更新数据库

最近在搭个网站,扩展了user后需要同步更改到数据库(我用的sqlite3),上网查了n多,网上都是千篇一律,转来转去的,很是讨厌!! 不知道是不是1.8才有的这个功能,更新数据表只需要执行python manage.py makemigrations此时会出提示信息Migrations for 'registration': 0002_userprofile.py: - Create

2015-07-24 22:43:48 2810 1

原创 OpenCV 数字验证码识别

更新后代码下载链接在此!!!点我下载 本文针对OpenCv入门人士,因为我也不是专门做图像的,只是为了完成一次模式识别的小作业。主要完成的功能就是自动识别图片中的数字,图片包括正常图片,有划痕图像和有噪点图像。分别如下先上图,看识别效果!接下来开始来点干货了:opencv的安装与配置:这个要是展开讲可以再写一篇博文了,我当时什么都不会配个opencv麻烦死了,最后参考网上studio2012的配

2015-07-17 21:46:34 20878

原创 Github添加sshkey

SSH keyAn SSH key allows you to establish a secure connection between your computer and GitLab.Before generating an SSH key, check if your system already has one by running cat ~/.ssh/id_rsa.pubIf you

2015-07-06 09:43:59 2438

转载 getline和cin.getline

C++中有两个getline函数,这两个函数分别定义在不同的头文件中。1.getline()是定义在中的一个行数,用于输入一行string,以enter结束。函数原型:getline(cin,str); cin:istream类的输入流对象 str:待输入的string对象example 1:#include <iostream> #include <string> using name

2015-05-20 15:52:25 809

原创 【LeetCode】Path Sum II

题意Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.思路基本的深搜,注意一点就是必须是根到叶子节点求和,不可在非叶子节点处停。代码/** * Definition for binary tree * struct TreeNode { *

2015-04-09 16:53:49 1096

opencv数字识别(更新)

更新后的,之前的有错误

2015-08-10

opencv数字识别

针对opencv入门的同学,本程序使用模板匹配的方法,实现了图片中数字的自动识别,包括有划痕和有噪点的图片识别。

2015-07-17

Android语音识别Demo

科大讯飞语音识别包,自带id,无需另外注册即可使用,但是有使用限制次数。

2014-09-25

android口语对话系统

自己仿照一个c++程序改写成android版的口语对话系统,现在可以实现航班查询以及语音打开已安装应用程序的功能,界面功能都暂时比较挫,望可以得到改进

2014-05-10

Django1.6_利用Form实现注册登录注销修改密码

详细代码示例,绝对可以运行,Django1.6,Python2.7.6版本。 利用表单以及auth模块实现Django的注册、登录、注销、修改密码等功能

2014-03-19

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除