2/14/11

Doing some Coding Katas in the meantime...

For some time, i tried to learn Scala with my own single learningproject.
I combined views in swing for simple input and output and database access to mysql with some classes in scala. Target should be a small App that is well tested and show all aspects for later richer Apps. But having no Java-background its much input, looking over and decide for the perfect libraries, understanding the scala concepts and so on. So i make small steps in my little app.

The perfect way to make small steps in learning a new programming language is
doing some coding katas. Some solutions i found in the beginner section of codingkata.org

def fibonacci(n :Int) : Int = {
        n match {
            case 0 => 0
            case 1 => 1
            case _ => { ( fibonacci(n-1) + fibonacci(n-2)) }
        }
    }

So i will solve a few more katas, whenever i can not reach the next step or feature of my learning-app-project...

2/8/11

Syntax Highlighter installed.

Trying out this here for syntax highlightning...

// Test JavaScript looking good
function foo()
{
   if (counter <= 10)
      return;
} 

Editing Design | HTML must add brush for Scala:
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushScala.js' type='text/javascript'/>  

Simple Scala-Swing example:
package helloscala
import swing._

object SimpleTextView extends Frame {    
    title = "Simple Text View"
    location = new java.awt.Point( 200,100 )
    minimumSize = new java.awt.Dimension(600, 400)

    var outArea : TextArea =  new TextArea;
    showText("")

    def showText(sometext:String) = {
        outArea.font = new java.awt.Font("Arial", java.awt.Font.BOLD, 12)
        outArea.text = sometext
       
        contents = outArea
        open
    }
    def addText(moretext:String) = {
        outArea.text += moretext
    }
    def writeln(moretext:String) = addText(moretext+"\n")

} 

2/1/11

Start with Scala practice

Trying out the basics for a first blog:
  • my blog will contain code-snippets, how will they look better ?
    import javax.swing._

    object MainApplication extends SimpleSwingApplication {
      def top = new MainFrame {       title="MainApp" ...
  •  an image