Social Icons

Wednesday, October 14, 2015

Can't connect to mysql server on 'some_server'

I had this problem when installing a site on a CentOS server, connecting to a database on another server. It was giving the error as Can't connect to mysql server 'another_server'.

It turned out the connection to the database was being prevented by SELinux.

Issuing the following command (as root) told SELinux to allow the connection:
setsebool httpd_can_network_connect_db=1

Wednesday, February 18, 2015

How to override inline css

Generally, inline css is meant to be used to override external css. But sometimes, it needs that you cannot remove the inline css for an element and you have to overrride that using some external css. You can do this using "!important" in css

Say for example, you have a "p" element as follows:

<p id="mypara" style="color:red">
    Paragraph content
</p>

Here, you have to change the "p" background to blue color with external css i.e, you have to override the inline one. You can do this as follows:

#para {
    color: blue; !important
}

jquery remove a style property

There are many a times it happen that you need to remove a particular css style only for an element (say div). You can remove that style property using jquery.

Say for example, you have a div like this:

<div id="mydiv" style="overflow:auto;float:left">
       div content
</div>

Now, if u want to remove the "overflow" style only from the above div, then you can do it in jquery as follows:

$(#div).css("overflow", "");

The above code will remove the "overflow" style from the div.

Total Pageviews