- 博客(12)
- 资源 (22)
- 收藏
- 关注
原创 Java:Access password protected URL
问题描述当访问要密码验证的网址的时候,通常会弹出一个对话框,指示用户输入用户名和密码,那么用Java代码去读取URL对应的内容时,如何设置好登陆凭证?解决方案 URL url = new URL("http://user:password@10.10.12.72:8080/data/retrieve?rid=109000&pid=community"); URLConn
2015-03-31 14:57:26 867
原创 Spring Boot MongoRepository
在Spring Boot中使用MongoDB作为spring data的话,可以使用如下方式来提供多种数据查询服务。这些接口中的方法都不需要实现,Spring Boot自动扫描并解析方法名,生成对应的方法实现。public interface PersonRepository extends Repository<User, Long> { List<Person> findByEmailAddr
2015-03-27 14:49:20 3759
原创 Spring Boot reads Json String as an object
Spring Boot JacksonSpring boot uses jackson to serialize the object and deserialize a string as an object.an example of serializationThe following code will automatically convert the ResourceDefinition
2015-03-27 10:21:00 1906
原创 算法:数组中只出现了一次的数字
题目一个整型数组里除了两个数字之外,其他的数字都是出现了两次。请写出程序找出这两个只出现了一次的数字。要求时间复杂度是O(n), 空间复杂度是O(1)。题解tip1:如果该数组A中只有一个数字出现了一次,其他的数字都出现了两次,那么求出该数字就很简单,其值就是 A[0] ^ A[1] ^ … ^ A[n-1] 因此就需要想办法,将问题转换为tip1里的问题场景。 tip2:将题目中的数组的每个数
2015-03-20 23:44:29 687
原创 关于Spring.io官网Spring Session Restful example的问题
问题描述当使用SpringBoot提供Restful接口服务时,可以非常方便快速地通过SpringBoot来发布。然而需要考虑的问题:使用安全机制使用外在数据库保存session针对安全机制,官网提供了一个demo: 官网demo地址为:http://docs.spring.io/spring-session/docs/current/reference/html5/guides/rest.
2015-03-20 15:14:22 2629
原创 关于Java和CPP强制类型转换
1,当基本类型由下往上转的时候,会有隐式的类型转换,比如float f = 0.1f;double d = f; // 默认向上转换不需要显示指定 double d = (double) f;2,在【java】中,然后向下转换的时候,却是需要的:float f = (float) d; // d是一个double类型f = 3.1415926f; // 在数字末尾加上 f,以表明这一个数字是fl
2015-03-18 08:10:12 861
转载 Python发送POST请求的简单例子
import urllib,urllib2def doPost(self,data1,data2): data = urllib.urlencode({'data1':data1,'data2':data2}) request = urllib2.Request('http://www.xxx.com/test',data) response = urllib2.urlope
2015-03-11 10:34:38 6965
原创 SpringBoot uses mysql as the database
When using mysql in the springboot project, we need to config the application.properties to enable it.first, config the application.propertiesapplication.properties# application.propertiesspring.dat
2015-03-10 11:26:55 1806
原创 Intellij idea中gradle设置多源文件目录
问题描述Intellij idea开发工具来开发Java工程的时候,通常会使用ant、maven、groovy、gradle等工具来管理项目依赖。我在工程中使用了较新的gradle作为管理工具。但是在运行build.gradle的build任务时,通常需要将多个目录设置为源代码文件目录。否则一旦build完了以后,某些目录中的源代码会被忽视,而认为不是源代码。比如说如下图所示: - 该图中w
2015-03-09 10:16:10 12345
原创 JumpNode递归和非递归访问
JumpNode的定义结构为如下所示:struct JumpNode { int data; //存储数据 int order; // 记录访问次序,初始化均为0 JumpNode *jump, *next; // next为线性下一节点,jump为跳跃到下一节点 JumpNode(int d): data(d), order(-1), jump(NULL), nex
2015-03-04 22:54:29 699
原创 非递归地中序遍历BST
使用栈来辅助遍历平衡二叉树// defines the data structure for BST Nodestruct Node { int data; Node *left, *right; Node(int d): data(d), left(NULL), right(NULL) {}};void inorder_traversal(Node *root) {
2015-03-04 21:23:05 946
原创 Miller_rabin & pollard_rho 快速素数检和合数因式分解
Miller_rabin & pollard_rho 快速素数检和合数因式分解
2015-03-02 10:39:04 844
hadoop 2.2.0 for eclipse plugin插件
2014-11-02
An Introduction to the Analysis of Algorithms
2014-09-01
Analytic Combinatorics [Philippe Flajolet / Robert Sedgewick ]
2014-09-01
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人