When am I Ready to Start Writing: Preparedness of Knowledge and Style

One of the most crucial prerequisites for writing, in my mind, is preparedness of knowledge and style.

Preparedness of knowledge entails that one has sufficient knowledge (or thoughts/ideas) of the topic one wants to write about. This seems pretty self-evident, since, as magical as the process of writing might be, we could never write say a biography of Napoleon without first gathering a set of facts about Napoleon’s life.

This preparedness of knowledge can be achieved with different depth; superficial preparedness makes you familiar with a couple of facts relevant to your writing. For instance, the time of birth of Napoleon, the place and duration of his conquests etc. While this superficial preparedness might be sufficient for certain types of writing; for instance to write a simple report about some obvious facts; it is most likely insufficient for creating exquisite writing on a complex subject. To achieve this, we will have to achieve deep preparedness. Such preparedness is grounded in a long process of collection of facts and perspectives from numerous sources.

While one easy distinguishing mark between superficial and deep preparedness lies in the time dedicated to preparation (with deep preparedness being more time-intensive), another important indicator is whether the knowledge we employ for the writing is conscious or subconscious. If we can grasps all the knowledge we require for the writing in our conscious mind (e.g. I will need to write about point A, B, C, …), we have most likely achieved only a superficial form of preparedness. If, in contrast, we have garnered so much knowledge about a topic that we cannot clearly understand the whole scale of our knowledge on the subject, we have more likely achieved a deeper form of preparedness. This preparedness enables us to write beyond our conscious plan of what we want to write. New twists and perspectives seem like they pop out of nowhere into our mind. However, they do not appear out of nothing but have grown from the extensive base of our knowledge on the subject.

Preparedness of style is a less obvious and more difficult to grasp form of preparedness. Preparedness of style assures that we have the technical skill to materialize our thoughts into well-formed words. Words, in particular, which meet the expectations of the specific type of writing we are engaged in.

As the most drastic example for preparedness of style think of mastery of language. If I never learnt a word of French in my life, I will not be able to produce even a simple shopping list written in French. However, I might well be able to do so, if I have taken some French classes and brushed up my vocabulary with a few words. My preparedness of style has increased, but would yet be insufficient to produce an essay for a French periodical.

While mastery of language is certainly an important dimension of preparedness of style, there are other, more subtle, yet possibly more practically relevant dimensions of this preparedness. The most important of these being the mastery of a particular writing style. Writing styles usually correlate with the type of output we seek to produce. For instance, the style of writing for a newspaper is quite different of the style of writing for an academic business journal, which will yet be different from writing a book about a new programming language.

The more we become familiar with a particular writing style, the more subtle differences will we be able to spot. There is, for instance, not just one style of writing for a newspaper, but one can distinguish slightly different writing styles for instance between The New York Times and The Wall Street Journal.

While preparedness of knowledge is certainly not easy to achieve, preparedness of style poses even greater challenges. While there are some style guides for languages or even for particular publications, what exactly makes up a ‘style’ is difficult to formalize; and therewith difficult to learn through traditional means.

Really the only way available is through practice; ideally with the help of a seasoned master of the style. This, for instance, is the supposed model to convey the style of academic writing, where the doctoral or master student is gently guided by a supervisor to pick up the tricks of the trade. However, given that no master craftsman is available and even if there is, it is required to learn by practicing; for instance, by critically examining the outputs one produces and matching them against one’s own ‘feeling’ of how well the writing matches with the style of the discipline.

Both preparedness of knowledge and preparedness of style are no qualities, which can be achieved in absolutes. Even the most knowledgeable expert or the most seasoned writing professional, will be able to find ways to improve their preparedness of knowledge and/or style. Try to reach the minimal level for both levels of preparedness after which you feel able to produce some coherent output. The output must not be great, not even be good. It really doesn’t matter. What matters is that you do what you want to learn. This is always the best form of practice, and in lucky circumstances even leaves you with respectable outputs for whichever goal you seek to achieve.

