Scala Convert List of Strings to Ints, List[String] => List[Int]

Posted on Monday, May 12, 2014


I am still fairly new to Scala so take what I write in this article with a grain of salt.


The more I learn Scala to more I like it and here is an example of why…

The following Scala Code will read in a file (whos name is the first command line argument) and read in every line as a String Array, convert it to a List[String] then convert that to a List[Int]  (this assumes the file has a valid integer on each line.  Then it prints out the Int list adding +1 to each number as it prints it out.


 
import scala.io.Source

object ListStringToInt{

  def main(args: Array[String]) {
    val sList = Source.fromFile(args(0)).
      getLines.toList.map((s: String) => s.toInt)

    sList.foreach((x: Int) => println(x + 1))
  }
}


Jquery Site Setup (Positioning) 4 of 4

Posted on Tuesday, May 6, 2014


This tutorial is going to be split into 4 sections.  The goal of this tutorial is to create a simple web site that has a top bar with a static Height, a left tool bar with a static width, and a variable "display area" which will take up the rest of the space.

This tutorial will start where the last tutorial finished which added some ajaxy goodness using jQuery load.  Now it's time to use the HTML 5 history tool.

Jquery Site Setup (Positioning) 3 of 4

Posted on Sunday, May 4, 2014


This tutorial is going to be split into 4 sections.  The goal of this tutorial is to create a simple web site that has a top bar with a static Height, a left tool bar with a static width, and a variable "display area" which will take up the rest of the space.

This tutorial will start where the last tutorial finished were the problem
Of resizing was solved using the underscore library.  Now it's time to add some buttons and create some ajaxiness

Jquery Site Setup (Positioning) 2 of 4

Posted on Friday, May 2, 2014


This tutorial is going to be split into 4 sections.  The goal of this tutorial is to create a simple web site that has a top bar with a static Height, a left tool bar with a static width, and a variable "display area" which will take up the rest of the space.

This tutorial will start where the last tutorial finished were the problem
Of resizing on a window resize was not yet solved.