Saturday 29 September 2012

Show error message if Java run-time not installed in client mechine through JavaScript

By using Follow code, it is possible to show error message if java run-time not installed in client mechine

<!DOCTYPE html>
<html>
<body>

<script>
if (navigator.javaEnabled()) {
    //Java is enabled
}
else
{
document.write("Error:Java is Disabled or Java Not Installed<br>Download and Insatall java from <a href=\"http://www.java.com/en/download/index.jsp\">http://www.java.com/en/download/index.jsp</a>");
}
</script>

</body>
</html>


Read More

Wednesday 26 September 2012

Solution SSH Connection Refused Problem in Linux - Backtrack

If your system unable to SSH from another System means

1. SSH server Not Running. So start SSH Server
    To start SSH server goto Applications->Backtrack->Services->SSHD->sshd start


If It is Running, and unable to SSH go to step 2

2. root@bt:~# sshd-generate
Generating public/private rsa1 key pair.
Your identification has been saved in /etc/ssh/ssh_host_key.
Your public key has been saved in /etc/ssh/ssh_host_key.pub.
The key fingerprint is:
d3:c3:ee:61:70:81:fa:06:44:18:a5:1c:49:25:70:d4 root@bt
The key's randomart image is:
+--[RSA1 2048]----+
|         .oo*B=. |
|        .  ..=  E|
|        ....o    |
|     o ..o.      |
|      = .S.o.     |
|       o o...    |.
|          ..  .   |
|                 |
|                 |
+-----------------+

..................
..................
..................

Now Check Again , I think it will work.




Read More

Monday 24 September 2012

Solution to Endianness Problems in Linux Networking

There are two types of Endians
1.Big-Endian
2.Little-Endian

In real world Networks generally use Big-Endian

Ethernet is Big-endian

IP's byte order also is Big-endian


A common solution to the endianness problem associated with networking can be handled by below functions

htons(): Convert 16-bit unsigned value from processor order (machine order) to network order. (htons-host to network short)
htonl(): Convert 32-bit unsigned value from processor order (machine order) to network order. (htonl-host to network long)
ntohs(): Convert 16-bit unsigned value from network order to processor order (machine order). (ntohs-network to host short)
ntohl(): Convert 32-bit unsigned value from network order to processor order (machine order). (ntohl-network to host long)
Read More

Saturday 22 September 2012

Send ajax post which contains '&' to PHP

Send '&' through Ajax Post method to PHP File
 
var strnew = encodeURIComponent("My & My");
 
Now At PHP Side no need to any thing
If problem in PHP Side reading data try below functions
urlencode()
urldecode() 
Read More

Friday 21 September 2012

Turning off spell check on Komodo Edit ( red lines )

To turn off red underlines (looks like Spell Check Problem) under Code in Komodo Edit, follow below steps

step1- goto Edit->Preferences
step2- In Preferences goto Syntax Checking
step3- turn off Enable checking of mixed end-of-lines (EOL) Characters option




Read More

Find string with in another string in PHP

By using Below Code it is possible to found that whether a string has searching String

<?php
 $str = "Hi Me Find";

 $find = "Me"; 
 if(sizeof(explode($find,$str))>1)
 {
   echo "Me Found";
 }
 else
 {
    echo "Me Not Found"; 
 } 
?>
Read More

Thursday 20 September 2012

Change proxy in linux through commands

Run below Commands as root in Linux terminal

 
[root@xyz~]# export http_proxy='http://12.12.12.12:3128/'
 
Check Proxy 
 
[root@xyz~]# echo $http_proxy 
http://12.12.12.12:3128/
 
 
Read More

Display errors in PHP

Add below two lines to your PHP file to display errors

error_reporting(E_ALL);
ini_set('display_errors', '1');
Example:
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
//remaining code
.............
.............
.............
?>
Read More

Solution How replace slach in PHP

You can replace '\' with '/' and '/' with '\' in PHP

Example
replace \ with /
echo str_replace('\\','/','Hi\Mi');
output: Hi/Mi

replace / with \
echo str_replace('/','\\','Hi/Mi');  
output: Hi\Mi
Read More

PHP equivalent for unescape()

urlencode() and urldecode() can be used

Examples:
urlencode()
echo urlencode("Hi+Me");
output: Hi%2BMe

urldecode()
echo urldecode("Hi+Me");
output: Hi Me
Read More

Solution to getVideoRatingInfo() returning array in PHP youtube API

If you are using PHP for Youtube API then you may face problem of getVideoRatingInfo() returning array

Problem
echo "Rating: ".$videoEntry->getVideoRatingInfo();
output: Array

Solution
$a = array();
$a = $videoEntry->getVideoRatingInfo();
echo "Rating: " . $a['average'] . "\n";
output:3.5 (example)
Read More

Steps to Install MYPLC successfully with out any problems

Below are the steps to install MYPLC ( planet-lab ) With out any problems

Step1 :
Download and Install Fedora 12
Download Fedora Linux 12 CD 32 bit i386 (694M)
Download Fedora Linux 12 CD 64 bit (698M)

Step2 :
After Install 
yum update

Step3 :
Add myplc repo
[root@xyz~]# cd /etc/yum.repos.d/
[root@xyz yum.repos.d]# vim myplc.repo


