Thursday, October 27, 2016

How to get DIV Parent & Child value in Jquery





$(document).ready(function(){
	txtPrntMsg1 = $('.chld').parents('.parnt').text();
	alert(txtPrntMsg1);

	txtchldMsg1 = $('.parnt').children('.chld').text();
	alert(txtchldMsg1);
});

I am parent block I am child of Parent class parnt

How to get Radio Button value using name in Jquey




Two way Data Binding in AngularJS

FirstName :{{fname}} MiddleName : FirstName : MiddleName :

Basic of AnjularJs | AngularJs with Examples | One way-data


one way Data Binding in AngularJS

FirstName :{{fname}} MiddleName :

Wednesday, May 25, 2016

All Mysql JOIN with example.

Note: FULL JOIN doesn't support to Mysql so we can use UNION or UNION ALL
select ed.empid, ed.emp_name, ed.emp_Join, edesg.designation from emp_data ed FULL JOIN emp_dseg edesg ON ed.empid = edesg.empid;

mysql> select * from emp_data;
+-------+------------+------------+
| empid | emp_name   | emp_Join   |
+-------+------------+------------+
|     1 | Ajay       | 2015-01-11 |
|     2 | Anji       | 2015-01-05 |
|     3 | Sabhapathi | 2015-11-11 |
|     4 | Bhasker    | 2015-04-11 |
|     5 | Raju       | 2014-01-10 |
|     6 | Mahipal    | 2015-01-15 |
|     7 | Manoj      | 2015-09-14 |
|     8 | Ragvendra  | 2015-06-05 |
|     9 | Sundheer   | 2015-01-09 |
|    10 | Mahi       | 2015-01-1  |
|    11 | Vijay      | 2015-01-05 |
|    12 | Sandip     | 2015-01-1  |
+-------+------------+------------+
12 rows in set (0.00 sec)

mysql> select * from emp_dseg;
+-------+----------------------+
| empid | designation          |
+-------+----------------------+
|     1 | Dev                  |
|     2 | QA                   |
|     3 | Senior Soft Engineer |
|     4 | Dev                  |
|     5 | Qa Engineer          |
|     6 | Dev                  |
|     7 | Dev                  |
|     8 | Senior Test Engineer |
|     9 | Test Eng. Enineer    |
|    13 | IT-Support           |
|    14 | DBA                  |
+-------+----------------------+
11 rows in set (0.00 sec)

mysql> select ed.empid, ed.emp_name, ed.emp_Join, edesg.designation from emp_data ed, emp_dseg edesg where ed.empid = edesg.empid;
+-------+------------+------------+----------------------+
| empid | emp_name   | emp_Join   | designation          |
+-------+------------+------------+----------------------+
|     1 | Ajay       | 2015-01-11 | Dev                  |
|     2 | Anji       | 2015-01-05 | QA                   |
|     3 | Sabhapathi | 2015-11-11 | Senior Soft Engineer |
|     4 | Bhasker    | 2015-04-11 | Dev                  |
|     5 | Raju       | 2014-01-10 | Qa Engineer          |
|     6 | Mahipal    | 2015-01-15 | Dev                  |
|     7 | Manoj      | 2015-09-14 | Dev                  |
|     8 | Ragvendra  | 2015-06-05 | Senior Test Engineer |
|     9 | Sundheer   | 2015-01-09 | Test Eng. Enineer    |
+-------+------------+------------+----------------------+
9 rows in set (0.00 sec)

mysql> select ed.empid, ed.emp_name, ed.emp_Join, edesg.designation from emp_data ed INNER JOIN emp_dseg edesg ON ed.empid = edesg.empid;
+-------+------------+------------+----------------------+
| empid | emp_name   | emp_Join   | designation          |
+-------+------------+------------+----------------------+
|     1 | Ajay       | 2015-01-11 | Dev                  |
|     2 | Anji       | 2015-01-05 | QA                   |
|     3 | Sabhapathi | 2015-11-11 | Senior Soft Engineer |
|     4 | Bhasker    | 2015-04-11 | Dev                  |
|     5 | Raju       | 2014-01-10 | Qa Engineer          |
|     6 | Mahipal    | 2015-01-15 | Dev                  |
|     7 | Manoj      | 2015-09-14 | Dev                  |
|     8 | Ragvendra  | 2015-06-05 | Senior Test Engineer |
|     9 | Sundheer   | 2015-01-09 | Test Eng. Enineer    |
+-------+------------+------------+----------------------+
9 rows in set (0.00 sec)

mysql> select ed.empid, ed.emp_name, ed.emp_Join, edesg.designation from emp_data ed RIGHT JOIN emp_dseg edesg ON ed.empid = edesg.empid;
+-------+------------+------------+----------------------+
| empid | emp_name   | emp_Join   | designation          |
+-------+------------+------------+----------------------+
|     1 | Ajay       | 2015-01-11 | Dev                  |
|     2 | Anji       | 2015-01-05 | QA                   |
|     3 | Sabhapathi | 2015-11-11 | Senior Soft Engineer |
|     4 | Bhasker    | 2015-04-11 | Dev                  |
|     5 | Raju       | 2014-01-10 | Qa Engineer          |
|     6 | Mahipal    | 2015-01-15 | Dev                  |
|     7 | Manoj      | 2015-09-14 | Dev                  |
|     8 | Ragvendra  | 2015-06-05 | Senior Test Engineer |
|     9 | Sundheer   | 2015-01-09 | Test Eng. Enineer    |
|  NULL | NULL       | NULL       | IT-Support           |
|  NULL | NULL       | NULL       | DBA                  |
+-------+------------+------------+----------------------+
11 rows in set (0.00 sec)


mysql> select ed.empid, ed.emp_name, ed.emp_Join, edesg.designation from emp_data ed LEFT JOIN emp_dseg edesg ON ed.empid = edesg.empid;
+-------+------------+------------+----------------------+
| empid | emp_name   | emp_Join   | designation          |
+-------+------------+------------+----------------------+
|     1 | Ajay       | 2015-01-11 | Dev                  |
|     2 | Anji       | 2015-01-05 | QA                   |
|     3 | Sabhapathi | 2015-11-11 | Senior Soft Engineer |
|     4 | Bhasker    | 2015-04-11 | Dev                  |
|     5 | Raju       | 2014-01-10 | Qa Engineer          |
|     6 | Mahipal    | 2015-01-15 | Dev                  |
|     7 | Manoj      | 2015-09-14 | Dev                  |
|     8 | Ragvendra  | 2015-06-05 | Senior Test Engineer |
|     9 | Sundheer   | 2015-01-09 | Test Eng. Enineer    |
|    10 | Mahi       | 2015-01-1  | NULL                 |
|    11 | Vijay      | 2015-01-05 | NULL                 |
|    12 | Sandip     | 2015-01-1  | NULL                 |
+-------+------------+------------+----------------------+
12 rows in set (0.00 sec)

mysql> select ed.empid, ed.emp_name, ed.emp_Join, edesg.designation from emp_data ed RIGHT JOIN emp_dseg edesg ON ed.empid = edesg.empid
UNION
select ed.empid, ed.emp_name, ed.emp_Join, edesg.designation from emp_data ed LEFT JOIN emp_dseg edesg ON ed.empid = edesg.empid

+-------+------------+------------+----------------------+
| empid | emp_name   | emp_Join   | designation          |
+-------+------------+------------+----------------------+
|     1 | Ajay       | 2015-01-11 | Dev                  |
|     2 | Anji       | 2015-01-05 | QA                   |
|     3 | Sabhapathi | 2015-11-11 | Senior Soft Engineer |
|     4 | Bhasker    | 2015-04-11 | Dev                  |
|     5 | Raju       | 2014-01-10 | Qa Engineer          |
|     6 | Mahipal    | 2015-01-15 | Dev                  |
|     7 | Manoj      | 2015-09-14 | Dev                  |
|     8 | Ragvendra  | 2015-06-05 | Senior Test Engineer |
|     9 | Sundheer   | 2015-01-09 | Test Eng. Enineer    |
|  NULL | NULL       | NULL       | IT-Support           |
|  NULL | NULL       | NULL       | DBA                  |
|    10 | Mahi       | 2015-01-1  | NULL                 |
|    11 | Vijay      | 2015-01-05 | NULL                 |
|    12 | Sandip     | 2015-01-1  | NULL                 |
+-------+------------+------------+----------------------+
14 rows in set (0.00 sec)

mysql> select ed.empid, ed.emp_name, ed.emp_Join, edesg.designation from emp_data ed RIGHT JOIN emp_dseg edesg ON ed.empid = edesg.empid
UNION ALL
select ed.empid, ed.emp_name, ed.emp_Join, edesg.designation from emp_data ed LEFT JOIN emp_dseg edesg ON ed.empid = edesg.empid

