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

Magento – Clean database dump for development purpose

cleaning database

Mangeto Database is huge and complicated, everyone knows about this truth. It’s a big obstacle for many developers who start working on a new project or grab latest changes on production server. The following procedure will help you to reduce size of production database a lot before downloading to you local environment.

Continue reading

MySQL – server has gone away, a new discovery

A long time ago, i wrote an article to show you how to deal with ‘mysql server gone away’ issue of mysql server. i hope it helped you guys to deal with this common issue as much as it did to me.

Recently, i fell into another mysql server gone away trap, i tried to fix it knowledge from the above article. It didn’t help 🙁 . so i decided to debug it and found the solution finally.

The solution is really simple: Don’t use socket connection or localhost to connect to mysql server in your apps. this fix will work when you have a lot of virtual hosts on your server. mysql won’t be able to handle so many socket requests at once, but if you connect to your local host server ip, it will receive query requests and handle internally with socket.

I hope this will help :). please leave comments if you still experience ‘mysql server gone away’ after trying my 2 articles (this and on on the link above)

Magento – Remove redundant attributes

Delete_Banner

Some time Magento redundant attributes can be very harmful. for example, AheadWork shop by brand will add aw_shopbybrand_brand attribute to catalog_product, it’s ok when you still use AheadWork module but it can be a big trouble like fatal error on server or producing error messages in your log file when you replace it with another extension. This issue happened because you just removed AheadWork module code from your Magento installation, aw_shopbybrand_brand attribute is still stay in your database. in this article, i will show you a setup script that will remove it.
Continue reading

Javascript – continuously, respectively send requests to server

continuous

Sometime you may want to send requests continuously to server with one request each time ( like a foreach in PHP, or for x in array or .each in Ruby …). we have ‘for’ and ‘for .. in’ loop but it’s not smart enough to wait for an Ajax request to be responded. so it doesn’t help us to fulfill our target. what should we do to loop through array, send Ajax request to server with data from array element and wait for response before sending new request ?

Continue reading

Control Git with PHP

gitphp
Git is getting popular day by day and there are many web front-ends for git available on the internet. In this article, i will give you an alternative option to work with git directly from PHP, i think it can be handy in some cases.

To start working with it, we will need to find out apache web user on the system. Normally, it’s www-data on linux and _www on Mac then we need to switch to that user using this command

Continue reading

WordPress – Update core/plugins without FTP

updatebanner

Ever wanted to update your wordpress core & plugins from admin 😀 ? this fix to allow WordPress automatic plugin installation/update without FTP:

A) Changed the owner and permissions for the entire WordPress installation, assuming you installed WordPress in /Users//Sites:

Continue reading