This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use DBI; | |
use Data::Dumper; | |
my $rdbms = 'mysql'; | |
my $db = 'database_name'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# JAVA_HOME=/your/java/home | |
# R CMD javareconf -e | |
# R | |
# install.packages("rJava") | |
# install.packages("RUnit") | |
wget https://github.com/downloads/tc/RMongo/RMongo_0.0.20.tar.gz --no-check-certificate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala -cp casbah-commons*.jar:casbah-core*.jar:casbah-query*.jar:mongo-java-driver*.jar:slf4j-api-*.jar:scalaj-collection*.jar | |
scala> val conn = com.mongodb.casbah.MongoConnection("hostname") | |
conn: com.mongodb.casbah.MongoConnection = com.mongodb.casbah.MongoConnection@ada6d09 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see also https://github.com/seratch/yahoo-setsuden-api-client | |
// invoke Scala REPL | |
// scala -cp yahoo-setsuden-api-client*:joda-time* | |
import com.github.seratch.yahooapis.setsuden.scala._ | |
import request._ | |
import response._ | |
import org.joda.time.LocalDate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rhino (Java required) | |
curl ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R3.zip > ./rhino.zip | |
unzip rhino.zip | |
mkdir -p ~/Library/Java/Extensions | |
cp -p rhino1_7R3/js.jar ~/Library/Java/Extensions/ | |
rm -rf rhino.zip ./rhino1_7R3 | |
# -- chekcing installed | |
# java org.mozilla.javascript.tools.shell.Main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---------------------------------------- | |
// * Scala LINQ-like impl memo | |
// http://scala-programming-language.1934581.n4.nabble.com/scala-LINQ-for-scala-td2003452.html | |
// https://github.com/vladimirk/scalalinq/blob/master/src/scalalinq/linq.scala | |
// ---------------------------------------- | |
class linq[A](seq: Seq[A]) { | |
def where(p: A => Boolean) = seq filter p | |
def select[B](p: A => B) = seq map p | |
def orderby[B <% Ordered[B]](f: A => B) = seq.toList sort ((a, b) => f(a) < f(b)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---------------------- | |
// Scala 2.9.0.final | |
// http://www.scala-lang.org/node/43 | |
// ---------------------- | |
// REPLのexitはdeprecated | |
scala> exit | |
<console>:8: warning: method exit in object Predef is deprecated: Use sys.exit() instead | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> val json = """{ "person" : { "name": "A" }, "person": { "name" : "B" } }""" | |
json: java.lang.String = { "person" : { "name": "A" }, "person": { "name" : "B" } } | |
scala> util.parsing.json.JSON.parseFull(json) | |
res4: Option[Any] = Some(Map(person -> Map(name -> B))) | |
scala> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src/scala-compiler-src.jar | |
src/scala-library-src.jar | |
diff -r scala-2.9.0.final/src/scala/tools/nsc/ast/TreeGen.scala scala-2.9.0.1/src/scala/tools/nsc/ast/TreeGen.scala | |
233,240c233,246 | |
< val sym = tp.typeSymbol | |
< val tree = | |
< if (sym == UnitClass) Literal(()) | |
< else if (sym == BooleanClass) Literal(false) | |
< else if (isValueClass(sym)) Literal(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> for { (k,v) <- List((1,2),(3,4)) } yield (k,v) | |
res0: List[(Int, Int)] = List((1,2), (3,4)) | |
scala> for { (k,v) <- List((1,2),(3,4)).toMap } yield (k,v) | |
res1: scala.collection.immutable.Map[Int,Int] = Map(1 -> 2, 3 -> 4) |
OlderNewer