自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(82)
  • 收藏
  • 关注

原创 ACE Minimum HTML Boostrap Template

[code="java"]Good Admin Html Template for Back End Developers[/code][img]http://dl2.iteye.com/upload/attachment/0119/9440/d052354c-6c7e-36b6-849d-fe786c813996.png[/img][code="java"] ...

2016-09-09 16:48:35 387

原创 row_number() and partition

[quote]一个表有三列,id,name,score,现在要取得每个人分数最高的两门课程[/quote][code="java"]create temp table tmp_xxxasselect 1 id,'A' name,80 gradeUNION ALLselect 2,'A',90UNION ALLselect 3,'A',60UNION ALLs...

2016-08-30 17:32:59 164

原创 Binary Tree

[code="java"]public class BinaryTree{ Node root; public void addNode(int key, String name) { // Create a new Node and initialize it Node newNode = new Node(k...

2016-08-30 15:47:48 144

原创 Eigenclass in Ruby

[code="java"]obj = Object.newdef obj.singleton_method endeclass = class

2016-08-02 17:50:06 135

原创 First DSL With Ruby

test_event.rb[code="java"]event "an event that always happens" do 110 > @target_salesendsetup do puts "Setting up sky" @target_sales = 100end[/code]main.rb[c...

2016-08-02 16:23:58 118

原创 Ruby Version of C# using keyword

[code="java"]class Resource1 def dispose @disposed = true end def disposed? @disposed endendmodule Kernel def using1(resource) begin...

2016-08-02 11:51:35 93

原创 Spring Security integrate with SSO(Siteminder)

[code="java"]This is the sample to integrate SSO to Java web app with spring security, typical authentication process:[/code][b]In this case, Web app sever is not proxyed, and recieve request dire...

2016-07-22 17:09:36 263

原创 DataTable Custom Sorting On Column

[code="java"]Requirement: we want to filter out the rows which is with empty value("", or " ") when sorting, always leave the rows with empty value column to the bottom of the data table. [/code][...

2016-06-07 18:28:55 153

原创 Linux SSH UsernamePasswordInteractive Login with Java ganymed-ssh2

[quote]Ganymed SSH-2 for Java is a library which implements the SSH-2 protocol in pure Java, more details http://www.ganymed.ethz.ch/ssh2/[/quote][quote]Here is a full sample for how to do Usernam...

2016-05-25 18:14:58 504

原创 Start Jersey rest api with embedded Jetty

[quote]This is an sample to start Jersey rest api with embedded Jetty, embedded jetty is easy for packaging in linux[/quote][code="java"]public class JerseyStart{ public static void main(...

2016-05-25 17:52:53 99

原创 Start tomcat with port 80 without Linux root user-Use iptables mapping

[quote]In linux system. only root user can use the port small than 1024, so if you change tomcat port to 80 and start without root account, then you will see the following error: [/quote][code="java...

2016-05-25 17:39:52 106

原创 Rails4 集成测试微信公众号API

[code="java"]这是一个简单集成微信api的的例子,使用这个Gem:https://github.com/lanrion/weixin_rails_middleware[/code]1. 下载这个rails4例子到本地[url]https://github.com/caiwenhn2008/weixin_rails_middleware_example[/url]2....

2016-01-17 20:34:36 268

原创 localtunnelling绑定本地Web应用到公网地址

[quote]Localtunnel will assign you a unique publicly accessible url that will proxy all requests to your locally running webserver. it's really helpful when we doing some testing like third-party logi...

2016-01-17 20:14:06 110

原创 Format XML in JAVA

[code="java"] public static String formatXMLContent(final String message) { try { final InputSource src = new InputSource(new StringReader(message)); ...

2016-01-11 12:23:21 87

原创 WordPress 风格开源博客 (响应式布局)

Rails4个人开源小博客介绍: https://ruby-china.org/topics/24666Github: https://github.com/caiwenhn2008/rails4blogHeroku Demo: https://wilsonsblog.herokuapp.com/articles

2015-08-09 23:42:58 354

原创 java多线程之BlockingQueue

[code="java"]package com.wilson.jdk5current;import java.io.File;import java.io.FileFilter;import java.util.concurrent.BlockingQueue;import java.util.concurrent.ExecutorService;import java.ut...

2015-08-09 23:38:03 110

原创 java多线程之CountDownLatch用法

CountDownLatch,一个同步辅助类,在完成一组正在其他线程中执行的操作之前,它允许一个或多个线程一直等待。主要方法public CountDownLatch(int count);public void countDown();public void await() throws InterruptedException构造方法参数指定了计数的次数...

2015-08-09 23:37:00 219

原创 java多线程之notify和wait

[code="java"]public class MyThreadPrinter2 implements Runnable{ private final String name; private final Object prev; private final Object self; private MyThreadPrinter2(Stri...

2015-08-09 23:35:39 109

原创 Rails实现markdown和代码高亮

安装GEMMarkdown是时下很流行的一种标记语言。可以很简便的生成html代码,github的README就是用这种形式显示再代码目录的下面。Ruby/Rails借助繁多的Gem,可以迅速的就做好markdown的支持,顺道包含对代码高亮的支持。Gem太多,实现方法也太多。下面就介绍一种比较迅速开发的办法。用了redcarpet和CodeRay两个Gem...

2015-08-07 11:47:24 213

原创 TextMate常见快捷键

[code="java"]cmd + option + L 显示行号 cmd + F 页面搜索文字 cmd + shift + F 项目搜索文字 cmd + G 下一个搜索文字 cmd + shift + G 上一个搜索文字 cmd + option + F 替换一个 cmd + ctrl + F ...

2015-08-07 11:42:06 1685

原创 Rails插件twitter-bootstrap-rails

github完整项目https://github.com/seyhunak/twitter-bootstrap-rails[code="java"]rails new demo --skip-bundle rails g scaffold Item title:string description:text --skip-stylesheets rake db...

2015-08-07 11:40:28 169

原创 HttpURLConnection下载文件

[code="java"]public class HttpDownloadUtility{ private static final Logger logger = LoggerFactory.getLogger(HttpDownloadUtility.class); private static final int BUFFER_SIZE = 4096; ...

2015-08-07 11:25:32 348

原创 Ruby1.8.7 安装和使用selenium

[quote]Selenium可以用来模拟浏览器页面点击,可以用来做页面功能测试,也可以用来做一些自动化脚本,它提供啦ruby版本实现,本文基于IE,当然它也支持其它主流浏览器[/quote]1. 安装selenium-webdriver[code="java"]gem install selenium-webdriver[/code]2. 安装Internet Explore...

2013-06-21 17:54:55 119

原创 Ehcache RMI Replicated Cluster(RMI集群)

[quote]本文是ehcache RMI集群的例子,导入附件中的java 项目到eclipse中,依次启动附件中的A.java,B.java,C.java, 就可以在eclipse的console中就可以看到3个cache的内容同步啦[/quote]1. ehcache 配置文件[code="java"] [/code]2...

2013-04-25 23:39:58 128

原创 Integrete unitils for database(dao) testing

[/code][quote]Database testingUnit tests for the database layer can be extremely valuable when building enterprise applications, but are often abandoned because of their complexity. Unitils greatly ...

2013-02-01 18:39:07 158

原创 Rails2.2.2之国际化

1. 新建国际化配置文件config\initializers\i18n.rb[code="java"]I18n.default_locale = 'en'LOCALES_DIRECTORY = "#{RAILS_ROOT}/config/locales/"LANGUAGES = { 'English' => 'en', "Espa\xc3\xb1ol" => 'e...

2013-01-27 23:52:10 119

原创 Rails2.2.2之文件上传下载

1. 创建一个保存文件的表,然后rake db:migrate同步到数据库[code="java"]class CreatePictures < ActiveRecord::Migration def self.up create_table :pictures do |t| t.string :comment t.string :name ...

2013-01-27 23:42:15 84

原创 Rails2.2.2之发送邮件

1. config\environment.rb中添加smtp邮件配置,以163邮件服务器为例[code="java"] Rails::Initializer.run do |config| 。。。 config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = ...

2013-01-27 23:32:31 147

原创 Rails2.2.2之will_paginate分页

[quote]分页是web开发中常见的问题,基本解决思路是每次查询当页的数据,在java中我们需要利用一些持久化框架才能实现各种数据库的通用分页逻辑。 然而在rails中我们只需安装will_paginate插件,简单的非常[/quote]1 用gem安装will_paginate插件[code="java"]gem install mislav-will_paginate -v2...

2013-01-27 23:04:08 112

原创 Ruby 代码块

[quote]Ruby代码块可以通过yield方法传递给被调用的方法[/quote]1 测试类[code="java"]require 'book'require 'booklist'booklist = BookList.new()b1 = Book.new("iPod","123")b2 = Book.new("How Objects Work","2")boo...

2013-01-14 18:27:40 159

原创 JAXB入门

[quote]jaxb是一个读写xml的工具,还可以提供验证,不需要额外的jar[/quote]1. XSD sample[code="java"] ...

2012-10-16 11:59:08 101

原创 Freemarker使用入门

[quote]freemarker是一种模板标记工具,可以做页面静态化,代码生成 http://freemarker.sourceforge.net/[/quote]1 pom 依赖[code="java"] freemarker freemarker 2.3.8 compile [/code]2 工具类[code="java"]pub...

2012-10-16 11:54:13 86

原创 perforce java api使用

[quote]perforce是种版本管理软件,提供啦完整的java api,可以方便我们做一些客户化开发,官方文档http://www.perforce.com/product/components/apis[/quote]1 . pom 依赖[code="java"] com.perforce p4java 2011.1.297684 [/code]...

2012-10-16 11:43:38 620

原创 XPath 入门

[quote]xpath可以快速定位获取XML文件中指定属性和值,jdk包含拉所有需要的类[/quote]1. 帮助类[code="java"]public class XpathUtil { private static final Log logger = LogFactory.getLog(XpathUtil.class.getName()); private Docum...

2012-10-16 11:29:07 116

原创 Java File Diff-diffutils

1. Maven Dependency[code="java"] com.googlecode.java-diff-utils diffutils 1.2.1 [/code]2. Test Class[code="java"]package com.citi.ocean.metadata.util;import java.io.File;i...

2012-09-27 17:35:18 1604

原创 XSD 入门使用

[code="java"] ...

2012-09-18 23:20:47 192

原创 nexus-2.1.1安装及使用入门

1. 安装地址[url]http://www.sonatype.org/nexus/[/url]解压之后先安装服务,每次开机自动启动[quote]nexus-2.1.1\bin\jsw\windows-x86-32\install-nexus.bat[/quote]然后查看日志,应该自动启动[code="java"]console-nexus.bat[/code]...

2012-08-13 22:52:58 291

原创 File Demo

[code="java"]package org.springside.examples.showcase.utilities.io;import java.io.File;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.io...

2012-06-25 22:55:08 103

原创 Java 访问sharepoint webservice(NTLM & SSL)

[quote]遇到需要使用java访问微软的sharepoint的webservice, 公司服务器配置的是NTLM+SSL验证解决办法: [b]jdk6支持ntlm和SSL, 同时使用jdk6 webservice做客户端[/b][/quote][b]1 sharepoint wsdl[/b][code="java"]https://server/_vti_bin/lis...

2012-06-12 09:47:52 375

原创 Selenium Web Driver入门

[b]1 What is Selenium?[/b][quote]Selenium automates browsers. That's it. What you do with that power is entirely up to you. Primarily it is for automating web applications for testing purposes, but...

2012-05-27 23:17:49 133

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除