Archive for januar, 2011

Cows in the Maze

mandag, januar 31st, 2011

– and other mathematical explorations

21 chapters of mathematical recreation. Usually I find the professors books rather entertaining, but I must say I’m feeling a bit disappointed about this volume.

It’s off to a good start with “the Lore and Lure of Dice” – the context specific reflection on the question of probability, and the non-transitive dice. Then quickly passing Piet Hein’s board game Hex.

Why we’re introduced to Tarzan and Jane in the midst of an otherwise interesting subject, “Walking with quadropeds” – the patterns of the gaits of four legged animals, I have no idea.

Chapters 7, 8, and 9 touches upon time travel, which – as I recall it – is much more physics and sci-fi than mathematics. Luckily though chapter 10 serves a nice gem – Cone with a Twist – the sphericon.

Chapter 11 touches upon the shape of a drop, and in chapter 12 we’re back to probability and fallacies in The Interrogator’s Fallacy, where we now use Bayes’ theorem and Mathews’s formula. There’s an error in the formula printed on page 173 at the top though, it should be:
P(A|C) = P(C|A) * P (A)/ P(C)

Then we get to the title chapter: Cows in the Maze. And while it has cows and is kind of a maze – it’s not a standard maze, it’s a maze of logic statements.

Leaving the maze on a Knight’s Tour into Cat’s Cradle over Klein bottles (and Möbius bands) into Voronoï celled craters into knots, which again I found a bit disappointing.

The construction of Most Perfect Squares are matched up with Mathematical impossibilities.

The final chapter of the book regards dancing with strings forming regular solids.

Gamification

søndag, januar 23rd, 2011

The idea to use game thinking and game mechanics to solve problems of any kind, raise moral and put an incentive in the hearts of players – which is all of us. It’s funny seeing dogs being trained using quite similar methods.

Games work if they are fun and enticing, but they mainly work for the purposes for which they were built: Entertainment. Sometimes, though, they have a positive side effect in that they actually make the players learn something, if not useful, then at least meaningful. That’s the Mary Poppins notion of “a spoonful of sugar makes the medicine go down.”

Games have been used throughout the ages as means to both entertain and educate – and they do that in an abstract world. The main reason for the sudden hype of gamification is that with internet connected devices we do see a much lower barrier to entry, and the possibility to pick up the game anytime anywhere.

Remove barriers to entry. Automate any mechanical tasks

Taking the card shuffle out of Solitaire or Patience games – or Poker for that matter – doesn’t improve on the gameplay as such, but it makes it a lot easier to pick up the game as well as play it.

Games can be anywhere

It doesn’t have to be a game – it could just be playful behavior, e.g. the VW initiative The Fun Theory – I’m thinking about the Piano Staircase, which reminds me of the piano floor in the 1988 movie “Big” starring Tom Hanks.

Many things are possible if the right idea and implementation arises. Be inspired try out some ideas for yourself, test and tweak them. Dive into the psychology behind predictability of people, the choices we make, and what really drives us.

REST in Practice

søndag, januar 23rd, 2011

by Jim Webber, Savas Parastatidis, and Ian Robinson

The author team takes their RESTBucks coffee shop application through Richardson’s Maturity Model explaining the issues at each level. Java (JAX-RS) and .Net implementations.

Then they go on to explain the importance of Hypermedia, and mentions that the hypermedia is a part of the representation. I’m not quite sure about this.
I tend to disagree with the way they implement this; as a List<Link> member. There are benefits and security issues with this approach. It becomes possible for any client to set a link including overwriting a link. While this can have benefits, the immediate security issues of a client setting e.g. payment links to phishing sites are also present.

They also like to use the Atom and AtomPub envelopes, which I fail to see work on a more common approach, that is, on any other media than formatted text.

The book is more recent though, and a good read.

RESTful Java Web Services

søndag, januar 23rd, 2011

