Friday, April 18, 2014

How to restore your MySQL database from a backup?

To restore (import) a database via phpMyAdmin, first choose the database you'll be importing data into. Then click the Import tab.

http://www.webprogrammingtips.com/index.php/2015/09/10/how-to-restore-your-mysql-database-from-a-backup/ 

How to backup your MySQL database?

You can easily create a dump file(export/backup) of a database used by your account. In order to do so you should access the phpMyAdmin tool available in your cPanel:




The phpMyAdmin tool will be loaded shortly.
You can select the database that you would like to backup from the Database menu.
Then click  Export tab from Right side of top of the page.


Finally Click on the Go button from down side of the export page to start the Database export/backup .

Monday, April 14, 2014

How to Install WordPress?


Step-by-step Manual WordPress Installation Guide

Step 1: Download the WordPress installation package
Step 2: Upload the WordPress files to your server
Step 3: Create a MySQL Database for WordPress to use
Step 4: Go through the installation process


To run WordPress your host just needs a couple of things:

  • PHP version 5.2.4 or greater
  • MySQL version 5.0 or greater
  • Web Server(Appache)
The requirements have changed as of WordPress 3.2. The minimum requirements for WordPress 3.1 are PHP 4.3 and MySQL 4.1.2.
You may use WAMP server for PHP/Mysql/Apache for Windows Development Environment. Click here to Download

Step 1:Download the WordPress installation package

To start the installation process, first you need to download WordPress from it's official download page. We recommend that you always download and install the latest stable version of WordPress.



Once you click on the Download button for the latest WordPress version, the installation package will be saved to your hard disk. Locate the installation package that you've just downloaded and extract it to a new folder

Step 2:Upload the WordPress Files to Your Server

Now, you need to upload the extracted files and folders to your web server. The easiest way to upload the installation files is via FTP. For detailed information on how to upload files via FTP

Step 3:Create a MySQL Database for WordPress to use

Now, you need to create a MySQL database and assign a user to it with full permissions. You may use PHPAdmin tools for creating Database.



Step 4:Go through the installation process

Now it's time to navigate to your website to start with the installation process. If you have uploaded WordPress in your public_html directory you'll need to go to http://yourdomain.com in your preferred browser. The first thing you will notice is a message, telling you that you don't have a wp-config.php file and you should create one. Just click on the Create a Configuration File button to proceed.


On this page you will see a message, asking you to prepare the necessary information for the installation. Since we already have this information, simply press the Go! button.


Enter the details for your newly created MySQL database and press the Sumbit button


WordPress will now check if your settings are correct. If you have entered all the necessary information, you will see a confirmation screen. Press the Run the Install button to proceed.



On the next screen you will have to enter the information about your administrative username and the title of your new site. In addition, you can specify whether you'd want search engines to index your site or not. Once you fill in that information, press the Install WordPress button. Bear in mind, however, that you should specify a real email address. It can be later used in case you forget your password.

Your new WordPress application is installed. You can use the Login In button to access your administrative backend and start posting in your new site.




Sunday, April 13, 2014

How to Install WordPress Themes



The first thing you need to do when you want to install a new WordPress theme is to login to your site admin page. Once there,
go to Appearance -> Themes.


Here, you will see all the themes you have currently installed in your application. To add another one, simply click on the Install Themes tab.


On this page there are two ways to add a new theme. You can either use the search field which will return results from the WordPress.org theme directory or you can upload a theme from your local hard drive. In this tutorial we will show you how to add themes in both ways.

Choose and Install a theme from the official WordPress theme directory

The easiest way to install themes to your WordPress site is if they are listed in the official themes directory. This allows you to search for the theme you need directly from your site admin page. Each theme in the official directory has to have Tags that describe its functionality allowing you to easily search for the right theme.

If you know the theme's name, you can simply search for it.
However, usually that's not the case. This is why, you can use the Feature Filter. For example, you can search for a Black and White, Two columns theme that has Flexible Width. Simply check those tags and press the Find Themes button.


Now, browse through the results and choose a theme for your site. Once you decide to use one, click on the Install Now link under it.


Your WordPress application will download and install the theme for you. Simply click the Acticate link on the next page you will be redirected to.

That's all - you can go to the front page of your site to see its new looks.



Upload a theme you have already downloaded

If you have a theme that's not listed in the WordPress.org directory, you can simply upload it from the Themes -> Install Themes section in WordPress. To do this click on the Upload link at the top of the page.