Speed Up Netty SSL

Knowing Where You Are

First you can do a few simple test to see how good (or bad) your current SSL configuration of your Netty server is. Note: These tools also work with any other web server.

  • Perform the wormly SSL Web server test on your server to get an idea how well your server is configured.
  • For a more comprehensive test, consider to use the tool sslyze, which will test your server SSL configuration.

Just download their executable from https://github.com/nabla-c0d3/sslyze/releases, unpack the repository and run

sslyze.exe –regular yourserver.com

The test might run for a while but will generate a very informative report.

Improving Netty Performance

Depending on your results in the first step, you might consider the following ways to improve the performance of your Netty server:

  • Assure to keep HTTP connections ALIVE.

This requires to send a ‘Content-Length’ header to the browser and not to close the channel after a response has been written to the channel.

References

Stackoverflow – Slow Java SSL in a netty application

5 easy tips to accelerate SSL

Fix Firefox ‘Permission denied to access property document’

Problem

You are trying to load a script from a local file into a page displayed in Firefox (as can sometimes be useful for testing).

Firefox reports an error such as

Error: Permission denied to access property ‘document’

Error: Permission denied to access property ‘local’

Solution

This problem is caused by a security restriction that should normally be in place. However, you can temporarily disable this security feature as follows:

  • Enter the address ‘about:config’ in your Firefox
  • Search for ‘strict_’
  • Double click on the value column for the preference ‘security.fileuri.strict_origin_policy‘ to switch it from ‘true’ to ‘false’.

Remember to reenable the policy once your tests are done!

Sources

https://bugzilla.mozilla.org/show_bug.cgi?id=477201

https://support.mozilla.org/en-US/questions/1003768

CodeMirror 3 Indent All Lines / Autoformat

Problem

You have created an instance of a CodeMirror and initialized it with some text and would like to correct its indentation or you would like to give the user the option to ‘autoformat’ the text entered.

Solution

Iterate over all lines in the editor and indent them individually:

var e = CodeMirror.fromTextArea(textarea.get(0), {});

for (var i=0;i<e.lineCount();i++) { e.indentLine(i); }

This should indent all lines in your editor nicely:

Note that in CodeMirror 2 there was an autoformatter add-in which is not officially supported for CodeMirror 3.

Setting Up Xtend with Maven and eclipse (Luna)

Xtend is currently my favourite alternative language for the JVM (closely followed by Kotlin). Unfortunately, I did not find a good guide of how to set up a Maven project within eclipse (Luna) which uses Xtend.

Specifically the following guide will allow you to allow you to write test cases in Xtend for your existing Java projects. A great way to get started with Xtend I suppose.

The following describes the necessary steps.

  • Install the Xtend plugin for eclipse as described here.
  • Add the xtend-maven-plugin to your pom.xml as follows:
<plugin>
    <groupId>org.eclipse.xtend</groupId>
    <artifactId>xtend-maven-plugin</artifactId>
    <version>2.7.1</version>
    <executions>
        <execution>
            <goals>
                <goal>testCompile</goal>
            </goals>

            <configuration>
                <testOutputDirectory>${basedir}/src/test/java</testOutputDirectory>
            </configuration>

        </execution>
    </executions>
</plugin> 
  • Also add a dependency to the Xtend runtime libraries
<dependency>
    <groupId>org.eclipse.xtend</groupId>
    <artifactId>org.eclipse.xtend.lib</artifactId>
    <version>2.7.1</version>
    <scope>test</scope>
</dependency>
  • Right click the project and select Maven / Update Project … and update the project.
  • Right clock the project and select Properties
  • Go to the Xtend / Compiler page
  • Set as the ouput director src/test/java

  • Go to the folder src/test/xtend. If the folder does not exist, create it.
  • Right clock the folder src/test/xtend and select Build Path / Use As Source Folder
  • Create a package in the new src/test/xtend folder and right click the package. Select New / Xtend class and define a class such as the following:
