Monday, November 19, 2012

Monads, shmonads and functional programming

Post consolidated and moved to http://www.coolscala.com/wiki/Cool_Scala/Monads_shmonads_and_functional_programming

Saturday, September 29, 2012

OMG, scala is a complex language!

Blog post consolidated to http://www.coolscala.com/wiki/Cool_Scala/OMG_scala_is_a_complex_language

Quick scala – step 1: setup

This was originally posted in Oct 2011, on the blog.coolscala.com which I'm removing.

If you just want to play with scala quickly – you can use one of the few online interpreters, like http://www.simplyscala.com/or http://www.tryscala.org - these let you run small bits of code interactively. Otherwise, continue reading, to complete a local setup for scala development. You need these:
1.Java
2.Scala (command line)
3.Eclipse with the scala plugin
Installing Java:
1.Download and install a 1.6 JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html . Do not use a 1.7 for this exercise and make sure you install the JDK not just the JRE. The exact link I use is: http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u27-download-440405.html
a.I recommend you use a 64 bit version, so you can allocate more memory to it
2.Run and install somewhere, let’s say C:\bin\jdk1.6.0_27\
a.I found it a good practice to keep my development tools in c:/bin
b.Make sure to check the “change destination folder” checkbox before letting the installer run…
3.Make sure the path to java.exe is in the PATH
a.Add C:\bin\jdk1.6.0_27\bin to the PATH system variable
b.Define a variable called JAVA_HOME with the value “C:\bin\jdk1.6.0_27\”.
4.Test it by opening a command line window and typing “java”.
Installing scala command line:
1.Download a distribution from http://www.scala-lang.org/downloads
2.Unpack it in a folder, let’s say C:/bin/scala
3.Make sure the path to scala.bat is in your PATH
a.Add C:/bin/scala/bin to the PATH system variable
4.Test it by opening a command line window and typing “scala”. You should get the scala interpreter prompt and then type“exit” to exit the interpreter.
Installing Eclipse:
1.Download Eclipse Classic from the download site: http://www.eclipse.org/downloads/packages/release/indigo/r
2.Install it (unzip it) in C:/bin/eclipsescala
3.To make sure it uses the JDK you just installed (if you went that route) modify your eclipsescala/eclipse.ini and add this line:
a.-vm
C:\bin\jdk1.6.0_27\bin
4.Start it up (eclipsescala/bin/eclipse.exe)
5.Install the scala plugin
a.Go to Help/Install new software
b.Click on Add
c.Type in name “scala291” and the url: http://download.scala-ide.org/releases-29/2.0.0-beta
d.You can see if there is a newer version at http://www.scala-ide.org/
e.Select this source in the drop-down
f.Click “Select All” to select the three features
g.Go ahead with the installation
6.Restart Eclipse
7.Read the detailed setups at http://www.assembla.com/spaces/scala-ide/wiki/SetupIt is a good idea to allocate Eclipse at least 1G – I use 2G.
8.If you changed any settings, restart Eclipse
To test your eclipse installation, select File/New/Project and see if “Scala Project” is in the list. You’ll use it for the “Hello World”exercise.
Check that the sources for the scala library are setup properly:
1.Open your project
2.CTRL+SHIFT+T to find types and type ‘List’
3.Scroll down the list to find the List from scala.collection.immutable
4.Click enter – you should now see the nicely formatted source code for List
5.You can take a quick look but don’t despair if that code looks foreign – we’ll get there soon enough.
Spruce up your Eclipse – my favorite plugins include:
-The GOTO plugin from, http://muermann.org/gotofile/
-The Color themes plugin, from http://www.eclipsecolorthemes.org/
-The VI plugin, from http://www.viplugin.com/viplugin/
Cheers – you are now setup to play with scala.

Friday, August 24, 2012

Racer kidz and wiki clubs - update

My little R&D into wiki domains at http://www.racerkidz.com seems to work fine - I add a feature evry now and then.

You can register a club, describe a racing schedule, then racers can add it to their profile and automatically, via the magic of wiki xpath, see the racing calendar and the map...

You can give it a try without an account from the home page.

I also experimentally used it to create simple blogs, like this enduro school. A blog has posts and that's that, see its domain definition.

Cheers!