Skip to content

Instantly share code, notes, and snippets.

def javaDirectoryPath = "src_managed" / "main" / "java"
def rubyDirectoryPath = "src_managed" / "main" / "ruby"
def thriftDirectoryPath = "src_managed" / "main" / "thrift"
def thriftFile = thriftDirectoryPath / "YourThriftDealie.thrift"
def thriftTask(tpe: String, directory: Path, thriftFile: Path) = {
val cleanIt = cleanTask(directory) named("clean-thrift-" + tpe)
execTask {
// you can do "thrift ...".format and pass a String here instead of inline xml
<x>thrift --gen {tpe} {directory.absolutePath} {thriftFile.absolutePath}</x>
val scanner = new ThriftFileScanner[YourThriftClassName]
scanner.allRecordsFromFile("/tmp/dump.thrift.gz") { println(_) }
import com.facebook.thrift.{TBase, TDeserializer}
import java.io.{BufferedInputStream, DataInputStream, File, FileInputStream, InputStream}
import java.util.zip.GZIPInputStream
import net.lag.logging.Logger
import scala.reflect.Manifest
// you'll want to import your generated Thrift package too!
class ThriftFileScanner[T <: TBase](implicit man: Manifest[T]) {
val log = Logger.get
var bufferedIn: BufferedInputStream = null
override def mainClass = Some("com.yourcompany.yourproject.Main")
/**
* In the classpath:
* - all dependencies (via Ivy/Maven and in lib)
* - package classes
* On the filesystem:
* - scripts
* - config
*/
lazy val thrift = task {
val javaDirectoryPath = "src/main/java"
val rubyDirectoryPath = "src/main/ruby"
val thriftFile = "src/main/thrift/YourThriftDealie.thrift"
"thrift --gen java -o %s %s".format(javaDirectoryPath, thriftFile) ! log
"thrift --gen rb -o %s %s".format(rubyDirectoryPath, thriftFile) ! log
None
} describedAs("Build Thrift stuff.")
import java.io.{BufferedReader, File, InputStream, InputStreamReader, IOException, PrintWriter, Writer}
import java.net.{InetAddress, ServerSocket, Socket, SocketException}
import java.util.concurrent.Executors
import net.lag.logging.Logger
import scala.actors.Actor
import scala.actors.Actor._
import scala.tools.nsc._
class RemoteDebugServer(port: Int) {
$ irb
>> 1.class
=> Fixnum
>> 1.respond_to?(:dup)
=> true
>> 1.dup
TypeError: can't dup Fixnum
from (irb):3:in `dup'
from (irb):3
10/6/09 2:09:00 PM [0x0-0xc5bc5b].org.gnu.Emacs[27169] dyld: Library not loaded: /opt/local/lib/libdbus-1.3.dylib
10/6/09 2:09:00 PM [0x0-0xc5bc5b].org.gnu.Emacs[27169] Referenced from: /Applications/Emacs.app/Contents/MacOS/Emacs
10/6/09 2:09:00 PM [0x0-0xc5bc5b].org.gnu.Emacs[27169] Reason: no suitable image found. Did find:
10/6/09 2:09:00 PM [0x0-0xc5bc5b].org.gnu.Emacs[27169] /opt/local/lib/libdbus-1.3.dylib: mach-o, but wrong architecture
10/6/09 2:09:00 PM com.apple.launchd.peruser.502[201] ([0x0-0xc5bc5b].org.gnu.Emacs[27169]) Job appears to have crashed: Trace/BPT trap
10/6/09 2:09:00 PM ReportCrash[27171] Saved crash report for Emacs[27169] version ??? (???) to /Users/al3x/Library/Logs/DiagnosticReports/Emacs_2009-10-06-140900_jaya.crash
Warning: arch-dependent data dir (/Users/ieure/Projects/emacs/nextstep/Emacs.app/Contents/MacOS/libexec/emacs/23.1.50/i386-apple-darwin9.8.0/) does not exist.
Warning: arch-independent data dir (/Users/ieure/Projects/emacs/nextstep/Emacs.app/Contents/Resources/share/emacs/23.1.50/etc/) does not exist.
Error: charsets directory (/Users/ieure/Projects/emacs/nextstep/Emacs.app/Contents/Resources/share/emacs/23.1.50/etc/charsets) does not exist.
Emacs will not function correctly without the character map files.
Please check your installation!
byte-code: Cannot open load file: warnings
<!DOCTYPE html>
<html>
<head>
<title>Really?</title>
<style>
body {
font-family: 'Helvetica Neue';
font-size: 42pt;
font-weight: bold;
margin-top: 15%;