Archive

May 2015

Browsing

Every one more exited with the new android version of  LOLLIPOP.  Some of them have updated lollipop via OTA (Over-The-Air) their mobile and enjoying its features. For MOTO serious, Moto x,  Moto G (1st and 2nd generation), Moto E 2nd Generation have lollipop update directly to your phone.

Still didn’t Check, Just go with steps,

Settings -> About Phone -> System updates

Lollipop updates for Moto E 1st generation

It show New system software available Click “yes, I’m in” and follow the steps finally update Complete, enjoy(Use WI-FI connection)

Lollipop updates for Moto E 1st generation

Lollipop updates for Moto E.

For Moto E(1st generation) they didn’t release lollipop version to the phone directly (Except some first level users). But don’t worry you can manually update the lollipop to your mobile. The problem is have  to root you phone. There is lot of risk while update manually. Whatever, Still wanna update manually. Let me explain the steps. Before that the size of moto E Lollipop is 341.7Mb. Atleast 500 MB of storage space is required to Install the Moto E Lollipop , so free up the internal storage by transferring your data, apps to sd card

 Steps :

  1. Download the file from here http://bit.ly/1B6HdYq (Mediafire) or here http://bit.ly/1ElrjqJ (Devhost)
  2. Download Motorola Update Services apk from here http://bit.ly/1z9Lox0. Install it on your device.
  3. Put the zip file to root of internal memory. (Root means simply internal or external memory.)
    Make sure that you have at least 500 mbs free in your internal memory as we said before.
  4. shutdown your mobile and Reboot your phone.
  5. Now goto Settings -> About Phone -> System updates,  see “New system software available”. Click on “Yes I’m in”.
  6. Download begins.  Once the download is complete, swipe down the notification bar and click on Install system update->Install now.
  7. Its Rebooting your mobile automatically you have to wait 10-20 mins
  8. While your mobile will start booting, don’t panic just let it be, its new software so took some more time be patience.
  9. Finally its updated,  ‘Say Cheers yourself’ and enjoy the Lollipop updates.

At last step delete you zip file, Its no need there after.

Lollipop updates for Moto E 1st generation Enjoy the Coding.

 

What Is Cookie?

Cookie is a small file embedded with server to the user’s browser. Its mainly used to Get or Identify the user details. Every time the same computer requesting a page with a browser, it will also send the cookie.
By locally we said, Its stored the pages and details in you browser History. you can check once the link in history. Until you cleared the history the webpage details are stored in you browser, you browser details are stored in the server with the help of cookie function.

Advantage of stored cookie is, If we browsing very large website or server in your browser its take large time to load for first time. But Second time its doesn’t take much time (send request to the server and get full website), it can easily access the website with the help of browser history which can previously stored using cookie.

How to Handle Cookie in Php and set Cookie time in browser

Using PHP you can create cookie function and set cookie and destroy cookie.

1. Create Cookies
A cookie is created with the setcookie() function.
Syntax

setcookie(name, value, expire, path, domain, secure, httponly);

parameters
name (* required)   –   user name
value (* required)   –   user value
expire (optional)     –   can set expire time
path (optional)        –  url path
domain (optional)  –   server domain name

all are optionals

Example Code

 

Explaination

Set cookie name, value and expire time to the page using setcookie() function
The cookie “Developerdesks” and “php” is stored in you browser as cookie

Real Time Checking
1. Run this code in your browser for first time the output is
“Cookie is not set set to the browser”
2.Refresh the same page again the output is
“Cookie ‘developerdesks’ is set!
Value is: Php”

Cookie “developerdesks” and “php” are stored in you browser history.

3. Delete the histor us CTRL+H -> clear browsing data -> Check “Cookies and other sites and plug-in data” and clear browsing data with the past hour.  now run the same page the output is

How to Handle Cookie in Php and set Cookie time in browser

“Cookie is not set set to the browser”

Because the cookie is deleted or expired. once you cleared history the cookie is deleted or expired.

If you not cleared the history its automatically cleared once the cookie set time is expired.

HINT : The setcookie() function must appear BEFORE the HTML tag or top of the page.

2. Modify the cookie.
We just create another user name and another setcookie function to modify the cookie values.

 

Output :

Cookie ‘user’ is set!       // Last Updated Cookie
Value is: Raja

3. Delete the Cookie
Just set expire time to delete the cookie

 

After one hour you reload the page the cookie is unset or delete

Output
Cookie ‘user’ is deleted.

How to Handle session variables in Php

Session is nothing but way to store a details or information (using variables) in multiple pages. Its Not like as Cookie.
The difference is details are not stored in the computer browser as like as cookie.

What is PHP Session? – Simple and clear Explanation

When You open a page in the browser. It have a login page. you logged in. browse some pages, update some changes and do all thing and closed it. From Your computer, know this who you are, what you do, where is it. But from Internet or server don’t know about all things. because the HTTP address doesn’t maintain state.

Here session works. It stored all login details or any information using session variable. It will carry the details to all the pages, links, update contents and changes until you unset or destroy the session. which means until you log-out or close the browser.

Syntax – how to start a Session
session_start();   // Session syntax

Session Variables is globally declared as $_SESSION  // variable syntax

Example

Output :

We are learning php
We are also learning Hmtl

Here You can call the session variable where you want.

Print all session in single output
We can also Print all the Session in single array function
Syntax

 output

Array ( [developer] => php [desks] => Html )

Modify the session variable
We can also modify the session variable where u want and when you want. It print last modified value only

 Output

We are learning WELCOME // Session variable print the last modified values
We are also learning Hmtl

Destroy or Unset the session variable
Want to remove all global session variables and destroy the session, we can use session_unset() and session_destroy():
Syntax:

If you run this code in your browser

Output
Notice: Undefined index: developer in you URL
We are learning .

Notice: Undefined index: desks in you URL
We are also learning .

Because variables are unset and destroyed.

Want to see the real time session variables functions work in multiple pages Click Here

Login page using session,  user details with out stored in database

Like this session some related functions also in php they are like cookie() and local storage()

COOKIE

LOCAL STORAGE

If we have a very large array values in Indexed or Associative array, we have to search or filter the particular array value or key.

Array_Search function is used to find the value.

This  function used to  search an array for a value and returns the key.

 

In the Given example, we have to find whether  “CSS” Find or not in the array. It prints the key of the value.

Output

b   // output

Explaination

array_search is used to search the array value(‘css’) and returns the value’s key(‘b’);

2. In_array()

In_array is simillar to the array_search

In_array Functions is used to find the value in the array list

using this function you can find the value is present or not in array queue.

syntax: In_array();

you can search anything value or key using IN_ARRAY();

for example

have to find “Developerdesks” in the given array

 

You can see explanation in this url

 

Function to find particular value or key in the array for php – In_array

In_array Functions is used to find the value in the array list

using this function you can find the value is present or not in array queue.

syntax: In_array();

for example

have to find “Developerdesks” in the given array

Explanation:

If you want find a particular key or value in the very long array for any action..

here ‘raj’ is ‘key’ and  ‘1233’ is ‘value’

you can search anything value or key using IN_ARRAY();

Similar to In_array();

2. array_search() 

If we have a very large array values in Indexed or Associative array, we have to search or filter the particular array value or key.

Array_Search function is used to find the value.

This  function used to  search an array for a value and returns the key.

You can see Explanation Here

A multidimensional array is an array containing one or more arrays.

Three-Dimensional array

For three dimensional array u have to use two for loop condition
find 0 indexed array value and then 0 indexed array value

Explain

First foreach consider skill as $develop and php =>80 as $desks

Second For each consider $key as php and $ value as 80

so the $develop –> indexed as skill, $key–> indexed as php and $value indexed as 80

simple foreach concept worked

Output

 

Similar like three dimensional array

Multidimensional Array concept in Php

A multidimensional array is an array containing one or more arrays.

Its is solution for to know how to handle a array with in array
Example
1.Two-dimensional array
2.Three-dimensional array

Here You can see Exaplaination

Multidimensional Array concept in Php

A multidimensional array is an array containing one or more arrays.

Its is solution for to know how to handle a array with in array
Example
1.Two-dimensional array
2.Three-dimensional array

1.Two-dimensional array

Output

Explanation:

First For loop consider all array values inside the array  –> array(“developer”,php,html) as 0 indexed

Second For loop consider inside values –> Developer as 0 indexed

For two dimensional array u have to use two for loop condition

find 0 indexed array value and then 0 indexed array value

simple example

Example For Three-Dimensional array

Associative array is array that use named keys that you assign to them.

example

named key ‘raj’ has vlaue ‘123’;

IF the named key is unknown and unlimited the use foreach

output

Similar like Associative array

Multidimensional Array concept in Php

A multidimensional array is an array containing one or more arrays.

Its is solution for to know how to handle a array with in array
Example
1.Two-dimensional array
2.Three-dimensional array

Here You can see Exaplaination