Don’t read this if you plan to listen to the Pimsleur Mandarin audio course!

Posted by eamonn on March 7th, 2010 filed in Language
Comment now »

I like the Pimsleur courses a lot. They allow you to get to a very basic speaking level in a language very quickly.

The courses are audio-only — in fact, they expressly discourage you from reading the language while you are listening to the course.

Nevertheless, now that I am finished the first eight lessons I feel
the need to actually see what the written Chinese (both pinyin and
characters) looks like. So here is the vocabulary from Pimseur Quick
and Simple Chinese Mandarin, Lesson 1. I show both the standard
pinyin and in my own phonetic impression of how the words sound.

Words (with translations from Pimsleur)
对不起 dui4 bu5 qi3 dway boo chee excuse me
英文 Ying1 wen2 een wen English (language)
hui4 whey can
shuo1 shwa speak
ni3 nee you
bu4 boo not
ma5 ma ?
请问 qing3 wen4 chin wen please let me ask
wo3 w’awe I/me
普通话 pu3 tong1 hua4 poo tung hwah common language / Mandarin Chinese (PRC)
一点 yi1 dian3 ee dyar some / a little
美国 Mei3 guo2 may gw’awe America
ren2 yren person
shi4 shr am/are/is
Characters (with translations from MDBG)
yi1 ee one; a, an; alone
bu4 boo no, not; un-; negative prefix
ren2 yren man; people; mankind; someone else
hui4 whey assemble, meet together; meeting
ni3 nee you, second person pronoun
ma5 ma (question tag)
guo2 gw’awe nation, country, nation-state
dui4 dway correct, right; facing, opposed
wo3 w’awe our, us, i, me, my, we
wen2 wen literature, culture, writing
shi4 shr indeed, yes, right; to be; demonstrative pronoun, this, that
pu3 poo universal, general, widespread
dian3 dyar dot, speck, spot; point, degree
mei3 may beautiful, pretty; pleasing
ying1 een petal, flower, leaf; brave, a hero; England, English
hua4 hwah speech, talk, language; dialect
shuo1 shwa speak, say, talk; scold, upbraid
qing3 chin ask, request; invite; please
qi3 chee rise, stand up; go up; begin
tong1 tung pass through, common, communicate
wen4 wen ask about, inquire after




Document image segmentation

Posted by eamonn on February 26th, 2010 filed in bookmarks
Comment now »


One of my patents just got granted. "Image layout constraint generation"

Posted by eamonn on February 24th, 2010 filed in bookmarks
Comment now »


Wired and Adobe's concept of what a digital version of Wired would look like on an iPad.

Posted by eamonn on February 22nd, 2010 filed in Consumer Media
Comment now »


Part of the answer of how to remove objects from PDF.

Posted by eamonn on February 16th, 2010 filed in Programming
Comment now »


Reddis and Akka — two interesting technologies for fast, light-weight distributed programming

Posted by eamonn on February 15th, 2010 filed in Programming
Comment now »


Decluttered API documentation for the iText PDF-manipulating Java library

Posted by eamonn on February 15th, 2010 filed in Programming
Comment now »

The iText library is a great resource for generating and manipulating PDF files. However its API is very complex and there is a notable lack of good online tutorial material. So you often must resort to plowing through the Javadoc-generated API documentation trying to figure out how to use the library.

Doing that, you might be annoyed at the fact that the API available online does not just include the public and protected members, but also includes package-private and private members. While this would be useful to people working on the internals of iText, it is just a lot of useless clutter to most people who are just going to use the API.

So I regenerated the Javadoc from the 5.0.1 source, using the default settings which hides the private stuff. You can access this at:

http://eamonn.org/itextpdf-5.0.1-api/


Debunking Airnergy with some back-of-the-envelope calculations

Posted by eamonn on February 14th, 2010 filed in Science
Comment now »

I have seen several reverences to Airnergy device by RCA that claims to recharge a battery by harvesting WiFi signals from the air.

That sounded a bit fishy to me. Let’s look at some numbers. First, how much power does a WiFi hotspot put out? According to moonblinkwifi.com a typical output is 200 mW.

Now say this device is 3 metres (10 feet) away from the hotspot. This 200 mW of power will be spread on the surface of a 3 metre-radius sphere with a surface area of about 110 square metres.

