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")
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).
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.
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.
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.
For some reason, I suddenly felt like playing around with Scala for a couple of days, and having gotten over my perceived difficulty of the language vs Groovy, and after actually trying to write something in it - I really like it :) At first glance, advanced functional programming in Scala can look a little freaky to someone who’s only been writing Java for the last few years. But if you start slowly, it all slides into place. I started to get into it by reading this is a really good series of articles introducing the language What follows are two examples of Scala. The first, LoveGame is a demonstration of programming a simple algorithm in Scala along with a little comarpison with Java. The second is a little toying around i did with Scala to create a front end for JScience with the “Pimp my library” pattern.
emir burak In Informatics, there are two (related) meanings of the word "monad": * A triple (T,eta,mu) following some laws in category theory * A way of structuring functional programs The first meaning can probably not be described easily in natural language. Michael Arbib and Ernest Manes' "Arrows, Structure, Functors - The Categorical Imperative". describe them as (generalized monoids) in Section 10.2 and through adjointness to the forgetful functor from algebras to sets. That last connection basically makes everything that we can write down or model using abstract syntax / universal algebra a monad. The second view is described in Wadler's papers. I mention category theory because we can describe things that are not computations as monads. It also reminds us why a monad is a collection of things taken together. With the List example in mind, a potentially more revealing account on monads (aka triples) can be found in the free book Barr, Wells
Just fire up your REPL and see for yourself how the malleable syntactic structures of the language grow in front of your eyes, alongside your program. Whether this is through Lisp macros or Ruby meta-programming or Scala control structures, the secret sauce is in the ability to implement more and more powerful abstractions within the language. But what makes one language shine more compared to another is the ability to combine abstractions leading to more powerful syntactic structures. Recently people have been talking about the Maybe monad and its myriads of implementation possibilities in Ruby. Because of its dynamic nature and powerful meta-programming facilities, Ruby allows you to write this .. @phone = Location.find(:first, ...elided... ).andand.phone Here andand is an abstraction of the Maybe monad that you can seamlessly compose with core Ruby syntax structures, effectively growing the Ruby language.
Gabriel C. Software surgeon / developer / architect with few years consulting and developing software using OOAD with UML and RUP in JEE and MS technolgies. I've been a software developer and project leader in a offshore development center in Uruguay, technical lead on a project in Chile, architect of a COTS application in Dominican Republic, OOAD/ UML mentor in Nicaragua, architecture and RUP mentor in Puerto Rico, and senior programmer in USA. But I'm still trying to learn what this software stuff is about...
Coming back to the above post by Anton, yes, the kind of runtime type checking exists in lots of popular Java frameworks, even today. And this is where frameworks like Guice and EasyMock really shine with their strongly typed API sets that make you feel more secure within the confines of your IDE and refactoring abilities. The Morale When you are programming in a statically typed language, use appropriate language features to make most of your type checking at compile time. This way, before you hit the run button, you can be assured that your code is well-formed within the bounds of the type system. And you have the power of easier refactoring and cleaner evolution of your codebase.
Lex Spoon discusses the Scala programming language including the origin of Scala, the philosophy behind Scala, the Scala feature set, Object-Oriented and Functional programming in Scala, examples of Scala code, writing DSLs, how Scala is converted into Java, Scala performance, Abstract Data Types, unapply, actors and partial functions. Lex Spoon divides his time between two posts: he works at EPFL in Switzerland on the Scala team, and at IBM Research in New York on X10.
The Scala Community Library (Scalax) is a nascent project to develop a general utility library for the Scala language, as a companion to the standard library. All members of the Scala community are invited to participate, by contributing code and by reviewing existing contributions. Scalax is released under a 3-clause BSD-style license, the same as Scala itself. Our Mercurial repositories and 0.1 release are available to preview. dormant?
emir burak scala.xml (draft book, updated for Scala 2.6.1) I. Semistructured Syntax and Data 1. Introduction XML, Types and Objects 2. The scala.xml API Nodes and Attributes Elements and Text Embedded expressions Other nodes Matching XML Updates and Queries Names and Namespaces Sharing namespace nodes 3. XPath projection 4. XSLT style transformations 5. XQuery style querying 6. Loading and Saving XML The native Scala parser Pull parsing (experimental) II. Library 7. Overview 8. scala.xml runtime classes 9. Scala's XML syntax, formally 10. Interpretation of XML expressions and patterns
Galleropa expands your browser Favorites to include bookmarked groups of tabs called Galleries. Use galleries yourself, share them with friends, or just browse the public galleries others have created.Used together with a tabbed browser such as Firefox, Galleropa streamlines the process of loading multiple sites that you use together most often.
We started High Scalability to help you build successful scalable websites. This site tries to bring together all the lore, art, science, practice, and experience of building scalable websites into one place so you can learn how to build your system with confidence.
If Merb is a paragon of professionalism and class, Shoes is a monkey on LSD. Shoes, by why the lucky stiff, is an incredibly compact cross-platform GUI toolkit for Ruby, but it looks nothing like the other cross-platform toolkits out there. For one thing, it is lightweight. Shoes lets you build GUIs in Ruby whose code actually looks like Ruby, not XML or Java. We are going to build a pastebin as a repository for our own code snippets and pieces of text we want to save. We'll build a GUI frontend using Shoes, and connect it to a Merb backend that will handle the database. In fact, the basic proof of concept took the two of us about an hour to get working, and it took another hour to finish. Without further ado, we present our pastebin application, using Shoes and Merb, Shmerboes. Creating a Simple YAML-Based Web Service with Merb
February 17th, 2008 A 'problem' with the Mongrel/Rails platform A request comes in to the web server, and if it's dynamic, falls down to a waiting mongrel process. Mongrel calls Rails which wraps a big lock around most of the request/response cycle so the mongrel thats serving the request has to wait for a response from Rails to unlock and start serving other requests. This is the Blocked Thread stability anti-pattern that Michael Nygard talks about in Release It!. The problem is that Nginx or Apache doesn't know that a mongrel is blocked and keeps blindly sending requests. Thats means that even a single blocked mongrel will result in some slow responses for requests that come in to that same mongrel. Cut the Request Fat And one way to do that is to use the "Skinny Request, Fat Backend" principle. What that means in practical terms is pretty simple: Do as little as possible inside of the Request/Response cycle.
* MakeCloud simplifies adding a cloud to any web page. Give it an RSS feed, and it makes a link cloud that summarizes the contents of the feed, and provides code to embded the cloud * FeedMarklet instantly creates an RSS feed and a browser button. You click the browser button to add whatever page you are currently reading to the feed. It is faster and easier to save links, because you do not have to interupt your browsing flow to go to a different website, and it automatically extracts information to save you the effort of entering it manually. * Video Lecture Database is a collection of links to streaming video lectures on subjects ranging from quantum mechanics to literature. The lectures are tagged. * The WizzardWiki is a power user's wiki- no stripped down markup here, just raw HTML, with real-time previews. * Hebbalicious is an experimental link cloud. Links get bigger when clicked, and anyone can submit a link. The cloud sorts out the rest.
CUDA lets you work with familiar programming concepts while developing software that can run on a GP This is the first of a series of articles to introduce you to the power of CUDA -- through working code -- and to the thought process to help you map applications onto multi-threaded hardware (such as GPUs) to get big performance increases. Of course, not all problems can be mapped efficiently onto multi-threaded hardware, so part of my thought process will be to distinguish what will and what won't work, plus provide a common-sense idea of what might work "well-enough". "CUDA programming" and "GPGPU programming" are not the same (although CUDA runs on GPUs). CUDA permits working with familiar programming concepts while developing software that can run on a GPU. It also avoids the performance overhead of graphics layer APIs by compiling your software directly to the hardware (GPU assembly language, for instance), thereby providing great performance.
GWT is a framework developed by Google to implement AJAX technology. This framework proposes to develop the GUI entirely from Java. This code is then compiled into Javascript, to be embedded in a web application. GWT is composed of a client part, Javascript, which is the GUI application, it communicates with a server developed in Java. Past the discovery of this excellent framework, a question light in my mind: What are the correct patterns and designs code to implement this framework? Let’s take an example, look at the problems and propose improvements to emerge a coherent design. We have a Toy Project, which consists of a login screen. This example, deliberately simplistic, offers the following GUI: