Ordering the Javascript Array

Javascript, 2016-05-30 06:53:19 UTC
1. Ordering an array; var arrA = [10,2,4,5,0,3,4]; arrA.sort(); // [0, 10, 2, 3, 4, 4, 5]   2. Ordering a simple array with a function; var arrA = [10,2,4,5,0,3,4]; // 1arrA.sort(function(a, b){     return a - b; }); // 1 result // [0, 2, 3, 4, 4, 5, 10]   // 2arr

How to rename fields in Mongodb

MongoDB, 2016-04-09 06:20:57 UTC
We know MongoDB database is unstructured. Each document may contain different field and different field number.  But, for some reason, We need the document contains same field name. Or We named with the wrong field name and We want to rename it for the new one.   This is how to do i

How to convert JSX files offline

ReactJS, 2016-04-07 08:10:40 UTC
For ReactJS project, it is easy to mix an HTML with JavaScript using JSX. We can serve a JSX file to produce an HTML element. But, it's not good because the application must convert it to JavaScript first, then the JavaScript create an HTML element for it. It will kill the application performanc

Backup MySQL by Time Interval with Bash Script and Crontab

MySQL, 2016-04-04 02:32:00 UTC
1. Create bash script; b=$(date +"%Y-%m-%d") c=".sql" mysqldump -uroot -pSecret123 --opt db_one > /home/myname/backup/db_one-$b$c mysqldump -uroot -pSecret123 --opt db_two > /home/myname/backup/db_two-$b$c   2. Create Crontab; $ crontab -e   In crontab file, add thi

Image error handling in ReactJs

ReactJS, 2016-03-31 03:36:48 UTC
Today I am dealing with image error. The main reason to check an image error is 'image not found'. When this error image rendered, the page looks ugly. This is like trivial problem with server side script. But for client side script, it is tricky.  Here is how to handle it in ReactJS; var Img

Shell command execution in nodejs

NodeJS, Web Development, 2016-03-19 23:34:26 UTC
Sometimes, we need a function that doesn't exist in nodejs. Or sometimes we know other function better to do 'this' job rather than in nodejs function. So, for this we need to execute some command via shell command. And for me, here is how to run shell command; function run_cmd(cmd, args,

How to submit new application to itunes

Apple, iOS, 2016-03-17 07:10:35 UTC
1. When you uploaded it to itunes from xcode, you will see this;     2. Above means, you need to create new idenditier in your apple account   3. Go to https://developer.apple.com/account/ios/identifier/bundle/create     4. Create new one. And here, you can cho