JSONObject jObject = new JSONObject(string);
String aJsonString = jObject.getString("STRINGNAME");
package io.github.budincsevity | |
import com.sun.net.httpserver.HttpServer | |
import java.io.PrintWriter | |
import java.net.InetSocketAddress | |
fun main(args: Array<String>) { | |
val server = HttpServer.create(InetSocketAddress(8080), 0) | |
server.createContext("/hello") { http -> |
import itertools | |
stuff = ['a', 'b', 'c'] | |
for L in range(0, len(stuff)+1): | |
for subset in itertools.combinations(stuff, L): | |
print(subset) |
public class BooleanUtils { | |
private static final Random RANDOM = new Random(); | |
public boolean maybe() { | |
return RANDOM.nextBoolean(); | |
} | |
} |
1.) Download and install Docker Toolbox for Windows | |
2.) Run the folowing commands to create a Docker virtual machine in cmd: | |
docker-machine create vdocker -d virtualbox | |
FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd vdocker') DO %i | |
docker run -it b.gcr.io/tensorflow/tensorflow | |
3.) Run python |
<?xml version="1.0" encoding="utf-8"?> | |
<!-- Add this as a debug manifest so the permissions won't be required by your production app --> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | |
<uses-permission android:name="android.permission.WAKE_LOCK" /> | |
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> | |
</manifest> |
/** | |
* Show the activity over the lockscreen and wake up the device. If you launched the app manually | |
* both of these conditions are already true. If you deployed from the IDE, however, this will | |
* save you from hundreds of power button presses and pattern swiping per day! | |
*/ | |
public static void riseAndShine(Activity activity) { | |
activity.getWindow().addFlags(FLAG_SHOW_WHEN_LOCKED); | |
PowerManager power = (PowerManager) activity.getSystemService(POWER_SERVICE); | |
PowerManager.WakeLock lock = |
Date input = new Date(); | |
LocalDate date = input.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
//JodaTime | |
Interval interval = new Interval(time, new Date().getTime()); | |
Period period = interval.toPeriod(); | |
int minutes = period.getMinutes(); | |
int hours = period.getHours(); | |
//ThreeTen | |
Instant firstInstant= Instant.ofEpochMilli(time); | |
Instant secondInstant = Instant.ofEpochMilli(new Date().getTime()); |
final String id = "android.test.purchased"; | |
mConnection = new ServiceConnection() { | |
@Override | |
public void onServiceConnected(ComponentName name, IBinder binder) { | |
service = IInAppBillingService.Stub.asInterface(binder); | |
String purchaseToken = "inapp:" + getPackageName() + ":android.test.purchased"; | |
try { | |
int response = service.consumePurchase(3, getPackageName(), purchaseToken); | |
} catch (RemoteException e) { |