background preloader

Scala

Facebook Twitter

Scala会議に参加してきました「ScalaからGPUを使ってみる ScalaCL Compiler Plugin」 - chimerastのエレガント指向プログラミング日記. Scala会議に参加してきました「ScalaからGPUを使ってみる ScalaCL Compiler Plugin」 勉強会はBlogを書くところまでが勉強会です。

Scala会議に参加してきました「ScalaからGPUを使ってみる ScalaCL Compiler Plugin」 - chimerastのエレガント指向プログラミング日記

ということで久しぶりに書きます。 あいかわらずのLTの時間破り魔っぷりでした。 申し訳ありませんでした。 15分ぐらいのMiddle Talk的な枠が欲しいです。 LT内容は「ScalaからGPUを使ってみるScalaCL Plugin」、ScalaコードをOpenCL C言語に変換してくれるScalaCLというコンパイラプラグインの話をGPUってすごいんだよって話とともにお届けしました。 シェルのコマンドを実行する - 技術備忘録. シェルのコマンドを実行する Scalaではscala.sys.processパッケージを使うことでシェルのコマンドを実行できます。

シェルのコマンドを実行する - 技術備忘録

#! Scalaでプログラムを作りました. 非同期処理でWebコンテンツをダウンロードする方法 - Groovy, Scala, F# - なんとなくな Developer のメモ. 前回(id:fits:20110925)、並列コレクション等で Web コンテンツをダウンロードする処理を実装してみましたが、今回はその非同期処理版を Groovy, Scala, F# で実装してみました。

非同期処理でWebコンテンツをダウンロードする方法 - Groovy, Scala, F# - なんとなくな Developer のメモ

(主な仕様は前回と同じ) Groovy の場合: GPars 非同期処理でも GPars が使えます。 GParsPool.withPool や GParsExecutorsPool.withPool 内*1で、クロージャに対して async() を実行すると非同期化されたクロージャを取得できます。 非同期化されたクロージャを実行すると Future が返り、Future に対して get() を呼び出す事で処理結果を取得します。 今回は指定の URL に接続する処理とダウンロードしてローカルファイルを作成する処理を非同期化し、全 URL を非同期で処理した後にループで 1件ずつ完了待ちするようにしてみました。 また、GParsExecutorsPool よりも GParsPool の方が速く感じたので、今回は GParsPool を使っています。 Instance Type (Abstract type gotcha 1) In a previous post about abstract types I showed one of the benefits of using abstract types over parameterized types.

Instance Type (Abstract type gotcha 1)

Abstract Types vs Parameter. The next several posts will feature potential problems you may encounter when using Abstract Types. I should point out that abstract types are not inherently difficult to understand but they are rather different from anything you will see when you come from the Java world so if you are new to them I would use them with caution at first. In the abstract types example you will notice that the abstract type 'I' in Foreach is not within the trait Source rather it is outside in the Foreach trait. At first one might consider putting the type in Source rather than Foreach. Compiling the class results in a compilation error: So what is the problem? 並列処理でWebコンテンツをダウンロードする方法 - Groovy, Scala, C#, Java, Ruby - なんとなくな Developer のメモ. How can I handle 403s with XML.load in Scala.

Monad

Still loving the Scala - Richard Dallaway. May 10, 2009.

Still loving the Scala - Richard Dallaway

Sending Play Framework File Uploads to Amazon S3. UPDATE: I’ve released a S3 Play Module based on this project.

Sending Play Framework File Uploads to Amazon S3

A couple of questions [1, 2] on StackOverflow.com led me to look into how we can send file uploads in a Play Framework application to Amazon S3 instead of the local disk. For applications running on Heroku this is especially important because the local disk is not persistent. Persistent disk storage makes it hard to scale apps. Instead of using the file system, it’s better to use an external service which is independent of the web tier. While at JavaZone I sat down with Peter Hilton and Nicolas Leroux to come up with a way to handle this. All of the code for the sample application is on github: The basics of what we did was this: This uses a JPA Entity to persist the metadata about the file upload (for some reason we named it ‘Document’) and a reference to the file’s key in S3.

