This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void doGet(HttpServletRequest request, | |
HttpServletResponse response) throws ServletException, IOException { | |
// logon user name | |
final String userName = request.getUserPrincipal().getName(); | |
PrintWriter out = response.getWriter(); | |
out.println(String.format("doGet(%s)", userName)); | |
out.flush(); | |
out.close(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import javax.ws.rs.GET; | |
import javax.ws.rs.Path; | |
import javax.ws.rs.QueryParam; | |
// http://localhost:8080/JerseySample/sample/hello?name=aaa&age=100 | |
@Path("/hello") | |
public class HelloResource { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertSheet2Json(sheet) { | |
// first line(title) | |
var firstRange = sheet.getRange(1, 1, 1, sheet.getLastColumn()); | |
var firstRowValues = firstRange.getValues(); | |
var titleColumns = firstRowValues[0]; | |
// after the second line(data) | |
var lastRow = sheet.getLastRow(); | |
var rowValues = []; | |
for(var rowIndex=2; rowIndex<=lastRow; rowIndex++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void registerAlarm(Context context) { | |
// 現在 | |
final Date nowDate = new Date(); | |
Calendar now = Calendar.getInstance(); | |
now.setTime(nowDate); | |
// 毎朝10:00 | |
int alarmHH = 10; | |
int alarmMM = 0; | |
final String alarmHHMM = userInfo.getAlarm_time(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test.jsonic; | |
import net.arnx.jsonic.JSON; | |
public class JsonicUtil { | |
public enum ResponseType { | |
TEST_1(Test1Response.class), ; | |
private Class<? extends JsonResponse> decodeTargetClazz; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DebugUtil { | |
private static final String DIRPATH_DEFAULT = "/mnt/sdcard/debug"; | |
private static final String FILENAME_DEFAULT = "tmp.txt"; | |
public static void flushText(String text) { | |
String path = String.format("%s/%s", DIRPATH_DEFAULT, FILENAME_DEFAULT); | |
flushText(text, path); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestAdapter extends ArrayAdapter<BindData> { | |
private LayoutInflater inflater; | |
private ColorStateList defaultColorStateList = null; | |
public TestAdapter(Context context, List<BindData> dataList) { | |
super(context, 0, dataList); | |
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void setGif(int resId) { | |
// Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resId); | |
BitmapFactory.Options opt = new Options(); | |
opt.inScaled = false; | |
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resId, opt); | |
setGif(resId, bitmap); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// permission は特に必要なし | |
// アプリ起動時に登録 | |
private void registerKeyguardReceiver() { | |
IntentFilter filter = new IntentFilter(); | |
filter.addAction(Intent.ACTION_USER_PRESENT); | |
filter.addAction(Intent.ACTION_SCREEN_OFF); | |
context.registerReceiver(mKeyguardReceiver, filter); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<application | |
android:icon="@drawable/ic_launcher" | |
android:label="@string/app_name" > | |
<activity | |
android:name="CustomActionBarActivity" | |
android:label="@string/title_activity_custom_actionbar" | |
android:theme="@style/Theme.Custom" /> | |
</application> |