FAQ: Mysql error – Too many connections

Error_too-many-connections

This is not a frequent error but can arise in situations if the number of mysql connections exceeds the Mysql max_connections configuration value.

To quote from MySQL site,

If you get a Too many connections error when you try to connect to the mysqld server, this means that all available connections are in use by other clients.

I also faced this situation and tried several solution but to no avail. Finally what worked was the command mentioned below.

 

Try this only if nothing else works.

FAQ: Mysql import and export database from command line

mysql-logo

Import a Mysql file to a database

Hit enter after entering above command in your terminal. You will be asked for MySql password. Note that mentioned database must be already available in mysql.

Export a Mysql database to sql file

To export your mysql database to a sql file use the following command:

Hit enter and a sql file will be generated for you.

 

Quick Tip – TinyMCE : Use full url while inserting image

fi-tinymce

Problem:This is a common scenario. You are using tinyMCE in admin of a site to insert a link to image.  While displaying that image on frontend tinyMCE makes it relative path instead of absolute.
Solution:
When setting up tinyMCE set these 2 configuration options:

 

Both these options are true by default. As the name implies, “remove_script_host” removes the protocol and host part of URLs. “relative_urls” must be set to false is you want to set “remove_script_host” to false.

TinyMCE documentation for relative_urls and remove_script_host.

Hope it helps.

Code snippet : WordPress qTranslate – Getting current language

So I was working with the qTranslate plugin of WordPress’s and needed to select an image depending on language. qTranslate provides a utility function which returns the current language.

The function is called qtrans_getLanguage() and it works as follows:

You can find this function in qtranslate_utils.php file in qTranslate directory.

 

jQueryUI Sortable-tr width reduces when used with table

I am working on a project where I need to make a list of items sortable. Naturally, I used jQueryUI’s sortable component. Now it works great for elements like ul, or ol or any other html structure.

In my case the items were in a table and I had to make the tr’s sortable. Implementing the sortable gave me the desired behavior. Here is the code I used:

But while dragging the rows, the width of cells inside currently dragged row was getting decreased, making the row appear far smaller than normal size and ugly. This is what I am talking about (note row #6):

I did a quick Google search and found the following solution which works well. You will have to use the “helper” option provided by jQuery UI api. Here is it how you use it:

Source : StackOverflow