Wednesday 24 October 2012

LaTeX errors

This article contains a list of LaTeX errors - good to know:
http://www.cs.utexas.edu/~witchel/errorclasses.html


Thoughts?

(La)TeX resources

Looking for LaTeX online renderer, came across this link that covers quite a few that are good:

http://tex.stackexchange.com/questions/3/compiling-documents-online


Worth taking a look at ;-)

Thoughts?

Friday 19 October 2012

Groovy iteration - great resource

Groovy allows you to use "short-written" constructs (such as each or find) to run through lists or easily find one or several items in a list using closures.


Example:
myList.each { item ->
     // do something with the item
     item.doSomething()
}


This says: for each element in my list, I would like to access it using the variable name "item". If the list is typed, the item will be of the type of the elements in the list and its properties and behaviours will be accessible as such. This is how you access item.doSomething() which is declared in the item's class.

The block in curly brackets is called a closure, it will get precompiled into a separate class file, much as anonymous classes in Java get precompiled into separate classes.

You can also for instance find the first occurrence of something using closures as follows:
myList.find { it.temperature == 165 }

This will find the first item in the list which has temperature 165. it is the keyword that lets you access the current element being iterated. Here we're imagining we are working with a class that store (among other things) a temperature value.

You could do the same and find all corresponding items using:
myList.findAll { it.temperature == 165 }


As in the two previous, examples, the piece of code between curly braces is called a closure and will get precompiled to a separate class file.

If this has wet your appetite, try this resource the covers a much more comprehensive range of iteration operations available in Groovy with clean hands-on examples: http://hanuska.blogspot.be/2008/12/easy-groovy-iteration.html.

As you can see there are some really cool one-liners just waiting to be born.

Thoughts?

Thursday 18 October 2012

Google - LaTeX labs

Want a quick and easy way of rendering LaTeX online? Try out the Google LaTeX labs tool. It's not a Google tool but it does work pretty well as far as I can tell.

Easy steps:
- add the lab to your Google labs
- type in some LaTeX
- in the menu select Compile and hey presto, a whole new world to explore.

Get back to editing mode, by using the "source" button, bottom left of your screen (you can also use the 'Preview' button instead of compiling).

See: http://docs.latexlab.org/docs

Enjoy and let me know your thoughts...

Wednesday 17 October 2012

Method Object pattern

"The Method Object implementation pattern suggests turning a complex method into an object to enable further simplification."

Read more at: http://www.threeriversinstitute.org/TwoMoreImplementationPatterns.htm

Thoughts?

Groovy is full-OO

Unlike Java that hawled us through (and still is) the autoboxing conundrum for primitive types, Groovy simply *is* fully object-oriented. Declare a primitive type such a 2, and you are actually handling an java Integer.

Want to know the really pretty thing about this? You can use stuff like:
def x = 5
def y = 7
and then something like:
def z = x + y
println z => should print 12
or something like:
def z = y.plus(x)
println z => will also print 12

Cool!

Thoughts?

Running *.groovy

Now, this one is interesting. You know how in Java - you call javac, the java or javaw with the classpath to run your *.class (precompiled) file?

Well, Groovy just lets you run the *.groovy file itself. Wow. This means it hides its inner workings, precompiles to Java bytecode for you and then runs the file.

Nifty is what I say.

Thoughts?

Tuesday 16 October 2012

Groovy

As you can see in the previous post, lots of new programming languages are cropping up that will actually run "on" the JVM. In clear, this simply means the code (groovy or whatever) is (pre-)compiled to Java-equivalent bytecode. Why do I say "Java-equivalent" because it may well be some things get optimized that wouldn't normally in Java. Why? Because optimization is often "pattern"-driven (not design pattern, just code pattern), which means languages that offer different constructs, may be able to optimize these in a way that Java cannot.
Cut a long story short... I am currently exploring Groovy, which is both a (pre-)compilable and scripting language. What's great about this, is that you can run along, code some Groovy on the command-line to check it's all working, create a *.groovy file you save to disk containing your logic, and run the file using groovyc for instance, the equivalent of javac for Java. What's really cool about the bytecode thing, is that it means you just take a piece of Groovy code, hand it to groovyc, then to the JVM. The JVM will basically handle it like any old plain piece of Java. So what's the point? might you ask. Groovy offers lots of very handy constructs, working with lists or XML for intance is a breeze, so try it and erm... let me know what you think. Personnaly I am pretty enthusiastic about it :-).

Thoughts?

PS: I nearly forgot... remember to "groovydoc", if you choose to walk that path...

JVM languages

Interesting article about Java Virtual Machine languages including Groovy, JRuby and Jython.

http://en.wikipedia.org/wiki/List_of_JVM_languages


Thoughts?
Online Marketing
Add blog to our blog directory blog search directory Blog Directory Blogarama - The Blog Directory