View gist:233d6c88ed73a0ba3c3b
  1. General Background and Overview
View JSONSample.scala
import scala.util.parsing.json._
val result = JSON.parseFull("""
{"name": "Naoki", "lang": ["Java", "Scala"]}
""")
result match {
case Some(e) => println(e) // => Map(name -> Naoki, lang -> List(Java, Scala))
case None => println("Failed.")
}
View wm-cn-conversion.py
# encoding: utf-8
'''
Script to convert the weltmodell into the conceptnet.
@author: Michael A. Huelfenhaus
'''
import sys
import csv
import hashlib
View all_yzt.sql
select numerator.x, numerator.num/denominator.denom, numerator.y, numerator.z, numerator.t
(select sum(x) as num, x, y, z, t from table group by x, y, z, t) numerator
join
(select sum(x) as denom, y, z, t from table group by y,z,t) denominator
on (numerator.y=denominator.y and numerator.z=denominator.z and numerator.t=denominator.t)
View sbt-intellij-build.txt
sbt
gen-idea no-sbt-build-module
/*This will enable IntelliJ's default building mechanism for Scala, which won't cause these problems.*/
View intellij-scala-sbt.txt
how-to: Scala for INtellij installation:
http://stackoverflow.com/questions/9563342/how-to-run-scala-code-on-intellij-idea-11
--------------------------------------------------------------------------------
how-to: create IntelliJ Idea project from existing github project:
git clone <scala_project_from_git_built with_sbt>
cd <to project root>
View EsTest.java
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.node.Node;
import java.io.IOException;
import java.util.Date;
import static org.elasticsearch.node.NodeBuilder.*;
import static org.elasticsearch.common.xcontent.XContentFactory.*;
View install_scala_sbt.sh
#!/bin/sh
# one way (older scala version will be installed)
# sudo apt-get install scala
#2nd way
sudo apt-get remove scala-library scala
wget http://www.scala-lang.org/files/archive/scala-2.11.4.deb
sudo dpkg -i scala-2.11.4.deb
sudo apt-get update