ITeye博客

aliahhqcheng的博客

aliahhqcheng · 共 78 篇文章

方法retry的编写实践版

package com.snda.sysdev.virtualsys; /** * @author chengyongchun * @date 14-3-21 下午2:54 */ public class RetryTest { public static int retryCount = 3; public static void retry() throws Exception{ int tries = retryCount; while (true){ tries--; try{ System.out.println(tries); System.out.println(tries/0…

2014-03-21 15:13 · 代码片段 · 评论(0)

Http各种状态

package org.apache.http; public interface HttpStatus { // --- 1xx Informational --- /** <tt>100 Continue</tt> (HTTP/1.1 - RFC 2616) */ public static final int SC_CONTINUE = 100; /** <tt>101 Switching Protocols</tt> (HTTP/1.1 - RFC 2616)*/ public static final int SC_SWITCHING_PROTOCOLS = 101; /** <t…

2014-03-21 12:21 · 代码片段 · 评论(0)

java正则简单用列

package com.simple.example; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * java正则工作中的使用 * ========================================== * ^A匹配以A开头 * $A匹配以A结尾 * \s?匹配0个或多个空格 * \S+表示至少一个字符 * \S{0,6}表示0到6个字符 * [0-9]*匹配0到9的数字(多个) * ()将括号里面的内容作为一个独立的单元,理解为一组,用于获取对应的字符串使用 * ==========…

2014-02-11 23:23 · 代码片段 · 评论(0)

多线程下生成UUID

这个实例是验证多线程下使用java.util.UUID生成UUID不会发生重复的(其实UUID发生重复的概率是很小很小的 ) import java.util.HashSet; import java.util.Set; import java.util.UUID; import java.util.concurrent.Callable; public class GenUUId implements Callable { //实现Callable接口 public String genUuid(){ String uuid = UUID.randomUUID().toString(); …

2014-01-21 12:10 · 代码片段 · 评论(0)

mysql的sql优化(前奏)

要优化mysql首先要知道什么地方需要优化,然后才能针对具体问题进行优化?难道不是吗?什么分库分表,建立索引....摆脱不要那么官方好吗? 1.学会和培养使用mysql的查看命令的使用习惯 什么你忘记如何创建表的语句了?? mysql> ? table Many help items for your request exist. To make a more specific request, please type 'help <item>', where <item> is one of the following topics: ALTER TABLE ANALYZE TABLE C…

2014-01-19 20:09 · 数据库 · 学习分享 · 评论(0)

将本地的工程添加到gihub的远程仓库中

1.在本地创建一个maven工程(你可以使用maven命令,eclipse插件,idea等工具),如springPropertyPlaceHolderExample 2.cd springPropertyPlaceHolderExample 3.git init 4.git add . 5.git commit -m 'init' 6.在你的github上创建springPropertyPlaceHolderExample仓库。 7.执行 git remote add origin git@github.com:yongchun/springPropertyPlaceHolderExampl…

2013-11-30 11:45 · 工具分享 · 评论(0)

java的log框架全介绍

1.本篇不是什么? 不会告诉你应用系统为什么要引入日志框架? 不会告诉你系统中什么样的异常及错误信息应该记录日志? 不会告诉你怎么可以高效的记录准确(能清晰的反应系统异常或业务异常)的日志? 当然也不会告诉你记录日志的n最佳实践,这些会在后一篇文章中详细介绍的..... 2.java中主要的日志框架有哪些? java.util.Logging(JUL) Java Logging API是sun公司于2002年5月正式发布的。它是自J2SE 1.4版本开始提供的一个新的应用程序接口。它能够很方便地控制和输出日志信息到文件,控制台或其它用户定义的地方,如数据库,电子邮件等。所以它是为最 终用户,…

2013-11-22 17:00 · 开源jar包学习 · 评论(0)

Integer的“==”返回值

/** * Created by spring on 10/26/13. */ public class Test { public static void main(String args[]){ Integer i_128 = -128; Integer j_128 = -128; System.out.println(i_128==j_128); Integer i_129 = -129; Integer j_129 = -129; System.out.println(i_129==j_129); Integer i128 = 128; Integer j128 = 128; Sys…

2013-10-26 16:06 · 代码片段 · 评论(0)

git代码冲突

<<<<<<< HEAD sb.append("SELECT ID_, TIME_, USER_ID_, TASK_ID_, PROC_INST_ID_, FULL_MSG_") .append(" FROM ACT_HI_COMMENT WHERE TYPE_ = 'comment' AND "); ======= sb.append( "SELECT ID_, TIME_, USER_ID_, TASK_ID_, PROC_INST_ID_, FULL_MSG_") .append(" FROM ACT_HI_COMMENT"); if (processInstanceId != nul…

2013-10-14 20:35 · 工具分享 · 评论(0)

eclipse颜色设置

1.eclipse 背景色设置: Window->Preferences->General->Editors->Text Editors->Backgroud colors 取消System default 设置成:RGB(204,232,207). 2.eclipse的package explore背景颜色设置 这个需要修改windows系统的窗口背景颜色,修改以后不仅仅影响eclipse,还包括其他应用程序。 设置方法如下: >>在桌面点右键,依次选属性(properties)—外观(appearance) >>点右下角的高级(advanced),然后在项目(items)的下拉菜单里选窗…

2013-10-14 20:33 · 工具分享 · 评论(0)

IP转整数以及整数转IP

IP转整数以及整数转IP, 代码见

2013-09-25 11:30 · 代码片段 · 评论(0)

maven编译文件的编码设置

mavan编译时设置编码, 配置见

2013-09-25 11:28 · 代码片段 · 评论(0)

android开发环境搭建

错误信息: PANIC: Could not open: android 这个是因为没有配置android环境变量。 参考: 错误原因介绍: http://blog.csdn.net/langeldep/article/details/7187502 解决办法: http://askubuntu.com/questions/266758/how-to-set-up-environment-variable-properly

2013-09-05 22:40 · 学习分享 · 评论(0)

android开发环境搭建

错误信息: Starting emulator for AVD 'android' Failed to start emulator: Cannot run program "/home/spring/soft/adt-bundle-linux/sdk//tools/emulator": error=2, No such file or directory 解决这个问题的办法是: If you're running a 64-bit system, you need to install ia32-libs sudo apt-get install ia32-libs 参考: http://…

2013-09-05 22:36 · 学习分享 · 评论(0)

Http的状态码及状态码的类型

Http的状态码以及根据这些状态码分成5种类型 statusCode/100 /* * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/…

2013-08-27 19:45 · 开源jar包学习 · 评论(0)