Skip to content

Instantly share code, notes, and snippets.

Date a, b; // assume these are set to something
Date d; // the date in question
return a.compareTo(d) * d.compareTo(b) > 0;
BigDecimal one = BigDecimal.ONE;
BigDecimal zero = BigDecimal.ZERO;
// 같으면 참
if (one.compareTo(zero) == 0) {
// one이랑 zero가 같음
}
// 크면 참
@springcome
springcome / EmailValidatorSample.java
Last active August 29, 2015 14:14
email validator sample code, smartgwt
public class EmailValidatorSample {
private Canvas drawForm() {
TextItem email = new TextItem("email");
email.setWidth("*");
email.setValidators(emailValidator());
}
private RegExpValidator emailValidator() {
return new RegExpValidator("^([a-zA-Z0-9_.\\-+])+@(([a-zA-Z0-9\\-])+\\.)+[a-zA-Z0-9]{2,4}$");
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="ko">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>www.springcome.me</title>
<head>
<link rel="stylesheet" type="text/css" href="/resources/css/maxmertkit.css">
<link rel="stylesheet" type="text/css" href="/resources/css/maxmertkit-animation.css">
<link rel="stylesheet" type="text/css" href="/resources/css/maxmertkit-components.css">
</head>
@springcome
springcome / jquery-ajax-async-false.js
Created October 23, 2013 11:41
ajax 동기 비동기, jquery
// 전화번호를 검색하여 받아온다.
var telNo = '';
$.ajax({
url : '',
data : {},
type : 'post',
sendDataType : 'json',
async : false,
success : function(data) {
telNo = data;
@springcome
springcome / jquery-ajax-async-true.js
Last active December 26, 2015 07:39
ajax 동기, 비동기 처리
// 전화번호를 검색하여 받아온다.
var telNo = '';
$.ajax({
url : '',
data : {},
type : 'post',
sendDataType : 'json',
success : function(data) {
telNo = data;
}
@springcome
springcome / android-SharedPreferences.java
Created October 22, 2013 10:23
안드로이드 설정파일 저장, android
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SharedPreferences sp = getApplicationContext().getSharedPreferences("Str", mode);
SharedPreferences.Editor editSp = sp.edit();
editSp.putString("setting", "1");
}
//mode - 0 : 읽고쓰기
@springcome
springcome / javascript-selected-text.js
Created October 22, 2013 10:16
선택된 텍스트 가져오기, javascript
var selection_text = document.selection.createRange().text;
alert(selection_text);
@springcome
springcome / android-getPackageManage.java
Created October 22, 2013 10:09
어플이 설치되어 있는지 확인하기, android
// 카카오톡이 설치되어 있는지 확인
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try {
this.getPackageManager().getPackageInfo("com.kakao.talk", PackageManager.GET_ACTIVITIES);
} catch (NameNotFoundException e) {
e.printStackTrace();
ToastUtil.showShotToast(this, "없음");
@springcome
springcome / servlet.xml
Created October 21, 2013 15:03
핸들러 인터셉터
<bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
<property name="interceptors">
<list>
<ref bean="sessionInterceptor" />
</list>
</property>
</bean>
<bean id="sessionInterceptor" class="" />