implicit.ly

Scala software, hot off the presses

snakked 0.3

Limitation: cannot see through collections or arrays so far.

Extended bean parsing by type. I.e. a tag name can be the type name expected. This only works for simple types and not for collections or arrays of type. It uses Class.getSimpleName()

case class C1 { val c=C2 }
case class C2 { val c=C3 }
case class C3 { val c="wow" }

@Test def test21  = expect("wow" :: Nil) { Snakk.bean(C1) \\ "C3" \@ "c" }

updated to sbt 0.11

Razie's Snakked is a scala naked objects framework with a twist.

Why? So you can easily source and manipulate any data in the major formats, via the major protocols, among others.

Snakking

razie.Snakk gives simple methods to suck content from URLs, including files etc in a few formats.

List of blog titles from an XML and JSON feed:

val xmlFeed = url("http://feeds.razie.com/Razblog?format=xml")
val jsonFeed = url("http://blog.razie.com/feeds/posts/default?alt=json")

for (n <- xml(xmlFeed) \ "channel" \ "item" \ "title") println (n.text)

for (n <- json(jsonFeed) \ "feed" \ "entry" \ "title" \@ "$t") println (n)

Filed under  //   Scala 2.9.1   com.razie   snakked  
Posted November 30, 2011 by Razie 

scripster 0.7.1

Biggest change: upgraded from CodeMirror to ACE (former Bespin) as editor... on browsers other than MSIE... need to work on that

fixed options issue where interpreter screws up for strings indented with spaces

fixed options not showing up due to un-escaped \

still use CodeMirror on IE and embedded

added titles for the main pages and cleaned up some code

fixed code assisst in the middle of a string

started to revive the embedding option - needs a bit of work

Razie's Scripster is an interactive scripting pad for scala. It is available over telnet, http and swing. Read the guide at http://wiki.homecloud.ca/scripster. Try it at http://www.tryscala.com.

Why? So anyone can interact with a running application, having access to all or some of the application's objects.

What is so special about the scrispter? It has full syntax coloring and content assist, for starters! It can be embedded into any application and shares the same port for telnet as well as web access...

Examples: ---------

Put some objects in a context and run a simple scala script:

val context = ScalaScriptContext("a" -> "1", "b" -> "2")
ScalaScript ("a+b").eval (context) getOrElse "?"

Create and add variables to the context, to pass to the next script:

val ctx = ScalaScriptContext("a" -> 1, "b" -> 2)
 ScalaScript ("val c = a+b").interactive (ctx) 
 ctx getOrElse ("c", "?") // "c" is exported back into the context and available below
 ScalaScript ("c").interactive (ctx) getOrElse "?"

Filed under  //   Scala 2.9.1   com.razie   scripster  
Posted October 20, 2011 by Razie 

gremlins 0.4

updated for scala 2.9.1

Razie's Gremlins is a scala DSL and Workflow engine for asynchronous and parallel programming.

Why? Threads, shared state, actors, processes...they're all stepping stones. A framework that allows full expressivity for creating asynchronous/parallel and distributed work units are what we need.

Examples: ---------

Here's a sample CSP-style parallel process

v(c) (c ? P | c ! Q)

Sample parallel/sequence

import razie.wfs._
val workflow = wfs strict seq {    
  par {      
    seq {      
      println ("he he - definition time")
      later { _ + "runtime-a" }
      }
    later { _ + "runtime-b" }
    }
    sort[String] (_ < _)
    matchLater { case x : List[String] => x mkString "," }  
  }

Filed under  //   Scala 2.9.1   com.razie   gremlins  

scripster 0.7

Updated to scala 2.9.1 and scalaz 6.0

Razie's Scripster is an interactive scripting pad for scala. It is available over telnet, http and swing. Read the guide at http://wiki.homecloud.ca/scripster. Try it at http://tryscala.org

Why? So anyone can interact with a running application, having access to all or some of the application's objects.

What is so special about the scrispter? It has full syntax coloring and content assist, for starters! It can be embedded into any application and shares the same port for telnet as well as web access...

Examples: ---------

Put some objects in a context and run a simple scala script:

val context = ScalaScriptContext("a" -> "1", "b" -> "2")
ScalaScript ("a+b").eval (context) getOrElse "?"

Create and add variables to the context, to pass to the next script:

val ctx = ScalaScriptContext("a" -> 1, "b" -> 2)
 ScalaScript ("val c = a+b").interactive (ctx) 
 ctx getOrElse ("c", "?") // "c" is exported back into the context and available below
 ScalaScript ("c").interactive (ctx) getOrElse "?"