The app/models/Document.java JPA Entity has three fields – the file being of type S3Blob: That’s it! Login to Heroku via the command line: Getting Started — Typesafe Console Documentation. Sbt-atmos If you use sbt, see the sbt-atmos plugin for an easy way to get started with Typesafe Console for development.

Getting Started — Typesafe Console Documentation

Instrumentation To gather information about your application, classes are instrumented with Aspectj. You need to add a java agent to your application, and include the aspects on the classpath. The Aspectj Weaver is included in the developer distribution at: Scala(Dispatch)でTumblrのAPIを叩く(ライブラリ化編) Connect to RabbitMQ Using Scala, Play and Akka. In this article we'll look at how you can connect from Scala to RabbitMQ so you can support the AMQP protocol from your applications.

Connect to RabbitMQ Using Scala, Play and Akka

In this example I'll use the Play Framework 2.0 as container (for more info on this see my other article on this subject) to run the application in, since Play makes developing with Scala a lot easier. This article will also use Akka actors to send and receive the messages from RabbitMQ. What is AMQP First, a quick introduction into AMQP. AMQP stands for "Advanced Message Queueing Protocol" and is an open standard for messaging. There are a number of tools implementing this protocol, but one that is getting more and more attention is RabbitMQ. Tutorial: Play Framework 2 with Scala, Anorm, JSON, CoffeeScript, jQuery & Heroku.

Play Framework 2 RC2 has been released and it is quickly becoming a mature and productive way to build modern web apps.

Tutorial: Play Framework 2 with Scala, Anorm, JSON, CoffeeScript, jQuery & Heroku

Lets walk through building a quick app with Play 2, Scala, Anorm, JSON, CoffeeScript, and jQuery. Once the app works locally we will deploy it on the cloud with Heroku. Twitterでも利用されているメッセージキュー Kestrelを試す - ゆるよろ・オブ・ザ・( ;゚皿゚)ノシΣ フィンギィィーーッ!!! 日記. Twitter が Scala 大好きすぎて (?) 設定ファイルまで Scala のソースコードな件 - scalaとか・・・ Using Akka Actor in Play2.0. I 've been learning Play framework 2.0 for a while.

Using Akka Actor in Play2.0

The documentation did a relatively decent job, it has some minor typos and doesn't cover all the framework features, which are totally understandable since it is still a working progress. The samples ship with the framework are really really good, you can really learn lots from the samples, and of course there is scala doc. Bootstrap、Hogan.js、Finagleなど注目のTwitter系オープンソース. 「Twitter Open House」はTwitter社のエンジニアと直接情報交換ができるオフラインイベントで、すでにサンフランシスコの本社では何度か開催している。 先日、日本では初めてとなる「Twitter Tokyo Open House」がTwitter Japanのオフィスで開催された。

50 million messages per second - on a single machine. 50 million messages per second on a single machine is mind blowing! We have measured this for a micro benchmark of Akka 2.0. As promised in Scalability of Fork Join Pool I will here describe one of the tuning settings that can be used to achieve even higher throughput than the amazing numbers presented previously. Using the same benchmark as in Scalability of Fork Join Pool and only changing the configuration we go from 20 to 50 million messages per second. The micro benchmark use pairs of actors sending messages to each other, classical ping-pong. All sharing the same fork join dispatcher. Hardware and configuration: Here is the result of using different values for the throughput setting of the dispatcher. 5 is the default value.

