Nepal Nirvana

January 7, 2015 Leave a comment

nirvana

Nepal Nirvana
Every motorcycle ride is a collection of small stories. Experiences, bundled up into fond memories for a lifetime.

Nepal is an enigma. When thinking about this country, what comes to mind are the mighty Himalayas and heroic feats of men and women who have set foot on some of the tallest mountains in the world. There’s more to Nepal than just mountaineering though.

Adventure in Nepal is a way of life. Once here, the ideal ingredients for adrenaline gushing, heart rate increasing and mind altering travel are found in every corner. It was time we took the Nirvana tread to Nepal!

Nepal is a neighbour to India and a mystery to everyone who hasn’t been to this country of concoctions. One of the smallest countries in the world is a window into some of the the biggest mountain ranges in the world. Not to mention the downright dumbfounding natural beauty…

View original post 1,224 more words

Categories: Uncategorized

Connecting PHP with Oracle

September 6, 2012 Leave a comment

அறிவுச் சுடரேந்து

PHP provides two extension modules with which we can connect to Oracle:

  • The normal Oracle functions (ORA); and
  • the Oracle Call-Interface functions (OCI).

OCI is frequently used. ORA doesn’t include support for CLOBs, BLOBs, BFILEs, ROWIDs, etc.

Here is a sample PHP script that uses OCI Extension module to connect Oracle.

<?php

$dbuser = “username”;
$dbpass = “password”;
$dbserver = “server”;
$c=OCILogon($dbuser, $dbpass, $dbserver);
if (!$c) {
$err = OCIError();
echo “Oracle Connect Error ” . $err[text];
}

OCILogoff($c);

?>

The following program fetches data from Oracle database using OCI :

<?php

$dbuser = “username”;

$dbpass = “password”;

$dbserver = “server”;

$c=OCILogon($dbuser, $dbpass, $dbserver);

if (!$c) {

$err = OCIError();

echo “Oracle Connect Error ” . $err[text];

}

$query =”SELECT * from student_details”;

$res= OCIParse($c,$query);

OCI_Execute($res, OCI_DEFAULT);

while(OCIFetch($res)){

$student_id = OCIResult($res, “STUDENT_ID”);

echo “Student Id” . $student_id;

}

OCILogoff($c);

?>

View original post

Categories: Uncategorized

scary Facebook …

September 6, 2012 Leave a comment

.

pindanpost

Wolfram Alpha: The Facebook app that knows you better than you do

  • by: Claire Connelly
  • From: News Limited Network
  • September 05, 2012 8:39AM
Facebook

New app crunches the numbers on your Facebook page. Picture: File

A FACEBOOK app known as “Wolfram Alpha” knows more about your social media use than you do.

In fact it’s a little bit scary.

By searching for “Facebook Report” and allowing it to access my Facebook feed I have found out I had posted 1293 links, 946 status updates and uploaded 237 photos on Facebook.

That’s 2476 posts all up. I spend way too much time on Facebook.

The app showed 47.5 per cent of my friends were female and 52.5 per cent were a male. Almost 50 per cent of my friends are married and

View original post

Categories: Uncategorized

PHP codes to tell browsers to open the download dialog box for users to download a file instead of open into the Browsers

September 4, 2012 Leave a comment

A fairly common question is, “How can I force a file to download to the user?” The answer is, you really cannot. You will need something on the server to send a Content-Disposition header to set the file as an attachment instead of being inline. You could do this with plain Apache configuration though.

<a href="download.php?file=path/<?=$row['file_name']?>">Download</a>

download.php:

<?php

$file = $_GET['file'];

download_file($file);

function download_file( $fullPath ){

  // Must be fresh start
  if( headers_sent() )
    die('Headers Sent');

  // Required for some browsers
  if(ini_get('zlib.output_compression'))
    ini_set('zlib.output_compression', 'Off');

  // File Exists?
  if( file_exists($fullPath) ){

    // Parse Info / Get Extension
    $fsize = filesize($fullPath);
    $path_parts = pathinfo($fullPath);
    $ext = strtolower($path_parts["extension"]);

    // Determine Content Type
    switch ($ext) {
      case "pdf": $ctype="application/pdf"; break;
      case "exe": $ctype="application/octet-stream"; break;
      case "zip": $ctype="application/zip"; break;
      case "doc": $ctype="application/msword"; break;
      case "xls": $ctype="application/vnd.ms-excel"; break;
      case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
      case "gif": $ctype="image/gif"; break;
      case "png": $ctype="image/png"; break;
      case "jpeg":
      case "jpg": $ctype="image/jpg"; break;
      default: $ctype="application/force-download";
    }

    header("Pragma: public"); // required
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: private",false); // required for certain browsers
    header("Content-Type: $ctype");
    header("Content-Disposition: attachment; filename=\"".basename($fullPath)."\";" );
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: ".$fsize);
    ob_clean();
    flush();
    readfile( $fullPath );

  } else
    die('File Not Found');

}
?>

