Skip to content

Instantly share code, notes, and snippets.

View secondsun's full-sized avatar
🎩
Happy Saturday!

Hoyt Summers Pittman secondsun

🎩
Happy Saturday!
View GitHub Profile
#!/bin/bash
#
# Derived from -
# Joshua Davis
# http://shrubbery.mynetgear.net/c/display/W/Java+Daemon+Startup+Script
#
# This is a modification of the original script (which lets you run a java program as a deamon.
# look bellow for more information) that lets you run a groovy script as a deamon.
#
# ============== OLD SCRIPT TEXT ==============
FATAL EXCEPTION: main
Process: com.example.jetsnack, PID: 5430
java.lang.IllegalArgumentException: Inconsistency between the count of nodes tracked by the state (0) and the children count on the SubcomposeLayout (3). Are you trying to use the state of the disposed SubcomposeLayout?
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.makeSureStateIsConsistent(SubcomposeLayout.kt:514)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:391)
at androidx.compose.ui.layout
<!doctype html>
<html>
<head>
<title>Network</title>
<script type="text/javascript" src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>
<style type="text/css">
#mynetwork {
width: 1200px;
height: 800px;
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository />
<interactiveMode />
<offline />
<pluginGroups />
<servers />
<mirrors />
<proxies />
<profiles>
ObjectMapper om = new ObjectMapper();
//Basic construction and json serialization
var rec = new Record(42, "Hello, World!");
System.out.println(rec.toString());
System.out.println(om.writeValueAsString(rec));
//Show Constructor
var recClass = Record.class;
private Request<Void> registerDevice(JSONObject data) {
nonNull(data, "data");
return Requester.call(() -> {
data.put("deviceToken", FirebaseInstanceId.getInstance().getToken());
String authHash = getHashedAuth(unifiedPushCredentials.getVariant(),
unifiedPushCredentials.getSecret().toCharArray());
public class MyApplication extends Application {
public Registrar registrar;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Registrar r = new Registrar(PUSH_REGISTRATION_URL);
PushConfig config = new PushConfig(GCM_APP_ID);
config.setMobileVariantId(AG_PUSH_VARIANT_ID);
r.register(getApplicationContext(), config, new Callback<Void>() {

AbstractPageRequestHandler.java

abstact class AbstractPageRequestHandler() {
    public List<Pair<String, String>>  getPagingHeaders(ReadFilter filter){
       List<Pair<String, String>> toReturn = new ArrayList<>();
       return toReturn;
    }
    
    public byte[] appendToBody(ReadFilter filter, byte[] body){
 return body;

Below is a comparison of the method usage proposed by each lib for handling paged resources.

Read Next Page

Android

ReadFilter filter = new ReadFilter();
filter.setLimit(5);

Client Paging

This document describes the client side interfaces which a developer can use to Query and Page through data obtained from remote rest services. This document describes both how to interact with the Aerogear-Controller based paging as well how to extend the libraries and APIs to support most other restful services. It is currently Java centric, but this should be fixed up in the future.

At a high level, Paging and Querying is supported though the Pipe.readWithFilter(ReadFilter, Callback) method. A ReadFilter object will set the current page, number of results perPage, and a where property. The Pipe implementation will be responsible for processing a request along with any paging data and sending the appropriate headers, data, and query parameters to the server. Once the response has been received, the Pipe implementation will provide a List of objects to the supplied callback. If this call used paging, the List will be an instance of PagedList.

PagedList will be a List of results f