This is a little Perl script I wrote to parse a CSV file I periodically download from Google AdSense. It does the following things:
Lately I have been thinking about writing a functional programming book, and if I decide to do that, I might include a variation of this Ward Cunningham example of how to parse HTML table tags recursively. His code is written in Java, and you can read about it here.
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 15.4, “How to parse JSON data into an array of Scala objects.”
You have a JSON string that represents an array of objects, and you need to deserialize it into objects you can use in your Scala application.
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 12.5, “How to process a CSV file in Scala.”
You want to process the lines in a CSV file, either handling one line at a time or storing them in a two-dimensional array.
Combine Recipe 12.1, “How to Open and Read a Text File” with Recipe 1.3, “Splitting Strings”. Given a simple CSV file like this named finance.csv:
Scala FAQ: How do I parse a number (
Float, etc.) from a
String in Scala?
to* methods that are available on a
String (courtesy of the Scala
My last edits to the Scala Cookbook were in June, 2013, and after all this time there aren’t many things I wish I had added to the Cookbook. Yesterday I ran into one thing that I don’t think I included in the Cookbook: How to process multiple
Option values in a Scala
for loop (for comprehension). Here’s a quick look at how to do this.
For the impatient
For those who just want to see a for comprehension that processes multiple input
Option values, here you go:
I don't get to parse too much JSON code with Java because the biggest JSON source I work with is Twitter, and I always use the Twitter4J project to interact with their web services. But a few days ago while working on an Android project, I just wanted to access their "Twitter Trends" REST service, and I used Java and the json.org Java library that comes with Android to parse the Twitter Trends JSON feed like this:
Scala JSON FAQ: How can I parse JSON text or a JSON document with Scala?
As I continue to plug away on my computer voice control application (SARAH), last night I started working with JSON, specifically the Lift-JSON library (part of the Lift Framework), which seems to be the preferred JSON library of the Scala community.
Summary: This tutorial demonstrates how to use the Java SimpleDateFormat class to convert a Java
Date to a formatted