Now, this device looks to be about 10cm X 5cm which is about 1/22000 of the area of the sphere across which the 200 mW is spread. Which means the amount of power hitting the device is about 9.1 μW

Now according to the Wikipedia battery article a small AAA rechargeable battery stores about 6700 J of energy. How long would it take to recharge a AAA battery with our 9.1 μW of power, assuming you could miraculously capture 100% of the power?

The answer: 24 years.

OK, there are some approximations here. The WiFi antenna does not actually broadcast equally in all directions, and you might have the device closer to the antenna, and there might be multiple WiFi signals you could receive. On the other hand, you probably want to recharge a battery that has more capacity than a little AAA battery.

So I call bullshit. A battery charger that takes on the order of a decade to recharge a battery, is a useless device.

The sad thing is how many tech journalist sites reported uncritically on the Airnergy.


50 Most Frequently Used Chinese Characters Presented in an Easy-to-Learn Way

Posted by eamonn on February 13th, 2010 filed in Language
Comment now »

I created this list of Chinese characters for my own benefit in trying to learn them. I took Jun Da’s list of most frequently used characters and added a Google image search to provide some mnemonics. I added tone-color and exaggerated tone marks to the pinyin to help remind me of the the tones.

See this on a separate page with links to shorter and longer lists of characters.

(Note, this may look ugly if you are using Internet Explorer. It should look better on Firefox, Chrome, or Safari. I need to do a bit more CSS-hacking to make it work on IE.)




Loading …

de di´di`

(possessive particle)/of, really and truly, aim/clear

Loading …

yi¯

one/1/single/a(n)

Loading …

shi`

is/are/am/yes/to be

Loading …

bu`bu´

(negative prefix)/not/no

Loading …

le liao˘liao`

(modal particle intensifying preceding clause)/(completed action marker), to know/to understand/to know, clear, look afar from a high place

Loading …

zai`

(located) at/in/exist

Loading …

ren´

man/person/people

Loading …

you˘

to have/there is/there are/to exist/to be

Loading …

wo˘

I/me/myself

Loading …

ta¯

he/him

Loading …

zhe`zhei`

this/these, this/these/(sometimes used before a measure word, especially in Beijing)

Loading …

ge`

(a measure word)/individual

Loading …

men

(plural marker for pronouns and a few animate nouns)

Loading …

zhong¯zhong`

within/among/in/middle/center/while (doing sth)/during/China/Chinese, hit (the mark)

Loading …

lai´

to come

Loading …

shang`

on/on top/upon/first (of two parts)/previous or last (week, etc.)/upper/higher/above/previous/to climb/to go into/above/to go up

Loading …

da`dai`

big/huge/large/major/great/wide/deep/oldest/eldest, doctor

Loading …

wei´wei`

act as/take…to be/to be/to do/to serve as/to become, because of/for/to

Loading …

he´he`huo´huo`

and/together with/with/peace/harmony/union, cap (a poem)/respond in singing, soft/warm, mix together/to blend

Loading …

guo´

country/state/nation

Loading …

de di`

(subor. part. adverbial)/-ly, earth/ground/field/place/land

Loading …

dao`

to (a place)/until (a time)/up to/to go/to arrive

Loading …

yi˘

to use/according to/so as to/in order to/by/with/because/Israel (abbrev.)

Loading …

shui`shuo¯

persuade (politically), to speak/to say

Loading …

shi´

o’clock/time/when/hour/season/period

Loading …

yao¯yao`

demand/ask/request/coerce, important/vital/to want/to be going to/must

Loading …

jiu`

at once/then/right away/only/(emphasis)/to approach/to move towards/to undertake

Loading …

chu¯

to go out/to come out/to occur/to produce/to go beyond/to rise/to put forth/to occur/to happen/(a measure word for dramas, plays, or operas)

Loading …

hui`kuai`

can/be possible/be able to/to assemble/to meet/to gather/to see/union/group/association, to balance an account/accounting

Loading …

ke˘

can/may/able to/certain(ly)/to suit/(particle used for emphasis)

Loading …

ye˘

also/too

Loading …

ni˘

you

Loading …

