How to check Linux OS version through command prompt

Use following check Linux OS version through command linux operating system version. There are so many linux commands which are useful but sometimes you need to know about hosting server details and their operating system.

following command will useful for fedora, centos, redhat os.

#uname -a

I got the following result after this command.

Linux purab-5745 3.8.0-29-generic #42-Ubuntu SMP Tue Aug 13 19:40:39 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

If you have debian OS than, you can use following command.

cat /etc/debian_version

Normally above command will show the your kernel version information.

Following command also shows the OS version

cat /proc/version
cat /etc/redhat-release

How we configure memcached on fedora with machine restart

In this tutorial we will show you how configure memcached on fedora with machine restart, First install the memcached on server- linux box.

What is Memcahced?

Memcached is free and open-source software, licensed under the Revised BSD license.[2] Memcached runs on Unix-like operating systems (at least Linux and OS X) and on Microsoft Windows. It depends on the libevent library.

configure memcached on fedora

# yum install php-pdo php-mcrypt squirrelmail php-pecl-apc php-xml php-gd php-devel php php-imap php-pgsql php-pear php-soap php-mbstring php-ldap php-mysql php-cli php-pecl-memcache

Using this file you can change the cache and memory size.

[root@kapilk-pc kapil]# vim /etc/rc.d/init.d/memcached

Aslo change the following file also. Do same setting in this file

# /etc/sysconfig/memcached

[root@kapilk-pc kapil]# /etc/init.d/memcached restart
Stopping memcached: [ OK ]
Starting memcached: [ OK ]

Following command will set command as wheneven machine reboots, memcached server will restart.

[root@kapilk-pc kapil]# /sbin/chkconfig memcached on

How to javascript append html string to element

Javascript tutorial, Article for, How to javascript append html string to element. I created following script putting the html at end of body tag.

javascript append html string to element

If you are using or following web 2.0(Table less HTML) standards for creating the HTMLs then this script will work 100%

Just Put this script in your HTML and see the html source. You will able to see the div id named “kapil” with the test content.


<script type=’text/javascript’>
var kapil = document.createElement(‘div’);
kapil.id = ‘form_kapil’;
var all_divs = document.getElementsByTagName(‘div’);
if (document.body.firstChild){
document.body.insertBefore(kapil, all_divs[all_divs.length] );
} else {
document.body.appendChild(kapil);
}
var oldHTML = document.getElementById(‘form_kapil’).innerHTML;
var newHTML = “test content”;
//document.getElementById(‘form_kapil’).innerHTML = newHTML;
var all_divs = document.getElementsByTagName(“div”);
//alert(all_links[all_links.length - 1].innerHTML);
all_divs[all_divs.length - 1].innerHTML = newHTML;
</script>

Have fun!

How to change timezone linux command line

In this article we will tell you to change timezone linux command line. Location of the local time file
Linux looks at /etc/localtime to determine the current time of your machine. This can either be a symbolic link to the correct time zone or a direct copy of the time zone file.

Please use following commands for changing the timezone.

[root@ip-kapilk-pc kapil]# date
Fri Jan 22 06:35:11 MST 2010

[root@ip-kapilk-pc kapil]# ln -sf /usr/share/zoneinfo/
Africa/ Cuba GMT0 Japan Poland Universal
America/ EET GMT-0 Kwajalein Portugal US/
Antarctica/ Egypt GMT+0 Libya posix/ UTC
Arctic/ Eire Greenwich MET posixrules WET
Asia/ EST Hongkong Mexico/ PRC W-SU
Atlantic/ EST5EDT HST Mideast/ PST8PDT zone.tab
Australia/ Etc/ Iceland MST right/ Zulu
Brazil/ Europe/ Indian/ MST7MDT ROC
Canada/ Factory Iran Navajo ROK
CET GB iso3166.tab NZ Singapore
Chile/ GB-Eire Israel NZ-CHAT Turkey
CST6CDT GMT Jamaica Pacific/ UCT

[root@ip-kapilk-pc kapil]# ln -sf /usr/share/zoneinfo/EST /etc/localtime
[root@ip-kapilk-pc kapil]# date
Fri Jan 22 08:40:32 EST 2010
[root@ip-kapilk-pc kapil]#

Change TimeZone Using /etc/localtime File

