Java is the most regularly used programming language for the creation of web applications. This high-level programming language develops by the Sun Micro-system. This language was designed for use in the world of internet and known for fastest, secure, and most reliable language of the computing platform. One interesting fact is that Java programmers are
Read more
Tag: Scala
Any good Java REPL tool/implementation?
Posted onAny good suggestions on a Java REPL implementation like ‘scala’ and ‘python’ or ‘php -a’? The java-repl tool https://github.com/albertlatacz/java-repl/ works nicely for most situations for me. It is released as a .jar. Hence, it is easy to download and run: $ wget –quiet https://github.com/albertlatacz/java-repl/releases/download/428/javarepl-428.jar -O /tmp/javarepo-428.jar && java -jar /tmp/javarepo-428.jar One usage example is as
Read more
if (p:string list) = c (is the only element)
Posted onif (p:string list) = [c] then (divide p1 c) showing unbound value c. i want to equalise (if one element in p which is (c:anything)) and use that variable let p = [“ocaml”] let f s = match s with | [c] -> print_endline c | _ -> print_endline “ops” f p It will print:
Read more
Setting sbt log level at the command line
Posted onsbt‘s log level can be set by execute set logLevel := Level.Error inside sbt. How to set the sbt log level at the command line? Add –error to sbt for specify the logLevel to error: sbt –error “your command”
How to install multiple versions of sbt on my Linux host?
Posted onHow to install multiple versions of sbt on my Linux host For example, some projects use 0.12.x while some use 0.13.x. Installing neither in the system only is not sufficient enough. You may use the excellent sbt-extras: https://github.com/paulp/sbt-extras Most of the time, it detects the version of sbt needed in the project direoctory automatically: [zma@office
Read more
How to package a Scala project to a .jar with sbt?
Posted onHow to package a Scala project to a .jar file with sbt? Manually packaging the .class files are fine but too tedious. A jar of just the project classes The command: sbt package will produces the main artifact as a jar into target/scala-2.x.y/project_name_2.x.y-zz.jar. Continuously building the package: sbt ~package Standalone jar with all dependencies If
Read more
How to set options for scala in sbt
Posted onIn sbt, I found this message printed out by the scala compiler: [warn] there were 1 deprecation warning(s); re-run with -deprecation for details [warn] one warning found The question is, how to add options (-deprecation here) to the scala compiler in sbt? You can use this inside the sbt console: set scalacOptions += “-deprecation”
Random string password generator in Scala
Posted onManaging our research cluster, I frequently need to generate some string for new users’ password. How to generate them automatically and randomly in Scala? The passwords need characters ‘a’ – ‘z’, ‘A’ – ‘Z’ and ‘0’ – ‘9’ only. This piece of code works very well for me: def randomString(len: Int): String = { val
Read more
Syntactical difference among OCaml, Scala, F# and Haskell
Posted onWhat’s the syntactical difference among OCaml, Scala, F# and Haskell. This page gives a side-by-side reference among OCaml, F#, Scala and Haskell: ML Dialects and Friends: OCaml, F#, Scala, Haskell
How to install sbt for scala on Fedora Linux
Posted onHow to install sbt for scala on Fedora Linux? It is not included in the default Fedora repository although scala is included. The download page of scala-sbt.org provides the RPM package. You can install the sbt rpm package by yum. We only need the URL to the RPM package. Here, let take version 0.13.1 as
Read more
How to install Scala on Fedora Linux
Posted onThis tutorial introduces how to install Scala 2.9.2 on 64-bit Fedora Linux 17. There are some changes needed to make scala work on Fedora Linux 17. Please check it out in the answer. Install Java Scala depends on Java, so please install Java first. In this tutorial, we installed JDK to: /usr/java/jdk1.6.0_24/lib/. Install Scala from
Read more
How to install Scala from the official Scala distribution
Posted onHow to install Scala from the official Scala distribution? This is needed on a Linux release with older version of Scala in the repository, e.g. Fedora 12. Use the install-scala.sh script: # wget https://raw2.github.com/zma/usefulscripts/master/script/install-scala.sh # sh ./install-scala.sh VER where VER is the scala version that you want to install. First step, install and configure the
Read more
Is cin much slower than scanf in C++?
Posted onI frequently hear that cin is significantly slower than scanf in C++. Is this true? And how to improve the efficiency of cin? It is really nice to use most of time. One discussion about that cin is very slow is here: http://apps.topcoder.com/forums/?module=Thread&threadID=508058&start=0&mc=7 In short: cin is not always slower (can be faster actually, see
Read more
Profiling Vim to Find Out Which Plugin Makes Vim Slow
Posted onVim is pretty fast and powerful. However, the core of Vim is (yet) single-threaded (some discussions and tries on porting Vim to be multi-threading, but not yet there). This means some functions that are slow will block Vim there and you have to wait for it. While Vim is fast, some plugins are not. When
Read more
How to install Scala on Linux
Posted onHow to install Scala on Fedora Linux How to install Scala on Fedora Linux: This tutorial introduces how to install Scala 2.9.2 on 64-bit Fedora Linux 17. There are some changes needed to make scala work on Fedora Linux 17. Please check it out in the answer. Continue reading: How to install Scala on Fedora
Read more