dui`

couple/pair/to be opposite/to oppose/to face/for/to/correct (answer)/to answer/to reply/to direct (towards sth)/right

Loading …

sheng¯

to be born/to give birth/life/to grow

Loading …

neng´

can/may/capable/energy/able

Loading …

er´

and/as well as/but (not)/yet (not)/(shows causal relation)/(shows change of state)/(shows contrast)

Loading …

zi˘zi

11 p.m.-1 a.m./1st earthly branch/child/midnight/son/child/seed/egg/small thing, (noun suff.)

Loading …

na˘na`nei`

how/which, that/those, that/those/(sometimes used before a measure word, especially in Beijing)

Loading …

de´de dei˘

obtain/get/gain/proper/suitable/proud/contented/allow/permit/ready/finished, a sentence particle used after a verb to show effect/degree or possibility, to have to/must/ought to/to need to

Loading …

yu´

(surname), in/at/to/from/by/than/out of

Loading …

zhao¯zhao´zhe zhu`zhuo´

catch/receive/suffer, part. indicates the successful result of a verb/to touch/to come in contact with/to feel/to be affected by/to catch fire/to fall asleep/to burn, -ing part. (indicates an action in progress)/part. coverb-forming after some verbs, to make known/to show/to prove/to write/book/outstanding, to wear (clothes)/to contact/to use/to apply

Loading …

xia`

under/second (of two parts)/next (week, etc.)/lower/below/underneath/down(wards)/to decline/to go down/latter

Loading …

zi`

from/self/oneself/since

Loading …

zhi¯

(literary equivalent of 的)/(subor. part.)/him/her/it

Loading …

nian´

year

Loading …

guo`

(experienced action marker)/to cross/to go over/to pass (time)/to celebrate (a holiday)/to live/to get along/(surname)/excessively/too-

Loading …

fa¯fa`

to send out/to show (one’s feeling)/to issue/to develop, hair

Loading …

hou`

empress/queen/surname, back/behind/rear/afterwards/after/later

Loading …

zuo`

to regard as/to take (somebody) for/to do/to make

Loading …

li˘

inside/internal/interior, village/within/inside, Chinese mile/neighborhood/li, a Chinese unit of length = one-half kilometer/hometown



Scalate: a lightweight alternative to the Lift Scala web framework

Posted by eamonn on February 3rd, 2010 filed in bookmarks
Comment now »

  • So far, Lift has been the only Scala-specific way of creating web applications. Scalate offers a lightweight alternative, though purists will shudder at how functionality and presentation are mixed willy-nilly.
    (tags: programming)


links for 2010-02-01

Posted by eamonn on February 1st, 2010 filed in bookmarks
Comment now »


Free BBC Online Chinese Course

Posted by eamonn on January 30th, 2010 filed in bookmarks
Comment now »


Handy summary of SBT commands

Posted by eamonn on January 25th, 2010 filed in Programming
Comment now »


Add a button to your browser to translate selected Chinese characters from a web page

Posted by eamonn on January 23rd, 2010 filed in Futzing
Comment now »

You can now use Google to do some pretty readable translation of Chinese-language web sites.

However if you are trying to learn Chinese it would be better to be able to look at a page in its original Chinese, try to figure out the meaning and pronunciation of the characters, and to selectively translate the just ones you do not understand. Hopefully, just like using flashcards, you would eventually learn more and more characters.

As a first step I built a simple crude tool to do this. It is a little web-browser add-on button (a bookmarklet).

(So far, it seems to only work properly on Firefox. I have had some problems on Chrome and IE. I have not yet tested it on Safari.)

To install it, drag this button Explain Chinese into your browser’s links bar or bookmark bar. You should end up with an “Explain Chinese” button in your browser.

To use this button, highlight some Chinese characters, such as these ones 你好, and click the “Explain Chinese” button. It should open up two new pages with translations of the characters, one by Google which usually gives a fairly idiomatic translation of the text, and another one by the MDBG dictionary which breaks the translation down into the individual words and characters, and gives the pinyin and audio pronunciation.

Enjoy!

(Properly formatted version of this article is at http://www.eamonn.org/blog/?p=643 )


See real example results of website optimization A/B tests

Posted by eamonn on January 23rd, 2010 filed in Programming
Comment now »

One of the big advantages of creating Web products is that effectiveness can be immediately measured. One lucrative example of this is click-through web advertising.

Another example is A/B testing where you can put up two different versions of a web page, each visitor randomly seeing one version or the other. You can then measure the comparative effectiveness of each version of the web page, measured in terms that you care about, such as the percentage of visitors that buy your product.

Here is one example from the Firefox download page
Try Firefox 3Download Now - Free

The only difference between these two versions is that the download button in the first has the text “Try Firefox 3″ while in the second it has “Download Now – Free”. Over almost 300,000 trials the first one resulted in 9.7% of the visitors downloading Firefox, while the second one resulted in 10.1% downloads. By repeatedly doing A/B tests, changing one thing at a time, you can incrementally increase your conversion rate — using actual evidence rather than guesses or conventional wisdom.

This and many other examples are on the abtests.com web site, which provides a fascinating insight into this technique. Here people share the results of their A/B tests, rarely available because most companies regard them as proprietary.

What is particularly interesting is that these are not all good A/B tests. Some are badly designed, and some have such small sample size that the results are not statistically significant. By reading through the comments that people make you can learn best practices to follow and also bad practices to avoid.

All in all abtests.com is an interesting site, and I hope people keep on sharing tests there.


Learning from Graphic Designers — Grids as Scaffolding for Automatic Layout

Posted by eamonn on January 21st, 2010 filed in Consumer Media
Comment now »

A presentation I gave yesterday at the “Imaging and Printing in a Web 2.0 World” conference (part of the broader Electronic Imaging Conference) in San Jose:


Man hole

Posted by eamonn on January 18th, 2010 filed in Photo
Comment now »

From MSNBC “2007: Floodwaters drain in Latvia: A Riga, Latvia, city worker stands on a manhole cover he removed to allow floodwater in Riga’s Krasta Street to escape like bathwater down the drain”


Some Maven repos (handy for SBT too)

Posted by eamonn on January 16th, 2010 filed in bookmarks
Comment now »


Nginx is a popular reverse proxy.

Posted by eamonn on January 12th, 2010 filed in Programming
Comment now »


How you might create a Scala matrix library in a functional programming style

Posted by eamonn on January 10th, 2010 filed in Programming
Comment now »

Sure you can program in Scala just like you would in Java and get all the advantages of the cleaner syntax. But if you really want to explore the power of Scala you should try some functional programming.

One way to tell if you are programming in a largely functional manner is if you prefer val declarations to var declarations and if you prefer immutable to mutable classes.

To implement matrices, let’s leverage the immutable lists generated by Scala’s default List(...) call.

Arbitrarily choosing a row-major representation, we will represent a row of a matrix as as a list of doubles. For convenience let’s create a type alias for that:

  type Row = List[Double]

A matrix can then be a list of rows:

  type Matrix = List[Row]

One fundamental operation we will be doing is a dot product. Let’s implement this in map-reduce style:

  def dotProd(v1:Row,v2:Row) =
    v1.zip( v2 ).map{ t:(Double,Double) => t._1 * t._2 }.reduceLeft(_ + _)

The zip method combines together two parallel lists of numbers into a single list of pairs of numbers. The map method multiplies the elements of each of these pairs together. The reduceLeft method sums the numbers of the list to create a single number.

OK, now let’s see how we can create some of the standard matrix functions.

First here is how we can transpose a matrix:

  def transpose(m:Matrix):Matrix =
    if(m.head.isEmpty) Nil else m.map(_.head) :: transpose(m.map(_.tail))

Notice this is a recursive function. It uses the construct firstRow :: remainderOfRows to form the list of rows that is the output matrix. It calculates the first row of the output matrix by using map to get the first element of each row of the input matrix. It gets the remainder of the rows by recursively getting the transpose of the matrix formed by the tail of each input row (i.e. every element except the first one).

How about matrix multiplication? That turns out to be pretty straightforward using standard Scala “for comprehensions”:

  def mXm( m1:Matrix, m2:Matrix ) =
    for( m1row <- m1 ) yield
      for( m2col <- transpose(m2) ) yield
	dotProd( m1row, m2col )

Here we directly implement the matrix multiplication formula, iterating through the rows of the first matrix and the columns of the second matrix, and calculating the dot-product of each. Note that to iterate over the columns of a matrix we actually iterate over the rows of the transpose of the matrix.

However it would be nice to be able to use standard mathematical operators like A*B and AT when coding with matrices. Well, we can using the power of Scala's operator identifiers, infix syntax, and implicit conversion:

case class RichMatrix(m:Matrix){

  def T = transpose(m)

  def *(that:RichMatrix) = mXm( this.m, that.m )

}

  implicit def pimp(m:Matrix)  = new RichMatrix(m)

The user of this library need never explicitly instantiate any RichMatrix objects -- they are automatically created from List[Double[Double]] object whenever the T or * method is called on it.

This allows you to do things like:

    val M = List(
      List( 1.0, 2.0, 3.0 ),
      List( 4.0, 5.0, 6.0 )
    )
    val MT = List(
      List( 1.0, 4.0 ),
      List( 2.0, 5.0 ),
      List( 3.0, 6.0 )
    )

    M.T  must_==  MT

    val A = List(List( 2.0, 0.0 ),
		 List( 3.0,-1.0 ),
		 List( 0.0, 1.0 ),
		 List( 1.0, 1.0 ))
    val B = List(List( 1.0,  0.0, 2.0 ),
		 List( 4.0, -1.0, 0.0 ))
    val C = List(List(  2.0,  0.0, 4.0 ),
		 List( -1.0,  1.0, 6.0 ),
		 List(  4.0, -1.0, 0.0 ),
		 List(  5.0, -1.0, 2.0 ))
    A * B  must_==  C

While we are at it we might as well add a few more convenience methods to the RichMatrix:

case class RichMatrix(m:Matrix){

  ...

  def apply(i:Int,j:Int) = m(i)(j)

  def rowCount = m.length
  def colCount = m.head.length

  def toStr = "\n"+m.map{
    _.map{"\t" + _}.reduceLeft(_ + _)+"\n"
  }.reduceLeft(_ + _)

}

The apply method is a special method invoked when the parenthesis operator is applied to an object. It allows you to, for example, do c(1,3) to get the number on the second row, fourth column of the matrix. Note that this method should not be used in performance-sensitive inner loops because it is not efficient. A matrix uses linked-lists as storage so the element access is O(N) not O(1) as would be the case if the matrix used arrays.

The rowCount and colCount methods are I hope obvious.

The toStr returns a string representation of the matrix in a nice tabular format that is much easier to than the default toString method if List[List[Double]], Note how this is done with two nested map/reduce pairs.

Now, creating a matrix using the List( List(...), List(...), ... ) syntax is fine for small matrices, but what if we want to generate large matrices? One way to do this is:

object Matrix{
  def apply( rowCount:Int, colCount:Int )( f:(Int,Int) => Double ) = (
      for(i <- 1 to rowCount) yield
	( for( j <- 1 to colCount) yield f(i,j) ).toList
    ).toList
}

This allows you do do things like:

    // 100x200 matrix containing random elements
    val A =  Matrix(100,200) { (i:Int,j:Int) =>
      random
    }

    // 5x5 identity matrix
    val I = Matrix(5,5) { (i:Int,j:Int) =>
      if(i==j) 1.0 else 0.0
    }

Note that everything above is pure-functional: all the objects are immutable and each function is implemented as a single expression.

That's it for now. There is obviously a lot more we would have to add to make this a useful, production-quality library,

(If you want to try this yourself, you can download the complete source code and the BDD-style regression test that demonstrates its use.)


Scala tip: Making it easier to add attributes to an XML element

Posted by eamonn on January 7th, 2010 filed in Programming
Comment now »

In most respects Scala makes it very easy to handle XML, but there are a few things that are hard to do. One is changing the value of an existing attribute on an element, or adding a new attribute to an element.

The simplest way I found to add new attributes c="CCC" d="DDD" is to do:

    val modified = elem %
                    new UnprefixedAttribute("c","CCC",Null) %
                    new UnprefixedAttribute("d","DDD",Null)

This is a bit verbose. What if instead you could do

    val modified = elem % Map( "c"->"CCC", "d"->"DDD" )

Well you can, if you add the following implicit somewhere in scope:

    implicit def pimp(elem:Elem) = new {
      def %(attrs:Map[String,String]) = {
        val seq = for( (n,v) <- attrs ) yield new UnprefixedAttribute(n,v,Null)
        (elem /: seq) ( _ % _ )
      }
    }

This uses the library pimping pattern discussed elsewhere to effectively add a new version of the % operator to Elem that takes a Map of attributes.

The new % operator uses a for-yield construct to convert the attrs Map into a sequence of UnprefixedAttribute objects. It then uses the /: fold operator to repeatedly apply the built-in % operator, reducing down to an element with all the attributes added.


A pastebin that actually executes your code.

Posted by eamonn on January 5th, 2010 filed in Programming
Comment now »


Another contender in the ebook space

Posted by eamonn on December 31st, 2009 filed in Consumer Media
Comment now »


Some handy tips including useful code snippets for the CSS programmer.

Posted by eamonn on December 28th, 2009 filed in Programming
Comment now »


links for 2009-12-21

Posted by eamonn on December 21st, 2009 filed in bookmarks
1 Comment »


Scala Class, an online resource to make it easier to learn the Next Big Language

Posted by eamonn on December 21st, 2009 filed in Programming
Comment now »

I believe that Scala is poised to take off as the successor to Java as the main programming language for programming on the Java virtual machine. However, I have found the online resources for learning the language to be a bit weaker than for some other programming languages, so I set up scalaclass.com where I gather together material to get you started and support your continued development in this interesting new language. The site is still in embryonic form, but I welcome your initial comments.


An idiom for cleaner pimping of libraries in Scala

Posted by eamonn on December 19th, 2009 filed in Programming
Comment now »

In dynamic languages like JavaScript and Ruby you can modify existing classes, including system classes, with extra methods. This can be a very handy, if dangerous, technique.

Scala, being a static language does not allow this same technique. But it does allow the use of implicit functions to get the same effect. For example the standard idiom to add sine and cosine methods to the Double class is

class PimpedDouble(x:Double){
  def sin = Math.sin(x)
  def cos = Math.cos(x)
}
implicit def pimpDouble(x:Double) = new PimpedDouble(x)

This has the effect of adding sin and cos methods to Double, though what is actually happening is that Double values are automatically converted to PimpedDouble values when doing so would correctly compile.

This is very clever and very handy, but the idiom is a little clumsy, compared to most of Scala’s elegant features. It is annoying to have to invent two names PimpedDouble and pimpDouble that are never referred to anywhere else in the code.

Can we do better? Yes we can. We can make the extra class be an anonymous class, which leaves only one arbitrary unreferenced name and also reduces the size of the code.

implicit def pimpDouble(x:Double) = new {
  def sin = Math.sin(x)
  def cos = Math.cos(x)
}

That seems a lot nicer to me.

Using either of the above techniques you can now do things like

  val x = 0.5 cos
  val y = 0.5 sin

which is taking the cosine and sine of the Double value 0.5

(Thanks to Daniel whose stackoverflow posting first brought this idiom to my attention.)


Here is a form that will speak out any English text you type into it.

Posted by eamonn on December 15th, 2009 filed in Programming
1 Comment »

  • You can craft a URL that will take advantage of Google’s web service to do test-to-speech of arbitrary English text like this
    http://translate.google.com/translate_tts?tl=en&q=some+text+separated+by+plus+signs

    This can easily be extended to work in a form. (Note, I found by trial-and-error that the text cannot have more than about 100 characters, so I limited how much you can type or paste into the text box.)

    Try entering some text and to see for yourself!

    There was some problem with the Internet Explorer browser. If you get a “not found” error page, try refreshing the error page. That worked for me.

    It worked fine in the Google Chrome browser.

    (tags: webservices)


Sproutcore, a Rails-like approach to client-side web programming

Posted by eamonn on December 14th, 2009 filed in Programming
Comment now »


Circular BIST with Partial Scan

Posted by eamonn on December 14th, 2009 filed in bookmarks
Comment now »

At AT&T Bell Labs in Princeton I worked on this particular type of built-in self-test for chip design. These technologies are now commonplace, but back then it was cutting edge.


An Agile Approach

Posted by eamonn on December 13th, 2009 filed in HP, Programming
Comment now »


The research I did in my first job out of college

Posted by eamonn on December 9th, 2009 filed in Programming
Comment now »


Building iPhone web apps that look like native apps

Posted by eamonn on December 8th, 2009 filed in Programming
Comment now »


Mandarin Chinese class I plan to take

Posted by eamonn on December 6th, 2009 filed in Personal, San Francisco
Comment now »


Java library to render PDF

Posted by eamonn on November 5th, 2009 filed in Programming
Comment now »


Functional programming library for JavaScript

Posted by eamonn on October 31st, 2009 filed in Programming
Comment now »


Publishing is going to be disrupted by new technology, probably in unforeseen ways.

Posted by eamonn on October 27th, 2009 filed in Consumer Media
Comment now »


How to make native-looking mobile web apps that can get location information and respond to the accelerometer.

Posted by eamonn on October 12th, 2009 filed in Programming
Comment now »


Getting free maps of Turkey for a Garmin

Posted by eamonn on October 10th, 2009 filed in Travel
Comment now »


The jodconverter Java library is handy for converting office document formats

Posted by eamonn on October 9th, 2009 filed in Programming, bookmarks
Comment now »


EPUB Electronic Book Format

Posted by eamonn on October 3rd, 2009 filed in Consumer Media, bookmarks
Comment now »


Advice on how to scale images in Java

Posted by eamonn on October 1st, 2009 filed in Programming, bookmarks
Comment now »


Using Scala to make it easy to do parallel/GPU programming.

Posted by eamonn on September 30th, 2009 filed in Programming, bookmarks
Comment now »


links for 2009-09-20

Posted by eamonn on September 20th, 2009 filed in bookmarks
Comment now »


Calling Java from XUL applications

Posted by eamonn on September 19th, 2009 filed in bookmarks
Comment now »


Equations for converting between different colour spaces

Posted by eamonn on September 15th, 2009 filed in bookmarks
Comment now »


How to make a live USB Ubuntu, with persistence

Posted by eamonn on September 6th, 2009 filed in bookmarks
Comment now »


How itext can be used to place text boxes in PDF.

Posted by eamonn on September 2nd, 2009 filed in bookmarks
Comment now »


Handy network monitoring tool

Posted by eamonn on September 1st, 2009 filed in bookmarks
Comment now »


Keyboard Not Working in Xorg After Booting Ubuntu

Posted by eamonn on August 19th, 2009 filed in bookmarks
Comment now »


Comprehensive guide for how to make your web apps secure.

Posted by eamonn on August 18th, 2009 filed in bookmarks
Comment now »


How a Scala script can specify what JARs should be added to its CLASSPATH

Posted by eamonn on August 17th, 2009 filed in Programming
4 Comments »

The reason the Scala programming language has such a name is that it is meant to be scalable, i.e. good for both small scripts and large software systems. I am already convinced that Scala is as good, if not better than Java for the large-scale development, but what about the small scale?

Well it turns out that on Linux if you chmod +x a scala script you can make it executable with a bit of shebang magic as shown by this complete, runnable script:

#!/bin/sh
exec scala $0 $@
!#
println("Hello World"!")

(You do have to make sure that “scala” is in your executable path.)

But what if you are using a scala script to control an existing Scala or Java system? It would be nice to express the CLASSPATH requirements in the script itself rather than depending on the calling environment to be configured correctly. Well, I came up with this convenient idiom to collect all the JAR files in a lib directory and add them to the CLASSPATH:

#!/bin/sh
L=`dirname $0`/../lib
cp=`echo $L/*.jar|sed 's/ /:/g'`
exec scala -classpath $cp $0 $@
!#
import com.my.special.World
val world = new World
world.hello

This assumes that all the required JAR files are in directory ../lib relative to the script file.


Gluster is a distributed file system, open source but with commercial support option.

Posted by eamonn on August 15th, 2009 filed in bookmarks
Comment now »


Example of tilted text (Safari or Chrome)

Posted by eamonn on August 11th, 2009 filed in bookmarks
Comment now »


Riak is a “nosql” database, similar to CouchDB

Posted by eamonn on August 8th, 2009 filed in bookmarks
Comment now »


How Amazon builds and scales its systems

Posted by eamonn on August 6th, 2009 filed in bookmarks
Comment now »


Announcing Goat Rodeo

Posted by eamonn on August 4th, 2009 filed in bookmarks
Comment now »


Single-tier web applications with static files and CouchDB

Posted by eamonn on August 3rd, 2009 filed in bookmarks
Comment now »


Biologically inspired attempt to overcome scalability problems of Linda

Posted by eamonn on August 2nd, 2009 filed in bookmarks
Comment now »


links for 2009-08-01

Posted by eamonn on August 1st, 2009 filed in bookmarks
Comment now »