For this example, assume that your current timezone is UTC as shown below. You would like to change this to Pacific Time.

# date
Mon Sep 17 22:59:24 UTC 2010

how to create easy web layout in dreamweaver

In dream weaver you can easy create web layout, edit web layout & modified. you just have to go in dream weaver click file then select new after clicking new there is open new window in that many option to select new layouts in new layouts there is many basic layout in dream weaver select first basic layout & click on finish. in dream weaver having code window & preview window you can access both of in one window that is more fine.

here are some best youtube videos:
Dreamweaver Tutorial – Create a SIMPLE website using CSS and HTML (for beginners)

In this Dreamweaver CS6 video we will:

– Create a web page template
– Style and position elements in the page using CSS
– Create a border radius on your DIV container using CSS
– We are going to load some new web fonts into Dreamweaver, so you can include really cool fonts on your projects, and ensure your visitors can see the fonts you intend for them to see, even if they do not have them on their computer.
– Explore some HTML5 tags
– Demonstrate how to add HTML 5 tags code hinting to Dreamweaver CS6 tag library
– Layout a basic page structure using a combination of HTML5 tags and regular DIV tags
– Create a hover effect using CSS for our newly created top and bottom navigation menu

CSS Build a Simple Web Page in Dreamweaver!

How To Make a Website in Dreamweaver (AMAZING Tutorial!)

In this video I will show you how to create a basic web page and how to set up a CSS website layout in Dreamweaver using div tags. I will explain to you the CSS box model, I will show you how to define a site, how to create a CSS layout, how to insert content: images, text, how to style text with CSS, how to create links and how to link one page to an other, how to fill out the meta tags, and how to style your elements in CSS.

How to Create Your First Web Page in Dreamweaver CS6 & CC

In this Dreamweaver CS6 video we will:

– Create a web page template
– Style and position elements in the page using CSS
– Create a border radius on your DIV container using CSS
– We are going to load some new web fonts into Dreamweaver, so you can include really cool fonts on your projects, and ensure your visitors can see the fonts you intend for them to see, even if they do not have them on their computer.
– Explore some HTML5 tags
– Demonstrate how to add HTML 5 tags code hinting to Dreamweaver CS6 tag library
– Layout a basic page structure using a combination of HTML5 tags and regular DIV tags
– Create a hover effect using CSS for our newly created top and bottom navigation menu

How to setup vnc-server on fedora or linux

In this tutorial we will show you to How to setup vnc-server on fedora 11, we given you steps you install and configure the vnc server. we installed the tiger vnc server. Use following steps:

What is vnc server?

TigerVNC is a high-performance, platform-neutral implementation of VNC (Virtual Network Computing), a client/server application that allows users to launch and interact with graphical applications on remote machines. TigerVNC provides the levels of performance necessary to run 3D and video applications, and it attempts to maintain a common look and feel and re-use components, where possible, across the various platforms that it supports. TigerVNC also provides extensions for advanced authentication methods and TLS encryption.

Following commands can be used on any linux machine like centos, redhat, debian and ubuntu os.

[root@siwank-pc siwan]# yum install vnc-server

Loaded plugins: refresh-packagekit
Setting up Install Process
Package tigervnc-server-1.0.0-2.fc11.i586 already installed and latest version
Nothing to do

[root@siwank-pc siwan]# vim /etc/sysconfig/vncservers

