2015年6月2日 星期二

MemSQL vs. MongoDB

MemSQL MongoDB
CategoryDatabaseDatabase, Data Storage
Preference75% votesvotes25% votesvotes
Websitewww.​memsql.​comwww.​mongodb.​org
LicenseProprietaryAGPLv3
Design
Database modelRelational, Distributed data structureDocument-oriented, Schema-less, NoSQL
Data storageVolatile memory, File SystemVolatile memory, File System
EmbeddableYesYes
Features
Query languageSQLAPI calls, JavaScript, REST
Data typesAll MySQL, JSON, BLOBJSON
Conditional entry updatesYesYes
Map and reduceYesYes
UnicodeYesYes
TTL for entriesNoYes
CompressionYesYes
Integrity
Integrity modelACID, MVCCBASE
AtomicityYesConditional
ConsistencyYesYes
IsolationYesYes
Durability (data storage)YesYes
TransactionsYesNo
Referential integrityYesNo
Revision controlYesNo
Locking modelLock Free Model, MVCCOptimistic Locking, Lock on write
Indexing
Secondary IndexesYesYes
Composite keysYesYes
Full text searchNoYes
Geospatial IndexesYesYes
Graph supportNoNo
Graph typeOriented graph?
Distribution
Horizontal scalableYesYes
ReplicationYesYes
Replication modeMaster-Slave ReplicationMaster-Slave-Replica Replication
ShardingYesYes
Shared nothing architectureYesYes
Restrictions
Value size max.1 000 EB16 MB
System requirements
Operating systemLinux, Amazon EC2Linux, Windows, Mac OS X
Native driverC, C++, php, Java, Python, Objective-C, Ruby, GoJava, php, Ruby, C#, Python, JavaScript, Haskell, Perl, C++, Erlang, Scala, C, Go
Memory recommended8 GB?
Memory minimum8 GB?
Architecture
Programming languageC++C++
More
DescriptionIn-Memory Database used for real-time analytics.Document Oriented Database
Multi-user systemYesYes
Accelerometer sensorNo?
Price rating●●●○○●●●●●
Software distributionPackage management systemTarball, Ubuntu Software Center, Package management system, Windows Installer
Object-Relational Mapping (ORM)YesYes
Release Date18ᵗʰ June 2012March 2009
Documentation level●●●●○●●●●●
Distributed CounterYes?
Free to useYesYes
ActiveYesYes
Database Connection PoolingYesYes
Real time analyticsYesYes
2 Letter Country CodeUS?
Cloud platform supportAmazon EC2Heroku, CloudBee, Bluemix, Amazon EC2, SoftLayer
Online backupYesYes
Function Based IndexYesNo
LogYesYes
Downloadwww.​memsql.​com/​#downloadmongodb.​org/​downloads
Backup functionalityGoodGood
Query CacheYesYes
Ease of use●●●●○●●●●●
Free for commercial useNoYes
SortsYesYes
Perfomance●●●●○●●●●○
Materialized ViewsNoNo
Spring Data SupportYesYes
JSONYesYes
Stored ProcedureNoYes
ConcurrencyYes?
Multi-statement TransactionsYesYes
ColumnerYes?
Brand?MongoDB Inc
Extension/Plug-in?Yes
Database?MongoDB
Standard compliance?No
RESTful?Conditional
Lines of code?617 k
Community Driven?Good
Web interface?Yes
Data encryption?Conditional
Admin Generator?Yes
Partial Index?No
Key length max?128
Implementation flexibility(0% global votes)(48% global votes)
In-Place Update?Yes
Capped Collections?Yes
Tuneable write concerns?Yes
Read preferences?Yes
Open Source?Yes
Op/s?5 000
Triggers?No
Pause Test?Yes
Cross Domain Testing?No
Pipeline Aggregation?Yes
Geospatial?Yes
Server Side Java Script?Yes
Flexible Table(Schema)?Yes
Geo-distributed?Yes
Max rows in query result?1 000
Re-Reduce?Yes
Clustering over WAN?Yes
Fully Distributed?Yes
Auto-Sharding?Yes
memcached protocol?No
Monitoring UI?Yes
Recursive queries?No
Network datatype?No
Windowed aggregate?No
CLI`?Yes
This table is based on the vsChart comparison MemSQL vs. MongoDB comparison | vsChart.com, which is released under the Creative Commons Attribution-Share-Alike License 3.0.

2014年9月23日 星期二

Linux 圖片轉檔指令

convert beach.gif beach.pnm


NAME
convert - convert an image or sequence of images

SYNOPSIS
convert [ options ... ] input_file output_file

DESCRIPTION
Convert converts an input file using one image format to an output file with a differing image format. In addition, various types of image processing can be performed on the converted image during the conversion process. Convert recognizes the image formats listed in ImageMagick.

2014年9月18日 星期四

Install Flask on CentOS 7.0

1. Install pip on CentOS 7.0

## First install the EPEL repo as per your Operating system version and architecture.
rpm -ivh http://mirror01.idc.hinet.net/EPEL/7/x86_64/e/epel-release-7-1.noarch.rpm
yum install -y python-pip

2. Install Flask

pip install Flask

## Test
vi hello.py

from flask import Flaskapp = Flask(__name__)
@app.route("/")def hello():    return "Hello World!"
if __name__ == "__main__":    app.run()

## Verify
python hello.py

* Running on http://0.0.0.0:80/

2014年7月17日 星期四

Python: ConfigParser

[core]
cmd = /usr/bin/vim

[mod]
safe_edit = yes
time_interval = 20

python 程式如下:
#!/usr/bin/python
from ConfigParser import SafeConfigParser
parser = SafeConfigParser()
parser.read('test.conf')

#傳回字串 /usr/bin/vim
parser.get('core', 'cmd')

#傳回 boolean 值 True
parser.getboolean('mod', 'safe_edit')

#傳回整數值 20
parser.getint('mod', 'time_interval')


references:
http://williewu.blogspot.tw/2007/10/python-configparser.html
https://wiki.python.org/moin/ConfigParserExamples
https://docs.python.org/2.6/library/configparser.html

How to find script's directory

import os
print os.path.dirname(os.path.realpath(__file__))

reference:
http://stackoverflow.com/questions/4934806/python-how-to-find-scripts-directory

2014年7月15日 星期二

strip in C programming


strtok(Name, "\n");

references:
http://stackoverflow.com/questions/2693776/removing-trailing-newline-character-from-fgets-input

2014年3月26日 星期三

Linux TOP 指令說明

Linux TOP 指令說明


VIRT  程序使用的虛擬記憶體總量,單位 kb。VIRT=SWAP+RES
RES    程序使用的、未交換出的實體記憶體大小,單位 kb。RES=CODE+DATA
SHR    共享記憶體大小,單位 kb

reference
http://blog.ycnets.com/2013/09/01/linux-commandtop/

2014年1月17日 星期五

GnuPlot references

地圖/統計圖/3d 函數圖/實驗報告圖 -- Gnuplot 純畫圖 (作者: 洪朝貴老師)
http://user.frdm.info/ckhung/b/ma/gnuplot.php

Gnuplot 入門教學
http://randle.wordpress.com/2007/06/12/gnuplot-induction/

2013年12月20日 星期五

Upgrade to CentOS 6.5 from CentOS 6.4

yum clean all
yum update glibc* yum* rpm* python*
yum update

reboot

cat /etc/redhat-release
## Output ##
CentOS release 6.5 (Final)

lsb_release -a
## Output ##
LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description:    CentOS release 6.5 (Final)
Release:        6.5
Codename:       Final


references:
http://www.if-not-true-then-false.com/2011/upgrade-centos-6/

2013年7月30日 星期二

GDB: Missing separate debuginfos

Fixed GDB: Missing separate debuginfos

1. 修改 /etc/yum.repos.d/CentOS-Debuginfo.repo, set enabled=1
2. yum install yum-utils
3. debuginfo-install glibc

如果還是不行更新 gdb and glibc

2012年10月17日 星期三

Translate int to string

#include <iostream>
#include <string>
#include <sstream>

using namespace std;
string int2str(int &);
int main(void) {
  int i = 123;
  string s;
  s = int2str(i);

  cout << s << endl;
}


string int2str(int &i) {
  string s;
  stringstream ss(s);
  ss << i;

  return ss.str();
}

2012年10月16日 星期二

判斷奇偶數

利用位元運算來判斷奇偶數

if( (value & 1) == 0 )
  cout << "偶數";
else
  cout << "奇數";

2012年7月3日 星期二

C/C++ 中的括號

在 C語言中的括號分別化表

{ } 大括號表示函式本體的開始與結束
( ) 小括號在函式的宣告中使用

大括號的另類用法,指定了變數的作用範圍,在大括號中的變數都是局部變數,有效區域只在大括號中有效。有效利用這個特性可以使程式簡單明白。


 int a = 5;
  {
    int a = 2;
    printf("Here a=%d!!\n", a);
  }
  printf(" a=%d!!\n", a);

2012年5月29日 星期二

NFSv4 設定


最近在設定CentOS 6 的時候發現, NFS default 是用version 4. 不察之下發現設不起來 ><
底下是NFSv4 的設定

CentOS 6時,由於NFS為NFSv4,需多設定一個檔案為/etc/idmapd.conf 還有必須啟動rpcidmapd服務

Head Node

####  vi /etc/idmapd.conf
[General]
Verbosity = 1 #主要更改
# The following should be set to the local NFSv4 domain name
# The default is the host's DNS domain name.
Domain = snowfox #主要更改
.
. (略)
.
#Local-Realms =
[Mapping]
#Nobody-User = nobody
#Nobody-Group = nobody

然後 將rpcidmapd服務開啟 service rpcidmapd start chkconfig rpcidmapd --level 345 on

2012年5月28日 星期一

安裝 wxPython


[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1


yum install wxPython.x86_64 wxPython-devel.x86_64

Dependencies Resolved

==================================================================================================================================================
 Package                                Arch                           Version                                  Repository                   Size
==================================================================================================================================================
Installing:
 wxPython                               x86_64                         2.8.9.1-1.el5.rf                         dag                          22 M
 wxPython-devel                         x86_64                         2.8.9.1-1.el5.rf                         dag                         479 k
Installing for dependencies:
 wxGTK                                  x86_64                         2.8.10-1.el5.rf                          dag                          27 M
 wxGTK-devel                            x86_64                         2.8.10-1.el5.rf                          dag                         1.1 M


2012年3月29日 星期四

Identify the speed of memory



dmidecode  is a tool for dumping a computer’s DMI (some say SMBIOS) table contents in a human-readable format.


dmidecode

# dmidecode 2.11
SMBIOS 2.5 present.
30 structures occupying 1372 bytes.
Table at 0x0009D800.

2012年3月5日 星期一

vm.swappiness



vm.swappiness is a tunable kernel parameter that controls how much the kernel favors swap over RAM. At the source code level, it’s also defined as the tendency to steal mapped memory. A high swappiness value means that the kernel will be more apt to unmap mapped pages. A low swappiness value means the opposite, the kernel will be less apt to unmap mapped pages. In other words, the higher the vm.swappiness value, the more the system will swap.

The default value I’ve seen on both enterprise level Red Hat and SLES servers is 60.

step of modify:
sysctl -w vm.swappiness=0 (default: 60)
swapoff -a
swapon -a

ADD  vm.swappiness=0  to  /etc/sysctl.conf

References:
What Is the Linux Kernel Parameter vm.swappiness?
http://overinfinityresearch.blogspot.com/2008/09/ubuntu804.html