As you see the number of processed messages per second increase dramatically with increased throughput configuration setting up to 20. When using even higher throughput values the curve becomes more flat, but with a maximum above 50 million messages per second. Scala XML Pattern matching and Attributes. [scala] - YoYの日記. 文字コード変換メソッド - MEMO:はてな支店. 斜陽産業と言われてもめげない SE(笑)の記録. Cabal-devとghcmod.vim [追記] Cabal 1.18 で sandobox という機能が入ったため、cabal-dev はその役目を終えたそうです。 トホホ… VimでHaskellプログラミングをする際、ghcmod.vimには大変お世話になっています。 ただ、cabal-devを使っている場合、なんか上手く動かないな、どうしたら上手く動くように設定できるのだろうなとずっと悩んでいました。 その対処法がだいたい見えてきたので紹介します。 Localrcとの合わせ技です。 まず、そもそもghc-modをコマンドラインで使うにはどうすればいいかです。 これはhello.hs内でcabal-devでinstallしたモジュールを使っているとエラーがでます。 このコマンドラインで追加したオプションは、ghcmod.vimにおいてはghcmod_ghc_optionsで指定できます。 Jetty7のWebSocketをScalaから使う - ゆろよろ日記.

Getting code coverage in the Play Framework using Jacoco - ronalleva.com. QUICKLINK: I don’t care about your stupid life story, just show me how to make it work We’ve been using the Play framework lately at KonciergeMD to build our application. One thing that’s always good to have on your application is good test coverage, and there’s no shortage of tools to measure that. To get the reports on code coverage, we decided to give JaCoCo a shot, and specifically try to use the sbt-jacoco plugin to do it. Trying to use it right out of the box, however, proved useless. Running jacoco:cover from sbt or play would not work, and instead run no tests while not giving any error messages, and making you feel like a fool for trying. After staring at the problem for a while, @seantbrady and I finally came across the solution. なかの日記 - Adding test resources to play framework 2.0 application. [2.0] Unit test resources not copied to target/scala-2.9.1/test-classes - Google グループ.

Connect to RabbitMQ (AMQP) using Scala, Play and Akka. In this article we'll look at how you can connect from Scala to RabbitMQ so you can support the AMQP protocol from your applications. In this example I'll use the Play Framework 2.0 as container (for more info on this see my other article on this subject) to run the application in, since Play makes developing with Scala a lot easier. This article will also use Akka actors to send and receive the messages from RabbitMQ. Update and shameless plug for someone else's book: If you want some more information on RabbitMQ, Manning, who also is the publisher for my two books, has just released RabbitMQ in action. Scalatra/example/src/main/scala/org/scalatra/MeteorChatExample.scala at develop · scalatra/scalatra. Scala School - Testing with specs. Scaling out messaging applications with Scala Actors and AMQP.

We have been sandboxing various alternatives towards scaling out Java/JMS based services that we implemented for our clients quite some time back. The services that form the stack comprise of dispatchers and routers meant to handle heavy load and perform heavy duty processing on a huge number of trade messages streaming in from the front and middle offices. I have been exploring lots of options including some of the standard ones like grid based distribution of processing and some wildly insane options like using Erlang/OTP. I knew Erlang/OTP is a difficult sell to a client, though we got some amazing results using OTP and mnesia over a clustered intranet. I was also looking at clustered Scala actors as another option, but I guess the Terracotta implementation is not yet production ready and would be a more difficult sell to clients.

Over the last week, I happened to have a look at RabbitMQ. Linear scalability on the JVM .. enter Scala actors .. Building Distributed Systems in Scala. User and support list for MongoDB, a NoSQL database. Bjartek/computer-database-mongo. Filter a list by type by using manifests in Scala. Due to the type erasure in Scala I got problems when I tried to create a function filterType<T>(list: List[Any]): List[T] that simply filters out all elements in a list of type T.

This is the naive implementation that I first tried out: What happened here is essentially that the type erasure mechanism that exists both in Java and Scala (but not in C#) removes the type T from the line case _: T => true which just leaves _ => true which will always match, obviously. I consulted the very helpful Scala community at irc.freenode.net/#scala and got the suggestion that I should use the undocumented and still experimental Scala manifests.

Storage of pickled Scala signatures in class files. Leon/play-salat. PlayFramework 2.0 Javaと WebSocketでつくる リアルタイムMVC Webアプリケーション.