- 博客(40)
- 资源 (3)
- 问答 (2)
- 收藏
- 关注
转载 Java单元测试工具:JUnit4——JUnit测试套件使用及参数化设置
1.JUnit测试套件 如果在测试类不端增加的情况下,如何运行所有的单元测试代码类?一个个测试类的执行吗?显然繁琐且费劲。 将要运行的测试类集成在我们的测试套件中,比如一个系统功能对应一个测试套件,一个测试套件中包含多个测试类,每次测试系统功能时,只要执行一次测试套件就可以了。1.1 测试类及测试套件代码 新建3个测试任务类:packa
2016-04-30 21:40:19 916
转载 Java单元测试工具:JUnit4——JUnit详解之运行流程及常用注解
1.JUnit的运行流程1.1 新建测试类 右键被测试类,新建一个测试类。弹出框中,首先改变测试类所在的代码目录,然后勾选4个方法:1.2 修改测试类代码如下:package jtzen9.util;import org.junit.After;import org.junit.AfterClass;import org.junit.Before;
2016-04-30 21:09:51 2607
转载 hql 语法与详细解释
HQL查询:Criteria查询对查询条件进行了面向对象封装,符合编程人员的思维方式,不过HQL(Hibernate Query Lanaguage)查询提供了更加丰富的和灵活的查询特性,因此Hibernate将HQL查询方式立为官方推荐的标准查询方式,HQL查询在涵盖Criteria查询的所有功能的前提下,提供了类似标准SQL语句的查询方式,同时也提供了更加面向对象的封装。完整的HQ
2016-04-30 20:31:30 575
转载 上网问题
首先有网,其次你连的上,再而打不开网页或者部分网页(最好的例子就是校园网了)笔者最近遇到了,按下面的方法解决了,以此做个参考。这种网络没有问题,但是网页打不开的现象,多是由于DNS设置错误,或者IE组件出现错误导致的DNS可以手动设置,IE组件非常的多,因此手动修复很困难,建议使用电脑管家的电脑诊所进行修复,一键就可以修复完成了附:手动修复步骤(来源:腾讯电脑管家电
2016-04-30 18:46:11 373
转载 Hibernate内置映射类型
在我们学习Hibernate时就知道,Hibernate映射类型分为两种:Hibernate内置的映射类型和Hibernate客户化映射类型。内置映射类型负责把一些常见的Java类型映射到相应的SQL类型;此外,Hibernate还允许用户实现UserType或CompositeUserType接口,来灵活地定制客户化映射类型Hibernate内置映射类型1).Java基本
2016-04-29 16:05:50 456
转载 Hibernate框架简述
Hibernate的核心组件在基于MVC设计模式的JAVA WEB应用中,Hibernate可以作为模型层/数据访问层。它通过配置文件(hibernate.properties或hibernate.cfg.xml)和映射文件(***.hbm.xml)把JAVA对象或PO(Persistent Object,持久化对象)映射到数据库中的数据库,然后通过操作PO,对数据表中的数据进行增,删,改,查
2016-04-29 14:27:18 446
转载 线程间操作无效:从不是创建控件的线程访问它的三种方法
我们在ui线程创建的子线程操作ui控件时,系统提示错误详细信息为:线程间操作无效: 从不是创建控件“XXX”的线程访问它。 就我知道的有三种方法,先看一下msdn的介绍:访问 Windows 窗体控件本质上不是线程安全的。如果有两个或多个线程操作某一控件的状态,则可能会迫使该控件进入一种不一致的状态。还可能出现其他与线程相关的 bug,包括争用情况和死锁。确保以线程安全方式访问控件
2016-04-28 21:34:30 1793
转载 C# Lock关键字
lock 关键字将语句块标记为临界区,方法是获取给定对象的互斥锁,执行语句,然后释放该锁。lock语句根本使用的就是Monitor.Enter和Monitor.Exit,也就是说lock(this)时执行Monitor.Enter(this),大括号结束时执行Monitor.Exit(this).他的意义在于什么呢,对于任何一个对象来说,他在内存中的第一部分放置的是所有方法的地址,第二部分
2016-04-28 21:09:11 391
转载 struts2中action接收参数的方法
Struts2中Action接收参数的方法主要有以下三种:Struts2中Action接收参数的方法主要有以下三种:1.使用Action的属性接收参数: a.定义:在Action类中定义属性,创建get和set方法; b.接收:通过属性接收参数,如:userName; c.发送:使用属性名传递参数,如:user1!add?userName=Magci;2.
2016-04-27 09:15:35 1416
原创 29. Divide Two Integers
Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.public class Solution { public int divide (int dividend, int divisor) { final i
2016-04-23 11:05:07 364
原创 28.Implement strStr()
Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.public class Solution { public int strStr(String haystack, String n
2016-04-21 18:23:13 531
原创 Bootstrap弹出窗示例
模态弹出框--实现原理解析(二)Bootstrap弹出窗示例大的模态弹出窗 ×Close 模态弹出窗标题 模态弹出窗主体内容 关闭 保存 小的模态弹出窗 ×Close 模态弹出窗标题 模态弹出窗主体
2016-04-21 15:47:16 3545
原创 27. Remove Element
Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.The
2016-04-20 11:42:56 401
原创 使用Cookie实现保存商品浏览记录
使用Cookie实现保存商品浏览记录1.确定好框架我新建了三个类。DBHelper.java来连接数据库,Items.java来封装数据,ItemsDAO.java来提供对Items的方法。在页面显示上,我新建了俩个jsp。index.jsp来负责提供商品展示,detail.jsp来负责显示商品的细节(也就是模拟网上购物的情形,然后再detail.jsp上会显示你的浏览记录)主要内
2016-04-19 23:00:52 4020 4
原创 26. Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear onlyonce and return the new length.Do not allocate extra space for another array, you must do this in place with
2016-04-19 08:54:48 242
原创 25. Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is.
2016-04-18 17:18:53 278
原创 24. Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. You m
2016-04-17 10:56:32 255
原创 23. Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.public class Solution { public ListNode mergeKLists(ListNode[] lists) { if (lists == null || list
2016-04-16 15:00:18 379
转载 Visual Studio Code 开源免费跨平台代码编辑器
微软良心之作——Visual Studio Code 开源免费跨平台代码编辑器 在 Build 2015 大会上,微软除了发布了 Microsoft Edge 浏览器和新的 Windows 10 预览版外,最大的惊喜莫过于宣布推出免费跨平台的 Visual Studio Code 编辑器了! Visual Studio Code (简称 VS Code / VSC) 是一款
2016-04-15 20:23:12 1392
转载 Java中String类的方法及说明
String : 字符串类型一、构造函数 String(byte[ ]bytes):通过byte数组构造字符串对象。 String(char[ ] value):通过char数组构造字符串对象。 String(Sting original):构造一个original的副本。即:拷贝一个original。 String(StringBuff
2016-04-15 19:57:37 297
原创 22. Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()()"
2016-04-15 19:55:21 228
原创 21. Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.public class Solution{ public ListNode mergeTwoLists
2016-04-15 16:38:28 245
原创 20. Valid Parentheses
Given a string containing just the characters '(', ')','{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all valid b
2016-04-15 12:21:08 252
原创 19. Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the l
2016-04-15 11:24:02 247
转载 javaweb学习总结(四)——Http协议
一、什么是HTTP协议 HTTP是hypertext transfer protocol(超文本传输协议)的简写,它是TCP/IP协议的一个应用层协议,用于定义WEB浏览器与WEB服务器之间交换数据的过程。客户端连上web服务器后,若想获得web服务器中的某个web资源,需遵守一定的通讯格式,HTTP协议用于定义客户端与web服务器通迅的格式。二、HTTP协议的版本 HTTP协议的
2016-04-15 10:11:10 404
转载 JavaWeb学习总结(三)——Tomcat服务器学习和使用(二)
一、打包JavaWeb应用 在Java中,使用"jar"命令来对将JavaWeb应用打包成一个War包,jar命令的用法如下: 范例:将JavaWebDemoProject这个JavaWeb应用打包成war包 执行完之后,就可以得到一个文件,平时开发完JavaWeb应用后,一般都会将JavaWeb应用打包成一个war包,然后将这个war包放到Tomcat服务器的web
2016-04-14 20:27:29 482
转载 JavaWeb学习总结(二)——Tomcat服务器学习和使用(一)
一、Tomcat服务器端口的配置 Tomcat的所有配置都放在conf文件夹之中,里面的server.xml文件是配置的核心文件。 如果想修改Tomcat服务器的启动端口,则可以在server.xml配置文件中的Connector节点进行的端口修改例如:将Tomcat服务器的启动端口由默认的8080改成8081端口Tomcat服务器启动端口默认配置1 Connector
2016-04-14 19:17:02 372
转载 JavaWeb学习总结(一)——JavaWeb开发入门
一、基本概念1.1、WEB开发的相关知识 WEB,在英语中web即表示网页的意思,它用于表示Internet主机上供外界访问的资源。 Internet上供外界访问的Web资源分为:静态web资源(如html 页面):指web页面中供人们浏览的数据始终是不变。动态web资源:指web页面中供人们浏览的数据是由程序产生的,不同时间点访问web页面看到的内容各不相同。 静态
2016-04-14 17:46:34 569 2
原创 18. 4Sum
Given an array S of n integers, are there elements a,b, c, and d in S such that a + b +c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note:Elements
2016-04-13 16:57:44 400
原创 17. Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Digit string
2016-04-12 15:24:30 384
原创 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 exactly
2016-04-11 19:12:07 273
原创 15. 3Sum
Given an array S of n integers, are there elements a,b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet (a,b,c) m
2016-04-10 14:48:26 260
原创 14. Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.public class Solution { public String longestCommonPrefix(String[] strs) { int len = strs.length; if(len ==
2016-04-10 02:42:05 252
原创 13. Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.public class Solution { public int romanToInt(String s) { if(s == null || s.length() ==
2016-04-09 23:39:35 387
原创 12. Integer to Roman
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.public class Solution { private static String M[] = {"","M","MM","MMM"}; private stati
2016-04-08 17:55:56 205
原创 11. Container With Most Water
Given n non-negative integers a1, a2, ...,an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of linei is at (i, ai) and (i, 0). Find
2016-04-07 22:13:45 251
原创 8. String to Integer (atoi)
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input case
2016-04-06 02:11:29 269
原创 10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire inp
2016-04-06 02:00:11 259
原创 蘑菇街2016校园招聘——聊天
import java.util.Scanner;/** * * ClassName:Solution * * * Description:求小菇合适的起床时间 * * Scanner cin = new Scanner(System.in); * while (cin.hasNextInt()) {}//正确 * * 写 * * while(true){}/
2016-04-04 13:54:46 524
原创 9. Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer to string, no
2016-04-03 22:26:32 347
var a = a || b,改用let,怎么写啊?
2018-10-18
TA创建的收藏夹 TA关注的收藏夹
TA关注的人