NoSQL Data Modeling Techniques

Highly Scalable Blog

NoSQL databases are often compared by various non-functional criteria, such as scalability, performance, and consistency. This aspect of NoSQL is well-studied both in practice and theory because specific non-functional properties are often the main justification for NoSQL usage and fundamental results on distributed systems like the CAP theorem apply well to NoSQL systems.  At the same time, NoSQL data modeling is not so well studied and lacks the systematic theory found in relational databases. In this article I provide a short comparison of NoSQL system families from the data modeling point of view and digest several common modeling techniques.

I would like to thank Daniel Kirkdorffer who reviewed the article and cleaned up the grammar.

To  explore data modeling techniques, we have to start with a more or less systematic view of NoSQL data models that preferably reveals trends and interconnections. The following figure depicts imaginary “evolution” of the major NoSQL…

View original post 3,646 more words

Open Navigation Drawer with a Handle

This type of functionality is not supported on DrawerLayout from support libraries. There are some third party libraries with all kind of additional functionality. They are huge and usually we don’t need all components included.

The implementation is very easy. After looking at source code of DrawerLayout class, we can see that there is onTouchEvent method predefined. So we have to delegate touch events from our “handle” widget to DrawerLayout.

 drag.setOnTouchListener(new View.OnTouchListener() {

    public boolean onTouch(View v, MotionEvent event) {

       if(event.getAction() == MotionEvent.ACTION_DOWN){
          MotionEvent copy = MotionEvent.obtainNoHistory(event);
          copy.setLocation(0, event.getY());

       return false;

Object drag could be any type of View as long as we can listen to touch events. If touch action equals ACTION_DOWN than we delegate event handling to DrawerLayout object with motion event position X set to 0. All next updates will bi automatically propagated to DrawerLayout instance.

Terminating python script and releasing resources

Python script can be used as a background running service in order to provide some functionality. This service is often stopped on very aggressive way with process termination. Therefore some resources may not be released or child threads stopped.Below are two options how to handle script termination.

1.  Catching KeyboardInterrupt and SystemExit errors:

 except (KeyboardInterrupt, SystemExit):
     print("Termination occurred")

2.  Register on system signals:

Described in this post:  How To Catch “Kill” Events with Python

How To Catch “Kill” Events with Python

daniel's devel blog

Currently I’m working on a small MRCPv2 client written in Python, which is part of a bigger project at my laboratory. The client is started remotely by a program which controls and monitors several applications in the whole network and is stopped by it again.

In the Linux world catching “kill events” would be a simple task, to shut down another program a process just has to send a SIGTERM signal which can be caught be Python easily using the signal module which comes with every Python installation. However, on Windows things are a little bit harder, because the operating system never produces SIGTERM (and SIGILL) events according to the signal.h documentation from MSDN. That’s why it took me some time to figure out how to catch “kill” events under Windows with Python.

First of all, there are two different ways to close a program in Windows using the .NET…

View original post 87 more words

Raspberry PI: Volume control

Set the volume of sound output jack or USB sound card on Raspberry PI with Raspbian distro.

This action will be perfomed with amixer utility.

First list all audio capable devices:

$ amixer

Sample output:

Simple mixer control 'Speaker',0
 Capabilities: pvolume pswitch pswitch-joined penum
 Playback channels: Front Left - Front Right
 Limits: Playback 0 - 151
 Front Left: Playback 151 [100%] [0.06dB] [on]
 Front Right: Playback 151 [100%] [0.06dB] [on]
Simple mixer control 'Mic',0
 Capabilities: pvolume pvolume-joined cvolume cvolume-joined pswitch pswitch-joined cswitch cswitch-joined penum
 Playback channels: Mono
 Capture channels: Mono
 Limits: Playback 0 - 127 Capture 0 - 16
 Mono: Playback 0 [0%] [0.00dB] [off] Capture 0 [0%] [0.00dB] [on]
Simple mixer control 'Auto Gain Control',0
 Capabilities: pswitch pswitch-joined penum
 Playback channels: Mono
 Mono: Playback [on]

In my case I have three diferent control options. Try to find the right one. I am using external USB dongle with stereo output, so I will use “Speaker,0” device to control.

Execute command to set volume of selected control to 100% (or use prefered value):

$ amixer sset Speaker,0 100%

So simple is that. 🙂

SQLite documentation page exception

Try this url:
Should be exception in sql. 🙂

Error: SQL logic error or missing database

SQL logic error or missing database
    while executing
"db one { SELECT count(*) FROM page WHERE page MATCH $::A(q) }"
    (procedure "searchresults" line 37)
    invoked from within
    ("uplevel" body line 1)
    invoked from within
"uplevel { set doc "[searchform] [searchresults] [footer]" }"
    invoked from within
"time [list uplevel $script]"
    (procedure "ttime" line 2)
    invoked from within
"ttime { set doc "[searchform] [searchresults] [footer]" }"
    invoked from within
"db transaction {
    set t [ttime { set doc "[searchform] [searchresults] [footer]" }]
    (procedure "main" line 6)
    invoked from within

Port Scanner published on GitHub

SVG version of Bug silk.png by Avatar

With Port Scanner you can easily check for open ports on your system or at any address. Frequently used ports can be saved in profiles and used later on different hosts. All ports are displayed in a table and can be filtered and ordered. The user has two options, he can scan all ports at once or each port separately. User can also edit host on selected port or remove port from scanning. Two types of adding ports are introduced. User can add individual port or selected port range. If port number is already in the table no port is added.

Link to GIthub project: