Skip to main content

Posts

Showing posts from October, 2014

Why use Apache Jackrabbit

The reference link: http://stackoverflow.com/questions/13890595/apache-jackrabbit-vs-rolling-your-on-content-repository There are several benefits to using an existing JCR implementation, such as  Jackrabbit  or  ModeShape . First and foremost, you immediately get lot of functionality for free: Hierarchical data storage  - Lots of data is naturally hierarchical, and a JCR repository allows you to organize your data in the way that your applications will access it. Anything keyed by a URI, date/time, categories, or folder structures are natural fits for storing in a repository. Use a standard Java API  - The JCR API is standard Java API with a TCK, meaning your applications can rely upon standard behavior and not be tied to a particular JCR implementation. Flexible schema enforcement  - You can choose whether and where the node structure and property values are enforced by how you define and use node types. Data evolution  - Your data structure will likely evolve over time, and

Django 1.7 + Nginx 1.4.6 + uWSGI 2.0.7 deployment

There are many ways to deploy Django project. Nginx and uWSGI is one of them. Nginx deals with static files. uWSGI transfers no-static file request from Nginx to Django. Note that you can only use uWSGI + Django for deployment. I assume you already installed Django, Nginx and uWSGI. (1) Test uWSGI. Write a simple test.py first # test.py def application ( env , start_response ) : start_response ( ' 200 OK ' , [( ' Content - Type ',' text / html ' )]) return "Hello World" Then run command uwsgi -- http : 8001 -- wsgi - file test . py Then you can check if   http://127.0.0.1:8001 is working (2) Test Django run command python manage.py runserver 0.0.0.0:8002 Then you can check if it is working. (3) Write Django uwsgi file write Django_wsgi.py file which is at the same directory with manage.py in Django project #!/usr/bin/env python # coding: utf-8 import os import sys reload(sys) sys.setdefaultenco

pip install uwsgi error

Install uwsgi error by pip The error message is as follows Cleaning up ... Command / usr / bin / python - c "import setuptools, tokenize;__file__='/tmp/pip_build_root/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" You have to install python dev package sudo apt-get install python2.7-dev

JVM Performance Optimization

How to set JVM parameters The performance of the JVM depends on how well it is configured to match the functionality of the application. Although memory is automatically managed using garbage collection and memory reallocation processes, you have control over their frequency. In general, the more memory you have available for your application, the less memory management processes are required, which pause your application. If garbage collections are occurring more frequently than you would want, you can start the JVM with more maximum heap size. The longer it takes for a generation of the heap to fill up, the fewer garbage collections occur. To configure the maximum heap size, use the -Xmx option when you start the JVM. By default, the maximum heap size is set to either 1/4th of the physical memory available to the OS, or to 1 GB (whichever is the smallest). If the problem is with memory reallocation, you can set the initial heap size to be the same as the maximum. This means th

PHP json_decode example

<?php $jsonData = '{ "user":"John", "age":22, "country":"United States" }'; $phpArray = json_decode($jsonData); print_r($phpArray); foreach ($phpArray as $key => $value) {      echo "<p>$key | $value</p>"; } ?>

Mac OS MAMP Netbeans Php debug

Reference: http://anthonyringoet.be/post/setting-up-xdebug-mamp-netbeans-for-debugging/ How to debug php at Netbeans at Mac OS. It is easy.  Three steps (1) install MAMP http://www.mamp.info/en/ (2) run a php script for "phpinfo()" to find "php.ini" file (3) modify "php.ini" file [xdebug] zend_extension="/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so" xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_host=localhost xdebug.remote_port=9000 xdebug.remote_autostart=1

Jersey client post JSON object error

The error message is as follows "MessageBodyWriter not found for media type=application/json  ........ " For a Maven project, please add following line in pom.xml file to solve the issue.         <dependency>             <groupId>org.glassfish.jersey.media</groupId>             <artifactId>jersey-media-moxy</artifactId>             <version>2.11</version>         </dependency>        

Connect MySQL server remotely

For Ubuntu, there are two steps (1)  In MySQL command line,  change privileges GRANT ALL PRIVILEGES ON *.* TO 'USERNAME' @ 'IP' IDENTIFIED BY 'PASSWORD' ; FLUSH PRIVILEGES ; where IP is the IP you want to allow access and USERNAME is the user you use to connect If you want to allow access from any IP just put  %  instead of your IP and then you only have to put FLUSH PRIVILEGES ; Or restart mysql server and that's it. (2) Modify  /etc/mysql/my.cnf  file change "bind-address 127.0.0.1" to "bind-address "your server IP"  Reference: http://stackoverflow.com/questions/8380797/enable-remote-mysql-connection