#Add Following Lines to myplc.repo

[myplc]
name= MyPLC
baseurl=http://build.onelab.eu/5.0/rc22/onelab--5.0-rc22-f12-32/RPMS
enabled=1
gpgcheck=0

[root@xyz yum.repos.d]# yum clean all
[root@xyz yum.repos.d]# yum update

Step4 :
Stop SELINUX
Check this http://linux-problem-solver.blogspot.in/2012/09/disabling-selinux-in-fedora.html 

Step5 :
Stop IPTable ( Firewall )
Check this http://linux-problem-solver.blogspot.in/2012/09/disable-or-turnoff-iptables-firewall-in.html

Step6 :
If you did not restart system after step4, step5 then restart your System now.

Step7 :
Install myplc
[root@xyz ~]# yum install myplc

Step8 :
make myplc start at system startup
[root@xyz ~]# chkconfig plc on

Step9 :
Start MYPLC if you done all steps correctly then you will see text like below
[root@xyz ~]# service plc start
PLC: Generating network files:                             [  OK  ]
PLC: Generating SSL certificates for: PLC: WWW: PLC: API: P[  OK  ]:
PLC: Generating GPG keys:                                  [  OK  ]
PLC: Generating SSH keys:                                  [  OK  ]
PLC: Starting web server: PLC: Setting PHP timezone to GMT:[  OK  ]
PLC: Starting PostgreSQL server:                           [  OK  ]
PLC: Configuring the API:                                  [  OK  ]
PLC: Bootstrapping the database: PLC:  - 101-up-leases.sql (dbdumped): PLC:  - 102-up-isvalid.sql (dbdumped): PLC:  - 103-up-extensions.sql (dbdumped): PLC:  - 104-up-noderole.sql (dbdumped): PLC:  - 105-up-timespent.sq[  OK  ]ped):
PLC: Starting DNS server: PLC: Configuring resolv.conf:    [  OK  ]
PLC: Creating BootCD variants:                             [  OK  ]
PLC: Rebuilding Boot CD:                                   [  OK  ]
                                                           [  OK  ]
PLC: Signing and indexing node packages:                   [  OK  ]


Step10 :
Stop myplc
[root@xyz ~]# service plc stop
PLC: Reverting /etc/resolv.conf:                           [  OK  ]
PLC: Removing /etc/plc_hosts:                              [  OK  ]
PLC: Stopping DNS server:                                  [  OK  ]
PLC: Ignoring request to stop myplc databases:             [  OK  ]
PLC: Stopping PostgreSQL server:                           [  OK  ]
PLC: Stopping web server:                                  [  OK  ]
PLC: Stopping mail server:                                 [  OK  ]
PLC: Reverting network files:                              [  OK  ]
 

Step11 :
Change the Configuration
[root@xyz ~]#plc-config-tty
Check this page for how to configure
https://svn.planet-lab.org/wiki/MyPLCUserGuide#Changingtheconfiguration 




 

 

 




 
Read More

Wednesday 19 September 2012

Disable or Turnoff IPTables ( Firewall ) in Linux

Below Steps show how to disable IPTABLES ( Firewall ) in Linux

Check IPTABLES are running
[root@xyz ~]# service iptables status
Table: mangle
Chain PREROUTING (policy ACCEPT 1169 packets, 809K bytes)
num   pkts bytes target     prot opt in     out     source               destination
........
........

Stop IPtables Temporary
[root@xyz ~]# service iptables stop
iptables: Flushing firewall rules:          [  OK  ]
iptables: Setting chains to policy ACCEPT: filter [  OK  ]
iptables: Unloading modules: [  OK  ]


Stop IPtables Permanently
[root@xyz ~]# chkconfig iptables off
Restart the System

After Restart ( Check there is no rules )
[root@center ~]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT 126 packets, 21125 bytes)
num   pkts bytes target     prot opt in     out     source               destination        

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source               destination        

Chain OUTPUT (policy ACCEPT 86 packets, 10809 bytes)
num   pkts bytes target     prot opt in     out     source               destination



Read More

Disabling SELINUX in Fedora

Below steps show how to disable SELINUX

To test SeLinux is running or not
[root@center /]# selinuxenabled && echo enabled || echo disabled
enabled

So SELINUX is Enabled

To stop temporary
[root@xyz~] sudo setenforce 0

To stop SELINUX permanently
[root@center /]# vim /etc/selinux/config

#And change
SELINUX=enforcing

to

SELINUX=disabled

Save the File and Restart the system to take effect
Read More

Adding Repo file in Fedora - example myplc repo

Below Steps will guide how to add repo file and how to install software 

[root@xyz~]# cd /etc/yum.repos.d/
[root@xyz yum.repos.d]# vim myplc.repo


#Add Following Lines to myplc.repo

[myplc]
name= MyPLC
baseurl=http://build.onelab.eu/5.0/rc22/onelab--5.0-rc22-f12-32/RPMS
enabled=1
gpgcheck=0

[root@xyz yum.repos.d]# yum clean all
[root@xyz yum.repos.d]# yum update
[root@xyz yum.repos.d]# yum install myplc







Read More
Here We Write The Problems we face at different situations and Solutions to those problems.