Category: languages

Unsafe Java

2 Comment

Pop quiz. Why is the following Java 8 code unsafe? UPDATE: this code is fine, see comments. Still good to think about, though. Entity e = new Entity(); e.setName(“my new entity”); persistanceLayer.put(e); To provide some context, Entity is a POJO representing something we want to store in a database. And persistanceLayer is an instance of a…

Prime Number sieve in Scala

0 Comment

There are a number of sieve algorithms that can be used to list prime numbers up to a certain value.  I came up with this implementation in Scala. I rather like it, as it makes no use of division, modulus, and only one (explicit) multiplication. Despite being in Scala, it’s not in a functional style. It uses…

Call a Spade a Spade

0 Comment

A cautionary tale of language from Ted Nelson: We might call a common or garden spade– A personalized earth-moving equipment module A mineralogical mini-transport A personalized strategic tellurian command and control module An air-to-ground interface contour adjustment probe A leveraged tactile-feedback geomass delivery system A man-machine energy-to-structure converter A one-to-one individualized geophysical restructurizer A portable…

Is XForms really MVC?

2 Comment

This epic posting on MVC helped me better understand the pattern, and all the variants that have flowed outward from the original design. One interesting observation is that the earlier designs used Views primarily as output-only, and Controllers primarily as input-only, and as a consequence the Controller was the one true path for getting data…

XML 2008 liveblog: Introduction to Schematron

0 Comment

Wendell Piez, Mulberry Technologies Assertion-based schema language. A way to test XML documents. Rule-based validation language. Cool report generator. Good for capturing edge cases. Same architecture as XSLT. (Schematron specifies, does not perform) <schema xmlns=”http://purl.cclc.org/dsdl/schematron”> <title>Check sections 12/07</title> <pattern id=”section-check”> <rule context=”section”> <assert test=”title”>This section has no title</assert> <report test=”p”>This section has paragraphs</report> … Demo….

Fun with xdmp:value()

0 Comment

Lately I’ve been playing with some more advanced XQuery. One thing nearly every XQuery engine supports is some kind of eval() function. MarkLogic has several, but my favorite is xdmp:eval. It’s lightweight because it reuses the entire calling context, so for instance you can write let $v := 5 return xdmp:value(“$v”). Not too useful, but…

The two-line CV

0 Comment

In my about page, I’ve written my CV in two lines. Why don’t you try it, then link back to here? I’ve been known to use this as an interview question, and it’s quite a bit harder than it looks. A clever candidate will turn the paper sideways giving themselves more room to write “two…

14 ways…

1 Comment

When making hash browns xkcd style, there are at least 14 ways it could go badly. That’s not a potato, it’s a misshapen rock. Unexpectedly flammable tennis racket. Sparks landing on gas can. Food poisoning via undercooked hash browns due to limited flame contact time. Broken plate fragments. Dripping, flaming gasoline. Swing and a miss;…

Kindle my disappointment

0 Comment

Where’s Project Gutenberg? One difficulty in launching an ebook platform is the lack of available titles. I keep hearing about 80,000+ titles, but expressed as a percentage of Amazon’s book catalog, it’s minuscule. There should be all kind of public domain titles ready to go on day one. And where’s the Creative Commons books? There’s…

© All Right Reserved
Proudly powered by WordPress | Theme: Shree Clean by Canyon Themes.