serialization (pickling / marshalling) in scala? [closed] - scala

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Are there are any examples, tutorials or docs for serialization / pickling / marshalling objects in Scala? I know of existence of scala.util.Marshal and scala.reflect.internal.pickling, but what is a difference between them? how can I use it? Is that some experimetal feature or can I use it in production ... ?

You should use either java serialization (I recommend using the Externalizable approach for complex cases). You can find lots of tutorials by googling "java serialization tutorial".
If you want to stay in Scala, you should have a look to SBinary which uses composable type classes. The project seems old and unmaintained but works like a charm with Scala 2.9.2. There's a tutorial link in the README and I'm currently writing another one.

Not sure about the requirements you have, but it's worth looking at Google's Protocol Buffers and Apache Thrift. Both provide efficient mechanism for serialization.
There is a Protocol Buffers scala compiler ScalaBuff

Related

What language is Scala written in, and where can the source be found? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
What language is Scala written in?
Where does one get the source code of Scala? i'm looking for the Scala source itself, not a project written in Scala.
Note: I've seen https://stackoverflow.com/questions/2135966/where-do-i-find-an-open-source-project-written-in-scala among some other discussions here.
Scala is [now] written in Scala. This process (of creating a language/compiler that can be used to build itself) is known as "bootstrapping".
The scalac source code can be found on GitHub scala/scala:
[GitHub scala] is the repository for the Scala Programming Language.
For the "compiler guts", start looking in nsc - New Scala Compiler.
Also see the Scala Developer Documentation "portal" which briefly hints how newer Scala/scalac versions are layered on top of previous builds.
Scala is written in Scala itself, and I think user2864740 has already explained a little bit about 'bootstrap'.
For the source code exploring, Github is definitely a good place, but I happened to know a good place Codatlas to view Scala Source Code, which provides some very essential IDE features, like jump to definition and cross reference. To me it has better code browsing experience than GitHub on the web.
For example, Array class is a good place to start.
I used it a lot recently to view Scala source code. Hope this helps.

Recommended Scala io library [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed last year.
Improve this question
By all accounts, Scala's Source is a bit of a mess - everything I've read about it mentions resources left open, mysterious bugs...
I was wondering whether that was still the case in recent versions of Scala and, if so, what are worthy alternatives?
I've mostly heard of scala-io and scalaz-streams (and, obviously standard Java IO primitives). Did I miss anything? If anyone has experience with these or other projects, what are their respective pros and cons?
I'm inclined to go for scala-io, since I found the author's blog to be a fairly high quality source of useful of information, but I'd love to know more about the alternatives and what other people use.
Rapture IO might be worth trying.
It provides some nice DSL for managing IO resources of various kinds.
Using the package java.nio.file in Java standard library may also be simple enough if you don't require advance features. For example, to read the lines of a file into memory:
Files.readAllLines(Paths.get("file_name"), StandardCharsets.UTF_8).asScala
And to write a sequence of lines into a file:
val strs = Seq("line1", "line2", "line3")
Files.write(Paths.get("output_file"), strs.mkString("\n").getBytes())
Check
http://docs.oracle.com/javase/tutorial/essential/io/file.html
for more information.

Play Framework + Scala + Couchbase? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I would like to use Couchbase in a Play Framework + Scala project. I have seen Scala based Play Modules like, https://github.com/leon/play-salat, to hook up Play and MongoDB. Just wondering if anyone has done anything similar for Couchbase or if anyone has used Couchbase with Play before?
A recent article by Michael Nitschinger might be of some use to you. He implemented the couchbase solution using java, but implementation in scala should be pretty straight forward. You can find the article here.
I have used Play framework + Scala + Couchbase and it works like a charm!
I can certainly recommend you to use it.
There are modules that you can use to make it real easy to use:
http://reactivecouchbase.org/
It includes a very good tutorial and samples.
If it is not listed on the modules page, it probably doesn't exist (or isn't used on large-scale).
You can always check/use/transform/tweak the Java version(s) of existing framework and create a module for the community! ;)

Is there anything like rubygems.org for scala libraries [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I notice there is an sbaz tool that seems to have similar functionality to the ruby gem tool but I don't see any community site like gemcutter.org / rubygems.org. Is there something like this around.
There are 1084 repositories on github with scala in them. I'm surprised I can't find some centralized package management utility. Perhaps I'm just googling the wrong keywords.
The closest equivalent is probably http://scala-tools.org which maintains a Maven (ivy, sbt, etc) repository of most of the best-known packages.
Scala Tools appears to no longer be functional as of this writing. It says:
We are no longer providing any support for scala-tools.org.
Instead, it is suggested to use https://oss.sonatype.org/
As Kris said, http://scala-tools.org is the closest thing so far. We're working on improving the site, and will be enabling "static project sites" shortly. There's also http://implicit.ly/ which aims to be the standard new source for published releases.

Working with images in Scala [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I am generating large PNG files from a Scala program. Currently, I am doing it the same way I would do it in java. I am creating a new BufferedImage and setting each pixel to the correct color. This works fine, but I am wondering if there are any good libraries for working with images in Scala? I am looking for something like Ruby's RMagick library.
Take a look at https://github.com/sksamuel/scrimage (Disclaimer: I am the author)
This is an open source Scala image library that essentially wraps java.awt Image operations in a nicer API as well as providing easy methods for operations like fitting to a given size, etc.
Maybe JMagick? Take a look here, it's a native interface between ImageMagick and Java exactly like RMagick..