Ruby – Introduce a new great tool for developers : regular expression builder

Today is a great day because i just finished my little tool name ‘RegexiZ’ (AKA : regular expression with ndthanh.net). this tool will help you to solve your problem with regular expressions – yeah, it’s a big problem when you decided to use regular expressions in your program. every developer know about the magic of regular expression, so let’s get start at https://ndthanh.net/regexiz 😀

note : this program is implemented base on Rails 4

Some people, when confronted with a problem, think
“I know, I’ll use regular expressions.” Now they have two problems.

MySQL – mysqldump database with minimum damage to the server

lightweght I have very large Magento databases with of almost 400 of tables some of which have up to 10GB of data in.  I’ve always had headaches when backing up these databases. Using default mysqldump it quickly spirals the server load out of control and locks up everything… affecting my users. Trying to stop the process can lead to crashed tables and lots of downtime during recovery of those tables. I now use Continue reading

Unix – Recursively chmod only directories or files

directories

Have you ever come across the problem of needing to chmod many directories and sub-directories, but you don’t want to touch any of the files? Maybe it’s the exact opposite, or you need to recursively change the permissions on only files with a specific extension. If so, this article is for you

To change permission of all directories to 755, execute this command in terminal

Continue reading

Unix – display a logfile in real time on screen

logfile

Q. I’d like to see my php or apache web server log files in real time. How do I see log file in real time including all incoming logs?

A. You need to use tail command which output the last part of files in real time including all incoming logs to a file.

tail -f file-name command

here are some examples

Continue reading

Tips for optimizing LAMP stack & Linux server

performance_banner
1. Get a dedicated server
Advantages– Whole server power for you
– You are very flexible in terms of new versions for webserver, database, php …
– There are not other customers which run “bad” scripts which slow down the shop
– You don’t share the same ip, very important for SEO.
If one customer makes a “bad business”, the ip can be blocked by google which affects your search ranking.
My recommendation:I am a big fan of the Amazon EC2 cloud which gives you everything you need (flexibility, scalability, security).
Continue reading

Auto update script for pathogen bundles


#vim auto update bundle script
 #author : Atheotsky

#locate self location & move to it
 cd `dirname $0`

#update function
 updatePlugins()
 {
 cd "$1"
 echo "updating $1 ......"
 git pull
 cd ..
 }

#build array of folder under current location
 directories=$(ls -l | egrep '^d' | awk '{print $9}')

#use loop with array
 for directory in $directories; do
 #execute function
 updatePlugins $directory
 done

echo "Update completed!"