- 博客(48)
- 资源 (1)
- 收藏
- 关注
转载 gradle配置国内镜像
gradle配置国内镜像文章转自: https://www.cnblogs.com/yangshifu/p/9801659.htmlAndroid Studio在构建项目时会拉取gradle资源,而goole和jcenter在国内的网络环境并不好用,容易产生connect timeout等错误。因此将地址修改成阿里云的国内镜像。一、允许使用maven仓库点击File->Sett...
2019-05-23 18:32:22
3739
原创 svg添加事件
<svg class="statement_right_bottom_more" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1107"><script type="text/ecmascript"><![
2018-07-13 23:12:53
9840
原创 Spring、springMVC、Mybatis整合
Spring、SpringMVC、Mybatis整合工程结构Spring配置文件:applicationContext.xml<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi...
2018-07-10 23:06:46
306
原创 springMVC返回的json中文全是问号
springMVC.xml里加上:<mvc:annotation-driven> <mvc:message-converters register-defaults="true"> <!-- 启动Spring MVC的注解功能,完成请求和注解POJO的映射 注解请求映射 默认是ISO-88859-1,...
2018-07-06 11:14:53
2085
1
原创 按照之字形打印二叉树
按照之字形打印二叉树描述请实现一个函数按照之字形打印二叉树,即第一行按照从左到右的顺序打印,第二层按照从右至左的顺序打印,第三行按照从左到右的顺序打印,其他行以此类推。Solutionpublic class Solution { public ArrayList<ArrayList<Integer> > Print(TreeNode p...
2018-05-12 11:45:33
175
转载 TensorFlow的tfrecords文件与queue队列组合读取数据方法
TensorFlow的tfrecords文件与queue队列组合读取数据方法自己制作了数据集,然而读取老是莫名其妙的读不出数据,参考了以下的文章: https://blog.youkuaiyun.com/julialove102123/article/details/80085871我的测试文件:import osimport tensorflow as tffrom PIL impor...
2018-05-02 12:16:55
406
原创 把hdfs上的多个目录下的文件合并为一个文件
hdfs dfs -cat files | hdfs dfs -copyFromLocal - newfile 这样就把files这些文件内容复制到newfile里面
2018-04-29 23:47:20
12079
原创 org.apache.hadoop.mapreduce.lib.input.InvalidInputException: Input path does not exist
idea下远程调试hadoop程序一直报路径不存在。。。找了好久,然后一直认为路径是正确的,然而。。。 我们在hdfs系统中直接建立文件后,可能误以为这个路径就是相对路径,事实上并不是 使用hdfs dfs -ls / 查看当前目录可以知道当前的相对路径是什么 这个路径困扰了一下午。。。好想哭。。。无语。。。...
2018-04-29 15:32:57
4046
3
原创 虚拟机Nat模式下ping宿主机
虚拟机Nat模式下ping宿主机最近用xshell连接虚拟机发现连接失败,然后发现。。。根本没能ping通,之前只是实现了Nat模式下为虚拟机配置静态IP,同时使虚拟机内部各个虚拟机之间相互ping通并能访问外网,当时似乎没有测试与宿主机的连接。。。(-_-)#检查了VMnet8网卡,发现ip地址和虚拟机不在同一个网段,于是修改为同一个网段,这里需要注意的是网关也要一致,然后宿主机就能与虚...
2018-04-29 12:05:19
770
原创 关于opencv使用imshow函数闪退解决方法
关于opencv使用imshow函数闪退解决方法将Debug x64下的附加依赖项改为只有后缀为d.lib的那个库文件,去除另一个,问题就这么解决了,虽然我也不知道加上另一个为什么就会闪退。。。emmm...
2018-04-24 15:43:53
8321
16
原创 交换两个变量的值的几种方式
交换两个变量的值的几种方式1.使用一个临时变量int a,b;int tmp = a;a = b;b = tmp;2.使用+-运算int a,b;a = a+b;b = a - b;a = a - b;3.使用位运算int a,b;a = a ^ b;b = a ^ b;a = a ^ b;...
2018-04-20 14:03:09
338
原创 12. Min Stack
12. Min StackDescriptionImplement a stack with min() function, which will return the smallest number in the stack.It should support push, pop and min operation all in O(1) cost.Examplepush(...
2018-04-15 14:24:28
212
原创 11. Search Range in Binary Search Tree
11. Search Range in Binary Search TreeDescriptionGiven two values k1 and k2 (where k1 < k2) and a root pointer to a Binary Search Tree. Find all the keys of tree in range k1 to k2. i.e. print ...
2018-04-15 13:54:12
359
原创 9. Fizz Buzz
9. Fizz BuzzDescriptionGiven number n. Print number from 1 to n. But:when number is divided by 3, print "fizz".when number is divided by 5, print "buzz".when number is divided by both 3 and 5,...
2018-04-15 13:44:18
268
原创 8. Rotate String
8. Rotate StringDescriptionGiven a string and an offset, rotate string by offset. (rotate from left to right)ExampleGiven "abcdefg".offset=0 => "abcdefg"offset=1 => "gabcdef"offset=2...
2018-04-15 13:32:40
239
原创 2. Trailing Zeros
2. Trailing ZerosDescriptionWrite an algorithm which computes the number of trailing zeros in n factorial.Example11! = 39916800, so the out should be 2Solutionpublic class Solution { /...
2018-04-14 23:41:20
266
原创 7. Serialize and Deserialize Binary Tree
7. Serialize and Deserialize Binary TreeDescriptionDesign an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called 'serialization' and reading ...
2018-04-14 20:26:15
182
原创 6. Merge Two Sorted Arrays
6. Merge Two Sorted ArraysDescriptionMerge two given sorted integer array A and B into a new sorted integer array.ExampleA=[1,2,3,4]B=[2,4,5,6]return [1,2,2,3,4,4,5,6]Solutionpublic clas...
2018-04-13 23:22:43
223
原创 5. Kth Largest Element
5. Kth Largest ElementDescriptionFind K-th largest element in an array.ExampleIn array [9,3,2,4,8], the 3rd largest element is 4.In array [1,2,3,4,5], the 1st largest element is 5, 2nd large...
2018-04-13 23:12:00
349
原创 4. Ugly Number II
4. Ugly Number IIDescriptionUgly number is a number that only have factors 2, 3 and 5.Design an algorithm to find the nth ugly number. The first 10 ugly numbers are 1, 2, 3, 4, 5, 6, 8, 9, 1...
2018-04-13 22:37:00
239
原创 68. Binary Tree Postorder Traversal
68. Binary Tree Postorder TraversalDescriptionGiven a binary tree, return the postorder traversal of its nodes' values.ExampleGiven binary tree {1,#,2,3}, 1 \ 2 / 3return [...
2018-04-11 22:44:02
207
原创 67. Binary Tree Inorder Traversal
67. Binary Tree Inorder TraversalDescriptionGiven a binary tree, return the inorder traversal of its nodes' values.ExampleGiven binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,...
2018-04-11 22:40:44
217
原创 66. Binary Tree Preorder Traversal
66. Binary Tree Preorder TraversalDescriptionGiven a binary tree, return the preorder traversal of its nodes' values.ExampleGiven: 1 / \ 2 3 / \4 5return [1,2,4,5,3].Solution...
2018-04-11 22:35:10
262
原创 155. Minimum Depth of Binary Tree
155. Minimum Depth of Binary TreeDescriptionGiven a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest le...
2018-04-11 22:23:28
213
原创 97. Maximum Depth of Binary Tree
97. Maximum Depth of Binary TreeDescriptionGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest lea...
2018-04-11 22:01:40
144
原创 3. Digit Counts
3. Digit CountsDescriptionCount the number of k's between 0 and n. k can be 0 - 9.Exampleif n = 12, k = 1 in[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]we have FIVE 1's (1, 10, 11, 12)Soluti...
2018-04-10 22:55:10
251
原创 41. Maximum Subarray
41. Maximum SubarrayDescriptionGiven an array of integers, find a contiguous subarray which has the largest sum.The subarray should contain at least one number.ExampleGiven the array [−2,...
2018-04-10 12:43:21
184
原创 1. A + B Problem
1. A + B ProblemDescriptionWrite a function that add two numbers A and B. You should not use + or any arithmetic operators.ClarificationAre a and b both 32-bit integers?Yes.Can I use bi...
2018-04-08 22:53:13
251
转载 Hexo自定义网站首页
Hexo默认的首页每次页面刷新时,播放器之类会被重置,所以想法是使用iframe内联框架,将整个页面嵌在里面,而自己另外定义一个主页,将播放器放在外面,这样就实现了在跳转时播放器能够继续播放的效果,实际上仔细看网易云官网也是这么干的,这样做还能够实现自定义的首页,个人觉得更灵活一些,而博客页面可以成为子网页。那么问题是如何更改首页路由?花了一早上查了不少资料浏览了不少博客,99.9%的做法没能符合预
2018-01-01 14:30:17
6220
转载 为Hexo添加音乐
为Hexo添加音乐本来打算自己写个插件,无奈有点费时间,主要是后天要考试试啦,头有点大。于是使用了音乐外链播放器。一开始直接用的网易云单首歌曲的播放器,但是只能播放同一首歌曲,而且切换歌曲很麻烦,想着加个音乐搜索功能,然后发现有个更好的方式——使用歌单外链。但是打开网易云歌单会发现找不到歌单的外链,不过仔细看源码会发现有个歌单id,这样就够了 转自https://www.tiexo.cn/apl
2017-12-31 15:32:31
3386
1
原创 2.尾部的零
2.尾部的零设计一个算法,计算出n阶乘中尾部零的个数样例11! = 39916800,因此应该返回 2分析两个大数字相乘,都可以拆分成多个质数相乘,而质数相乘结果尾数为0的,只可能是2*5。而在某个范围内5的个数必定比2少,因为每隔2个数就有会出现因子2。 对于一个正整数n来说,怎么计算n!中5因子的个数呢?我们可以把5的倍数都挑出来,即: 令 n! = (5*K
2017-12-24 00:52:38
252
原创 A+B问题
A+B问题描述给出两个整数a和b, 求他们的和, 但不能使用 + 等数学运算符。说明a和b都是 32位 整数,可以使用位运算样例输入1和2,输出为3实现class Solution {public: /* * @param : An integer * @param : An integer * @retu
2017-12-15 11:40:09
345
原创 Java类初始化顺序
1、静态块 > 非静态块 > 构造函数 2、父类 >子类总得来说顺序是这样: 父类静态块>子类静态块>父类非静态块>父类构造函数>子类非静态块>子类构造函数
2017-09-29 20:53:04
274
转载 Java开发中的23种设计模式详解(转)
设计模式(Design Patterns)——可复用面向对象软件的基础设计模式(Design pattern)是一套被反复使用、多数人知晓的、经过分类编目的、代码设计经验的总结。使用设计模式是为了可重用代码、让代码更容易被他人理解、保证代码可靠性。 毫无疑问,设计模式于己于他人于系统都是多赢的,设计模式使代码编制真正工程化,设计模式是软件工程的基石,如同大厦的一块块砖石一样。项目中合理的运用设
2017-04-13 23:59:27
852
1
转载 Swing与线程
swing与线程使用线程是为了提高程序的响应速度,当程序需要做某些很耗时的任务时,不应阻塞用户接口而应启动另一个工作器线程。但是我们必须小心工作器线程所做的事情。 Swing不是线程安全的,不要尝试在多个线程中操作用户界面元素,否则程序可能崩溃。 Swing为什么不设计成线程安全的:首先同步要耗费时间(Swing的速度本来就令人不满了);使用线程安全包的用户界面程序员不能很好的使其同步,容...
2017-04-09 16:04:36
916
原创 java多线程
多线程进程进程的概念主要有两点:第一,进程是一个实体。每一个进程都有它自己的地址空间,一般情况下,包括文本区域(text region)、数据区域(data region)和堆栈(stack region)。文本区域存储处理器执行的代码;数据区域存储变量和进程执行期间使用的动态分配的内存;堆栈区域存储着活动过程调用的指令和本地变量。第二,进程是一个“执行中的程序”。程序是一个没有生命的
2017-03-23 23:23:55
1046
1
转载 java并发编程,Thread类的使用
Java并发编程:Thread类的使用 在前面2篇文章分别讲到了线程和进程的由来、以及如何在Java中怎么创建线程和进程。今天我们来学习一下Thread类,在学习Thread类之前,先介绍与线程相关知识:线程的几种状态、上下文切换,然后接着介绍Thread类中的方法的具体使用。 以下是本文的目录大纲: 一.线程的状态 二.上下文切换 三.Thread类中的方法
2017-01-15 11:10:02
455
转载 同余定理(求余数)
现在给你一个自然数n,它的位数小于等于一百万,现在你要做的就是求出这个数除10003之后的余数输入第一行有一个整数m(1<=m<=8),表示有m组测试数据;随后m行每行有一个自然数n。输出输出n整除10003之后的余数,每次输出占一行。样例输入345465456541样例输出456948代码如下:[cpp] view plain copy/* 同余定理:(a+b)%c=((a%c)+(...
2016-11-15 13:52:27
1196
转载 全排列的编码与解码——康托展开及其逆展开
一、康托展开:全排列到一个自然数的双射 X=an*(n-1)!+an-1*(n-2)!+...+ai*(i-1)!+...+a2*1!+a1*0! ai为整数,并且0<=ai<i(1<=i<=n) 适用范围:没有重复元素的全排列 二、全排列的编码: {1,2,3,4,...,n}的排列总共有n!种,将它们从小到大排序,怎样知道其中一种排列是有序序
2016-11-13 21:35:27
601
原创 1079 三角形
1079 三角形时间限制:500MS 内存限制:65536K提交次数:283 通过次数:82题型: 编程题 语言: G++;GCCDescription著名的数学家毕达哥拉斯可能从来都不曾想过有人居然会问他这样的一个问题:给出一个整数,存在多少个直角三角形,它的某一条边的长度等于这个整数,而且其他边的长度也是整数。既然毕达哥拉斯不可能预见到有
2016-07-01 18:30:28
864
1
JavaWeb开发实战1200例源码(第1卷)
2017-11-25
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人