Filed under  //   Scala 2.9.1   com.razie   scripster  

snakked 0.2

You can Snakk beans now

case class Student(name: String, age: Int)
case class Class(name: String, students: Student*)
case class School(name: String, classes: Class*)

val school = Snakk bean School("my school",
  Class("1st grade",
    Student("Joe", 6),
    Student("Ann", 7)),
  Class("2nd grade",
    Student("Mary", 8),
    Student("George", 7)))

@Test def test11 = expect("Ann" :: "George" :: Nil) { school \ "classes" \ "students[age==7]" \@ "name" }

Snakking beans is scala-friendly (JXpath won't work on scala classes)

You can use recursive matching \ or "**/"

You can use OR to default attributes:

val someone:String = (school \ "classes" \ "students[age==7]" \@@ "name") OR ("nobody")

Snakking XMLs will default an attribute not found to the contents of a node with the same name, if found

Razie's Snakked is a scala naked objects framework with a twist.

Why? So you can easily source and manipulate any data in the major formats, via the major protocols, among others.

Snakking

razie.Snakk gives simple methods to suck content from URLs, including files etc in a few formats.

List of blog titles from an XML and JSON feed:

val xmlFeed = url("http://feeds.razie.com/Razblog?format=xml")
val jsonFeed = url("http://blog.razie.com/feeds/posts/default?alt=json")

for (n <- xml(xmlFeed) \ "channel" \ "item" \ "title") println (n.text)

for (n <- json(jsonFeed) \ "feed" \ "entry" \ "title" \@ "$t") println (n)

Filed under  //   Scala 2.9.1   com.razie   snakked  

snakked 0.1

Created project structure; for now it depends on razbase, where most of the actual code is...

Introduced Snakking with razie.Snakk: you can snakk xml, json and java beans, via razie.XP

Razie's Snakked is a scala naked objects framework with a twist.

Why? So you can easily source and manipulate any data in the major formats, via the major protocols, among others.

Snakking

razie.Snakk gives simple methods to suck content from URLs, including files etc in a few formats.

List of blog titles from an XML and JSON feed:

val xmlFeed = url("http://feeds.razie.com/Razblog?format=xml")
val jsonFeed = url("http://blog.razie.com/feeds/posts/default?alt=json")

for (n <- xml(xmlFeed)) \ "channel" \ "item" \ "title") println (n.text)

for (n <- json(jsonFeed)) \ "feed" \ "entry" \ "title" \@ "$t") println (n)

Filed under  //   Scala 2.9.0-1   com.razie   snakked  
Posted September 6, 2011 by Razie 

gremlins 0.3

Updated to scala 2.9.0-1

Razie's Gremlins is a scala DSL and Workflow engine for asynchronous and parallel programming.

Why? Threads, shared state, actors, processes...they're all stepping stones. A framework that allows full expressivity for creating asynchronous/parallel and distributed work units are what we need.

Examples: ---------

Here's a sample CSP-style parallel process

v(c) (c ? P | c ! Q)

Sample parallel/sequence

import razie.wfs._
val workflow = wfs strict seq {    
  par {      
    seq {      
      println ("he he - definition time")
      later { _ + "runtime-a" }
      }
    later { _ + "runtime-b" }
    }
    sort[String] (_ < _)
    matchLater { case x : List[String] => x mkString "," }  
  }

Filed under  //   Scala 2.9.0-1   com.razie   gremlins  
Posted July 28, 2011 by Razie 

scripster 0.6

Updated to scala 2.9.0-1 and scalaz 6.0

Also simplified the code quite a bit. The 2.9.0 parser is much better to use than before.

Scripster is an interactive scripting pad for scala. It is available over telnet, http and swing. Read the guide at http://wiki.homecloud.ca/scripster.

Why? ----

So anyone can interact with a running application, having access to all or some of the application's objects.

What is so special about the scrispter? It has full syntax coloring and content assist, for starters! It can be embedded into any application and shares the same port for telnet as well as web access...

Examples: ---------

Put some objects in a context and run a simple scala script:

val context = ScalaScriptContext("a" -> "1", "b" -> "2")
ScalaScript ("a+b").eval (context) getOrElse "?"

Create and add variables to the context, to pass to the next script:

val ctx = ScalaScriptContext("a" -> 1, "b" -> 2)
 ScalaScript ("val c = a+b").interactive (ctx) 
 ctx getOrElse ("c", "?") // "c" is exported back into the context and available below
 ScalaScript ("c").interactive (ctx) getOrElse "?"

Filed under  //   Scala 2.9.0-1   com.razie   scripster  
Posted July 28, 2011 by Razie