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.

 

Create sharing icons for Facebook, Twitter and LinkedIn to share URLs

Social sharing icons are commonplace on websites these days. Almost every blog or website has links to share on Facebook and Twitter at least. Normally, these can be embedded by copy-pasting some JavaScript and HTML code from their respective sites. This is clearly an overhead for your web page if all you want to do is share a link from your web page.

In this post, we will see, how your can create your own sharing icons to share links on Facebook, Twitter and LinkedIn in a simple manner. Let us start now.

Continue reading Create sharing icons for Facebook, Twitter and LinkedIn to share URLs

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