+-------+------------+------------+----------------------+
| empid | emp_name   | emp_Join   | designation          |
+-------+------------+------------+----------------------+
|     1 | Ajay       | 2015-01-11 | Dev                  |
|     2 | Anji       | 2015-01-05 | QA                   |
|     3 | Sabhapathi | 2015-11-11 | Senior Soft Engineer |
|     4 | Bhasker    | 2015-04-11 | Dev                  |
|     5 | Raju       | 2014-01-10 | Qa Engineer          |
|     6 | Mahipal    | 2015-01-15 | Dev                  |
|     7 | Manoj      | 2015-09-14 | Dev                  |
|     8 | Ragvendra  | 2015-06-05 | Senior Test Engineer |
|     9 | Sundheer   | 2015-01-09 | Test Eng. Enineer    |
|  NULL | NULL       | NULL       | IT-Support           |
|  NULL | NULL       | NULL       | DBA                  |
|     1 | Ajay       | 2015-01-11 | Dev                  |
|     2 | Anji       | 2015-01-05 | QA                   |
|     3 | Sabhapathi | 2015-11-11 | Senior Soft Engineer |
|     4 | Bhasker    | 2015-04-11 | Dev                  |
|     5 | Raju       | 2014-01-10 | Qa Engineer          |
|     6 | Mahipal    | 2015-01-15 | Dev                  |
|     7 | Manoj      | 2015-09-14 | Dev                  |
|     8 | Ragvendra  | 2015-06-05 | Senior Test Engineer |
|     9 | Sundheer   | 2015-01-09 | Test Eng. Enineer    |
|    10 | Mahi       | 2015-01-1  | NULL                 |
|    11 | Vijay      | 2015-01-05 | NULL                 |
|    12 | Sandip     | 2015-01-1  | NULL                 |
+-------+------------+------------+----------------------+
23 rows in set (0.00 sec)




INNER JOIN gets all records from one table that have some related or matching records from second table

LEFT JOIN gets all records from the LEFT Side linked table but if you have selected some columns from the RIGHT table, if there is no related records, these columns will contain NULL

RIGHT JOIN is like the above but gets all records in the RIGHT table

FULL JOIN gets all records from both tables and puts NULL in the columns where related records do not exist in the opposite table


Tuesday, May 24, 2016

Cross Platform Requrest in PHP

my $xml = <<"GENERATE_XML";
< GeStdDataInput >
  < Course>BE< /Course>
  < StdName>TestStudent< /StdName>
  < CourseFee>350000
< /GeStdDataInput >
GENERATE_XML

$xmlReq = array (
  'http' => array(
  'method' =>"POST",
         'header' => "Content-Type: application/xml\r\nAccept: application/xml",
         'timeout' => 60,
         'content' => $xml)
 );
 $ulr = 'http://studentrecords.com/getStduentData';
 $strCont = stream_context_create ($xmlReq);
        $filePoint = @fopen($url, 'rb', false, $strCont);
        if (!$filePoint){
  $filePoint = @fopen($url, 'rb', false, $strCont);
  if (!$filePoint) {
                    throw new Exception("Problem with $url, $php_errormsg");
                }
 }
 $response = @stream_get_contents($filePoint);
        $response_array = array();
 $response_array = simplexml_load_string($response);

Cross Platform PHP Requrest

my $xml = <<"GENERATE_XML";

  BE
  TestStudent
  350000

GENERATE_XML

$xmlReq = array (
  'http' => array(
  'method' =>"POST",
         'header' => "Content-Type: application/xml\r\nAccept: application/xml",
         'timeout' => 60,
         'content' => $xml)
 );
 $ulr = 'http://studentrecords.com/getStduentData';
 $strCont = stream_context_create ($xmlReq);
        $filePoint = @fopen($url, 'rb', false, $strCont);
        if (!$filePoint){
  $filePoint = @fopen($url, 'rb', false, $strCont);
  if (!$filePoint) {
                    throw new Exception("Problem with $url, $php_errormsg");
                }
 }
 $response = @stream_get_contents($filePoint);
        $response_array = array();
 $response_array = simplexml_load_string($response);

Cross Platform request using PERL

my $xml = <<"GENERATE_XML";
< gestddatainput >
< course >BE< /Course >
< stdname >TestStudent< /StdName >
< coursefee >350000< /CourseFee >
< /GeStdDataInput >
GENERATE_XML

my $length = length($xml);
my $ua = LWP::UserAgent->new(env_proxy => 1, keep_alive => 1, timeout =>45);
my $req = HTTP::Request->new(POST =>'http://studentrecords.com/getStduentData');
$req->content($xml);
$req->header('Connection' => 'close', 'Content-length' => $length,'Content-Type'=>'text/xml', charset=>'utf-8');
my $res = $ua->request($req);
my $response_data = $res->content;
my $ref;
eval {
$ref =  new XML::Smart($response_data);
};
if($@){
print STDERR "\n------- Student Response START----------";
print STDERR "\n". $response_data;
print STDERR "\n". $@;
print STDERR "\n------- Student Response END----------";
return "";
}
<.pre>

How to Create File in PERL

my $message = "

Wel come to file Handleding

" my $fileName = '/tmp/testUserData.html'; open(my $sqf, '>', $fileName) or die "Could not open file '$fileName' $!"; print $sqf $message; close $sqf;