Why the headphone jack should go at the top.

When pocket radios came out they always had the headphones somewhere near the top. At some stage some designers wanted to be different and have it at the bottom.

One can make various reasons pro top or pro bottom.

Pro Top:

  • When holding the phone upright, the jack will be closer to upper objects such as your head which will give the cable better reach ability for the same length.
  • When holding the phone upright, you can more easily see the jack when you are .

Pro Bottom:

  • You can put the phone in your lower pocket more easily.
  • When using a phone stand the cable can be more easily tucked away.

There is another more complex reason why I like the audio jack to be at the top. Phones can be very slippery. With the buds in your ear and the phone in your pocket, you can easily have it catch onto something.  Your phone can fly into the air and easily break apon landing.

By making the phone easy to shift in your pocket it is now easy to slip out. By having the jack at the top although it’s harder stuff it in your pocket, it’s also less likely to fall out.

When the jack is at the bottom of your pocket the phone literally has to rotate all around before it has any energy to fly out. By this stage it’s much more likely that your ear buds will pull out instead and end up hanging somewhere above your feet.


Why you should put doctype html at the top of your document

If you create the following html document:

It will render like this.


If you add <!doctype html> to the top of your document like this:

It will render like this.


What happens is that browsers such as firefox will think that you are viewing an old website so they will try and render websites how they used to be rendered. This old way of rendering is called “Quirks mode”. Adding <!doctype html> signifies that you are writing a modern webpage so the browser does not render using quirks mode.

A taste of tag soup

TagSoup is a library to parse non compliant HTML.

To explain why you might want this, lets start by considering the following table.

Notice the missing closing td tag.

This still, in a browser renders as a table, border and all.

Though I don’t have the actual stats, judging by how often I may mistakes in my own HTML, I think this I a valid enough reason to suspect the html you try to parse may not be compliant.

The problem is, a strict XML parser would not parse this. What we need is a parser which is lenient enough to parse malformed HTML with some degree of usefulness. Remote controlling a browser session would be a novel solution but it does incur a few overheads making it slower, harder to build and harder to code. Let’s see how far we can get with some common xml parsers.

For example, using the popular HaXml the following error is produced when trying to parse the following source document.

This library is way to strict to parse bad html. Let’s try another. This time we will try the package known on hackage as simply xml

Slightly better, but as you can see the closing i tag is counted as text just like hello.

Now, this time, we’ll try using TagSoup.

What is Tagsoup? Tagsoup is a library for parsing and re-rendering html.

To get it,

After having done that. You can do some scraping. But first you might want to do some reading on the library by doing an online search for “tag soup haskell”.

Also, if you do not know what “tag soup” is you might want to read up the page on wikipedia.

With that out of the way,

First import tagsoup

Now we can try and parse the broken HTML again.

…Now we’re getting somewhere.

As a small demonstration of the library, let’s extract just the text from the html document.

So here you see a library which is capable of handling broken html documents in a fairly more malleable way than the usual xml library.

The cross compatibility/targeted system trade off.

Why do some people use android and other ios?

Why do some people like windows and other MacOS?

Why do some people like to write apps in Java while others dot net.

Why do some people like web apps while others like native apps?

You will find that apps made for one system that just aren’t available in the same way on the others systems and one reason for this is because some environments are more cross compatible than others. This compatibility however, comes at a price.

Often cross platform code is slower because it has to run through an interpreter. The java script with web applications is one example. Even Java byte code has to run through extra interpretation before being run.

Often the abstraction layers do not provide the complete functionality of all the systems they target and just provide a subset. Someone developing for Windows using dot net might be able to add context menus to File Explorer but someone using Java may not do that because they are trying to create a consistent experience across systems where adding custom context menus is not possible. Also, web apps do not currently allow for as much data to be stored locally as native apps. A Cross Platform developer might have to support a wider array of hardware such as monitors with different resolutions so they might settle for a simpler UI for speed of development.

The more targeted developer can make more assumptions about Ram availability. While developers in the past have tried to put “Recommended Hardware Requirements” on the box, it can be hard to expect users to check it. Even for the experienced software buyer it can greatly complicate the software availability landscape to the end user.

In summary.

  • If each individual who uses your app will use it a lot of the time, use native as the experience can be better custom fit.
  • If you want your app to be fast use native
  • otherwise, provided the first two conditions are not met, if you want to target a large audience use an environment which is more cross platform.


Google Search Bar dilemma

Note: this is an old article I wrote around 2004 which I have transferred to this blog.


You go over to your friend(some friend…) house or anywhere which has a stock installation of IE and you realize:
“Oh no, my Google Search bar has gone. That means you will have to traverse one more link before arriving at my destination”(xxl0litaz.net etc).

This tutorial is an attempt at avoiding the usual break out of rage which typically occurs in such situations.


Type in the address bar:

eg. google.com/search?q=chuck+norris
note: terms dilimited by “+” signs.

eg2. google.com/search?q=%20chuck+norris%20
note: quotes are specified by the string “%20”.

eg3. google.com/search?q=chuck+norris+facts&btni*
note: The btni specifies the magic Google option I’m Feeling
lucky which can effectively save 2 links.
*remember the “I” in “btnI” is case sensitive.

eg4. google.com/groups/search?q=chuck+norris
note: adding /groups/ will make it try search within google groups

eg5. google.com/group/alt.whateva
note: this is the quick way to access your fav group

eg6. google.com/groups/dir?q=chuck+norris
note: this is the way to search for a particular group.

There is heaps more you can do with google searches if you
go to the site and click help. this stuff is just
undocumented by them.

The difference between excessive, redundant and superfluous.

The words redundant, superfluous and excessive all imply that a quantity greater than the minimum amount needed has exceeded some threshold. But they all suggest different implications.

Excessive indicates that a quantity is so high it might be a bad thing. It could be said for example, that excessive rainfall will cause a tank to overflow. If you wanted the tank to overflow to feed the plants around it, you might just call it sufficient instead.

Redundant implies that the extra abundance can be used as a means of substitution. When you buy a packet of say 100 sheets of paper, they may give you 103. The extra 3 are redundant in case only 99 of the regular sheets are provided. Animals often have organs in pairs, Lungs, kidneys etc. Its said that one kidney can perform the job of two so it that sense it is there for redundancy reasons.

If your job is to be terminated, one of the tactful ways to express this is that your position is redundant. This implies that the company found a way to do your job without you. To simply say that the person is no longer needed might imply that they can no longer do there job which is only sometimes the case and could be a harsh thing to do considering their situation.

Superfluous makes no judgement on whether something is worse or better, indeed it suggests the matter is little importance to the rest of the message being conveyed . Although the etymology of superfluous means overflown water, you would not use the term if you were concerned with wasting water or things getting wet. Instead you would say it’s excessive. If however you were describing the motion of water in a physics class and you filled up a cup of water which overflowed into a basin you might describe the overflown water as superfluous as to not import any other concerns other than the motion of the water. In a practical scenario, saying excessive when you meant superfluous will almost always be forgiven as superfluous is a much less used word than excessive and they can both get a common point across. This would be like saying big when you meant ample. Both are matters of connotation which generally fall under fairly subjective interpretation.

As a further explanation, when acronyms are described, sometimes both the last letter and last translation of the last letter are pronounced. For example, ATM Machine, which expands to Automatic teller machine machine. Notice machine is described twice. This, I’ve noticed to be a contentious issue in communication. If you think its a good thing you would call the extra M redundant. If you think its a bad thing you would call it excessive. If you think its neither bad nor good you would call it superfluous.

EDIT: there is also extraneous. This word is similar to excessive but works on type and not quantity. Extra objects of which the type is bad.