Live geek or die tryin'

Why-you-should-not-use-elasticsearch-as-a-database

lack of typesafety

mapping

{"error":"MapperParsingException[Root type mapping not empty after parsing! Remaining fields: [mogopay : {mappings={BOTransactionLog={properties={dateCreated={type=long}, direction={type=string}, lastUpdated={type=long}, log={type=string}, provider={type=string}, transaction={type=string, index=not_analyzed}, uuid={type=string}}}}}]]","status":400}

object mapping for [BOTransaction] tried to parse as object, but got EOF, has a concrete value been provided to it?
do u even engrish?

shitty query language

  • queries are painful to write
  • remember all keywords
  • keywords are not parsable because they’re bare strings

bad support of hierarchies

A Fix for Select2 Not Displaying Results on IE

When using Select2, filling a select box, and not seeing any result, chances are that you’re querying a different server, which requires CORS, which in turn isn’t supported by Internet Explorer (9.0 and below).

Using the jQuery-ajaxTransport-XDomainRequest plugin fixes the problem.
Explanations are in the README.

(this problem is of course not specific to Select2, but given the layers of code/libs between the developer and the creation oFJthe XHR object inside jQuery’s ajax() function, one might forget this detail like I did)

Use Java 7 for IntelliJ’s SBT Plugin

IntelliJ IDEA runs on JRE 6, and so does its SBT plugin.

If you need to use a more recent version of Java (and you should):

  • Open the Preferences panel
  • Go to the SBT section
  • Tick the Use alternative JRE option
  • Click the arrow on the right of the field to check if the IDE suggests the desired JRE
    • If so, choose it.
    • Otherwise, look for the path by yourself.
      It’s /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home on my Mac.

WebSockets: INVALID_STATE_ERR: DOM Exception 11

This error can be caused by many reasons, among them what happened to me: I tried sending a message via the WebSocket before the connection was completely opened.

What you should not do:

ws = new WebSocket("ws://localhost/ws");
ws.send('foo');

What you should do instead:

ws = new WebSocket("ws://localhost/ws");
ws.onopen = function () {
  ws.send('foo');
}

Java: No Main Manifest Attribute

I won’t go though explaining how to create a build.xml file, the official manual, which is really good, does it better than I would.

The error in question occurs because the java executable, after reading the Manifest file from the inside of the JAR, doesn’t know what is the entry point of the program; i.e. the class that contains the ugly public static void main(String[] args) method.

To fix the error, that class’ full name needs to be specified in the build.xml file.
For example:

<jar destfile="${jar}" basedir="${build}">
    <manifest>
      <attribute name="Main-Class" value="my.awesome.package.Main" />
    </manifest>
</jar>