Archive for September, 2011
Rollback RHEL updates using LVM
Sep 28th
RHEL6 has a nice new feature: LVM snapshot merging. This basically means that you can merge a snapshot back into it’s origin LV. RHEL installations normally have their OS installed on LVM (If you don’t, please reconsider. You don’t know what your missing).
Groovy Goodness: Use inject Method on a Map
Sep 27th
The inject() method is since Groovy 1.8.1 also available for Map objects. The closure arguments accepts two or three arguments. With the three-argument variant we get the key and value separately as arguments. Otherwise we get a map entry as closure argument.
Groovy Goodness: Access ResultSetMetaData with Groovy SQL
Sep 26th
Groovy’s SQL support allows us to access ResultSetMetaData with a closure when we use the query methods rows() and eachRow(). We can pass a closure as the last argument of these methods. The closure parameter is the ResultSetMetaData object. The closure is only invoked once after the query is executed.
Groovy Goodness: Using Named (Ordinal) Parameters with Groovy SQL
Sep 23rd
Groovy has great SQL support built-in. With just a few lines of code we can access a database and write SQL statements and execute them. To query data we can for example use the rows() method. We pass a SQL query and we get a List of GroovyResultSet objects back. But we can also use other methods like query() or eachRow().
Groovy Goodness: Use Connection Parameters to Get Text From URL
Sep 22nd
For a long time we can simply get the text from an URL in Groovy. Since Groovy 1.8.1 we can set parameters to the underlying URLConnection that is used to get the content. The parameters are passed as a Map to the getText() method or to the newReader() or newInputStream() methods for an URL.
Groovy Goodness: Streaming JSON with StreamingJsonBuilder
Sep 21st
Since Groovy 1.8 we can use JSONBuilder to create JSON data structures. With Groovy 1.8.1 we have a variant of JsonBuilder that will not create a data structure in memory, but will stream directly to a writer the JSON structure: StreamingJsonBuilder. This is useful in situations where we don’t have to change the structure and need a memory efficient way to write JSON.
Groovy Goodness: Transform Items into a Collection with collectMany
Sep 20th
In Groovy we can use the collectMany() method to transform items from a collection into a collection. The resulting collection is then flattened into a single collection. This means we can use the closure to return a collection with values and at the end all these collections are flattened into a single collection.
19-Sep-2011
Sep 19th
Maintenance
Once again, I wasn’t able to check on the site on the change of the month, and other (more, and less important) jobs interfered. But yesterday I blew the wiki – more on that later – so I had to get into the system anyway….
As to be expected, there were no surprises on the monthy cleanup. Mail statistics are in the logfile:
Modeling Availability
Sep 19th
In my work I often deal with availability of infrastructure, especially when storage is involved. I am surprised by the enormous amount of completely different ways people think about availability and try to put it in workable specifications. From those variations and from various books that cover (parts) of this subject I have developed my own working model and apply it whenever possible.