Home » Blog

Svenska Utifrån 2

Posted by Roger Keays, 19 February 2009, 12:00 PM

  • visst (adv) - Ja visst!
  • blir (v) - Tre och två blir fem.
  • utan (prep) - Yrken utan artikel.
  • det finns (v) - Det finns flera kapitel i boken.

No comments yet, be the first to comment!

Svenska Utifrån 1

Posted by Roger Keays, 18 February 2009, 12:00 PM

  • om (prep) - Skriv en liten text om det.
  • tyvärr (adv) - Nej, tyvärr jag har inte barn.
  • nästan (adv) - Vi läser svenska nästan varje dag.
  • varje (det) - Varje elev spelar en roll.
  • andra (pn) - Andra läser franska.
  • vid (prep) - Man läser svenska vid universitet.

No comments yet, be the first to comment!

Lexiphanic

Posted by Roger Keays, 10 February 2009, 6:18 PM

  • lexiphanic (adj) - Do you agree that sesquipedalian linguaphiles shouldn't be so lexiphanic?

No comments yet, be the first to comment!

Fluid CSS Menus and Sub-Pixel Workaround

Posted by Roger Keays, 28 January 2009, 1:08 AM

A long standing CSS problem, best described by John Resig in his blog, is the different approach browsers use when rounding widths calculated from percentages. Firefox rounds alternately up and down in order to make elements fit perfectly, Opera and Safari always round down so that elements will never overflow the container, and Internet Explorer always rounds up so elements often overflow their container and developers get to practise using profanities.

My use case is a fluid css menu with no gaps between the elements or at the end. If you don't know how to build css menus you might want to start by reading my blog on css menus. CSS menus are useful because they are built with <ul> and <li> markup which is a natural representation for hierarchies. The problem is that since menu items are floated, using percentage widths does not guarantee the space will used perfectly (unlike tables).

The basic concept behind the workaround is to leave the last element of the list unfloated so it occupies the entire width of the menu bar underneath the floated elements. Essentially the last item has the following style:

.web_cssMenu li.web_last { float: none; width: auto; }

Read more...

2 comments, post a comment!

More Reading

Posted by Roger Keays, 24 January 2009, 5:51 AM

  • polemicist (n) - A polemicist has said 'IT doesn't matter, PR doesn't matter, Marketing doesn't matter'.
  • precocious (n) - They learn rapidly and get far ahead of their age-mates and thus may be viewed as precocious.
  • vicissitudes (n) - Cognitive intelligence offers virtually no preparation for the turmoil life's vicissitudes bring.

No comments yet, be the first to comment!

Onward Travel Extortion

Posted by Roger Keays, 24 January 2009, 3:52 AM

When I left for Singapore in December I gained some unfortunate insight into the nature of the airline business. I was checking in for my flight was asked about my itinery. Since the assistant was having a bad hair day and I was traveling without a return ticket she insisted that I had to buy a return flight before I was allowed to board, citing that proof of onward travel was required to enter Singapore.

Puuuuuurlease!! Singapore?! A laissez-faire democracy covering 650 square km that issues 90 day tourist visas on arrival? I mean, the country is so small you could crawl out on your hands and knees if you had to. No. Nobody in Singapore cares, least of all the immigration officers processing queues and queues of people. BUT, the airlines care because the sooner they get your money the sooner they can put it to work.

Read more...

1 comment, post a comment!

Removing Line Feeds in Java

Posted by Roger Keays, 22 January 2009, 10:18 PM

This should be a fairly cross-platform way to remove line feeds from a string using Java:

string.replaceAll("[\r\n]", "")

Why do the smallest issues always take the longest to resolve?

No comments yet, be the first to comment!

Using Enums in EL

Posted by Roger Keays, 21 January 2009, 11:14 AM

Unfortunately EL has no special support for enums. That makes it especially hard when you need to input enum values (for example from a dropdown box). One simple solution is to add a getter and setter to your bean to marshall the String value to and from an enum:

enum Status { A, B, C, D}

/* EL convenience getters and setters */
public String getStatus_() {
    return (status == null) ? null : status.name();
}
public void setStatus_(String status) {
    this.status = Status.valueOf(status);
}

Now you can build your dropdowns easily like this:

<h:outputText value="Status:"/>
<h:selectOneMenu value="${bean.status_}">
  <f:selectItem itemValue="A" itemLabel="Asleep"/>
  <f:selectItem itemValue="B" itemLabel="Bored"/>
  <f:selectItem itemValue="C" itemLabel="Creative"/>
  <f:selectItem itemValue="D" itemLabel="Dead"/>
</h:selectOneMenu>

In this example I use the underscore on the method name to distinguish it from the regular getter and setter which are not shown.

No comments yet, be the first to comment!

Vim Keybindings for Netbeans

Posted by Roger Keays, 18 January 2009, 3:03 PM

In case you haven't attained vim nirvana with your Netbeans IDE:

http://jvi.sourceforge.net/

No comments yet, be the first to comment!

Singlish 101

Posted by Roger Keays, 15 January 2009, 11:55 PM

One of the great things about Singapore is the expansive range of cultures, food, languages and dialects. They have large Chinese, Malay and Indian populations and their government housing plan ensures that they are mixed relatively evenly. As a result, it's hard to say exactly what language people speak colloquially in Singapore because they switch so often depending on who they are speaking to.

Here are some of my recollections of Singlish, which is pretty similar to Manglish, but with less influence from Malay and more from Chinese (especially WRT pronounciation).

  • Lah - An emphatic particle. If you don't hear a Singaporean say lah, you've probably been dropped off in the wrong country lah.
  • Syllable-final glottal stops - My next favourite feature. Apparently a corollary from Chinese which doesn't have syllable-final consonants. Because of this, Singaporeans replace these consonants with glottal stops. My personal favourite is the word 'stuck' which is pronounced /stəʔ'/ with such an emphasis on the stop it gives you a fright :) A multi-syllable example would be 'Woodlands', pronounced something like /wʊʔ.lɛn/.

Read more...

1 comment, post a comment!