bookmarks  3709

  •  

    Welcome to the Chickenfoot interactive tutorial. When you see text in a box like the one below, it is a piece of Chickenfoot code (which we call Chickenscratch) that can be executed from the Chickenfoot Script Editor. To introduce you to Chickenfoot, the interactive tutorial consists of a series of sample pages. Each sample page will show a real web site, such as Google, and a snippet of Chickenscratch to run on that web site. This will expose you to the various commands that are available in Chickenfoot. click("begin interactive tutorial")
    13 years ago by @draganigajic
    (0)
     
     
  •  

    With the advent of multi-core processors concurrent programming is becoming indispensable. Scala's primary concurrency construct is actors. Actors are basically concurrent processes that communicate by exchanging messages. Actors can also be seen as a form of active objects where invoking a method corresponds to sending a message. The Scala Actors library provides both asynchronous and synchronous message sends (the latter are implemented by exchanging several asynchronous messages). Moreover, actors may communicate using futures where requests are handled asynchronously, but return a representation (the future) that allows to await the reply. This tutorial is mainly designed as a walk-through of several complete example programs Our first example consists of two actors that exchange a bunch of messages and then terminate. The first actor sends "ping" messages to the second actor, which in turn sends "pong" messages back (for each received "ping" message one "pong" message).
    13 years ago by @draganigajic
    (0)
     
     
  •  

    All of these samples perform essentially the same task: traverse an array of strings and print each value to stdout. Of course, the C++ example is actually using a vector rather than an array due to the evil nature of C/C++ arrays, but it comes to the same thing. Passing over the differences in syntax between these four languages, what really stands out are the different ways in which the task is performed. C++ and Java are both using iterators, while Ruby and Scala are making use of higher order functions. Ruby and C++ both use lowercase variables separated by underscores, while Java and Scala share the camelCase convention. This is a bit of a trivial example, but it does open the door to a much more interesting discussion: what are these idioms in Scala’s case? Scala is a very new language which has yet to see truly wide-spread adoption. More than that, Scala is fundamentally different from what has come before.
    13 years ago by @draganigajic
    (0)
     
     
  •  

    That should be it. You now be able to boot up you Lift app, launch the Flex app, click the “Subscribe to ‘notifications’” to start the Notifier Actor and subscribe to the Consumer to the notifications destination. You should then see id number and the time in the text input field get automatically updated every 0.5 seconds. You can the click the “Unsubscribe from ‘notifications’” to stop the Notifier actor and the Consumer to unsubscribe from the notifications destination. Pretty exciting. With these three technologies it’s really easy to automatically push data from the server to the client in real time. This is obviously a trivial example, but I think it should be relatively straight forward to scale this approach up for more sophisticated apps.
    13 years ago by @draganigajic
    (0)
     
     
  •  

    Once you start thinking about structuring your code to use Option in languages which have built-in support for it, you’ll find yourself dreaming about such patterns in other, less fortunate languages. It’s really sort of bizarre how much this little device can open your mind to new possibilities. Take my code, and give it a try in your project. Better yet, implement something on your own which solves the problem more elegantly! The stodgy old Java “best practices” could use a little fresh air. P.S. Yes, I know that the original implementation of this was actually the Maybe monad in Haskell. I picked Option instead mainly because a) I like the name better, and b) it’s Scala, so it’s far more approachable than Haskell.
    13 years ago by @draganigajic
    (0)
     
     

publications  28