package de.mxro.async.map.tests
 

import org.junit.Assert
import org.junit.Test
 

class TestThatNumbersAreEqual {
    
    @Test
    def void test() {
        Assert.assertTrue(3 == 3)
    }
    
    
}
  • Immediately after you save the class a translated class should be created in the folder src/test/java

Now, have fun writing tests using Xtend’s concise syntax – while not affecting any step of your build and development workflow!

To see an example configuration in a complete project, also check out async-map on GitHub.

A Comparison of Data Models in BaaS (Backend-as-a-Service)

While Backed-as-a-Service (BaaS) – and their stepbrothers PaaS – offerings should sensibly support various domain-specific data models for the application they support, these services are inherently built on a ‘meta’ data model. This meta data model lays the constraints for all domain-specific data and should thus be an important consideration in selecting or not selecting a BaaS solution.

I have sifted through the documentation of five popular BaaS solutions and tried to uncover the fundamental model of data underlying these platforms. My findings are presented below.

In a Nutshell

All examined solution but Firebase have a ‘three-tier’ data model where similar JSON documents are aggregated in collections or classes, which allow the effective querying of these documents. These collections of JSON documents in turn are aggregated in databases or per application. Some solutions provide additional mechanisms for defining connections between JSON documents (Parse, usergrid). Firebase features the most unique model; where all data is stored in one very big, hierarchical JSON document.

Parse

Parse stores data internally as flat JSON Documents, called ParseObject, with have the restriction that keys must be alphanumeric strings. Parse automatically creates ‘classes’ for ParseObjects, grouping objects with similar properties. Classes and all objects associated to them belong to applications, which can be defined on the Parse web interface. In addition, Notably, Parse allows for various types of relationships between ParseObjects for one-to-many and many-to-many relationships.

Firebase

Firebase stores data as JSON documents. Essentially, a data store in Firebase is one large JSON document. Data stores are associated with subdomains such as <my store>.firebase.com.

Kinvey

Fundamentally, Kinvey stores data as collections and entities. Entities are essentially JSON documents. Collections belong to applications. Internally, data is stored in a MongoDB cluster.

Apache usergrid_

The Apache usergrid_ documentation did not make it easy to find out about the data model underlying the platform. I think the data is primarily stored as JSON documents named entities on the platform. These in turn (I think) are stored in collections. Collections themselves belong to applications. Notably, Apache usergrid has some support for graph-like data as relationships between entities. Internally, Apache usergrid is based on Cassandara and provides good support for relational/SQL type queries.

BaasBox

Data in BaasBox is stored as JSON documents called documents. These documents are grouped in collections. Collections are ultimately stored in databases. Since every BaasBox server represents one application, databases belong to the application configured for the server.

References

Parse

ParseObject JavaDoc

Parse JavaDoc

Parse Documentation – Data & Security

Firebase

Firebase – How It Works

Firebase – Understanding Data

Kinvey

A backend’s representation inside Kinvey

Android – Data Store

Apache usergrid_

Entity.java in usergrid Java client library

Apache usergrid Documentation

BaasBox

BaasDocument JavaDoc

BaasBox Documentation – Database Management

UML Diagrams created with creately.com.

 

 

 

 

Force Android Studio to Update Maven Snapshot Dependencies

Problem

You are using Gradle to build your Android Studio project and you have linked Maven SNAPSHOT modules.

When you build your project, Gradle/Android Studio does not grab the latest version of the SNAPSHOT module but instead uses a cached version.

Solution

Add the following to your build.gradle:

configurations.all {

resolutionStrategy {

cacheChangingModulesFor 0, ‘seconds’

}

}

References

Gradle DSL Documentation – Resolution Strategy

Gradle Documentation Chapter 50, Section 50.9.22 Refresh

Gradle Forum – Use latest version of changing module