The way to force the browser not to handle the file internally is to change the headers (content-disposition prefereably, or content-type) so the browser will not try to handle the file internally. You can either do this by writing a script on the webserver that dynamically sets the headers (i.e. download.php) or by configuring the webserver to return different headers for the file you want to download.

Categories: Programming

Creating a HTTP Web Server Using NodeJs

August 12, 2012 Leave a comment

Here I am gonna show you how to create a HTTP Web Server .Node.js is an evented system,.

To create an application using NodeJs you simply make sure that you have installed NodeJs in your system .

Write this code on your textfile

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

To run the server, put the code into a file app.js and execute it with thenode program:

Go to command Prompt

go to NodeJs Directory and Type

C:\ NodeJs>node app.js
Server running at http://127.0.0.1:1337/

Then go to your browser and type above address🙂🙂 Enjoy

Categories: Programming

Implement Cache using PHP

July 23, 2012 Leave a comment

Cache is a very simple concept that can be used in a various web applications . A cache can be used for storing database queries for later use, to store rendered pages to be served again without generating them again, or to save indexed pages in a crawler application to be processed by multiple modules.

here will see how to implement Cache into your website

First of all, if you’re using sessions, you must disable session_cache_limiter (by setting it to noneor public). Headers it sends are the worst case of voodoo programming I’ve ever seen.

session_cache_limiter('none');

Then send Cache-Control: max-age=number_of_seconds and optionally equivalent Expires:header.

header('Cache-control: max-age='.(60*60*24*365));
header('Expires: '.gmdate(DATE_RFC1123,time()+60*60*24*365));

To get best cacheability, send Last-Modified header and reply with status 304 and empty body if browser sends If-Modified-Since header.

This is cheating a bit (doesn’t verify the date), but is valid as long as you don’t mind browsers keeping cached file forever:

if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
   header('HTTP/1.1 304 Not Modified');
   die();
}
Categories: Uncategorized

Upload image Using PHP and store name into MySQL Database

June 1, 2012 6 comments

Here I will show you how to upload the image using PHP . and  store that image into Specific folder and store the name of image intp Mysql database as well 

Before Start you need to create a database in your MySql Database . and you need to configure

1) Create a HTML Form and Copy this Code

<form method=”post” action=”addMember.php” >

<p>
Please Upload a Photo of the Member in gif or jpeg format. The file name should be named after the Members name. If the same file name is uploaded twice it will be overwritten! Maxium size of File is 35kb.
</p>
<p>
Photo:
</p>
<input type=”hidden” name=”size” value=”350000″>
<input type=”file” name=”photo”>

<input TYPE=”submit” name=”upload” title=”Add data to the Database” value=”Add Member”/>
</form>

2) You need to create another file = addMember.php and then copy below code

<?php

//This is the directory where images will be saved
$target = “your directory”;
$target = $target . basename( $_FILES[‘photo’][‘name’]);

$pic=($_FILES[‘photo’][‘name’]);

// Connects to your Database
mysql_connect(“yourhost”, “username”, “password”) or die(mysql_error()) ;
mysql_select_db(“dbName”) or die(mysql_error()) ;

//Writes the information to the database
mysql_query(“INSERT INTO tableName (photo)
VALUES (‘$pic’)”) ;

//Writes the photo to the server
if(move_uploaded_file($_FILES[‘photo’][‘tmp_name’], $target))
{

//Tells you if its all ok
echo “The file “. basename( $_FILES[‘uploadedfile’][‘name’]). ” has been uploaded, and your information has been added to the directory”;
}
else {

//Gives and error if its not
echo “Sorry, there was a problem uploading your file.”;
}
?>

Enjoyyyyyyyyy

Categories: Uncategorized
%d bloggers like this: