We are helping to solve Php Java Android SQL Java Script .............

  • Easy Programming Problems

    Here I have made a collection of some easy programming problems for Beginner’s practice with solutions and Critical Test Cases.

  • Easy Programming Problems

    Here I have made a collection of some easy programming problems for Beginner’s practice with solutions and Critical Test Cases.

  • Easy Programming Problems

    Here I have made a collection of some easy programming problems for Beginner’s practice with solutions and Critical Test Cases.

  • Easy Programming Problems

    Here I have made a collection of some easy programming problems for Beginner’s practice with solutions and Critical Test Cases.

  • Easy Programming Problems

    Here I have made a collection of some easy programming problems for Beginner’s practice with solutions and Critical Test Cases.

Monday 14 November 2016

PHP Problem Solutions


Question: How can PHP read the hash portion of the URL?
Answer: PHP can't read the hash portion of the URL
index.php?page=group#birthday
Here, PHP can not read the birthday

Question: What Is difference between array_combine and array_merge?
Answer:
array_combine give an array by combining two arrays($keyArray, $valueArray) and both $keyArray & $valueArray must have same number of elements. $keyArrays become keys of returning Array, $valueArray become values of returning Arrays.

array_merge gives an array by merging two array ($array1, $array2) and both can have different number of elements. $array1 and $array2 are added in returning array.

Question: What Is difference between Cookie and Session?
Answer:
Cookie are stored in client side (e.g Browser) where as Session are stored in server side (tmp file of web server). Cookie can be added/update/delete from browser but session can't delete from browser. 
Session is depended on cookie. For example: When user login in website then session is created in webserver. To communicate the webserver with user, an cookie is created by the application. with use of this cookie-key, Server get to know that user is login OR not.

Question: What are encryption functions in PHP? 
CRYPT(), MD5() 

Question: How to store the uploaded file to the final location?move_uploaded_file( string filename, string destination)

Question: Explain mysql_error(). The mysql_error() message will tell us what was wrong with our mysql query.

How to import csv file to database through phpmyadmin

To import csv file in database though phpmyadmin, Follow the following steps.
You must have valid CSV File. EXCEL file will not work.
you must have a table in database
Number of Colums in CSV file must be equal to Number of column in table
Now login to phpmyamdin.
Make sure you server allow to upload the heavy files (If CSV is heavy). 
You can update the php.ini file as following(If you CSV is less than 700MB).
upload_max_filesize = 700M
post_max_size = 800M


If your CSV is more than 700MB, then increase the above values in php.ini
If you are uploading heavy files, you might need to increase the max_execution_time. (Means loading time to upload )
max_execution_time = 300000



Go to database and then go to table listing.
Click on Import link at top page
Next, Follow the steps in next.

@@@@@@
Question: How to add element to array?
$arrayData = array(0=>'one',1=>'two',3=>'three'); 
print_r($arrayData);
/*
 Array ( [0] => one [1] => two [3] => three ) 
 */
$arrayData['4']='four';


print_r($arrayData);
/**
Array ( [0] => one [1] => two [3] => three [4] => four ) 
 * 
 */
Question: How to add multiple element in array?
$arrayData = array(0=>'one',1=>'two',3=>'three'); 
print_r($arrayData);
/*
 Array ( [0] => one [1] => two [3] => three ) 
 */
$arrayData['4']='four';
$arrayData['5']='five';


print_r($arrayData);
/**
Array ( [0] => one [1] => two [3] => three [4] => four [5] => five ) 
 * 
 */
Question: How to replace multiple array element with single array?
$arrayData = array(0=>'one',1=>'two',3=>'three',4=>'four',5=>'five',6=>'six'); 
print_r($arrayData); echo "
";
/*
 * Array ( [0] => one [1] => two [3] => three [4] => four [5] => five [6] => six ) 
 */
array_splice($arrayData, 1,2,array('r'=>'replaced'));


print_r($arrayData);
/**
Array ( [0] => one [1] => replaced [2] => four [3] => five [4] => six ) 
 * 
 */
Question: How to add element to an begining of array?
$arrayData = array(0=>'one',1=>'two',3=>'three'); 
print_r($arrayData);
/*
Array ( [0] => one [1] => two [3] => three )  
 */
array_unshift($arrayData, "four", "five");


