Java and Scala File and Directory Handling

Scala – How to open and read files in Scala

How to write to file in Java – BufferedWriter

Java File: Reading and Writing Files in Java

org.apache.commons.io.FileUtils Example

org.apache.commons.io.FileUtils (Api Docs)

4 Ways to Copy File in Java

File and directory Copying

Java File IO – How to test whether a file or directory exists

How to create directories in Java

How do I get all files with certain extensions in a directory including subdirectories?

How to set File Permissions in Java Easily using Java 7 PosixFilePermission

java.nio.file.Files.setPosixFilePermissions

Instantiating Object from String at Runtime in Scala

import scala.reflect.runtime.{universe => ru}
import scala.reflect.runtime.universe._

case class Person(name: String)

object ReflectionPoc {
	def main(args: Array[String]) { 
		val m = ru.runtimeMirror(getClass.getClassLoader)
		val p_clz = Class.forName("Person")
		val personClassSymbol = m.classSymbol(p_clz)
		val p = m.reflectClass(personClassSymbol)
		println(p)
		val p_Type = personClassSymbol.toType
		val p_ctor = p_Type.declaration(ru.nme.CONSTRUCTOR).asMethod
		val p_ctorm = p.reflectConstructor(p_ctor)
		val p_obj = p_ctorm("Mike")
		println(p_obj)
		
	}
}

Links
Reflection Overview (Scala Docs)
Scala 2.10 Runtime Reflection from a Class Name (Veeb’s Brain Dump)
Symbols, Trees, and Types (Scala Docs)
Environment, Universes, and Mirrors (Scala Docs)
How to get constructor argument names using Scala-Macros

Kale-Carrot Vegetable Quinoa

Ingredients:
Quinoa
Vegetable broth
Carrots
Broccoli
Kale
Mushrooms
Leek
Garlic
Rosemary
Thyme
Salt + Pepper
Cayenne pepper
Olive Oil

Recipe:
Pre-heat oven to 375F degrees.
Rinse and chop herbs, garlic, onion, carrot, kale, broccoli, mushrooms and set aside.
Setup a baking pan coated with tin-foil.
Mix carrots with oil, salt+pepper then put on pan and bake for about 10 minutes.
Mix kale and rest of vegetables. all herbs, salt+pepper, and cayenne then add on top of carrots already in oven. Bake for about 10 minutes or until kale have a little bit of crispiness to its top edges.
In soup pot simmer quinoa using vegetable slightly diluted with water until tender.
Mix veggies with quinoa and enjoy!

Tips:
Best with organic fresh herbs, no dried stuff.

Jetty’s Server in Spark Stack

Spark has a web accessible monitoring interface, as well as, several other mechanisms like remoting, and file-serving that use http protocols. Spark uses the Jetty web server, client and java servlet container for these functionalities.

The web UI is started from within the SparkContext class by instantiated a SparkUI class, which is sub-class of the WebUI class. WebUI uses Spark utility and Jetty utility functions to spin up the web server and attach handlers to server web content.