A simple non-static logger for Scala

Overview Here’s an idea for a logger that doesn’t rely on it being shared statically. Initialization is done using implicits, which results in less typing when using the actual classes that mixin the Loggable trait. Any object created within such classes will also get access to these implicits. This lets the implicit arguments propagate forward…

Preparing pdf-documents for the ebook reader

Briss Getting the best resolution for pdf-documents on the an ebook reader like kindle isn’t always easy, but there’s a great program available for “trimming” your pdfs. With the Java-based open-source software Briss, you can remove unnecessary margins by cropping the even and odd pages of a pdf-document. The end-result is a pdf-document that better…

Setting up an Ant build script for your Scala project

Introduction This is a small writeup which gives one way of setting up a build system for your Scala project. Here Apache Ant is used for managing this process, where the whole configuration is contained within a single build.xml file placed in the project’s root directory. Execution is done from command line or within your…

@tuple – experimenting with lisp-like syntax as XML replacement

Motivation The following post describes an experimental format which has a lisp-like syntax, with hints of JSON, for storing tree-structured data as text. The main motivation was a need to have a less verbose alternative to XML, but still be readable and editable, support pattern matching and transformation, include common binary datatypes, and enable structural…

Trait-like CSS on HTML

Defining some CSS types One way of structuring the CSS is to define some types over the CSS classes. What these types might be may be is open, but one instance might be Behaviour, Layout and Roles. The types are not used explicitly in the CSS, but are there to help organize and abstract the…

Reminders on Scala syntax

Reminders The companion object (both for own code and Scala’s API) // The class definition with primary constructor class Node protected (val a: String, private var b: String) { // imports definitions in companion object import Node._   // attributes and primary constructor code var busy = false   // methods override def toString() =…

Simple serialization with XML strings in Javascript

Introduction Included in this post are some quick and simple functions for doing XML serialization in Javascript through strings. Reserved XML characters < > & ‘ ” are escaped from input and if any invalid input are found an exception will be thrown. List of XML utility functions: toXmlHeader() – Creates the XML header. toXmlElem(name:…

Comparison against null and undefined in Javascript

Values in Javascript can come from Object – object reference String – immutable, 16-bit USC-2 Boolean – true, false Number – only 64-bit floating point, IEEE 754 (double) null – empty object reference undefined – unassigned variables and function arguments, missing object properties Boolean evaluation of values using == and != operators Values that are…

Deep Pocket Layout – tree-based UI layout

Overall idea The Deep Pocket Layout is a specialized tree data-structure for use in non-overlapping layout of widgets. This data-structure can be used for partitioning screen-space, like the quadtree or kd-tree data-structures, and uses the naming conventions of border layout. In usage, it functions as a tree of either vertically or horizontally linked partitions. Much…

Code documentation for Javascript and Actionscript 3

Prerequisites for Actionscript documentation Flex 2 SDK Prerequisites for Javascript documentation JSDoc For Windows users: ActivePerl HTML::Template – Perl module required by JSDoc For Windows users: Microsoft NMAKE – Build utility required by ActivePerl to install HTML::Template Actionscript 3 Code Documentation Example documentation: /** * class-description */ class-declaration/** * class-description */ class-declaration /** * method-description…