print_r($arrayData);
/**
Array ( [0] => four [1] => five [2] => one [3] => two [4] => three ) 
 * 
 */
Question: How to add elements at the end of array?
$arrayData = array(0=>'one',1=>'two',3=>'three'); 
print_r($arrayData);
/*
Array ( [0] => one [1] => two [3] => three )  
 */
array_push($arrayData, "four", "five");


print_r($arrayData);
/**
Array ( [0] => four [1] => five [2] => one [3] => two [4] => three ) 
 * 
 */
Question: How to create Model Object?
$userObj= D("Common/Users");
Question: How to add simple AND Query?
$map=array();
$userObj= D("Common/Users");
$map['user_type'] = 2;
$map['city_id'] = 10;
 $lists = $userObj
                ->alias("u")                
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to add simple OR Query?
$map=array();
$userObj= D("Common/Users");
$map['u.username|u.email'] = 'email@domain.com';  //username OR email is email@domain.com
 $lists = $userObj
                ->alias("u")                
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use =, >, < in Query?
$map['id']  = array('eq',1000); //equal to 1000

$map['id']  = array('neq',1000); //Not equal to 1000

$map['id']  = array('gt',1000);//Greater than 1000

$map['id']  = array('egt',1000);//Greater than OR EQual 1000

$map['id']  = array('between','1,8'); //Between 1-8
Question: How to use like Query?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $lists = $userObj
                ->alias("u")                
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use like Query with NOT?
$map=array();
$userObj= D("Common/Users");
$map['b'] =array('notlike',array('%test%','%tp'),'AND'); //Not like %test% and %tp
 $lists = $userObj
                ->alias("u")                
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use Inner JOIN ?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $lists = $userObj
                ->alias("u") 
                ->join(C('DB_PREFIX') . "profile as p ON u.id = p.uid")               
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use LEFT JOIN ?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $lists = $userObj
                ->alias("u") 
                ->join('LEFT JOIN '.C('DB_PREFIX') . "profile as p ON u.id = p.uid")               
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use RIGHT JOIN ?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $lists = $userObj
                ->alias("u") 
                ->join('RIGHT JOIN '.C('DB_PREFIX') . "profile as p ON u.id = p.uid")               
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use group by and having?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $lists = $userObj
                ->alias("u") 
                ->join('RIGHT JOIN '.C('DB_PREFIX') . "profile as p ON u.id = p.uid")               
                ->where($map)
                ->order("u.id DESC")
                 ->group('u.id')                
                 ->having('count(p.id) >0')
                ->select();
Question: How to use count(for total records)?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $count = $userObj
                ->alias("u")                 
                ->where($map)                
                ->count();
Share:

Saturday 12 November 2016

Interviews Php Java Android Java Script SQL HTML

Job interviewing never seems to get any easier - even when you have gone on more interviews than you can count. You are always meeting new people, having to sell yourself and your skills, and often getting the third degree about what you know or don't know. And, you have to stay upbeat and enthusiastic throughout each interview.

That said, there are ways to make a job interview much less stressful.

                      PHP interview questions and answers


Question: What are the different types of errors in php?
Answer:
E_ERROR: A fatal error that causes script termination
E_WARNING: Run-time warning that does not cause script termination
E_ALL: Catches all errors and warnings
E_PARSE: Compile time parse error.
E_NOTICE: Run time notice caused due to error in code
E_USER_WARNING: User-generated warning message.
E_USER_ERROR: User-generated error message.
E_USER_NOTICE: User-generated notice message.
E_STRICT: Run-time notices.
E_RECOVERABLE_ERROR: Catchable fatal error indicating a dangerous error

Question: What is maximum size of a database in mysql?
Answer: Depend on Operating System

Question: What is meant by MIME?
Answer:
Multipurpose Internet Mail Extensions. 

WWW ability to recognize and handle files of different types is largely dependent on the use of the MIME (Multipurpose Internet Mail Extensions) standard. The standard provides for a system of registration of file types with information about the applications needed to process them. 

Question: What Is a Persistent Cookie?
Answer:

Persistent cookie is a cookie which is permanently stored on user’s computer in a cookie file. They are used for tracking the user information of the users who are browsing from a very long time. They also have the drawbacks of being unsecure, as user can see the cookies which are saved on the computer. 

