- 博客(41)
- 资源 (1)
- 收藏
- 关注
原创 hadoop2.8一些问题
所以说,装这些东西还是不要装最新的,装个2.7的好好的偏偏要装2.8……第一个:hadoop fs -mkdir 报错 No such file or directory-ls也报错原因:hadoop2.7以上版本,默认使用hadoop fs -ls 或者 -mkdir命令的话,hadoop程序不知道命令对象是在哪个目录下,用hadoop fs -ls / 或者 had
2017-12-27 11:15:02
330
原创 cudamat安装
要疯。记录下。1.下载地址:https://github.com/cudamat/cudamat2. 解压,进入I:\gnumpy\cudamat-master\cudamat-master,执行python setup.py install3. 拷贝I:\gnumpy\cudamat-master\cudamat-master下所有文件到anaconda的脚本路径下,如D:\Anac
2017-10-12 13:58:42
2222
2
原创 win10安装tensorflow-gpu版本各种坑
1、python的版本要是3.52、tensorflow如果是1.0的,cudnn的版本要是5.1;tensorflow如果是1.3,cudnn要是6.0
2017-10-12 10:11:17
670
转载 python yield
https://www.ibm.com/developerworks/cn/opensource/os-cn-python-yield/
2017-09-10 20:47:37
196
原创 checkstyle auto-fix by python
这两天用python写了个checkstyle的error auto-fix的脚本。知识点:1、文本操作2、正则库 re模块一般步骤是:先将正则表达式的字符串compile成pattern实例,然后用pattern实例处理文本并获得匹配结果(Match实例),最后使用Match实例获取信息。 import re pattern = re.compile(r’hello’)
2017-08-15 15:38:22
432
转载 关于Python对于文件某一行删除/更改的Hack
转自http://blog.youkuaiyun.com/z_lit0/article/details/52823724stackoverflow上的精彩solution http://stackoverflow.com/questions/2329417/fastest-way-to-delete-a-line-from-large-file-in-pythoncode:de
2017-08-14 11:53:40
459
原创 checkstyle直接用java命令,不调用eclipse等IDE
首先,checkstyle的jar包路径如下:(checkstyle目前最新版本是8.1,不同版本规则不大一样,如果出现这个错误: com.puppycrawl.tools.checkstyle.api.CheckstyleException: SuppressionCommentFilter is not allowed as a child in Checker,说明规则和check
2017-08-10 11:38:41
2402
原创 js常忽略的错!!!
再次mark一下!!!1. js里面对于变量直接加一是不可行的!!!!比如,如果a是string类型,a = 1 然后取 str[a+1],会变成a[11]所以要把a变成int,用的方法是parseInt(a)
2017-08-08 21:29:34
283
原创 maven项目报maven包错误
嗯……困扰了好久,一直以为是.m2里面的包有问题,下了一遍又一遍。。最后发现,eclipse里面maven配置有问题,要用自己下载的maven,重新配置一下。具体如下:1、增加自己配置的maven路径:Window -> Preference -> Maven -> Installation -> Add2、设置User SettingsWindow -> Pref
2017-08-08 10:32:37
229
原创 欢迎使用优快云-markdown编辑器
1.设置节点属性G.node[1]['room'] = 714nx.set_node_attributes(G,'betweenness',bb)
2017-07-19 14:48:57
262
原创 正则表达式
常用的限定符. 匹配任何字符(除了换行符以外的任意字符)*前面的内容可以出现任意次(>=0)+前面的内容可以出现任意次(>=1)?前面的内容可以出现0次或1次\d数字{n}前面的内容出现n次\w字母或数字或下划线或汉字^字符串开头$字符串结尾
2017-07-18 10:38:59
838
原创 linux crontab定时执行命令
crontab -l //列出某个用户cron服务的详细内容crontab -r //删除某个用户的cron服务crontab -e //编辑某个用户的cron服务ps -ax | grep cron //查看服务是否启用
2017-07-17 11:08:09
232
转载 STAF 21错误
1, Go to the /tmp directory, and delete the temporary files that STAF created for the instance of STAFProc that you're trying to start. You'll need to be logged on as a user that has permission to
2017-07-12 16:45:27
429
原创 queue
expand的时候,当现有item的数量达到capacity的时候,capacity翻倍。shrink的时候,当item的数量减少到capacity的1/4的时候,capacity减半。
2017-06-25 20:39:17
153
转载 各种优化方法总结比较(sgd/momentum/Nesterov/adagrad/adadelta)
http://blog.youkuaiyun.com/luo123n/article/details/48239963
2017-05-12 09:46:26
461
转载 vanishing gradient problem
转载自:http://www.jianshu.com/p/917f71b06499vanishing gradient problem兄弟是:exploding gradient problem
2017-05-12 09:27:19
316
原创 numpy一些用法
1、numpy.allclosenumpy.allclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False)Returns True if two arrays are element-wise equal within a tolerance.Parameters:a, b : array_likeInput ar
2017-05-10 16:02:05
561
原创 hibernate插入中文乱码
1、查看建表语句,看是否用utf-8SHOW CREATE TABLE table_name2、如果表是utf-8,修改hibernate的url原来我配置文件中的connection.url是这么写的:jdbc:mysql://localhost:3306/pm_manage现在改成jdbc:mysql://localhost:3306/pm_manage?u
2017-04-20 10:46:40
423
原创 547. Friend Circles【用warshall算法求解】
https://leetcode.com/problems/friend-circles/#/description这个题目,给出一个N*N的矩阵M,如果M[i][j]==1,说明i和j有直接朋友关系,如果M[i][j]==1并且M[j][k]==1那么i和k就有间接朋友关系。求所有人之间的朋友圈子有几个。一开始的想法是用warshall算法,计算闭包,那么有多少个链子应该能很快计算出
2017-04-10 17:18:08
433
原创 55. Jump Game
https://leetcode.com/problems/jump-game/#/description这道题是说,给定一个数组,数组中每个元素表示当前位置最大能前进的数,最开始在第一个元素所在的位置,判断是否能到达终点。题目的tag是贪心算法,一开始我认为从前往后看,每一步走争取最大步数,能走多远就是多远。public class Solution { public bo
2017-04-07 16:33:21
166
原创 122. Best Time to Buy and Sell Stock II
https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/#/description这个题允许股票进行多次买卖,目标是计算总的最大获益。基本思路是用贪心算法,只要能挣到钱(下一个数字比上一个数字大),就进行买卖。public class Solution { public int maxProfit(in
2017-04-07 16:09:23
126
原创 121. Best Time to Buy and Sell Stock
https://leetcode.com/problems/best-time-to-buy-and-sell-stock/#/description股票买入和卖出的最大差价,只允许交易一次,实际上就是计算数组中靠后的值和靠前的值最大差。public class Solution { public int maxProfit(int[] prices) { in
2017-04-07 15:52:46
151
原创 455. Assign Cookies
tag为贪心的第一题。https://leetcode.com/problems/assign-cookies/#/description思路:先给两个数组排个序,然后比较cookie数组比need数组大的数字有多少。public class Solution { public int findContentChildren(int[] g, int[] s) {
2017-04-07 11:22:39
145
原创 125. Valid Palindrome
https://leetcode.com/problems/valid-palindrome/#/description判断一个字符串是否是回文(正着和反着看一样)。思路,硬着头皮判断呗。不过要注意,标点符号不算在内,但是数字算在内。。public class Solution { public boolean isPalindrome(String s) {
2017-04-05 11:21:46
211
原创 【回头再看看】141. Linked List Cycle
https://leetcode.com/problems/linked-list-cycle/#/description这个题目要判断链表里是否有回路。总的来说用两个指针,slow走的慢,每次只走一步,fast走得快,每次走两步,如果有环,slow就会和fast碰到。。参考一下这个吧,以后再认真看看……………………http://blog.sina.com.cn/s/blog_6f
2017-04-05 11:06:27
153
原创 160. Intersection of Two Linked Lists
https://leetcode.com/problems/intersection-of-two-linked-lists/#/description计算两个链表相交的部分,返回刚开始相交的位置。思路:判断呗。。if(headA == null || headB == null){ return null; }
2017-04-05 10:45:44
122
原创 【还没做,待定】198. House Robber
https://leetcode.com/problems/house-robber/#/description
2017-04-05 10:36:44
163
原创 326. Power of Three
https://leetcode.com/problems/power-of-three/#/description要求不用循环和递归判断一个数字是否是3的次方。思路:3^19=1162261467,用1162261467 % 这个数字,如果没有余数,说明是3的次方~public class Solution { public boolean isPowerOfThree(i
2017-04-05 10:29:59
220
原创 202. Happy Number
https://leetcode.com/problems/happy-number/#/description问题是判断一个输入的数字是否是happy number,规则看题目吧,翻译无能。。思路就是将一个数字拆分成各个位数上的数字,然后进行求和,判断。用到了map,最近只会用map。。因为如果是false,要判断是否是出现过的数字,不然会死循环Map map = new HashM
2017-04-05 10:24:03
196
原创 268. Missing Number
https://leetcode.com/problems/missing-number/#/description找到从0开始的等差数列中缺失的一项。思路:求和,然后用理论上应该得到的数列和减去实际上得到的数组和,就是缺失的数字。public class Solution { public int missingNumber(int[] nums) { i
2017-04-05 10:03:26
151
原创 350. Intersection of Two Arrays II
https://leetcode.com/problems/intersection-of-two-arrays-ii/#/description很简单的问题,求两个集合的交集。写的有点蠢了。。先a了再说初步思路是,将两个集合各自遍历一遍,映射一下元素,然后将映射后的结果进行对比。遇到的一个问题是,在取map元素数据的时候,要对map里的数据进行比较,用==不能比较,只能用equals
2017-04-04 17:56:59
170
原创 238. Product of Array Except Self
https://leetcode.com/problems/product-of-array-except-self/#/description计算数组中除本身以外的所有数字之积要求:不允许用除法;O(n)思路:将乘法拆开,分为该数字的前一部分和后一部分。那么开两个数组,forword表示从前往后的乘积,backword表示从后往前的乘积。最后将两个相乘就得到结果。public
2017-04-04 12:02:56
155
原创 387. First Unique Character in a String
https://leetcode.com/problems/first-unique-character-in-a-string/#/description寻找字符串中第一个只出现一次的字符的位置思路:先计算每个字符出现的次数,获得第一个只出现一次的字符,遍历字符串,得到该位置。public class Solution { public int firstUniqChar(
2017-04-04 11:25:43
241
原创 283. Move Zeroes
将数组中所有的零元素移到数组末尾。思路:寻找 0元素,移动到末尾。public class Solution { public void moveZeroes(int[] nums) { int count = 0; int i,j; for(i = 0;i if(nums[i] == 0){
2017-04-04 10:56:36
230
原创 136. Single Number
https://leetcode.com/problems/single-number/#/description所有数字都出现两次,仅有一个数字出现一次,找出这个数字。要求:线性时间;不占用其他内存。思路:xora xor a = 0a xor 0 = apublic class Solution { public int singleNumber(int[
2017-04-04 10:30:06
132
原创 371. Sum of Two Integers
https://leetcode.com/problems/sum-of-two-integers/#/description两个整数求和,不能用到加号和减号。思路:比特运算,用and表示进位,用xor表示不进位的结果,累加起来。public class Solution { public int getSum(int a, int b) { int c
2017-04-04 10:28:18
163
原创 3. Longest Substring Without Repeating Characters
计算字符串中的最长不重复子串用到map,一次遍历if (s.length()==0) return 0; HashMap map = new HashMap(); int max=0; for (int i=0, j=0; i if (map.containsKey(s.charAt(i))){
2017-03-24 15:44:44
144
原创 leetcode第一题
https://leetcode.com/problems/two-sum/#/descriptiono(n)的方法,用到了map。public class Solution { public int[] twoSum(int[] nums, int target) { int[] result = new int[2];//哈希
2017-03-23 11:20:30
170
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人