Dec 18, 2012

How to change mysql database or table collation


 



You can use the ALTER TABLE/DATABASE SQL statements to convert your data.


 


To set the default character set for a database, use the following statement.


 


ALTER DATABASE <database_name> CHARACTER SET utf8;


 


This does not affect any existing tables, but any future tables created in this database will use utf8 by default.


 


How to change mysql database- table collation


 


For each table you want to convert to utf8, use the following statement.


 


ALTER TABLE <table_name> CONVERT TO CHARACTER SET utf8;


 


This will automatically convert all text columns to utf8.


 

Dec 15, 2012

How to Change a Broken WordPress Theme Using PHPMyAdmin


 


Sometimes when editing .php files you will make a mistake and end up breaking your theme or sometimes you might upload a theme that is old and out of date or is just too problematic and it needs to be switched back to the twenty ten default theme.



Some times the following error may occur.



Change a Broken WordPress Theme 1


 


Here is an easy way to switch to the twenty ten default theme using PHPMyAdmin.


 


Step 1


 


Go into your cPanel and look for the Databases section and click on the phpmyadmin link.




 


Step 2


 


Select the database where your WordPress is stored.




 


Step 3


 


Select the ‘wp_options’ table from the menu on the left.

 

How to Add Leverage Browser Caching in WordPress Website via .htaccess


 


Step 1


 


First you need to access your .htaccess file through cPanel by clicking on the File Manager. When the popup box appears, click on the Web Root option and make sure that the “Show hidden files” option is checked.


 


Add Leverage Browser Caching 1





 


Step 2


 


Open up your .htaccess file and paste the following directives at the top of the file:


 

Dec 13, 2012

MySQL database export to pdf using PHP


 


To export whole database or whole table content we can use phpMyAdmin Export option but if you want to export some rows or any query result then we should perform some other way.


 


To create PDF file we should first download the FPDF Library - Click Here.


 


Copy the following code and create a new PHP file called exportpdf.php and paste the content into it or download the file - Click Here


 


Sample Output


Export PDF



Sample Code


 


<?php


require('fpdf.php');


$d=date('d_m_Y');


 

Dec 12, 2012

How to fix ereg and ereg_replace is deprecated errors in PHP 5.3


 


If you upgraded to PHP 5.3 Version, chances are high you’re going to run into a few warnings or deprecated function error messages.


 


ereg is deprecated


 


An example is the ereg family of functions, which are gone for good, as they were slower and felt less familiar than the alternative Perl-compatible preg family.




 


To migrate ereg() to preg_match()


 


Before


 


ereg('\.([^\.]*$)', $this->file_src_name, $extension);


 


After


 


preg_match('/\.([^\.]*$)/', $this->file_src_name, $extension);


 


Notice that we should wrapped the pattern (\.([^\.]*$)) around / /, which are RegExp delimiters. If you find yourself escaping / too much (for an URL for example), you might want to use the # delimiter instead.




Dec 7, 2012

How To Optimize Your Site With GZIP Compression


 


Step 1


 


First you need to access your .htaccess file through cPanel by clicking on the File Manager. When the popup box appears, click on the Web Root option and make sure that the “Show hidden files” option is checked.


 


Add Leverage Browser Caching 1





 


Step 2


 


Open up your .htaccess file and paste the following lines.


 


How to view and kill the process in Linux using Terminal


 


We can see the currently running processes in Terminal. Process means the application, command, or script that is running in your computer. Process can be visible or it can be hidden. If you just open Mozilla Firefox, then the process is created. Each process has the unique ID, called PID.


 


To view the processes


 


Open the terminal and type this command:


 


ps -e


 


To view in the page manner type:


 


ps -e | less


 


linux processes



Here, PID refers to the process ID. Every process has the unique id.


How to find windows alternative software for Linux


 


Linux have lot of alternative to windows software. Good news, the alternative are free software. Try to note down the one that you need. Finding an open source application for your need might helps you to convert yourself to Linux in short period of time. The are are several website where you can find the alternative software for commercial software. Some of them are:


 


Method 1


 


The Linux Alternative Project (formerly the Linux Equivalent Project). The website is currently in beta form and it will periodically update the database with Windows software and the Linux equivalents and alternatives.


 


To view website ==> Linux Alt - Click Here




 


Method 2


 


Its mission is to provide easy access to high quality open source alternatives to well-known commercial products. And remember that open source software is also a freeware alternative.


 


To view website ==> Osalt - Click Here



Different ways to use wget command in Linux


 


Wget is non-interactive network downloaded meaning all the download operation will run in the background. Therefore you can download any file from the Internet with wget command.


 


Wget also lets user to download the entire website. The download process start with simple wget command followed by the website URL. Wget supports HTTP, HTTPS and FTP protocol to download file.


 