Now, click the Choose File button, select the archive of your theme from your local computer and press the Install Now button.


In few seconds, WordPress will upload and extract the theme archive for you. All you need to do next is to press the Activate link under the message for successful theme installation.


End of installation.

Friday, April 11, 2014

MySQL Change root Password



Method #1: Use mysqladmin command to change root password

If you have never set a root password for MySQL server, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows:
$ mysqladmin -u root password NEWPASSWORD

However, if you want to change (or update) a root password, then you need to use the following command:

$ mysqladmin -u root -p'oldpassword' password newpass

For example, If the old password is abc, you can set the new password to 123456, enter:
$ mysqladmin -u root -p'abc' password '123456'

Note:123456 password is used for demonstration purpose only. You must select a strong password. It is an important protection to help you have safer MySQL database transactions.
Sample live session from my home server using mysqladmin


Fig.01: mysqladmin command in action
How do I verify that the new password is working or not?

Use the following mysql command:

mysql -u root -p'123456' db-name-here

OR

mysql -u root -p'123456' -e 'show databases;'
A note about changing MySQL password for other users

To change a normal user password you need to type the following command. In this example, change the password for nixcraft mysql user:
$ mysqladmin -u nixcraft -p'old-password' password new-password

Method #2: Changing MySQL root user password using mysql command

This is an another method. MySQL stores username and passwords in user table inside MySQL database. You can directly update or change the password using the following method for user called nixcraft:
Login to mysql server, type the following command at shell prompt:
$ mysql -u root -p
or
if there is no password of root user
Use $mysql

Use mysql database (type command at mysql> prompt):

mysql> use mysql;

Change password for user nixcraft, enter:
mysql> update user set password=PASSWORD("NEWPASSWORD") where User='nixcraft';

Finally, reload the privileges:
mysql> flush privileges;
mysql> quit

Saturday, April 5, 2014

Oracle Application Server 10g R2 Installation guide in Linux Redhat- 4 update 5

Step-1

Log in as root:
Change redhat version

[root@localhost ~]# vim /etc/redhat-release

#Red Hat Enterprise Linux ES release 4 (Nahant Update 5) Add following line for new
Redhat-4


IP address & host name in /etc/hosts file

[root@app01 ~]# vim /etc/hosts
Save the username and password carefully during the install steps.

========================================================

127.0.0.1               pblapps localhost.localdomain   localhost
========================================================

Change host name in /etc/sysconfig/network file

[root@pblapps ~]# vim /etc/sysconfig/network

========================================================
HOSTNAME=pblapps
========================================================
To Check Host Name

[root@pblapps etc]# echo $HOSTNAME
========================================================

Using any text editor, create or edit the /etc/sysctl.conf file and add or edit lines similar to the following:

[root@app01 ~]# vim /etc/sysctl.conf
========================================================

kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
#semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 256 32000 100 142
fs.file-max = 206173
net.ipv4.ip_local_port_range = 1024 65000
kernel.msgmni = 2878
kernel.msgmax = 8192
kernel.msgmnb = 65535
========================================================

To check:
[root@app01 ~]# /sbin/sysctl -p

========================================================

Add the following lines to /etc/security/limits.conf file:

[root@app01 ~]# vim /etc/security/limits.conf
========================================================
*        soft        nproc         2047
*        hard       nproc         16384
*        soft        nofile        2048
*        hard       nofile        65536
========================================================

Add the following line to the /etc/pam.d/login file, if it does not already exist

[root@app01 ~]# vim /etc/pam.d/login
========================================================
session    required     /lib/security/pam_limits.so
========================================================

Step-2

Check that the following software packages, or higher versions, are installed:

