Skip to content

Instantly share code, notes, and snippets.

View akbertram's full-sized avatar

Alex Bertram akbertram

View GitHub Profile
@akbertram
akbertram / 0.connections.R
Last active July 13, 2019 16:38
Compiling readBin
readBin <- function(con, what, n = 1L, size = NA_integer_, signed = TRUE,
endian = .Platform$endian)
{
if(is.character(con)) {
con <- file(con, "rb")
on.exit(close(con))
}
swap <- endian != .Platform$endian
if(!is.character(what) || is.na(what) ||
length(what) != 1L || ## hence length(what) == 1:
```
Apr 09, 2019 11:07:35 AM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: /resources/query/columns
java.lang.RuntimeException: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.NumberFormatException: For input string: "ju9exeyy1"
at org.activityinfo.server.database.hibernate.HibernateDatabaseTreeLoader.loadAll(HibernateDatabaseTreeLoader.java:99)
at org.activityinfo.server.database.hibernate.HibernateDatabaseTreeProvider.getDatabaseTrees(HibernateDatabaseTreeProvider.java:51)
at org.activityinfo.server.endpoint.rest.DesignedDatabaseTreeProvider.queryDatabaseTree(DesignedDatabaseTreeProvider.java:91)
at org.activityinfo.server.endpoint.rest.VisibleDatabaseTreeProviderImpl.fetchUserDbs(VisibleDatabaseTreeProviderImpl.java:83)
at org.activityinfo.server.endpoint.rest.VisibleDatabaseTreeProviderImpl.getDatabaseMetadata(VisibleDatabaseTreeProviderImpl.java:71)
at org.activityinfo.store.query.server.FormSupervisorAdapter.getFormPe
@akbertram
akbertram / Context.java
Created December 21, 2018 10:09
grDevices Context Decompiled
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package org.renjin.grDevices;
import java.lang.invoke.MethodHandle;
import org.renjin.gcc.runtime.BytePtr;
import org.renjin.gcc.runtime.FunctionPtr1;
@akbertram
akbertram / query.R
Created September 27, 2018 11:36
query.R
# Needs to be done once
install.packages("devtools")
library(devtools)
install_github( "bedatadriven/activityinfo-R", ref = "release")
library(activityinfo)
activityInfoLogin(userEmail = "api+training@bedatadriven.com",
password = "testing123")
@akbertram
akbertram / hand-fixed.svg
Created June 27, 2018 07:10
Exporting icons from Avocode
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@akbertram
akbertram / Search2.java
Created June 26, 2018 19:55
Fledgling vdom-based replacement for search box
package org.activityinfo.ui.client.search;
import com.google.common.base.Strings;
import com.google.gwt.dom.client.InputElement;
import com.google.gwt.event.dom.client.KeyCodes;
import org.activityinfo.i18n.shared.I18N;
import org.activityinfo.model.database.Resource;
import org.activityinfo.model.database.UserDatabaseMeta;
import org.activityinfo.observable.Observable;
import org.activityinfo.observable.StatefulValue;
function(beta, X, y, offset, theta, lambda, S, fact = c(1,1)){
n <- dim(X)[1]
eta <- offset + X%*%beta
mu <- exp(eta)
aux1 <- theta + y
aux2 <- theta + mu
## pull the log inside to use gamma and factorial in log space due to
## possibly very high numbers
l <- sum(lgamma(aux1) - (lfactorial(y) + lgamma(theta))) + t(y) %*% eta + n*theta*log(theta) - t(aux1) %*% log(aux2)
pen <- t(beta) %*% S %*% beta
---
title: "Text Mining with R"
date: "13 February 2018"
output:
html_document:
theme: flatly
highlight: haddock
code_folding: show
toc: true
toc_float:
library(tm)
library(SnowballC)
library(stringr)
library(ggplot2)
## RQ: What are the most commonly used words & the term frequencies in the 'Protestants-Christelijk' schools and 'Openbaar' schools?
# Read in our school metadata
schools <- read.csv("schools.csv",
sep = ";",
Extends:
Class "vector", directly
Class "index", directly
Class "replValue", directly
Class "numLike", directly
Class "number", directly
Class "atomicVector", directly
Class "numericVector", directly
Class "replValueSp", by class "replValue", distance 2