The author, Jose Sandoval, goes over the same application for the different frameworks: JAX-RS, Restlet, RESTEasy, and Struts2. Well, the RESTEasy part is quickly skipped as RESTEasy builds on top of JAX-RS.

I tend to disagree with the way the example code is written, but that could just be down to a difference of opinions or different cultures. It’s important to look at the downloadable example code as the book was written prior to Restlet 2.0 release. The example code covers both versions.

The book has sufficiently many typos and minor flaws that it becomes annoying.

REST und HTTP

søndag, januar 23rd, 2011

German being my 3rd language, this is not the fastest read, but the book seems thorough in its coverage of the subject. The code used for some of the examples is written in Ruby on Rails but focus is more on XML and HTTP headers – which makes it understandable for most readers.

Stefan Tilkov explains some issues with Atom and AtomPub, and why developers may want to use it even though it’s not the best fit for the current application. The major issue with Atom – as I see it – is that it’s yet another envelope, something we should leave alone.

RESTful Web Services

lørdag, januar 22nd, 2011

This book, by Leonard Richardson and Sam Ruby, is prominently called ‘The Bible’ with regards to REST – I think this has more to do with the fact that it’s the first book on the subject than anything else. The “bible” – or should that then be “the word” must be Fielding’s Thesis

Code examples are primarily in Ruby – not that it matters much in the case where the HTTP is more interesting than the underlying code.

As @stilkov mentions: “I agree with at least 80% of it.” – I tend to agree, and I’m hoping that I’m agreeing with Stefan Tilkov in the same 80%

It’s a good book on REST and it leaves open some of the issues still needing closure – if closure is possible.

Relaunch of my stagnant website

lørdag, januar 22nd, 2011

So it has been quite a while since last I touched my website. I’ve now migrated to WordPress, and will most likely start blogging about everything and nothing – primarily in English.

My interests beside food and cake mostly revolves around what’s possible with a computer – luckily that’s just about everything. Yet my main interest – in a jumbled order – are:

  • Games
  • Programming
  • Design – of programs, games, user interfaces
  • Data – large amounts of data
  • Visualization
  • Mathematics
  • Statistics
  • Java, Scala, Groovy – at some point I’ll probably go back to play with Haskell
  • REST, OSGI
  • Android
  • Books

Banankage

lørdag, januar 22nd, 2011

125 gram margarine eller smør

125 gram melis – evt. lidt mindre, hvis der tilsættes brun farin
2 æg
125 gram hvedemel
1 tsk. bagepulver
125 gram bananer uden skræl (de skal helst være godt modne, eller kan et par minutter i ovnen sikkert gøre underværker)
1 spsk. citronsaft
evt. lidt brun farin – hvilket giver en lidt anderledes smag, men sÃ¥ skal der tages noget af sukkeret fra.
evt. en sjat rom. Rom og bananer er som regel en ganske god blanding.
evt. chokolade til glasur.

Rørt dej: Ingredienserne røres sammen i den nævnte rækkefølge (eller kastes i en ond foodprocessor). Sukkeret røres sammen med det bløde fedtstof til massen er hvid og skummende. Rør æggene i, et ad gangen. Hvert æg bør indarbejdes godt i dejen, før det næste tilsættes. Sigt mel og bagepulver i massen, rør rundt indtil en homogen dej forefindes.

Bananen dryppes med citronsaft, moses med en gaffel inden den røres i dejen.

Dejen kan bages i en smørsmurt, melstrøet springform 25 min. ved 200 grader eller i en sandkageform 45 min. ved 185 grader.

Lad kagen hvile 5-10 min. i formen efter den er taget ud af ovnen.

Kagen kan pyntes med bananskiver, der glaseres med citronglasur eller med smeltet chokolade.

Honning Hjerter

lørdag, januar 22nd, 2011

600 gram mel

2 tsk. stødt kanel
2 tsk. stødt nellike
2 tsk. hjortetakssalt
1 tsk. stødt ingefær
30 gram potaske (røres ud i vand)
200 gram smeltet smør eller margarine
500 gram honning
2 æg

