Friday, June 10, 2016

Backup and Restore with PostgreSQL


Enter psql
DOS> psql -U user database_name
DOS> psql database_name (if no password defined)

Drop DB
DOS> dropdb database_name
PSQL# drop database database_name

Create DB
DOS> createdb database_name
PSQL# create database database_name

Dump DB
DOS> pg_dump database_name > file_name

Restore from Dump
DOS> psql -U user -d database_name -f file_name


Monday, May 23, 2016

Make web application start up faster

To make web application start up faster in Tomcat, you may consider the following tuning:

  1. Add metadata-complete="true" as an attribute in <web-app> tag
  2. Add <absolute-ordering/> inside <web-app> </web-app>

Tuesday, February 23, 2016

Change font size by language using CSS

Quick useful when browser render text with different size in different languages:

html:lang(en) h1{
    font-size: 20px;
}

html:lang(ko) h1{
    font-size: 10px;
}
Reference: http://stackoverflow.com/questions/15267355/change-font-size-based-on-language

Tuesday, January 5, 2016

Using @RunWith(SpringJUnit4ClassRunner.class)

If you use @RunWith(SpringJUnit4ClassRunner.class) in a JUnit test class and it just cannot run, do double check your JUnit version.

It requires JUnit 4.9 or above. 

Thursday, November 12, 2015

Leaflet vs ArcGIS JS / FeatureLayer

I'd been deciding ESRI-Leaflet or ArcGIS JS for a small project. Some findings for our references:

When using FeatureLayer for plenty amount of data (e.g. vast amount of points), ArcGIS JS performs better than Leaflet. So even the file size of Leaflet is far smaller than ArcGIS JS, I still have to choose the larger one.

Hope Leaflet FeatureLayer performance can boost up in future.

Tuesday, June 23, 2015

True Parallel AsyncTask in Android

Multiple AsyncTask execute() actually execute the tasks sequentially. If the previous task takes a long time to run, the next task can only wait till the previous one finish.

To have a true parallel run, use the following instead of AsyncTask.execute():

    AsyncTask.executeOnExecutor(Executor exec, Params... params)

Friday, May 29, 2015

3D translate an element in HTML

To translate the element, you need:
  1. A container having CSS style "perspective: ___px"
  2. The actual element having CSS style "transform: rotateX(___deg)"
Sample:

<div style="perspective:500px; margin-left:100px;">
    <div style="transform: rotateX(40deg)">
        <table border=1>
            <tr><td>testing</td><td>testing</td><td>testing</td></tr>
            <tr><td>testing</td><td>testing</td><td>testing</td></tr>
            ...
            <tr><td>testing</td><td>testing</td><td>testing</td></tr>
            <tr><td>testing</td><td>testing</td><td>testing</td></tr>
    </table>                
    </div>
</div>
testingtestingtestingtestingtesting
testingtestingtestingtestingtesting
testingtestingtestingtestingtesting
testingtestingtestingtestingtesting
testingtestingtestingtestingtesting
testingtestingtestingtestingtesting
testingtestingtestingtestingtesting
testingtestingtestingtestingtesting
testingtestingtestingtestingtesting
testingtestingtestingtestingtesting

Monday, April 20, 2015

Speed Up the Eclipse IDE

Nice tutorials and references for people who find their Eclipse is kinda slow:

  • http://www.nicolasbize.com/blog/7-tips-to-speed-up-eclipse/


Tuesday, April 7, 2015

Install Teclast X80H (FB6M) as Android USB in Windows


Teclast X80H (FB6M) is a dual OS (Windows 8.1 + Android 4.4.4) tablet, to install

  1. Install the Samsung USB driver 
  2. Restart the computer
  3. Select Device Manager > The X80H device > Update Driver Software.
  4. Select Browse my computer for driver software
  5. Select Let me pick from a list of device drivers on my computer
  6. Select ADB Interface / Android USB Devices from the list
  7. Select SAMSUNG Android ADB Interface

http://forum.xda-developers.com/windows-8-rt/general/teclast-x80h-8-dual-os-chinese-tablet-t2996314/post59151938#post59151938

Can Teclast simply provide an adb driver link for customer download easily? ... sigh

Wednesday, April 1, 2015

JavaScript frameworks that we should get touch with

More and more JavaScript framework to work with:
  • React.js
  • Ember.js
  • Knockout.js
  • Backbone.js
  • Meteor
  • Mithril
  • Ember
  • Vue.js
  • Breeze.js
  • Ractive
Reference: http://www.breck-mckye.com/blog/2014/12/the-state-of-javascript-in-2015/

CSP on Apache

To add CSP to root if sort of funny. The following will NOT work for most cases !!     <LocationMatch "^/$">        Header s...