• Indexing and Searching Arbitrary JSON Data using Elasticsearch

    If you have ever worked with Elasticsearch, then you are probably familiar with one of the most important features of Elasticsearch - the [Dynamic Field Mapping]:

    By default, when a previously unseen field is found in a document, Elasticsearch will add the new field to the type mapping.

    Therefore, if you need to index documents with high similarity between their field names (dense data), including field types, then this default behaviour may be exactly what you want. However, if your documents have high variation of field names (sparse data), or have same field names but with different types, then you will need a different approach.

    In this post I would like to show you how to create an Elasticsearch index that can be used to index arbitrary JSON data, including data with nested arrays and objects. All this, without exploding the index type mapping with arbitrary properties originating from the indexed data. Nevertheless, the indexed data will still be searchable by any of its fields, including any nested fields by specifying their path in a “dot” notation format. In addition, I will show how to use Elasticsearch aggregations to fetch a list of all of the available fields and their respective types of the indexed data.

    Indexing and Searching Arbitrary Data in Elasticsearch

    Indexing and Searching Arbitrary Data in Elasticsearch

  • Extending events and attributes of the inherited backbone views

    I like Backbone Views because they introduce a conventional way to wrap HTML elements and their presentation logic in a single JavaScript class. Thus, allowing better organisation and reuse of my application views. In addition to that, by utilizing JavaScript prototypical inheritance, JavaScript classes can be further extended to allow even better code reuse. But sometimes, when I am extending Backbone.View classes, I also want to extend some of their properties instead of just overriding them.

  • Synchronizing rotation animation between the keyboard and the attached view - Part 2

    In the first part of this post I have explained how to synchronize rotation animation in iOS between its virtual keyboard and the view floating above it. Many things have changed since then, iOS 6, iOS 7 and now the iOS 8, which is the reason why I am writing the second part of that post. In short, Apple changed something in their iOS 8 implementation causing keyboard notifications observer methods to execute their code while animations are disabled. But only when notifications are posted as a consequence of an interface orientation change while the keyboard was visible.

  • Hit-Testing in iOS

    Hit-testing is the process of determining whether a point, such as touch-point, intersects a given graphical object, such as UIView, drawn on the screen. iOS uses hit-testing to determine which UIView is the frontmost view under the user’s finger that should receive the touch event. It implements it by searching the view hierarchy using reverse pre-order depth-first traversal algorithm.

  • Synchronizing rotation animation between the keyboard and the attached view

    Hi, today I would like to show you how to make a UIView to stay attached to the top of the iPhone’s keyboard while the keyboard is animated. But not only when the keyboard is animated while it is being presented or dismissed but also when it is animated when the iPhone is rotated and the interface orientation is changed.

    Although many answers could be found explaining how to make a UIView to stay attached to the keyboard while the keyboard is being animated when it is presented or dismissed. I have not found any solutions that also make that UIView to stay attached to the keyboard when device is rotated and rotation of the interface orientation is animated.