18 5 / 2013

scallop 0.9.2

New changes since version 0.7.0:

  • Default values of simple options and trailing args are now lazily evaluated (#38)
  • Now ScallopConf.props and ScallopConf.propsLong return a Map instead of (String => Option[A]) (#39)
  • Improvements in help output: --help and --version are now always included in output, and developer can specify what options should go to the top of the list (via mainOptions on ScallopConf) (#46)
  • Also, help output is now clear of trailing whitespace
  • Improved option name guessing - now works with properties and trailing arguments (#47, thanks to Christopher Hodapp)
  • New option type: “tally”. Counts the amount of time the option was invoked, useful for setting verbosity level (like -vvv) (#50)
  • Added flatMap on ValueConverter (#53)
  • Added validateOpt on ScallopConf to enable more flexible validation of arguments (#55)
  • Bugfixes (#40, #51, #57, #59, #60)

Scallop is a simple (yet powerful) command-line arguments parsing library for Scala.

17 5 / 2013

repatch-twitter 0.1.0

This is the initial release of repatch-twitter, a plugin for Dispatch 0.10.0 to use Twitter REST API v1.1 .

Request builder for basic API end points

It ships with 20+ API end points, including Search, Status.home_timeline, PublicStream.track, etc with parameters provided as fluent API. For example, here’s how to search two tweets about “#scala” in the 10 mile radius from New York City:

scala> val x = http(client(Search("#scala").geocode_mi(40.7142, -74.0064, 10).count(2)) OK as.json4s.Json)
x: dispatch.Future[org.json4s.JValue] = scala.concurrent.impl.Promise$DefaultPromise@3252d2de

Field parser

For common objects like Tweet, repatch-twitter ships with field parser to help parsing json:

scala> {
         import repatch.twitter.response.Search._
         import repatch.twitter.response.Tweet._
         for {
           t <- statuses(json)
         } yield(id_str(t), text(t))
       }
res0: List[(String, String)] = List((330931826879234049,Rocking the contravariance. Hard. #nerd #scala)

Case class converter

It also comes with case class converters for Tweet and User. The case classes may not cover all the fields, but it’s convenient:

scala> val timeline = http(client(Status.user_timeline("twitterapi")) OK as.repatch.twitter.response.Tweets)
timeline: dispatch.Future[List[repatch.twitter.response.Tweet]] = scala.concurrent.impl.Promise$DefaultPromise@40878d74

scala> timeline()
res0: List[repatch.twitter.response.Tweet] = 
List(Tweet(330369772619452416,We're extending API v1 Retirement...

repatch-twitter is a plugin for Dispatch to use Twitter API.

Tags:

Permalink 2 notes

16 5 / 2013

sbt-unidoc 0.1.0

This is the initial release of sbt-unidoc.

The original implementation of unidoc command was written by @pvlugter for Akka’s build definition. @eed3si9n turned it into a plugin, and refactored it some more.

The basic use case of sbt-unidoc is to unify Scaladoc generation across all projects in a build. This is useful for builds that modularizes its parts into subprojects like Akka. After setting it up, you just run unidoc task from the root project.

Another interesting use case is to unify Javadoc generation, except plain Javadoc won’t know your Scala code. So they wrote a compiler plugin that generates Scala-equivalent Java code, so you can generate Javadoc. See sbt-unidoc for the details.

sbt-unidoc is a plug-in for sbt that unifies scaladoc/javadoc across multiple projects.

15 5 / 2013

scalikejdbc 1.6.0

ScalikeJDBC 1.6.0 has been released. New query DSL for SQLSyntaxSupport users is added!

ScalikeJDBC Logo

http://git.io/scalikejdbc

library

  • Wrapped exception explicitly for extraction failures

interpolation

  • #122 Query Interface DSL support
  • #121 useSnakeCaseColumnName option in SQLSyntaxSupport

Quite readable and typesafe DSL for SyntaxSupport users.

val (u, g, gm, c) = (User.syntax("u"), Group.syntax("g"), GroupMember.syntax("gm"), Company.syntax("c"))

val groups: List[Group] = withSQL {

  select
    .from(GroupMember as gm)
    .innerJoin(User as u).on(u.id, gm.userId)
    .innerJoin(Group as g).on(g.id, gm.groupId)
    .leftJoin(Company as c).on(u.companyId, c.id)
    .where.eq(g.id, 1)
    .orderBy(u.id)
    .limit(5)
    .offset(0)

}.one(Group(g))
 .toMany(User.opt(u, c))
 .map { (group, members) => group.copy(members = members) }
 .list
 .apply()

Also check more examples!

https://github.com/seratch/scalikejdbc/blob/master/scalikejdbc-interpolation/src/test/scala/scalikejdbc/QueryInterfaceSpec.scala

Enjoy writing typesafe SQL and get things done!

ScalikeJDBC is a tidy SQL-based DB access library for Scala.

Tags:

Permalink 1 note

13 5 / 2013

kiama 1.5.0

The Kiama team are pleased to bring you the next release of the library.

New features

  • General

    • The API methods that create rewriting strategies and attributes are now defined by macros. We use our dsinfo library to provide easy access to the names of these domain objects. Strategies and attributes now have a name member that can be used for debugging messages and profiling (see below).
    • This new dependence on macros means that we do not support Kiama on Scala 2.9 any more.
    • Kiama now uses our dsprofile library to provide domain-specific profiling reports about strategy and attribute evaluation. See the Profiling wiki page for more information on Kiama’s profiling support.
  • Attribution

    • Circular attributes now support the same reset and hasBeenComputedAt interface as other cached attributes.
    • Dynamic attributes can now be properly reset.
  • Rewriting

    • The apply method of strategies is now common, so it is possible to easily customise the behaviour of all strategies.
    • MemoRewriter is a new version of the Rewriter where every strategy memoises its results.
    • The Strategy type is now defined externally to the Rewriter so it must be imported separately if you use it.
  • Output

    • There is now a PrettyPrinter module that can be used if you just want the default pretty-printer behaviour (e.g., just to print trees with no customisation).
    • Issue 57: Output filters have been added so that pretty-printed output can be filtered for display (e.g., to only show up to a maximum number of lines or up to particular indentation) (inspired by Lucas Sabatin).
    • Issue 58: line (repl) is exported from the pretty-printing library so that the replacement for an omitted line break can be customised (inspired by Lucas Sabatin).
  • Utilities

    • A ProfilingCompiler variant of Compiler trait has been added to make it easier to define main programs that provide options for running profiles.
    • Bug fixed in Compiler trait where only the first filename argument was passed on to the driver.
    • The Compiler.process method is now also given the filename.
  • Examples

    • Added a pretty-printer and obfuscation rewriting to the PicoJava example.
    • The Lambda2 example now always allows type annotations to be omitted instead of using an interactive REPL command to switch type checking on and off.
    • New MiniJava example that compiles a cut-down but non-trivial version of Java to JVM byte code.

Fixes

  • Attribution

    • Issue 59: fix bug where hasBeenComputedAt on attributes didn’t take account of memoisation table resets.

Other

  • The project uses a new structure with core and kiama sub-projects to support separate compilation needed for macros.
  • Some other minor fixes and code style improvements.

Kiama is a Scala library for language processing including attribute grammars, term rewriting, abstract state machines and pretty printing.

09 5 / 2013

scala-chart 0.2.2

  • fixes #2: tiny chart.show window by using default width and height of org.jfree.chart.ChartPanel
  • fixes #3: adds autoSort and allowDuplicateXValues to toXYSeries* conversions
  • documentation improvements

For more information about scala-chart usage have a look at the README and at the API.

`scala-chart` is a Scala library for creating and working with charts. It wraps JFreeChart, much like scala-swing does with the original javax.swing package.

06 5 / 2013

bytecask 0.9.1

There is finally a new milestone coming out!

Changes since 0.1.1:

  • blob store/retrieve (i.e.for files)
  • support for keys with common prefixes (i.e. urls, files etc)
  • support for entries expiration and eviction
  • passivation/activation
  • lots of major refactorings and bugfixes
  • built with Scala 2.10.1 and SBT 0.12.3

Examples

val db = new Bytecask("/home/foo")
db.put("foo", "some value...")
println(db.get("foo"))
db.delete("foo")
db.destroy()

//other methods of initialization:

val db = new Bytecask("/home/foo") with Compression
val db = new Bytecask("/home/foo", prefixedKeys=true) with Compression
val db = new Bytecask("/home/foo") with Eviction { val maxCount = 3 }
val db = new Bytecask("/home/foo") with Expiration { val ttl = 180 }
val db = new Bytecask("/home/foo") with BlobStore { val blockSize = 1024 * 1024 }
val db = new Bytecask("/home/foo") with Compression with Expiration with BlobStore {
    val ttl = 180
    val blockSize = 1024 * 1024
}
val db = new Bytecask("/home/foo") with JmxSupport

...

//blob store example

val db = new Bytecask(mkTempDir) with BlobStore {
      val blockSize = 1024 * 1024
}

// store a blob (i.e. file) passing an input stream to read data from

db.storeBlob(name, new FileInputStream(...))

// retrieve the blob passing an output stream to write the blob to

withResource(new FileOutputStream(...)) {
      os => db.retrieveBlob(name, os)
}

...

// passivation/activation example

if (db.idleTime > 15*60*1000)
    db.passivate()

// passivation releases memory occupied by the index (data is not gone though)
// now all access methods throw exception as the db is inactive (no references are kept)

if (!db.isActive)
    db.activate()

// activation restores index from files and sets 'active' state
Bytecask is a low latency key/value storage component inspired by Bitcask

06 5 / 2013

scalikejdbc 1.5.4

ScalikeJDBC 1.5.4 has been released. In this release, core-library, interpolation and play-plugin are changed.

ScalikeJDBC Logo

http://git.io/scalikejdbc

library

  • #118 LoggingSQLAndTimeSettings.singleLineMode support

Newly singleLineMode option is added to LoggingSQLAndTimeSettings. If the option is set as true, ScalikeJDBC uses simplified and single line logging.

interpolation

  • #119 SQLSyntaxSupport doesn’t suppose the column such as x1 and x2

play-plugin

  • #118 LoggingSQLAndTimeSettings.singleLineMode support

Enabled specifying “scalikejdbc.global.loggingSQLAndTime.singleLineMode”.

Enjoy writing (mostly) typesafe SQL and get things done!

ScalikeJDBC is a tidy SQL-based DB access library for Scala.

Tags:

Permalink 1 note

05 5 / 2013

jackson-module-scala 2.2.1

This release fixes a number of bugs in the 2.2.0 release. Many thanks to David Pratt for significant contributions to this release.

Fixes

The Jackson Scala Module is an extension for the Jackson JSON Processor that adds databinding support for Scala native types and collections.

30 4 / 2013

scalaxb 1.1.0

breaking changes

  • scalaxb now generates sys.error, so the generated code will no longer be compilable under Scala 2.8. #115 reported by @idot and others.

dispatchVersion

A new key dispatchVersion was added to generate Dispatch 0.10.x compatible code #210:

dispatchVersion in scalaxb in Compile := "0.10.0"

libraryDependencies <+=(dispatchVersion in scalaxb in Compile) { dv =>
  "net.databinder.dispatch" %% "dispatch-core" % dv
}

bug fixes and minor enhancements

  • Includes offending data in ParserFailure message. #206 requested by @caoilte
  • Fixes handling of QName enums. #208
  • sbt-scalaxb sorts *.xsd to avoid platform variance. #207 reported by @caoilte
  • sbt-scalaxb generates code only when the xsd files are modified. #199 requested by @fommil

scalaxb is an XML data-binding tool for Scala that supports W3C XML Schema (xsd) as the input file.