other bookmarks
Bill Venners: Can you given an overview of Jamon?Ian Robertson: Jamon is a templating engine. Among the templating engines most people are aware of, Jamon is probably most similar to Velocity. But there are a few big differences. The most significant difference is that it has static typing. A Jamon template will declare the arguments it’s taking in, and the types of those arguments. Then all code in it is actually converted into Java code, and is type checked by the compiler. It also has a few additional features that Velocity doesn’t have, including the ability for a template to pass a subtemplate as an argument to another template, which is useful for certain looping constructs.
Bill Venners: Most templating engines that I’m aware of are not statically typed. JSP is statically typed, but Velocity, Freemarker, StringTemplate are not. They don’t provide compile-time type or name checking of any kind. What are the advantages and disadvantages of using a statically typed templating system?
Ian Robertson: I think the main advantage is the same advantage of having a statically typed language, You described JSP as statically typed, but even JSP I would consider in some ways dynamically typed in the sense that arguments are passed in through the request context. You’re pulling them out by name, and then you’re hoping they are the right type. And it makes refactoring extremely difficult. If you decide you want to change some of your model objects, which are being referenced in the view, it’s very difficult to figure out how that’s going to impact the view. We have had to make refactorings at Overstock, where we use Jamon for our website, fairly significant refactorings. And we were able to do it with a high degree of confidence, because anything that we get wrong, we’re going to know before we’ve even successfully compiled. And I think that’s probably the single biggest reason.
It also provides, as any static typing system does, a better documentation. You can tell looking at a template, not only what data is coming in by the name the data is given as a variable, but you can look at the type and see ah this is actually a list of product recommendations. And I can look at that bean and understand what it does. I can really know what’s going on without having to guess.Bill Venners: So what is the advantage of FreeMarker and Velocity’s approach? What are they getting that you don’t get if you take a statically typed approach like Jamon?
Ian Robertson: There is a loose coupling that’s involved when you don’t have the static typing. And I think that is probably at least a large perceived advantage of these other templating languages. But in my opinion, this is an image of loose coupling, but it’s not true loose coupling. It’s true that you can change the type on one side, and everything will still work–until you try to run it. And then everything falls apart, with a NullPointerException if an expected parameter wasn’t passed, or a ClassCastException if the parameter had the wrong type. I’ve talked with some people who initially questioned why Jamon didn’t have this loose coupling model, which makes it very easy to work with a lot of frameworks, for example, Spring MVC. But when you dig down, you find that the loose coupling is a facade.
Introducing KeyczarKeyczar is an open source cryptographic toolkit designed to make it easier and safer for developers to use cryptography in their applications. Keyczar supports authentication and encryption with both symmetric and asymmetric keys. Some features of Keyczar include:
* A simple API
* Key rotation and versioning
* Safe default algorithms, modes, and key lengths
* Automated generation of initialization vectors and ciphertext signatures
* Java and Python implementations (C++ coming soon)
* International support in Java (Python coming soon)Keyczar was originally developed by members of the Google Security Team and is released under an Apache 2.0 license.
virtualbox.org :: View topic - how to make a copy of .VDI image?
Suggestion from nailbnny above works though. Follow these steps:1) Shut down the virtual machine you would like to copy
2) In File > Virtualdiskmanager, select the virtual machine disk image you would like to copy, and press the Release button
3) In a terminal window, issue following command (see virtualbox user manual):
vboxmanage clonevdi /directory/image1.vdi /directory/image2.vdi
4) In File > Virtualdiskmanager, add the new disk image you’ve created in step 3.
5) In the main virtualbox window, press the New button to create a new virtual machine, and link it to the new disk image you’ve created.
λ Tony’s blog λ » Blog Archive » Scala exercises for beginners
The following exercises have come from of a course that I give on Functional Programming. I have assigned them difficulty ratings to make it a bit more exciting. Download the compilable source code from here or find it below. Enjoy![]()
These exercises can be translated into any language powerful enough to possess algebraic data types and case matching (yes, I am talking to you). Haskell is another such language and I will convert these exercises to Haskell if prompted.
Roundup: Scala for Java Refugees - Code Commit
To be honest, I’m somewhat kicking myself for writing this post. As I’ve said many times: roundup posts are for people who are too lazy to write real content. I can’t tell you how many blogs I’ve come across which have a roundup-to-post ratio of easily 3:1. You know it’s a bad sign when sites start having roundups of their roundups…Meta-roundups aside, I decided (after much deliberation) that a single post linking to all six parts of the series would be useful to one or two people. So if you like to save things with del.icio.us or even plain-old-bookmarks (POBMs for short), this is the one! And if no one finds it useful, eh, I suppose Google probably likes it.
Of course it’s always possible that you subscribe to my way of looking at things. If you hate roundups as much as I do, skip this article and go read something useful.
* Part 1: main(String[])
Introductory article giving motivation for learning Scala and some first steps to “get your feet wet” in the language.
* Part 2: Basic OOP
Looking at Scala’s syntax in a little more detail. Properties, variables, methods, classes and constructors all find their home here. We also touch on Scala’s import statement (which is a vast improvement over Java’s).
* Part 3: Methods and Statics
Scala’s method syntax is far too powerful to cover in a single post. Part 3 goes into more detail, as well as introducing the concept of the singleton object and explaining how Scala really doesn’t have statics at all.
* Part 4: Pattern Matching and Exceptions
Pattern matching is one of the most useful constructs in the entire language. Having a good understanding of it is critical to utilizing Scala to its full potential. This article covers some basic pattern matching, case classes and a bit of exception handling. There are a lot of very interesting comments on this post, so be sure to scroll all the way down!
* Part 5: Traits and Types
Getting further away from perfect parity with Java, this article looks at traits (Scala’s more powerful substitute for interfaces) and just skims the surface of type theory applicability in Scala.
* Part 6: Getting Over Java
This article throws caution to the wind and picks up all the fun, Scala-specific topics I didn’t cover throughout the rest of the series (such as functionals, implicit type conversions, symbolic method names, etc). This is my favorite of the series, simply because it covered many of the really interesting topics.
Scala for Java Refugees Part 6: Getting Over Java - Code Commit
Thus follows the sixth and final installment of my prolific “Scala for Java Refugees” series. After this post, I will continue to write about Scala as the spirit moves, but I don’t think I’ll do another full-length series focused entirely on this one topic. It’s a surprisingly exhausting thing to do, tying yourself to a single subject for so long. (insert piteous moans from my keyboard) Anyway, enough of my whining…To be honest, I’ve been looking forward to this article from day one of the series. This is the article where we get to open the door on all sorts of wonderful Scala-specific goodies. So far, the focus has been mostly on areas where Scala’s semantics more-or-less parity Java’s. In this article, we’ll look at some of the many ways in which Scala surpasses its lineage. It’s time to get over that old girlfriend of yours and join me in the new tomorrow!
You can do it from the command line with 2 utilities.
The first one, ASSOC, is used to create a file association. To verify if there is one defined for JAR type :
>assoc .jar
.jar=jarfile
If not found then create it with :
>assoc .jar=jarfile
The next step is to define the association. This is done with FTYPE.
To verify if one is already defined , type
>ftype jarfile
jarfile=”C:\Program Files\Java\jre1.5.0_10\bin\javaw.exe” -jar “%1″ %*
Again if not found or the wrong JRE is used, use FTYPE to fix the problem
>ftype jarfile=jarfile=”C:\Program Files\Java\jre1.5.0_10\bin\javaw.exe” -jar “%1″ %*