Monday 22 November 2010

Few Useful Sites To Subscribe

Here I am listing few of the very useful information/resource providing sites that keeps you awake about the things in current trends to buisness,social media, market, entrepreneurship , design , technology.

http://techcrunch.com/
http://sanderssays.typepad.com/sanders_says/
http://www.smashingmagazine.com/
http://sethgodin.typepad.com/seths_blog/
http://dilbert.com/
http://www.leadershipnow.com/leadingblog/
http://www.ted.com/
http://www.spring.org.uk/
http://www.fastcompany.com/
http://www.boomberg.com/
http://www.ft.com

Please add your comment if I missed any important site.

 

Web 2.0 Vs Web 1.0


  • Web 2.0 is about communities, Web 1.0 was about companies

  • Web 2.0 is about blogs, Web 1.0 was about home pages

  • Web 2.0 is about peer to peer, Web 1.0 was about client-server

  • Web 2.0 is about XML, Web 1.0 was about HTML

  • Web 2.0 is about writing, Web 1.0 was about reading

  • Web 2.0 is about tags, Web 1.0 was about taxonomy

  • Web 2.0 is about wireless, Web 1.0 was about wires

  • Web 2.0 is about sharing, Web 1.0 was about owning

  • Web 2.0 is about RSS, Web 1.0 was about portals

  • Web 2.0 is about trade sales, Web 1.0 was about IPOs

  • Web 2.0 is about web applications, Web 1.0 was about web forms

  • Web 2.0 is about APIs, Web 1.0 was about screen scraping

  • Web 2.0 is about broadband, Web 1.0 was about dialup

  • Web 2.0 is about bandwidth costs, Web 1.0 was about hardware costs

  • Web 2.0 is about Google, Web 1.0 was about Netscape


 

Thursday 18 November 2010

PHP Add and Remove Querystring Variables

function add_querystring_var($url, $key, $value) {

$url = preg_replace('/(.*)(\?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&');

$url = substr($url, 0, -1);

if (strpos($url, '?') === false) {

return ($url . '?' . $key . '=' . $value);

} else {

return ($url . '&' . $key . '=' . $value);

}

}

 

function remove_querystring_var($url, $key) {

$url = preg_replace('/(.*)(\?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&');

$url = substr($url, 0, -1);

return ($url);

}

EXE in PHP (Make Executable or Make Desktop Application in PHP)

Hello Friends,

I m a web developer and i always use PHP as web scripting server side language but before some days when i found that now it is possible to make EXE in PHP means now you can make Executable or make Desktop application by PHP. Isn’t it Great?

There are many complier available on web by which you can create EXE in PHP.

This program runs through dos and windows only,I don’t know About Linux.If you want to make Executable in PHP then firstly download PHP EXE Compiler/Embedder from Here.

Try to explain you some more things about this.

 

1.First Download zip from Here.

2. Now unzip it and open Command prompt and then go to its directory.

3. Start > run… ‘cmd’
4. Use the “cd..” command to change directory.

5. Place PHP script to be compiled next to bamcompile.exe (same directory)
6. in the cmd prompt, at that directory, type:
ex: “bamcompile test.php”
variations:
“bamcompile -c test.php” gives compression.
-e:something.dll allows a DLL to be embedded

Readymade examples are given in Zipped files which you have downloaded, just try it out.

Monday 15 November 2010

MySQL Table Types



MySQL supports various of table types or storage engines to allow you to optimize your database. The table types are available in MySQL are:

  • ISAM

  • MyISAM

  • InnoDB

  • BerkeleyDB (BDB)

  • MERGE

  • HEAP


The most important feature to make all the table types above distinction is transaction-safe or not. Only InnoDB and BDB tables are transaction safe and only MyISAM tables support full-text indexing and searching feature. MyISAM is also the default table type when you create table without declaring which storage engine to use. Here are some major features of each table types:

ISAM


ISAM had been deprecated and removed from version 5.x. All of it functionality entire replace by MyISAM. ISAM table has a hard size 4GB and is not portable.

MyISAM


MyISAM table type is default when you create table. MyISAM table work very fast but not transaction-safe. The size of MyISAM table depends on the operating system and the data file are portable from system to system. With MyISAM table type, you can have 64 keys per table and maximum key length of 1024 bytes.