glibc-2.3.4-2.9
glibc-common-2.3.4-2.9
binutils-2.15.92.0.2-13
compat-libstdc++-296-2.96-132.7.2
gcc-3.4.3-22.1
gcc-c++-3.4.3-22.1
libstdc++-3.4.3-22.1
libstdc++-devel-3.4.3-22.1(not ins)
openmotif21-2.1.30-11.RHEL4.4(not i
pdksh-5.2.14-30(not inst)
setarch-1.6-1
make-3.80-5
gnome-libs-1.4.1.2.90-44.1(not
sysstat-5.0.5-1
compat-db-4.1.25-9
control-center-2.8.0-12
xscreensaver-4.18-5.rhel4.2

To check:
            rpm -q package_name
To Install:
            rpm -i package_name

We recommend that select all package to install when Linux installation

 Step -3

Add a group
==========================================================
[root@app01 ~]# /usr/sbin/groupadd oinstall ==========================================================

Add oracle user to group
==========================================================
[root@app01 ~]# /usr/sbin/useradd -g oinstall oracle
==========================================================

Password set
==========================================================
[root@app01 ~]# passwd oracle
==========================================================

=========================Output============================

Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

==========================================================

To Make Directory where install infra & Middle
==========================================================
[root@app01 ~]# mkdir -p /u01/infra
[root@app01 ~]# mkdir -p /u01/mid
[root@app01 ~]# chown -R oracle.oinstall /u01

==========================================================

Step -4

Log in as oracle user

Edit bash profile of oracle user

[oracle@app01 ~]$ vim .bash_profile

==========================================================
PATH=$PATH:$HOME/bin; export PATH
unset USERNAME

#Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_BASE=/u01; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/infra; export ORACLE_HOME

## Active Infra Home when you install infra other wise active Middle home

#ORACLE_HOME=$ORACLE_BASE/mid; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
ORACLE_SID=iasdb; export ORACLE_SID
PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH; export PATH
PATH=$PATH:$ORACLE_HOME/dcm/bin:$ORACLE_HOME/opmn/bin:$ORACLE_HOME/jdk/bin; export PATH

################ This part for Middle ware##################################

LD_LIBRARY_PATH=/u01/oracle/mid/lib:/u01/oracle/mid/jdk/jre/lib/i386:/u01/oracle/mid/jdk/jre/lib/i386/server:/u01/oracle/mid/jdk/jre/lib/i386/native_threads:/tmp/OraInstall2005-11-09_04-23-19PM/jre/lib/i386/client:/tmp/OraInstall2005-11-09_04-23-19PM/jre/lib/i386:/tmp/OraInstall2005-11-09_04-23-19PM/jre/../lib/i386:/usr/lib:/u01/oracle/mid/forms:$ORACLE_HOME/jdk/jre/lib/i386/server:$ORACLE_HOME/jdk/jre/lib/i386/native_threads:$ORACLE_HOME/jdk/jre/lib/i386:$ORACLE_HOME/lib:$ORACLE_HOME/jre/1.1.8/lib:/u01/oracle/mid/forms; export LD_LIBRARY_PATH
export LD_ASSUME_KERNEL=2.4.19
CLASSPATH=/u01/oracle/mid/j2ee/OC4J_BI_Forms/applications/formsapp/formsweb/WEB-INF/lib/frmsrv.jar:/u01/oracle/mid/jlib/repository.jar:/u01/oracle/mid/jlib/ldapjclnt10.jar:/u01/oracle/mid/jlib/debugger.jar:/u01/oracle/mid/jlib/ewt3.jar:/u01/oracle/mid/jlib/share.jar:/u01/oracle/mid/jlib/utj.jar:/u01/oracle/mid/jlib/zrclient.jar:/u01/oracle/mid/reports/jlib/rwrun.jar:/u01/oracle/mid/forms/java/jacob.jar:/u01/oracle/mid/forms/java/frmwebutil.jar:/u01/oracle/mid/jdk/jre/lib/rt.jar; export CLASSPATH
FORMS_BUILDER_CLASSPATH=/u01/oracle/mid/forms/java/webutil.jar:/u01/oracle/mid/jdk/jre/lib/rt.jar:/u01/oracle/mid/forms/java/jacob.jar:/u01/oracle/mid/forms; export FORMS_BUILDER_CLASSPATH
RW=$ORACLE_HOME/reports; export RW
REPORTS_PATH=$ORACLE_HOME/reports/templates:$ORACLE_HOME/reports/samples/demo:$ORACLE_HOME/reports/integ:$ORACLE_HOME/reports/printers; export REPORTS_PATH
REPORTS_TMP=/tmp; export REPORTS_TMP
WEBUTIL_CONFIG=/u01/oracle/mid/forms/server/webutil.cfg; export WEBUTIL_CONFIG
REPORTS_NO_DUMMY_PRINTER=TRUE; export REPORTS_NO_DUMMY_PRINTER
REPORTS_TAGLIB_URI=/WEB-INF/lib/reports_tld.jar; export REPORTS_TAGLIB_URI
#REPORTS_CLASSPATH=$ORACLE_HOME/reports/jlib/rwbuilder.jar:$ORACLE_HOME/reports/jlib/rwrun.jar:$ORACLE_HOME/jlib/zrclient.jar:$ORACLE_HOME/j2ee/home/oc4j.jar:$ORACLE_HOME/j2ee/home/lib/ojsp.jar; export REPORTS_CLASSPATH
NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1; export NLS_LANG
TK_ICON=$ORACLE_HOME/reports/plugins/resource; export TK_ICON


#####################################################################


if [ $USER = "oracle" ]; then
  if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
  else
    ulimit -u 16384 -n 65536
  fi
fi

PS1="`hostname`> "
set -o emacs
set filec

=========================================================

Step -5

Upload oracle apps server 10g R2 into Linux server using SSH File uploader using root user then change mode for oracle/all user


Finally run . /runInstaller file through VNC or direct login to machine

Save the username and password carefully during the install steps.


Screenshot for Infra Installation:








To Install Report Server

[oracle@app01 ~]$ rwserver server =  <report_server_name>

Before this command please check PATH variable for $ORACLE_HOME/bin

After this command, < report_server_name>. File will be created in $ORACLE_HOME/reports/conf/


Report Server configuration

Edit $ORACLE_HOME/reports/conf/rwservlet_properties


SERVER_IN_PROGESS=NO
SERVER=< report_server_name>

Edit $ORACLE_HOME/reports/conf/< report_server_name>

Remove   : <Security>……..</Security> from file.
Comment : <Job Type> ……</Job Type> from file.

End of Installation.

Adding Windows Fonts in Linux

Unlike past times, Linux do come with good fonts. And the font rendering can be made better by choosing to antialiase the fonts. But at times you come across a website which has been designed with the windows user in mind. Such websites are best viewed with one of the windows fonts. If you have windows OS installed on your machine, you can copy the essential fonts from the windows partition to linux and use them to get a better web experience. Here is how you do it.

Method 1 :
Copy the ttf (True Type Fonts) fonts Ariel, Tahoma, Verdana, Courier New and Times New Roman from the windows partition to the fonts:// location in nautilus.

Method 2 :
Some people who are using Ubuntu have said that they can't do it as normal user. And since Ubuntu does not have a root account, they find difficulty in using su to copy eaither. Such people can do the following:
Create a '.fonts' folder in your home directory and copy the necessary fonts into it. Now you have access to the fonts on a per user basis.

Method 3:
This method can be used to install the fonts system wide if the above two methods do not give satisfactory results.
First find out in which location linux has installed the truetype fonts. It is usually at the location '/usr/share/fonts/truetype/' . But you may also do a search for the same as follows:
# find /usr -iname \*.ttf |head -n 5
Once you know the path of the fonts directory, move to this directory and create a folder there (it can be any name).
# cd /usr/share/fonts/truetype
# mkdir windowsfonts
Note: You need to be logged in as root while doing this.
Next copy all the windows ttf fonts to the windowsfonts directory that was just created.
# cp /media/hda1/windows/Fonts/*.ttf .
Now change the ownership of the fonts as well as make sure they have a right of 644 .
# chown root.root *.ttf
# chmod 644 *.ttf
Now run the command mkfontdir while in the windowsfonts directory.
# mkfontdir
This will create an index of the fonts in the directory. It will also create two files fonts.dir and fonts.cache-1 .
Now moving to the parent directory, edit the file fonts.cache-1 using your favourate editor and append the following line to it.
#File: /usr/share/fonts/truetype/fonts.cache-1
...
"windowsfonts" 0 ".dir"
Lastly run the command fc-cache.
# fc-cache
This command will scan the font directories on the system and build font information cache files for applications using fontconfig for their font handling.


That's it. Now you can have access to windows fonts in all your X applications including firefox and OpenOffice.org.

Wednesday, April 2, 2014

MS SQL Date time conversion examples

 

MS SQL Date time conversion examples

 
/* MSSQL Server string to date conversion - datetime string format sql server
 MSSQL string to datetime conversion - convert char to date sql server */
 
SELECT convert(datetime,'Oct 23 2012 11:01AM',100) -- mon dd yyyy hh:mmAM (or PM)
 
SELECT convert(datetime,'Oct 23 2012 11:01AM') -- 2012-10-23 11:01:00.000
 
 
-- Without century (yy) string date conversion - convert string to datetime
 
SELECT convert(datetime, 'Oct 23 12 11:01AM', 0) -- mon dd yy hh:mmAM (or PM)
 
SELECT convert(datetime, 'Oct 23 12 11:01AM') -- 2012-10-23 11:01:00.000
 
 
-- Convert string to datetime sql - convert string to date sql - sql dates format
 
-- T-SQL convert string to datetime - SQL Server convert string to date 
 
SELECT convert(datetime, '10/23/2016', 101) -- mm/dd/yyyy
 
SELECT convert(datetime, '2016.10.23', 102) -- yyyy.mm.dd
 
SELECT convert(datetime, '23/10/2016', 103) -- dd/mm/yyyy
 
SELECT convert(datetime, '23.10.2016', 104) -- dd.mm.yyyy
 
SELECT convert(datetime, '23-10-2016', 105) -- dd-mm-yyyy
 
-- mon types are nondeterministic conversions, dependent on language setting
 
SELECT convert(datetime, '23 OCT 2016', 106) -- dd mon yyyy
 
SELECT convert(datetime, 'Oct 23, 2016', 107)-- mon dd,yyyy -- 2016-10-23 00:00:00.000
 
SELECT convert(datetime, '20:10:44', 108) -- hh:mm:ss -- 1900-01-01 20:10:44.000
 
-- mon dd yyyy hh:mm:ss:mmmAM (or PM) - sql time format
 
SELECT convert(datetime, 'Oct 23 2016 11:02:44:013AM', 109)
 
-- 2016-10-23 11:02:44.013
 
SELECT convert(datetime, '10-23-2016', 110) -- mm-dd-yyyy
 
SELECT convert(datetime, '2016/10/23', 111) -- yyyy/mm/dd
 
SELECT convert(datetime, '20161023', 112) -- yyyymmdd
 
-- 2016-10-23 00:00:00.000
 
SELECT convert(datetime, '23 Oct 2016 11:02:07:577',113) -- dd mon yyyy hh:mm:ss:mmm   -- 2016-10-23 11:02:07.577
 
SELECT convert(datetime, '20:10:25:300', 114) -- hh:mm:ss:mmm(24h)-- 1900-01-01 20:10:25.300
 
SELECT convert(datetime, '2016-10-23 20:44:11',120) -- yyyy-mm-dd hh:mm:ss(24h)
 
-- 2016-10-23 20:44:11.000
 
SELECT convert(datetime, '2016-10-23 20:44:11.500',121) -- yyyy-mm-dd hh:mm:ss.mmm -- 2016-10-23 20:44:11.500
 
SELECT convert(datetime, '2008-10-23T18:52:47.513',126) -- yyyy-mm-ddThh:mm:ss.mmm -- 2008-10-23 18:52:47.513
 
 
/* Convert DDMMYYYY format to datetime */
 
SELECT convert(datetime, STUFF(STUFF('31012016',3,0,'-'),6,0,'-'), 105)
 
-- 2016-01-31 00:00:00.000
 
/* SQL string to datetime conversion without century - some exceptions */
 
SELECT convert(datetime, '10/23/16',  1)   -- mm/dd/yy
 
SELECT convert(datetime, '16.10.23',   2)  -- yy.mm.dd
 
SELECT convert(datetime, '23/10/16',  3)   -- dd/mm/yy
 
SELECT convert(datetime, '23.10.16',  4)  -- dd.mm.yy
 
SELECT convert(datetime, '23-10-16', 5)   -- dd-mm-yy
 
SELECT convert(datetime, '23 OCT 16', 6)  -- dd mon yy
 
SELECT convert(datetime, 'Oct 23, 16', 7) -- mon dd, yy
 
SELECT convert(datetime, '20:10:44',  8)   -- hh:mm:ss
 
SELECT convert(datetime, 'Oct 23 16 11:02:44:013AM', 9)
 
SELECT convert(datetime, '10-23-16',  10)  -- mm-dd-yy
 
SELECT convert(datetime, '16/10/23',  11)  -- yy/mm/dd
 
SELECT convert(datetime, '161023',    12)  -- yymmdd
 
SELECT convert(datetime, '23 Oct 16 11:02:07:577', 13) -- dd mon yy hh:mm:ss:mmm
 
SELECT convert(datetime, '20:10:25:300', 14) -- hh:mm:ss:mmm(24h)
 
SELECT convert(datetime, '2016-10-23 20:44:11',20) -- yyyy-mm-dd hh:mm:ss(24h)
 
SELECT convert(datetime, '2016-10-23 20:44:11.500', 21) -- yyyy-mm-dd hh:mm:ss.mmm