Pages

Thursday, October 24, 2013

Media Queries

What are Media Queries?

Allows us to change our layouts to suit the exact need of different devices without changing the content.
It is applied with the help of CSS3.
Media queries are CSS extensions to media types that give us more control over rendering across different devices.
Media query is a logical expression which is either true or false.
CSS associated with media query is only applied if the expression is true.
What are Media Types?
CSS can be used to specify how a document is presented in different media
There are ten media types defined in CSS
all : suitable for all devices.
handheld : for handheld devices.
screen :  for color computer screens.

tv  : for television type devices. 
aural : for speech synthesizer.
braille : for braille tactile feed back devices.
embossed : for paged braille printers.
projection : for projected presentations .
tty : for teletypes and terminals.
print : for print material
Methods to specify Media for CSS
First method:
You can use a element in the head of your HTML document to specify the target media of an external style sheet.
Example:
rel=“stylesheethref=“a.css” type=“type/css” media=“screen”/>
Second method:
You can use a stylesheetl?> element in the head of your XML document to specify the target media of an external style sheet.
Example:
stylesheet media=“screen” rel=“stylesheethref=“example.css”?>
Third method:
You can specify the target medium within a CSS file using @media
Example:
@media screen
{
   body{color:blue;}
}
Media Query Syntax
Types Of Keywords
and:
You can use multiple expressions in a media query if you join them with “and “ keyword.
E.g.:
Comma Separated:
You can use multiple, comma-separated media queries.
This comma act like an “or” keyword.
E.g.:
not:
You can use the not keyword in a media query if you want your CSS to be ignored by a specific device.
E.g.:
not:
You can use the not keyword in a media query if you want your CSS to be ignored by a specific device.
E.g.:
only:
You can use the only keyword in a media query if you want your CSS to be applied only to a specific device.
E.g.:
Targeting iPhone
iPhone does not support hand held media type.
Apple recommends targeting the iPhone using media queries.
  E.g.:
 
 

Monday, August 5, 2013

PHP CODE FOR CREATING A NEW FOLDER IN GOOGLE DRIVE API

         PHP CODE FOR CREATING A NEW FOLDER IN GOOGLE DRIVE API




require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_DriveService.php';
require_once 'google-api-php-client/src/contrib/Google_Oauth2Service.php';
$client = new Google_Client();
// Get your credentials from the APIs Console
//$client->setApplicationName('Google+ PHP Starter Application');
$client->setClientId('your client id');
$client->setClientSecret('your client secret id');
$client->setRedirectUri('your redirect uri');
$client->setScopes(array('https://www.googleapis.com/auth/drive'));


$client->setAccessToken(file_get_contents('conf.json'));
if ($client->getAccessToken()) {
//It means that I have the right to manipulate whatever service
// Choose the service you want to use
    $service = new Google_DriveService($client);

    $file = new Google_DriveFile();
    $file->setTitle('test'); //name of the folder
    $file->setDescription('A test folder');
    $file->setMimeType('application/vnd.google-apps.folder');
    $createdFile = $service->files->insert($file, array(
        'mimeType' => 'application/vnd.google-apps.folder',
    ));

   // print_r($createdFile);
    print "folder created sucessfully";
   
    echo "folder id is" . $createdFile->id;
   
}

CODE TO UPLOAD ANY TYPE OF FILE TO GOOGLE DRIVE API AFTER CREATING AN ACCESS TOKEN USING PHP

CODE TO UPLOAD ANY TYPE OF FILE TO GOOGLE DRIVE API   AFTER CREATING AN ACCESS TOKEN USING PHP

require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_DriveService.php';
require_once 'google-api-php-client/src/contrib/Google_Oauth2Service.php';


$client = new Google_Client();

// Get your credentials from the APIs Console
//$client->setApplicationName('Google+ PHP Starter Application');
$client->setClientId('your client id');
$client->setClientSecret('your client secret id'); 
$client->setRedirectUri('your resirect uri');
$client->setScopes(array('https://www.googleapis.com/auth/drive'));


$client->setAccessToken(file_get_contents('conf.json'));
if ($client->getAccessToken()) {
//It means that I have the right to manipulate whatever service
// Choose the service you want to use
    $service = new Google_DriveService($client);

    $file = new Google_DriveFile();
    $file->setTitle('hai');
    $file->setDescription('A test document');
    $file->setMimeType('text/plain');
    $data = file_get_contents('hello.txt'); //example file
    
    $createdFile = $service->files->insert($file, array(
        'data' => $data,
        'mimeType' => 'text/plain',
    ));
   
   // print_r($createdFile);
    print "file uploaded sucessfully";
   
    

?>

Sunday, August 4, 2013

CODE TO CREATE A CONNECTION WITH GOOGLE DRIVE API USING PHP AND SAVE AUTHENTICATION TOKEN


CODE TO CREATE A CONNECTION WITH GOOGLE DRIVE API USING PHP AND SAVE AUTHENTICATION TOKEN 

require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_DriveService.php';

session_start();
$client = new Google_Client();
// Get your credentials from the APIs Console
//$client->setApplicationName('Google+ PHP Starter Application');
$client->setClientId('your client side');
$client->setClientSecret('your client secret id');
$client->setRedirectUri('your client redirect uri');
$client->setScopes(array('https://www.googleapis.com/auth/drive'));

////I will address building permit
$authUrl = $client->createAuthUrl();
print "Connect Me!";
echo $authUrl;
//Return of the address with the code that I can autenticarme
if (isset($_GET['code'])) {
  $accessToken = $client->authenticate($_GET['code']);
  
  file_put_contents('conf.json', $accessToken);
  $client->setAccessToken($accessToken);
  $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
  header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
}


Tuesday, June 30, 2009

Strengthening Tech Trends

The next Green Revolution seems to be happening in the field of electronics and IT, with a slew of products ranging from servers, storage solutions and laptop computers to even point -of-sale counters claiming eco- friendliness as their unique selling proposition.

But what really does the ‘greenness’ of a product refer to? Is it merely the quality of being energy efficient and working on a smaller footprint? While energy efficiency is a key aspect of a product’s greenness, a product must adhere to many more factors in order to truly qualify as green

For example, eliminating harmful substances like vinyl plastics such as PVC and Brominated flame retardants (BFRs) from products and avoiding the use of other toxic chemicals in the manufacturing process, is an important requirement for eco – friendliness. The amount of floor – space occupied by the product, length of its useful life, ability to discard, reuse or recycle it in an environmental – friendly way at end of its life, etc are other key aspects.

Companies are likely to strengthen their greening exercises with eco- friendliness becoming more of a necessity than a value-add today, thanks to great awareness amongst consumers and a deeper interest shown by activists.

The year 2007and 2008 saw the rise of ‘green’ as a buzzword amongst the electronics and IT industry in India, and the word was thrown about in marketing materials and news reports. Yet, studies by Greenpeace International showed that very few companies in India qualified as being eco-friendly, and even giants like HCL have much ground to cover. Internationally, companies like SONY, SAMSUNG and DELL have consistently performed well in Green peace’s ‘green’ electronics reading.