- The compressed version is only 345 caracters long.
- Faster than common libraries, even a large number of arrays, or on very big arrays. (See benchmarks)
Usage
import javax.script.ScriptEngine; | |
import javax.script.ScriptEngineManager; | |
public class E4X { | |
public static void main(String[] args) { | |
System.out.println("E4X: " + System.getProperty("nashorn.lexer.xmlliterals")); | |
ScriptEngineManager manager = new ScriptEngineManager(); | |
ScriptEngine engine = manager.getEngineByName("js"); | |
try { |
package com.awilmore.ioutils; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.nio.ByteBuffer; | |
import java.nio.channels.Channels; | |
import java.nio.channels.ReadableByteChannel; | |
import java.nio.channels.WritableByteChannel; |
This is a data structure for a Slowly-Changing Dimension Type 2 temporal database, implemented using only PostgreSQL >= 9.0 features.
Any application code is completely unaware of the temporal features: queries are done against a view that behaves exactly like a plain table (it can be SELECTed, UPDATEd, INSERTed INTO and DELETEd FROM), but behind the scenes the database redirects the queries to backend tables holding actual data, using the PostgreSQL rule system.
-- psql -U postgres -h localhost -f /path/to/tardis.sql | |
SET statement_timeout = 0; | |
SET lock_timeout = 0; | |
SET client_encoding = 'UTF8'; | |
SET standard_conforming_strings = on; | |
SET check_function_bodies = false; | |
SET client_min_messages = warning; | |
SET row_security = off; |
/* | |
Problem Description: | |
Time series forecast for a single securities minor reversal points. | |
A "minor reversal point" is defined as either a period (day) with a high price greater than both the previous and next high prices, or a period with a low value lower than both the previous and next low prices. | |
This is a time series regression problem with 8 input features and 2 regression output dimensions | |
Input Features: | |
- period return r = (p2 - p1) / p1, descr: a linear return value, typically [-0.05,0.05] | |
- period volume, descr: standardized, z = (x - Mean) / SD | |
- High-Low spread, descr: standardized, z = (x - Mean) / SD |
/* | |
Assuming you have an enum type like this. | |
You want to rename 'pending' to 'lodged' | |
*/ | |
CREATE TYPE dispute_status AS ENUM('pending', 'resolved', 'open', 'cancelled'); | |
BEGIN; | |
ALTER TYPE dispute_status ADD VALUE 'lodged'; | |
UPDATE dispute SET status = 'lodged' WHERE status = 'pending'; |
# List unique values in a DataFrame column | |
# h/t @makmanalp for the updated syntax! | |
df['Column Name'].unique() | |
# Convert Series datatype to numeric (will error if column has non-numeric values) | |
# h/t @makmanalp | |
pd.to_numeric(df['Column Name']) | |
# Convert Series datatype to numeric, changing non-numeric values to NaN | |
# h/t @makmanalp for the updated syntax! |
package nl.avwie | |
interface Tag<T> | |
interface Tagged<T> { | |
val tag: Tag<T> | |
} | |
class ComponentBag { | |
private val components = mutableMapOf<Tag<*>, Any>() |
package com.lapanthere.bohemia | |
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.flow | |
import org.apache.kafka.clients.consumer.ConsumerRecord | |
import org.apache.kafka.clients.consumer.KafkaConsumer | |
import java.time.Duration | |
fun <K, V> KafkaConsumer<K, V>.asFlow(timeout: Duration = Duration.ofMillis(500)): Flow<ConsumerRecord<K, V>> = |