InnoDB


Different from MyISAM table type, InnoDB table are transaction safe and supports row-level locking. Foreign keys are supported in InnoDB tables. The data file of InnoDB table can be stored in more than one file so the size of table depends on the disk space. Like the MyISAM table type, data file of InnoDB is portable from system to system. The disadvantage of InnoDB in comparison with MyISAM is it take more disk space.

BDB


BDB is similar to InnoDB in transaction safe. It supports page level locking but data file are not portable.

MERGE


Merge table type is added to treat multiple MyISAM tables as a single table so it remove the size limitation from MyISAM tables.

HEAP


Heap table is stored in memory so it is the fastest one. Because of storage mechanism, the data will be lost when the power failure and sometime it can cause the server run out of memory. Heap tables do not support columns with AUTO_INCREMENT, BLOB and TEXT characteristics.


 

Tuesday 2 November 2010

Send mail from your localhost

Hello Friends !!

When you developing your site then you are facing a problem that how to send mail from your local host ?

Because when you are testing your project/site in localhost then this problem occurred. At that time you think about upload your site on server.

If you don’t want this type of uploading work and you want to test your mail form your localhost then here is the solution.

First of all open your xamp or wamp installed directory.

Then open php directory and find php.ini.

Then open this php.ini in notepad and find [mail function] in that file.

When you find it, remove semi colon before SMTP,smtp_port and sendmail_from.

Set this parameters like this :

SMTP=mail.test.com  //it indicates mail server

smtp_port=25            // it indicates port address

sendmail_from=test@test.com   // it indicates mail id from which you want to send mail

After this, please stop you xamp/wamp services, do refresh and start it again.

Thats it.. Now you can send mail from your localhost..

If you have any query or any confusion then feel free to comment me.

Thanks !!

[PHP] Email Attachment – PDF In Email Attachment

Hi Friends , yesterday I was working with email attachment and I wanted to send pdf file as email attachment but It was giving me so many problems. I have searched so many code for PDF attachment but no one was working So I start tp debug code and finally  made working pdf attachment code by pdf attachment in email worked successfully.

<?php



$fileatt = "test.pdf"; // Path to the file

$fileatt_type = "application/pdf"; // File Type

$fileatt_name = "test.pdf"; // Filename that will be used for the file as the attachment

$email_from = "noreply@hackingethics.com"; // Who the email is from

$email_subject = "Your attached file"; // The Subject of the email

$email_message = "Thanks for visiting <a href="http://www.hackingethics.com/" target="_blank" title="More about HackingEthics »">HackingEthics</a>.com! <br>";

$email_message .= "Thanks for visiting.<br>"; // Message that the email has in it

$email_to = "xyz@gmail.com"; // Who the email is to

$headers = "From: ".$email_from;

$file = fopen($fileatt,'rb');

$data = fread($file,filesize($fileatt));

fclose($file);

$semi_rand = md5(time());

$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

$headers .= "\nMIME-Version: 1.0\n" .

"Content-Type: multipart/mixed;\n" .

" boundary=\"{$mime_boundary}\"";

$email_message .= "This is a multi-part message in MIME format.\n\n" .

"--{$mime_boundary}\n" .

"Content-Type:text/html; charset=\"iso-8859-1\"\n" .

"Content-Transfer-Encoding: 7bit\n\n" .

$email_message .= "\n\n";

$data = chunk_split(base64_encode($data));

$email_message .= "--{$mime_boundary}\n" .

"Content-Type: {$fileatt_type};\n" .

" name=\"{$fileatt_name}\"\n" .

//"Content-Disposition: attachment;\n" .

//" filename=\"{$fileatt_name}\"\n" .

"Content-Transfer-Encoding: base64\n\n" .

$data .= "\n\n" .

"--{$mime_boundary}--\n";

$sent = @mail($email_to, $email_subject, $email_message, $headers);

if($sent) {

echo "Your email attachment has been Worked.";

} else {

die("Sorry but the email could not be sent. Please go back and try again!");

}

?>

Replace your email address in $email_to and filename in $fileatt and $fileatt_name.

 









