Skip to content

Instantly share code, notes, and snippets.

import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class XOAuth {
public static void main(String[] args) throws Exception {
java.io.BufferedReader input = new java.io.BufferedReader(
new java.io.InputStreamReader(System.in));
System.out.println("Enter an email:");
String email = input.readLine();
System.out.println("Enter a consumer key:");
String consumerKey = input.readLine();
System.out.println("Enter a consumer secret:");
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Notification test</title>
<script type="text/javascript">//<![CDATA[
function notify(iconUrl, title, message) {
var api = window.webkitNotifications;
if (api) {
if (api.checkPermission() != 0) {
api.requestPermission();
public static List<Entity> asyncQuery(List<Query> queries, FetchOptions fetchOptions)
throws InterruptedException, ExecutionException {
@SuppressWarnings("unchecked")
Delegate<Environment> delegate = ApiProxy.getDelegate();
Environment env = ApiProxy.getCurrentEnvironment();
ApiConfig config = new ApiProxy.ApiConfig();
config.setDeadlineInSeconds(5.0);
List<Future<byte[]>> futures = new ArrayList<Future<byte[]>>(queries.size());
for (Query query : queries) {
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.URI;
static final String BASEURL = "https://www.instapaper.com/api/";
static int addToInstaPaper(String username, String password, String url) throws IOException {
StringBuilder b = new StringBuilder();
b.append("username=").append(URLEncoder.encode(username, "utf-8"));
b.append("&password=").append(URLEncoder.encode(password, "utf-8"));
b.append("&url=").append(URLEncoder.encode(url, "utf-8"));
b.append("&auto-title=1");
byte[] payload = b.toString().getBytes("utf-8");
static final String APIKEY = "APIキー";
static final String BASEURL = "https://readitlaterlist.com/v2/";
static int addToReadItLater(String username, String password, String url) throws IOException {
StringBuilder b = new StringBuilder();
b.append("username=").append(URLEncoder.encode(username, "utf-8"));
b.append("&password=").append(URLEncoder.encode(password, "utf-8"));
b.append("&url=").append(URLEncoder.encode(url, "utf-8"));
mvn install:install-file -DgroupId=com.google.appengine -DartifactId=appengine-api-1.0-runtime -Dversion=1.2.8 -Dpackaging=jar -Dfile=lib/impl/appengine-local-runtime.jar
mvn install:install-file -DgroupId=com.google.appengine -DartifactId=appengine-api-1.0-sdk -Dversion=1.2.8 -Dpackaging=jar -Dfile=lib/impl/appengine-api.jar
mvn install:install-file -DgroupId=com.google.appengine -DartifactId=appengine-api-1.0-stubs -Dversion=1.2.8 -Dpackaging=jar -Dfile=lib/impl/appengine-api-stubs.jar
mvn install:install-file -DgroupId=com.google.appengine -DartifactId=appengine-api-1.0-runtime-shared -Dversion=1.2.8 -Dpackaging=jar -Dfile=lib/shared/appengine-local-runtime-shared.jar
mvn install:install-file -DgroupId=com.google.appengine -DartifactId=appengine-tools-sdk -Dversion=1.2.8 -Dpackaging=jar -Dfile=lib/appengine-tools-api.jar
mvn install:install-file -DgroupId=com.google.appengine -DartifactId=appengine-api-labs -Dversion=1.2.8 -Dpackaging=jar -Dfile=lib/impl/appengine-api-labs.jar
mvn install:install-file -Dgr
/**
* 親エンティティを永続化しない状態で子エンティティを永続化できるか?
* <p>Transactionなし</p>
* @throws EntityNotFoundException
*/
@Test
public void ajn3_01() throws EntityNotFoundException {
DatastoreService service = DatastoreServiceFactory.getDatastoreService();
KeyRange parentKeyRange = service.allocateIds("parent", 1);
Key parentKey = parentKeyRange.getStart();
package com.shin1ogawa.util;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilder;