Skip to content

Instantly share code, notes, and snippets.

View visenger's full-sized avatar
❤️
Focusing

Dr. Larysa Visengeriyeva visenger

❤️
Focusing
View GitHub Profile
@visenger
visenger / install_scala_sbt.sh
Last active January 31, 2023 19:10
Scala and sbt installation on ubuntu 12.04
#!/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
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.*;
@visenger
visenger / intellij-scala-sbt.txt
Last active December 16, 2015 22:19
Scala - Sbt - IntelliJ saga ;)
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>
@visenger
visenger / sbt-intellij-build.txt
Last active December 19, 2015 04:58
Solving "shared output path" - problem
sbt
gen-idea no-sbt-build-module
/*This will enable IntelliJ's default building mechanism for Scala, which won't cause these problems.*/
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)
# encoding: utf-8
'''
Script to convert the weltmodell into the conceptnet.
@author: Michael A. Huelfenhaus
'''
import sys
import csv
import hashlib
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.")
}
  1. General Background and Overview
package de.bhtb.data.formats;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.net.URL;
import java.util.Scanner;