Question: How to set persistent Cookie?
There is no special way to set persistent cookies. Setting Cookies with an expiration date become persistent cookie.

setcookie( "cookieName", 'cookieValue', strtotime( '+30 days' ) );

Question: How can PHP read the hash portion of the URL?
Answer: PHP can't read the hash portion of the URL
index.php?page=group#birthday
Here, PHP can not read the birthday

Question: What Is difference between array_combine and array_merge?
Answer:
array_combine give an array by combining two arrays($keyArray, $valueArray) and both $keyArray & $valueArray must have same number of elements. $keyArrays become keys of returning Array, $valueArray become values of returning Arrays.

array_merge gives an array by merging two array ($array1, $array2) and both can have different number of elements. $array1 and $array2 are added in returning array.

Question: What Is difference between Cookie and Session?
Answer:
Cookie are stored in client side (e.g Browser) where as Session are stored in server side (tmp file of web server). Cookie can be added/update/delete from browser but session can't delete from browser. 
Session is depended on cookie. For example: When user login in website then session is created in webserver. To communicate the webserver with user, an cookie is created by the application. with use of this cookie-key, Server get to know that user is login OR not.

Question: What are encryption functions in PHP? 
CRYPT(), MD5() 

Question: How to store the uploaded file to the final location? move_uploaded_file( string filename, string destination)

Question: Explain mysql_error(). The mysql_error() message will tell us what was wrong with our mysql query.


@@@@@@
Question: How to add element to array?
$arrayData = array(0=>'one',1=>'two',3=>'three'); 
print_r($arrayData);
/*
 Array ( [0] => one [1] => two [3] => three ) 
 */
$arrayData['4']='four';


print_r($arrayData);
/**
Array ( [0] => one [1] => two [3] => three [4] => four ) 
 * 
 */
Question: How to add multiple element in array?
$arrayData = array(0=>'one',1=>'two',3=>'three'); 
print_r($arrayData);
/*
 Array ( [0] => one [1] => two [3] => three ) 
 */
$arrayData['4']='four';
$arrayData['5']='five';


print_r($arrayData);
/**
Array ( [0] => one [1] => two [3] => three [4] => four [5] => five ) 
 * 
 */
Question: How to replace multiple array element with single array?
$arrayData = array(0=>'one',1=>'two',3=>'three',4=>'four',5=>'five',6=>'six'); 
print_r($arrayData); echo "
";
/*
 * Array ( [0] => one [1] => two [3] => three [4] => four [5] => five [6] => six ) 
 */
array_splice($arrayData, 1,2,array('r'=>'replaced'));


print_r($arrayData);
/**
Array ( [0] => one [1] => replaced [2] => four [3] => five [4] => six ) 
 * 
 */
Question: How to add element to an begining of array?
$arrayData = array(0=>'one',1=>'two',3=>'three'); 
print_r($arrayData);
/*
Array ( [0] => one [1] => two [3] => three )  
 */
array_unshift($arrayData, "four", "five");


print_r($arrayData);
/**
Array ( [0] => four [1] => five [2] => one [3] => two [4] => three ) 
 * 
 */
Question: How to add elements at the end of array?
$arrayData = array(0=>'one',1=>'two',3=>'three'); 
print_r($arrayData);
/*
Array ( [0] => one [1] => two [3] => three )  
 */
array_push($arrayData, "four", "five");


print_r($arrayData);
/**
Array ( [0] => four [1] => five [2] => one [3] => two [4] => three ) 
 * 
 */
Question: How to create Model Object?
$userObj= D("Common/Users");
Question: How to add simple AND Query?
$map=array();
$userObj= D("Common/Users");
$map['user_type'] = 2;
$map['city_id'] = 10;
 $lists = $userObj
                ->alias("u")                
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to add simple OR Query?
$map=array();
$userObj= D("Common/Users");
$map['u.username|u.email'] = 'email@domain.com';  //username OR email is email@domain.com
 $lists = $userObj
                ->alias("u")                
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use =, >, < in Query?
$map['id']  = array('eq',1000); //equal to 1000

$map['id']  = array('neq',1000); //Not equal to 1000

$map['id']  = array('gt',1000);//Greater than 1000

$map['id']  = array('egt',1000);//Greater than OR EQual 1000

