Saturday, December 1, 2018

Cassandra - Data modeling



Cassandra is a NoSQL data base. Some core features that are provided by Cassandra are -

  1. High write performance
  2. High scalability
  3. Fault tolerant
  4. Linear scale performance
  5. Easy data distribution

The Cassandra data model contains -
  1. Keyspaces - A keyspace is the container of all data in Cassandra. Replication is specified at the keyspace level.
  2. Tables - Every table should have a primary key, which can be a composite primary key.
  3. Columns - A column contains the key value data in Cassandra.


Cassandra provides CREATE TABLE, ALTER TABLE, and DROP TABLE statements for data definition and provides INSERT, UPDATE, SELECT, and DELETE statements for data manipulation. The ‘where’ clauses in Cassandra have restrictions. Certain filters in the where clause can result in cluster wide scans which are not desirable.

While doing data modeling for your application, some things to keep in mind would be -
  1. Start with what kind of queries you will be performing on the database.
  2. Denormalize when you can.
  3. Data should be spread evenly across the cluster. This can be achieved by picking the right partition key. The partition key is the first element of the primary key. Data is partitioned by the first part of the primary key and clustered by the remaining part.
  4. Minimize the number of partitions that need to be accessed in your read queries.






Friday, August 8, 2014

Solr 4.9.0 Tomcat SEVERE: Error filterStart

Error

SEVERE: Error filterStart

Solution:

For Solr Version  4.9.0

These jars are required in tomcat/7.0.23/lib/ directory-

slf4j-api-1.7.6.jar
slf4j-log4j12-1.7.6.jar

Thursday, February 14, 2013

Java - String comparison

Does it give you a bellyache?
Never mind, you can compare them like this-

System.out.println(gg1.compareTo(gg3));

Saturday, February 9, 2013

Url encode an HTTP GET Solr request and parse json using gson java library

Make a request to the SOLR webserver and parse the json string to Java classes using the code snippets below.
The JSON to be parsed- The corresponding Java classes- Code snippet to make a web server call and parse using gson-

The Java classes must have the same variable names as the Json's keys. Notice how nested Json elements are handled.

Wednesday, February 6, 2013

Errors running builder 'Google WebApp Project Validator'

Error:

Problems occurred building the selected resources.
Errors running builder 'Java Builder' on project 'curve_app'.
com/google/gdt/eclipse/suite/preferences/GdtPreferences
Errors running builder 'Google WebApp Project Validator' on project 'curve_app'.
java.lang.NullPointerException

Workaround solution:

Close all projects, close eclipse.

Start eclipse using, "eclipse -clean" option.

You can try repeating the process 2-3 times,  if it does not work first time.

Not sure of the exact reason why this appears.


Tuesday, February 5, 2013

Highcharts Phantomjs Export - TypeError: 'undefined' is not an object

Generating a png file from config-

phantomjs-1.8.1/bin/phantomjs highcharts-convert.js -infile config.json  -outfile out1.png -width 300 -scale 2.5 -constr Chart -callback callback.js

Error-

Things to check-
1. The following 3 files should be there in same folder or you have to set the paths to these here-
var config = {
                /* define locations of mandatory javascript files */
                HIGHCHARTS: 'highstock.js',
                HIGHCHARTS_MORE: 'highcharts-more',
                JQUERY: 'jquery-1.8.2.min.js'
        },

2. The 'infile' parameter should have an extension of .json, because that is what it uses to decide between svg input and a configuration json.

Friday, February 1, 2013