OBS: Nybegyndere bør måske nøjes med den halve portion.

Hæld de tørre ingredienser i en skål.

Smelt smør/margarine – kom honningen deri nÃ¥r fedtstoffet er smeltet.

Bland den udrørte potaske i skålen sammen med æg efterfulgt af honning/fedtstofblandingen. Det hele skal æltes sammen til en homogen masse, lad det blot forblive i skålen, da dejen er rimelig tynd på dette tidspunkt.

Ingen panik, ikke mere mel i – det ordner sig, nÃ¥r fedtstoffet sætter sig.

Lad dejen stå koldt et par dage så smagen kan gennemtrænge.

Dejen rulles ud i ca. 1 cm tykkelse. Forme kan bruges til at trykke kager ud, men man kan også forsøge sig ud i frihånd.

Kagerne lægges pÃ¥ en smurt bageplade – brug evt. bagepapir i stedet. Kagerne vil hæve lidt under bagningen og vil iøvrigt ogsÃ¥ løbe lidt ud, sÃ¥ hold et par centimeters afstand imellem dem.

Pladen stilles i en 200 graders varm ovn, hvori kagerne bages i ca. 10 minutter.

Kagerne kan pyntes med chokolade eller hvid glasur (1 æggehvide, 150 gram flormelis, 4 dråber eddike piskes sammen) kan sprøjtes på, når hjerterne er afkølet og tørre.

Man behøver naturligvis ikke pynte kagerne, men jeg syntes, at de er mere saftige – i længere tid – med en skal af chokolade… og sÃ¥ smager det jo godt :o)

Når glasuren er tør pakkes kagerne lufttæt.

Klejner

lørdag, januar 22nd, 2011

2 æg

100 gram melis
revet skal af 1 citron (økoligisk citron, de er ubehandlede)
100 gram smeltet smør eller margarine
50 gram kartoffelmel
250 gram hvedemel
1/2 tsk. bagepulver

olie eller palmin til friturestegningen

Pisket dej: Hele æg og sukker piskes, til det ikke knaser mere og “æggesnapsen” er blevet næsten hvid og ganske luftig. Citronskal tilsættes. Smeltet, afkølet smør røres i. Kartoffelmel, hvedemel og bagepulver sigtes sammen og blandes i lidt efter lidt.

Dejen lægges koldt, til den er fast. Den rulles ud sÃ¥ tyndt som muligt (omkring 2 mm finder jeg passende) og skæres med klejnesporen i 5 cm brede strimler. Strimlerne skæres igen i spidse firkanter (parallellogrammer eller “ruder”). Disse ridses i midten, hvorefter klejnerne vrides. Klejnerne lægges koldt.

Olien eller palminen opvarmes i en tykbundet gryde til 180 grader, eller til det syder om en tændstik, når denne stikkes ned i olien. Klejnerne koges hurtigt heri, 3-4 stykker pr. gang. De affedtes på gråt papir eller køkkenrulle og gemmes i kagedåser, når de er kolde. De kan også lægges i fryseren.

Hvis klejnefedtet skummer og bruser, er det ikke tilstrækkelig varmt. Da må det varmes igennem en tid, før man igen lægger klejner i.

Klejnerne synker til bunds idet de lægges i olien, men stiger hurtigt op til overfladen, så snart en skal har formet sig, og bagepulveret har sørget for luftlommer i klejnen. Alt efter dejens tykkelse skal de ligge kortere eller længere tid (vi snakker få sekunder) i overfladen inden de vendes, så også den anden side bliver gyldenbrun. Dette tager få sekunder.

Advarsel: Frist ikke skæbnen til at hælde mere mel på/i, når dejen skal rulles ud. Mere mel gør dejen porøs, det bliver svært at vride klejerne uden at de knækker. Desuden vil de hyppigt falde fra hinanden under kogningen eller kort derefter samt evt. virke en smule tørre.