Skip to content

Instantly share code, notes, and snippets.

@smd877
smd877 / smd877test1.java
Created March 5, 2012 07:35
this is test
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class Sample1 {
/**
* @param args
*/
public static void main(String[] args) {
String str = "メンタルにがり";
System.out.println("print : " + str);
@smd877
smd877 / BlowfishTest.java
Created March 6, 2012 05:05
Javaの暗号化
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.DecoderException;
@smd877
smd877 / gist:2708067
Created May 16, 2012 06:33
test.html
<pre style="font: 10px/5px monospace;"><span style="color: #b78550;"></span><span style="color: #af7d48;">#</span><span style="color: #b6834c;">#</span><span style="color: #c28b53;">#</span><span style="color: #c38c54;">#</span><span style="color: #be8955;">#</span><span style="color: #bb8757;">#</span><span style="color: #cd9d6d;">#</span><span style="color: #d5a66e;">#</span><span style="color: #d2a469;">#</span><span style="color: #d4a66b;">#</span><span style="color: #d3a46e;">#</span><span style="color: #d2a669;">#</span><span style="color: #d3a873;">#</span><span style="color: #cb9e74;">#</span><span style="color: #d0a280;">#</span><span style="color: #c69877;">#</span><span style="color: #9f734c;">#</span><span style="color: #a1764c;">#</span><span style="color: #b3885d;">#</span><span style="color: #ad8152;">#</span><span style="color: #b17f4c;">#</span><span style="color: #c9965f;">#</span><span style="color: #d09f65;">#</span><span style="color: #cd9f63;">#</span><span style="color: #d1a568;">#</spa
@smd877
smd877 / StringUtils.java
Created July 25, 2012 02:52
日本語文字列のバイト数切り分け
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
public class StringUtils {
/** バイトチェックする際の文字列エンコード */
public static final String ENCODING = "SJIS";
/**
@smd877
smd877 / CommonUtilities.java
Created September 27, 2012 09:47
GCMのClientDemoを簡略化
package com.google.android.gcm.demo.app;
import android.content.Context;
import android.content.Intent;
public final class CommonUtilities {
/** サードパーティのID登録/解除用URL */
static final String SERVER_URL = "http://localhost:8080/jsp";
@smd877
smd877 / do.jsp
Created September 27, 2012 10:13
registration_idを取得する用のjsp
<%@ page import="java.util.Enumeration" %>
<%
Enumeration<String> en = request.getParameterNames();
while (en.hasMoreElements()) {
String name = en.nextElement();
System.out.print(name + " = ");
System.out.println("" + request.getParameter(name));
}
out.println("fin.");
%>
@smd877
smd877 / GCMSendSample.java
Created September 27, 2012 10:17
ローカル起動でGCMのメッセージをpush要求する
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
@smd877
smd877 / getRecordList.sql
Created October 12, 2012 07:57
PostgreSQLでDBの各テーブルのレコード数を確認したいとき
SELECT T2.relname
, T2.reltuples
FROM pg_stat_user_tables AS T1
INNER JOIN pg_class AS T2
ON T1.relname = T2.relname
ORDER BY T2.relname;
@smd877
smd877 / SimpleSample 01 SimpleSampleActivity.java
Last active December 12, 2015 04:39
Androidで利用できるxmlパーサー「simple」のサンプル
package jp.gr.java_conf.smd877.simplesample;
import android.os.Bundle;
import android.view.View;
import android.app.Activity;
/**
* xmlパーサーSimpleを試すためのActivity
*/
public class SimpleSampleActivity extends Activity {

Title

Hi, my name is smd877.


Lists

  • List1
  • List2