How to add a new user to MySQL and set privileges
Dec 3rd
First you need to connect to MySQL server with a user who has administrative priveleges.
[root@techpulp ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.0.67 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
Let us assume you are creating an user named “neo” with password “neopass“and you would like to grant all privileges on the database “articles“.
mysql> GRANT ALL ON articles.* to 'neo'@'localhost' identified by 'neopass' WITH GRANT OPTION;
After adding a new user, you need More >
How to disable directory listing by Apache web server
Dec 2nd
There are two ways to disable directory browsing feature of Apache web server. However the first method is most practical way as server’s configuration file is typically not modifiable by the user as part of his hosting plan. Most of the hosting provides allow modification of .htaccess file and enable ModRewrite module in the Apache.
The ModRewrite Way
Add the following line towards the end of .htaccess file present in a directory for which you would like to disable directory listing.
Options All -Indexes
However if you have lots of such directories, it may become difficult for you to do this.
The httpd.conf way
If you More >
How to create rounded border for DIV, PRE like HTML elements
Dec 1st
The following CSS code enables rounded borders for elements like DIV, PRE etc. However it may not work in Internet Explorer (IE) as it is specific to certain browsers like Firefox.
pre {
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
The above CSS defines 3px radius for the rounded element. You can change it to a value of your choice.
How to define scrollable and fixed width DIV or PRE tag in HTML using CSS
Nov 30th
With fixed width websites, it is often desired to fix the maximum width of certain elements like <DIV>, <PRE> etc. However by fixing the maximum width of these elements, the content inside them may either disappear or may interfere with the content of element that appear near to them.
CSS supports an attribute “overflow” which can be used to define the way how browser should behave if the contents of such element tend to go beyond width or height of the element. The following are the possible values for “overflow” attribute.
Value Meaning auto Display horizontal or vertical scroll bar automatically when More >How to change bullet style for unordered list UL in HTML or CSS
Nov 30th
The unordered list “<ul>” supports an attribute named “type” that specifies type of display for bullets. The “type” attribute takes values: disc,circle,square.
The following displays a square instead of default disc style for bullets.
<ul type="square"> <li>One</li> <li>Two</li> <li>Three</li> </ul>
display looks like following
- One
- Two
- Three
Similarly, a disc style appears as follows:
- One
- Two
- Three
Similarly, a circle style appears as follows:
- One
- Two
- Three
Otherwise, you can use “list-style-type” attribute in CSS as shown below:
ul {
list-style-type: square;
}
You can customize the bullets further by specifying an image url in CSS as follows:
ul {
list-style-type: url("/images/arrow.jpg");
}
More > How to display special characters in HTML
Nov 30th
HTML is a mark up language that uses characters like “<”, “>” as part of its syntax. So it provides a special escapes to display the special characters as is in HTML. The following table provides list of special characters and their HTML syntax.
Name Symbol HTML syntax Ampersand & & Cent ¢ ¢ Copyright © © Degree ° ° Greater Than > > Less Than < < Non-breaking Space Registered Trademark ® ® Trademark ™ ™How to disable left indentation of LI tags in HTML
Nov 29th
The <li> tag can be used under an unordered list tag <ul> or ordered list tag <ol>.
The following shows how <li> tag can be used in an unordered list. Under unordered list, each <li> shows a bullet by default.
<ul> <li>One</li> <li>Two</li> <li>Three</li> </ul>
The above code appears in the browser as follows:
- One
- Two
- Three
You can use following CSS to disable left indentation:
ul {margin: 0;}
If you don’t want to display bullets, you can do the following.
ul {
list-style-type: none;
margin: 0;
}
You can use similar trick for ordered list
- as well.
How to convert huge number of images from one format to another in Linux
Nov 29th
The ImageMagick suite of tools provides all tools necessary to manipulate images and to convert images from one file-format to another. You can check if ImageMagick suite is installed in your system using following command.
[neo@techpulp ~]# rpm -aq | grep ImageMagick ImageMagick-6.4.0.10-2.fc10.i386 [neo@techpulp ~]#
Otherwise you can install the suite using following command.
[root@techpulp ~]# yum install ImageMagick
Coming back to the original topic of discussion, The ImageMagick suite provides a command-line utility “convert” to convert an image from one format to another. A simple use of “convert” command is as follows where it converts an image from PNG format to JPG More >
How to disable display of bullets for LI tags in HTML
Nov 29th
The <li> tag can be used under an unordered list tag <ul> or ordered list tag <ol>.
Unordered List The following shows how <li> tag can be used in an unordered list. Under unordered list, each <li> shows a bullet by default.
<ul> <li>One</li> <li>Two</li> <li>Three</li> </ul>
The above code appears in the browser as follows:
- One
- Two
- Three
If you don’t want each <li> item not to display its position as number under <ul>, you can add “list-style-type: none;” style to the <ul> tag.
<ul style="list-style-type: none;"> <li>One</li> <li>Two</li> <li>Three</li> </ul>
Ordered List The following shows how <li> tag can be used in an ordered list. Under ordered list, each More >
How to convert a PDF file to an image in command line of Linux
Nov 28th
The command “convert” is used to do the job. You need to install ImageMagick suite of tools that are used to manipulate images.
The following command converts a PDF file myfile.pdf to a JPG image.
[neo@techpulp ~]# convert myfile.pdf myfile.jpg
You can convert it to other image formats as well. For example, the following command converts the PDF to a PNG image file.
[neo@techpulp ~]# convert myfile.pdf myfile.png
The following command converts the PDF to a GIF image file.
[neo@techpulp ~]# convert myfile.pdf myfile.gif


Recent Comments