Integration of Google Map in Websites (PHP,dot net,Java etc)

Hello friends I m a Web Developer so i want to share my knowledge with you.We all know about GoogleMap, now if you want to integrate Google Map in your website or in your client website then i m giving you some tips about Google map integration in website (PHP,.NET,Java etc).

To integrate Google Map in Website then firstly you have one API key,from this API key you can use Google Map in your website. This API key is Unique for every website (this API key working for all subdirecories in a website,So always use Root directory to get API key ) , so here is the link to generate API key for Google Map. (Click here to Generate API key for Google Map).Now you can check Google Map Documentation for integration in Google Map in Website.you can find all things in this Documentation but But now if you wana some more Stuffs in Google Map like Position Overview,Markers on places,Zoom,Double Click Zoom,To here from Here direction,Markers with info windows,Tabbed Info WIndows,Custom Zoom Slider,Context menus and also Adding your own custom map with examples then i know one more website link which have this all stuffs with simple and sweet examples.You can understand this all examples easily and also you can integrate in your website. (Click here for Google Map integration in Website Tutorial)
If you have any problem in Google Map you can contact me, I will try my best to help you in Google Map

How to integrate paypal pro in to your php site....

The following code is used to integrate payment module in your site

create one file with name paypal.php [or any name you wish]

paypal.php file contains the following code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>The Popout - Paypal Payment</title>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="icon" href="images/1.ico" type="image/x-icon">
<link rel="shortcut icon" href="images/1.ico" type="image/x-icon">
</head>
<body oncontextmenu="return false" onLoad="document.paypal_form.submit();">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="paypal_form">
<input type="hidden" name="image" src="images/payment_sub.gif" border="0" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="clientpaypalid@clientsite.com"> <!--Value is Client paypal id for his site, it is mandatary-->
<input type="hidden" name="item_name" value="Premium Membership">
<input type="hidden" name="buyer_credit_promo_code" value="1">
<input type="hidden" name="buyer_credit_product_category" value="1">
<input type="hidden" name="buyer_credit_shipping_method" value="1">
<input type="hidden" name="buyer_credit_user_address_change" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="AUD"> <!--Value is currency code-->
<input type="hidden" name="lc" value="US"> <!--Country code-->
<input type="hidden" name="bn" value="PP-SubscriptionsBF">
<input type="hidden" name="a3" value="<?=$amount?>"> <!--Value is the amount how much you collect from user, this value is mandatary, you can get this value from the hidden filed of previous form you come from or get from passing to the url, best to get from hidden field, if you get from url it is not safe because we give chance to the user to change the amount value-->
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="hidden" name="first_name" value="<?=$firstname?>"> <!--Value for this user details is not mandatary, these fields will be filled in the paypal site if we are not passing. If we pass these values these values will be autofilledin in the paypal site-->
<input type="hidden" name="last_name" value="<?=$lastname?>">
<input type="hidden" name="address1" value="<?=$address?>">
<input type="hidden" name="city" value="<?=$city?>">
<input type="hidden" name="state" id="state" value="<?=$state?>">
<input type="hidden" name="zip" value="<?=$zip?>">
<input type="hidden" name="country" id="country_code" value="<?=$country_code?>">
<input type="hidden" name="H_PhoneNumber" value="<?=$H_PhoneNumber?>">
<input type="hidden" name="email" value="<?=$email?>">
<input type="hidden" name="credit_card_type" id="credit_card_type" value="<?=$credit_card_type?>">
<input type="hidden" name="cc_number" value="<?=$card_num?>">
<input type="hidden" name="expdate_month" value="<?=$exp_month?>">
<input type="hidden" name="expdate_year" value="<?=$exp_year?>">
<input type="hidden" name="cvv2_number" value="<?=$card_code?>">
<input type="hidden" name="return" value="http://www.popout.com.au/dev/paypalstatus.php?msg=success"> <!--this is the page redirecting from paypal site when the user gives all correct details-->
<input type="hidden" name="cancel_return" value="http://www.popout.com.au/dev/paypalstatus.php?msg=failure"> <!--this is the page redirecting from paypal site when the user gives false details-->
<input type="submit" name="submit" value="continue" />
</form>
</body>
</html>