Download web pages using wget


 


For example you want to download the front page of jijokjose.com. You can simply follow the command


 


wget jijokjose.com


 


the download start and saved your file in home directory which you can use for later off-line uses. Now lets suppose you have connection problem or the jijokjose server has some problem. Wget try to reconnect to the server 20 times by default. You can limit the reconnection limit by following command


 


wget -t jijokjose.com


 

Dec 6, 2012

How to Delete WordPress Post Revisions To Reduce Database Size


 


It is also made sense to delete and remove all existing stored post revisions and changes made on pages stored in the database in order to reduce the wp_posts table size, especially when there is already tons of revisions or changes been kept. After this operation you can reduce several MB size of your wp_posts table.


 


To view your post revisions, select any post and click edit button then scroll down to bottom of the page.


 


Delete WordPress Post Revisions 1


 


To delete and remove all existing post revisions entries, delete all rows from WordPress database Posts table having post_type value as revision.




Dec 4, 2012

How to change Hidden Attribute of a file/folder in Windows OS


When a Virus modifies these attributes to the files/folders in a removable device (USB/SD Memory/HDD) in order to hidden them from the user.



The problem is solved using attrib -s -h /s /d command.



The effect of New Folder.exe virus : It just make all your directory as system director and also make it hidden. Then it creates exe file for each directory with directory icon. This is why when you open any folder, it opens in new window (if you are using Microsoft windows as operating system).



So, First deleted all those exe files and delete recycle directory as well. This should remove your folder.exe virus. But still you need remove the effect of virus. You need to update back the folder attributes.



Open Command Prompt Window and navigate to the required folder usind cd <foldername> command then you can do it by a single line command:



Method 1



attrib -s -h /s /d





Method 2



attrib FOLDERNAME -s -r -a -h /S /D




Dec 3, 2012

How to solve malayalam or any other font display error in wordpress


If your wordpress site don't show malayalam or any other fonts then no need to worry. It is a simple problem in your database.



Problem



Post title and post content accepts malayalam font and when you publish the post then it displays only ???????? characters.



Before publishing : After pasting malayalam texts in title and content page, It looks like below



malayalam font display error in wordpress 1


Dec 2, 2012

How to Install JDK 7 on Ubuntu


There are several JDK implementations available for Linux, such as Oracle JDK 7, OpenJDK, Sun JDK 6, IBM JDK and GNU Java Compiler. We shall choose the Oracle JDK 7 (Ubuntu chooses OpenJDK as its default JDK, which is not 100% compatible with Oracle JDK).



Step 1 : Check if JDK has already been Installed


 


Open a Terminal or press Ctrl + Alt + T and issue this command:


 


javac -version


 


If a JDK version number (e.g., "javac 1.7.0_{xx}") appears, JDK has already been installed. You can skip the installation and goto step 3.


 


Step 2 : Download and Install JDK


 


Goto JDK (Java SE) download site at



Select "Java SE 7ux" ⇒ JDK ⇒ Download ⇒ "Accept Licence Agreement" ⇒ Select Linux x86 (for 32-bit system) or Linux x64 (for 64-bit system) "tar.gz" package, e.g., "jdk-7ux-linux-i586.tar.gz". The tarball will be stored in folder "~/Downloads", by default.


We shall install JDK under "/usr/lib/jvm". First, create a directory "jvm" under "/usr/lib" (with superuser authority "sudo"). Open a Terminal and issue these commands:


 


cd /usr/lib


sudo mkdir jvm


 

Dec 1, 2012

How to Install NetBeans on Ubuntu


To use NetBeans for Java, PHP programming, you need to first install JDK. Read "How to install JDK on Ubuntu".



Step 1 : Download netbeans


 


Download NetBeans from http://netbeans.org/downloads/. Choose platform "Linux (x86/x64)" ⇒ "Java SE". You shall receive a sh file (e.g., "netbeans-7.x-ml-javase-linux.sh") in "~/Downloads".


Set the downloaded sh file to executable and run the sh file.




Step 2 : Install netbeans


 


Open a Terminal and type the following commands.


 


cd ~/Downloads


chmod a+x netbeans-7.x-ml-javase-linux.sh   // Set to executable for all (a+x)


./netbeans-7.x-ml-javase-linux.sh                   // Run


 


Follow the instructions to install NetBeans.




How to install LAMP in ubuntu


 



Open terminal or press Ctrl + Alt +T and type the following command


 


sudo apt-get install lamp-server^


 


lamp 2





 


When you search for the name of the package that the given command seems to install cannot be found using apt-cache search. e.g. You will see this used most often when someone tells you how to install LAMP server setup (Linux-Apache-MySQL-PHP) by using the command “sudo apt-get install lamp-server^”. If you miss the caret at the end or try to search for lamp-server, it just doesn’t work.