$map['id']  = array('between','1,8'); //Between 1-8
Question: How to use like Query?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $lists = $userObj
                ->alias("u")                
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use like Query with NOT?
$map=array();
$userObj= D("Common/Users");
$map['b'] =array('notlike',array('%test%','%tp'),'AND'); //Not like %test% and %tp
 $lists = $userObj
                ->alias("u")                
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use Inner JOIN ?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $lists = $userObj
                ->alias("u") 
                ->join(C('DB_PREFIX') . "profile as p ON u.id = p.uid")               
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use LEFT JOIN ?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $lists = $userObj
                ->alias("u") 
                ->join('LEFT JOIN '.C('DB_PREFIX') . "profile as p ON u.id = p.uid")               
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use RIGHT JOIN ?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $lists = $userObj
                ->alias("u") 
                ->join('RIGHT JOIN '.C('DB_PREFIX') . "profile as p ON u.id = p.uid")               
                ->where($map)
                ->order("u.id DESC")
                ->select();
Question: How to use group by and having?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $lists = $userObj
                ->alias("u") 
                ->join('RIGHT JOIN '.C('DB_PREFIX') . "profile as p ON u.id = p.uid")               
                ->where($map)
                ->order("u.id DESC")
                 ->group('u.id')                
                 ->having('count(p.id) >0')
                ->select();
Question: How to use count(for total records)?
$map=array();
$userObj= D("Common/Users");
$map['name'] = array('like','test%'); //like test%
 $count = $userObj
                ->alias("u")                 
                ->where($map)                
                ->count();

Share:

Friday 11 November 2016

How to Solve Google Play Store Error

How to Solve Google Play Store Error

Google Play – Error DF-DLA-15

Problem :
Downloading an update or an application may fail with this error.

Solution :
The first thing to do is to clear the cache and data of the Play Store app. To do this, go in the Settings, tap Applications and look for the Play Store and you can delete the cache and information. On some smartphones, you need to enter the Storage tab to see this option.

This should fix the problem however if it persists you have got to go to your account settings and delete your phone's Google account. Once you've got done that you just need to return in and reinsert it.

Google Play - Error rh01

Problem :
Error retrieving information from server.

F1 Solution :
Go to Settings > Apps > All > Google Play Store and select both Clear data and Clear cache. Do the same for Google Services Framework.

2nd Solution :
Remove and re-add your Gmail account, restart your device and then re-add your Gmail account.

Google Play – Error retrieving information from server

Problem :
This error message usually appears when updating or downloading an app. Google's servers are unable to retrieve data from your Google account. you'll be able to delete and re-register, however wait some hours to see if the problem persists. generally it's going to just take care of itself.

Solution :
  • Go to the Settings> Accounts> Google 'to delete your Google Account'
  • Once this is done, you must reboot your device, then re-synchronize the account
  • Finally, open the Settings> Applications> All> Google Services Framework. Inside, you must click Options 'Clear Data' and 'Force Stop'

Google Play - Package File Invalid

Problem :
Play store error

Solutions :
  • Go to Settings > Apps > All and select the app that's causing the problem, then select Clear cache and Clear data. Try again in Google Play Store.
  • Disable Wi-Fi and download or update the app using mobile network data.
  • Install app through Google Play Store website.
  • Go to Settings > Apps > All > Google Play Store and select Clear cache and Clear data. Do the same for Google Services Framework.
  • Remove your Google account, restart your device, re-add your Google account and try again.

Share:

Java, jsp, j2ee,advance java source code

Java Features


1. Platform Independence.

Java is a platform independent language because of the byte code magic of java. In java when we execute the source code...it generates the .class file comprising the byte codes. Byte codes are easily interpreted by JVM which is available with every type of OS we install.

2. Object Oriented.

Object-oriented programming is a method of programming based on a hierarchy of classes, and well-defined and cooperating objects.

3. Robust.

java gives importance to memory management by using the technique called Garbage Collection and Exception handling.

4. Security

since java is used on internet, security is an important issue. A security code is asked before a java code is interpreted on internet.

5. Multi Threading and interactive

Multi threading means handling more than one job at a time. Java supports Multi threading.
Share:

Contact Form

Name

Email *

Message *

Supersoftitsolutions.com - Software Development Company