In file use following lines (//SIWAN IS MY USER NAME, YOU NEED TO USE YOUR USERNMAE)

VNCSERVERS="59:siwan"
VNCSERVERARGS[59]="-geometry 1024x768 -nolisten tcp"

Than set your password or change for VNC-viewer

[siwan@siwank-pc ~]$ vncpasswd
Password:
Verify:

Than Became root user using following command.

[siwan@siwank-pc ~]$ su
Password:

Start the VNC server using following command. Use following command to start vnc services after rebooting

[root@siwank-pc siwan]# /sbin/service vncserver restart

[root@siwank-pc siwan]# /sbin/chkconfig vncserver on

Done!

Now you can able to use your box from vnc viewer..

How to install Imagemagick on linux and check Imagemagick

In this tutorial we will give information about, How to install Imagemagick on linux and check Imagemagick. Imagemagick is great application for image manipulation on linux box.

What is Imagemagick?

ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, TIFF, DPX, EXR, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.

install Imagemagick on linux

The functionality of ImageMagick is typically utilized from the command-line or you can use the features from programs written in your favorite language. Choose from these interfaces: G2F (Ada), MagickCore (C), MagickWand (C), ChMagick (Ch), ImageMagickObject (COM+), Magick++ (C++), JMagick (Java), L-Magick (Lisp), Lua (LuaJIT), NMagick (Neko/haXe), Magick.NET (.NET), PascalMagick (Pascal), PerlMagick (Perl), MagickWand for PHP (PHP), IMagick (PHP), PythonMagick (Python), RMagick (Ruby), or TclMagick (Tcl/TK). With a language interface, use ImageMagick to modify or create images dynamically and automagically.

Use following command for Installing the Imagemagick
#su
#YOUR_PASSWORD
#yum install imagemagik

OR binary installtion follow this:
tar -xzf imagemagic1.2.3.4.5.6.tar.gz
cd imagemagic1.2.3.4.5.6
./configure
make
make check
make install

How to check Imagemagick on Fedora:
[root@siwank-pc html]# rpm -ql ImageMagick
/usr/bin/animate
/usr/bin/compare
/usr/bin/composite
/usr/bin/conjure
/usr/bin/convert
/usr/bin/display
/usr/bin/identify
/usr/bin/import
/usr/bin/mogrify
/usr/bin/montage
/usr/bin/stream
…….

For running the ImageMagick use following commands
#animate or #display

Run Php code in html files

In this tutorial we will show you to Run Php code in html files. PHP is most popular server-side script in the world now. HTML is great for SEO purpose. executing PHP script is possible in HTML file.

What is PHP?

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly.

Just use following code in your .htaccess file or Apache configuration file.

AddType application/x-httpd-php .html

Or for .htm

AddType application/x-httpd-php .htm

If you only plan on including the PHP on one page, it is better to setup this way:

AddType application/x-httpd-php .html
I found following article useful.
http://php.about.com/od/advancedphp/p/html_php.htm

How to remove curly quotes from WordPress post

While doing the copy and paste from any website is always problem. While coping the code. curly quotes come and you want to convert that into straight quotes. Some time you want to remove curly quotes from WordPress post title or body.

How to remove curly quotes from WordPress post Title and body.

Here we have given following code which can be useful. The apostrophe should be straight not curly in WordPress.

Just Open your functions.php file from your theme folder. If you did not created functions.php file then you can paste this code in your header.php file.

remove_filter('comment_text', 'wptexturize');
remove_filter('the_title', 'wptexturize');
remove_filter('the_content', 'wptexturize');

This will solve your problem.

How to remove curly quotes and use straight quotes then use following code.

function removesmartquotes($content) {
$content = str_replace('&#8220;', '&quot;', $content);
$content = str_replace('&#8221;', '&quot;', $content);
$content = str_replace('&#8216;', '&#39;', $content);
$content = str_replace('&#8217;', '&#39;', $content);

return $content;
}
add_filter('the_content', 'removesmartquotes');
add_filter('comment_text', 'removesmartquotes');

More reference

code snippets which is most useful in functions.php, wordpress
code snippets which is most useful in functions.php, wordpress

In wordpress – wp-includes/default-filters.php file, we have following list of filters which we can override.

/ Display filters
//add_filter('the_title', 'wptexturize');
add_filter('the_title', 'convert_chars');
add_filter('the_title', 'trim');
 
//add_filter('the_content', 'wptexturize');
add_filter('the_content', 'convert_smilies');
add_filter('the_content', 'convert_chars');
add_filter('the_content', 'wpautop');
add_filter('the_content', 'prepend_attachment');
 
//add_filter('the_excerpt', 'wptexturize');
add_filter('the_excerpt', 'convert_smilies');
add_filter('the_excerpt', 'convert_chars');
add_filter('the_excerpt', 'wpautop');
add_filter('get_the_excerpt', 'wp_trim_excerpt');
 
//add_filter('comment_text', 'wptexturize');
add_filter('comment_text', 'convert_chars');
add_filter('comment_text', 'make_clickable', 9);
add_filter('comment_text', 'force_balance_tags', 25);
add_filter('comment_text', 'convert_smilies', 20);
add_filter('comment_text', 'wpautop', 30);
 
add_filter('comment_excerpt', 'convert_chars');
 
//add_filter('list_cats', 'wptexturize');
//add_filter('single_post_title', 'wptexturize');

 

 

Finding mouse position browser and screen size javascript

This article will be use for Finding mouse position browser with only javascript. Javascript is base for many framework. If you have strong knowledge of javascript then you will be able to write any code in web sites.

Following script Will tested and working on following browsers.
1. Firefox 2+
2. Google chrome
3. Safari
4. IE 6, 7, 8
5. Opera
You can Use following code for Capturing the Mouse coordinates as per Document body

var isIE = document.all?true:false;
// document.onmousemove = getMousePosition;
// document.onmousemove = getscreenPosition;
function getMousePositionBrowsersizeWise(e) { // as per Document body
var _x;
var _y;
if (!isIE) {
_x = e.pageX;
_y = e.pageY;
}
if (isIE) {
_x = event.clientX + document.body.scrollLeft;
_y = event.clientY + document.body.scrollTop;
}
alert(_x);
alert(_y);
}

You can Use following code for Capturing the Mouse coordinates as per Screen Resolution

function getMousePositionScreenWise() {
var ScrX = window.screenLeft != undefined ? window.screenLeft : window.screenX;
var ScrY = window.screenTop != undefined ? window.screenTop : window.screenY;
alert(ScrY);
alert(ScrX);
}

Following script Will tested and working on following browsers.1. Firefox 2+2. Google chrome 3. Safari4. IE 6, 7, 85. Opera
You can Use following code for Capturing the Mouse coordinates as per Document body

var isIE = document.all?true:false;// document.onmousemove = getMousePosition;// document.onmousemove = getscreenPosition; function getMousePositionBrowsersizeWise(e) { // as per Document body var _x; var _y; if (!isIE) { _x = e.pageX; _y = e.pageY; } if (isIE) { _x = event.clientX + document.body.scrollLeft; _y = event.clientY + document.body.scrollTop; } alert(_x);alert(_y); }

You can Use following code for Capturing the Mouse coordinates as per Screen Resolution

function getMousePositionScreenWise() {var ScrX = window.screenLeft != undefined ? window.screenLeft : window.screenX;var ScrY = window.screenTop != undefined ? window.screenTop : window.screenY;
alert(ScrY);alert(ScrX);
}

Following script Will tested and working on following browsers.1. Firefox 2+2. Google chrome3. Safari4. IE 6, 7, 85. Opera
You can Use following code for Capturing the Mouse coordinates as per Document body

var isIE = document.all?true:false;// document.onmousemove = getMousePosition;// document.onmousemove = getscreenPosition;function getMousePositionBrowsersizeWise(e) { // as per Document bodyvar _x;var _y;if (!isIE) {_x = e.pageX;_y = e.pageY;}if (isIE) {_x = event.clientX + document.body.scrollLeft;_y = event.clientY + document.body.scrollTop;}alert(_x);alert(_y);}

You can Use following code for Capturing the Mouse coordinates as per Screen Resolution

function getMousePositionScreenWise() {var ScrX = window.screenLeft != undefined ? window.screenLeft : window.screenX;var ScrY = window.screenTop != undefined ? window.screenTop : window.screenY;alert(ScrY);alert(ScrX);}

Following script Will tested and working on following browsers.1. Firefox 2+2. Google chrome 3. Safari4. IE 6, 7, 85. Opera
You can Use following code for Capturing the Mouse coordinates as per Document body

var isIE = document.all?true:false;// document.onmousemove = getMousePosition;// document.onmousemove = getscreenPosition;
function getMousePositionBrowsersizeWise(e) { // as per Document body  var _x;  var _y;  if (!isIE) {    _x = e.pageX;    _y = e.pageY;  }  if (isIE) {    _x = event.clientX + document.body.scrollLeft;    _y = event.clientY + document.body.scrollTop;  }
alert(_x);alert(_y);  }

You can Use following code for Capturing the Mouse coordinates as per Screen Resolution

function getMousePositionScreenWise() {var ScrX = window.screenLeft != undefined ? window.screenLeft : window.screenX;var ScrY = window.screenTop != undefined ? window.screenTop : window.screenY;
alert(ScrY);alert(ScrX);
}