<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Moazzam's Ramblings</title>
	<atom:link href="http://moazzam-khan.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://moazzam-khan.com/blog</link>
	<description></description>
	<lastBuildDate>Fri, 13 Aug 2010 19:54:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>The world of programming</title>
		<link>http://moazzam-khan.com/blog/?p=575</link>
		<comments>http://moazzam-khan.com/blog/?p=575#comments</comments>
		<pubDate>Mon, 07 Jun 2010 18:00:12 +0000</pubDate>
		<dc:creator>Moazzam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://moazzam-khan.com/blog/?p=575</guid>
		<description><![CDATA[A friend of mine sent me this picture which shows who did what in the field of computing. He found the picture on Smash magazine's website (don't know where). But here it is: Share on Facebook]]></description>
			<content:encoded><![CDATA[<p>A friend of mine sent me this picture which shows who did what in the field of computing. He found the picture on Smash magazine's website (don't know where). But here it is:</p>
<div class="wp-caption alignnone" style="width: 410px"><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2010/06/aboutprogramming04.jpg"><img class=" " title="Click to enlarge" src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2010/06/aboutprogramming04.jpg" alt="About programming" width="400" height="500" /></a><p class="wp-caption-text">Click to enlarge</p></div>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://moazzam-khan.com/blog/?p=575" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://moazzam-khan.com/blog/?feed=rss2&amp;p=575</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up your Android environment</title>
		<link>http://moazzam-khan.com/blog/?p=452</link>
		<comments>http://moazzam-khan.com/blog/?p=452#comments</comments>
		<pubDate>Tue, 06 Apr 2010 20:06:31 +0000</pubDate>
		<dc:creator>Moazzam</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[android setup]]></category>
		<category><![CDATA[eclipse android]]></category>
		<category><![CDATA[install android sdk]]></category>
		<category><![CDATA[windows setup android]]></category>

		<guid isPermaLink="false">http://moazzam-khan.com/blog/?p=452</guid>
		<description><![CDATA[I have seen quite a few posts on some lists asking about how to set up a programming environment for Android. While it is very straight forward, the documentation is all over the place. So, I decided to write this tutorial . In this tutorial, we will install Android SDK in eclipse (Galileo), we will [...]]]></description>
			<content:encoded><![CDATA[<p>I have seen quite a few posts on some lists asking about how to set up a programming environment for Android. While it is very straight forward, the documentation is all over the place. So, I decided to write this tutorial <img src='http://moazzam-khan.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>In this tutorial, we will install Android SDK in eclipse (Galileo), we will add an SD Card to your emulator and put some pictures in it. I have written this tutorial with Windows users in mind but the process should not be very different for other platforms.</p>
<p>I have written this tutorial assuming that you already have JDK installed. If you don't have it already installed then please install it before reading this. You can find a tutorial on how to install <a href="http://moazzam-khan.com/blog/?p=215" target="_blank">here</a>.</p>
<h3>Installing the SDK</h3>
<ol>
<li> Download the latest eclipse IDE from<br />
<a href="http://www.eclipse.org/downloads/" target="_blank">http://www.eclipse.org/downloads/</a>.</p>
<p>You can also download Galileo directly from <a href="http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/SR1/eclipse-java-galileo-SR1-win32.zip&amp;url=http://ftp.osuosl.org/pub/eclipse/technology/epp/downloads/release/galileo/SR1/eclipse-java-galileo-SR1-win32.zip&amp;mirror_id=272" target="_blank">here</a>.</li>
<li>Create a folder in your <strong>c:\</strong> drive and name it <strong>android</strong>. The file you just downloaded (at least from the direct link I provided above) is a zip file which contains a folder called <strong>eclipse</strong>. Extract the zip file and place the folder in, <strong>c:\android</strong>. Now, you have eclipse installed in <strong>c:\android</strong>. Go into the eclipse folder. You will see an executable called eclipse. Double click it to run eclipse.
<div class="wp-caption alignnone" style="width: 421px"><a href="http://i95.photobucket.com/albums/l132/marc188/blog/blog_eclipse_path.png"><img title="Eclipse executable" src="http://i95.photobucket.com/albums/l132/marc188/blog/blog_eclipse_path.png" alt="Click to enlarge" width="411" height="359" /></a><p class="wp-caption-text">Click to enlarge</p></div></li>
<li>Now, download the android SDK 1.6 (the latest as of this writing) for windows from the link below:<a href="http://developer.android.com/sdk/download.html?v=android-sdk-windows-1.6_r1.zip" target="_blank">http://developer.android.com/sdk/download.html?v=android-sdk-windows-1.6_r1.zip</a>To download the SDK for other platforms, go here :<a href="http://developer.android.com/sdk/1.6_r1/index.html" target="_blank">http://developer.android.com/sdk/1.6_r1/index.html</a></li>
<li>Extract the contents of the zip file in <strong>c:\android\</strong>. Now, you will have 2 folders in <strong>c:\android\</strong>. One is <strong>eclipse</strong> and the other is <strong>android-sdk-windows-xxx</strong>.<strong>android-sdk-windows-xxx </strong>folder contains another folder called <strong>tools</strong>. We need to add this folder to the system's PATH variable. To do that, Click on Start, then right click on "My Computer" and click on "Properties" in the menu that pops up.</li>
</ol>
<p>The "System Properties" dialog will pop up. Click on the "Advanced" tab and then click on "Environment variables". Another dialog will appear.</p>
<p>Run eclipse. Click on Help -&gt; Install New Software.</p>
<p><div class="wp-caption alignnone" style="width: 485px"><a href="http://i95.photobucket.com/albums/l132/marc188/blog/blog_eclipse2.png"><img title="Eclipse" src="http://i95.photobucket.com/albums/l132/marc188/blog/blog_eclipse2.png" alt="Click to enlarge" width="475" height="342" /></a><p class="wp-caption-text">Click to enlarge</p></div>
<p>An install dialog will appear. Click on "Add", another dialog will appear. Type in Android for name and put in https://dl-ssl.google.com/android/eclipse for Location. Then click OK. Click on next, check both the checkboxes and click next. Eclipse will start downloading the plugin and install it. You will be asked to restart eclipse after the installation is done. Click on "Yes" when it asks you to restart. Eclipse will restart and you can, now, create Android projects!</p>
<div class="wp-caption alignnone" style="width: 414px"><a href="http://i95.photobucket.com/albums/l132/marc188/blog/blog_eclipse3.png"><img title="Eclipse" src="http://i95.photobucket.com/albums/l132/marc188/blog/blog_eclipse3.png" alt="Click to enlarge" width="404" height="221" /></a><p class="wp-caption-text">Click to enlarge</p></div>
<p>Now that the basic installation is done. Let's setup the SC Card.</p>
<h3>Setting up the SD Card</h3>
<p>Creating the SD card is very easy.</p>
<ol>
<li>Click on <strong>Start</strong> -&gt; <strong>Run</strong>. The run dialog will appear</li>
<li>Type "cmd" (without the quotes) and hit enter or click the <strong>OK</strong> button. A commant prompt window will appear.</li>
<li>Type "android list targets" in it and hit enter. It will show you a list of targets. Get the id for Android 1.6. It will most probably be 2</li>
<li>Type the command "android create avd -n testavd -t &lt;target_id&gt; -c 128M" (without the quotes) and hit enter. Make sure to subsitute the &lt;target_id&gt; with the actual ID you got from "android list targets" command. Since it will most probably be 2, the command will look like this "android create avd -n testavd -t 2 -c 128M (again without quotes).</li>
<li>Press enter 1 more time</li>
</ol>
<p>Viola! you have created your SD Card for the emulator. The next time you start the emulator, you will be able to access it. Below is an illustration to make things easy.</p>
<div class="wp-caption alignnone" style="width: 486px"><a href="http://i95.photobucket.com/albums/l132/marc188/blog/blog_eclipse6-1.png"><img title="Setting up SD card" src="http://i95.photobucket.com/albums/l132/marc188/blog/blog_eclipse6-1.png" alt="Click to enlarge" width="476" height="438" /></a><p class="wp-caption-text">Click to enlarge</p></div>
<p>When I created my SD card, I needed to get some pictures on it. So, I used an external program called winimage to do that.</p>
<h3>Working with your SD card</h3>
<ol>
<li>Download winimage from <a href="http://www.winimage.com/download.htm" target="_blank">http://www.winimage.com/download.htm</a>. You can either get the zip file or the exe file. I downloaded the zip file, extracted it and use that.</li>
<li> Run winimage.exe and make sure your emulator is not running.</li>
<li> Click on<em> Open image</em> icon. Browse to <strong>c:\android\sd_card\</strong> folder. Select <strong>sdcard</strong> and click <strong>OK</strong> button. Winimage will open the sdcard image. Now, you can browse the file structure and add files, delete files, etc. After you are done, make sure to close winimage or you won't be able to access the SD card from the emulator.</li>
</ol>
<p>As always here's an illustration:</p>
<div class="wp-caption alignnone" style="width: 451px"><a href="http://i95.photobucket.com/albums/l132/marc188/blog/blog_eclipse7.png"><img title="Winimage" src="http://i95.photobucket.com/albums/l132/marc188/blog/blog_eclipse7.png" alt="Click to enlarge" width="441" height="508" /></a><p class="wp-caption-text">Click to enlarge</p></div>
<p>Now, we have an the SD Card image open. Let's create a folder called "media" and put some pictures in it. When you take pictures with your phone's camera they are stored in the media folder in  your SD Card.</p>
<p>To create the media folder, click on <em>Image</em>, then on <em>Create Folder</em>. A dialog box will appear. Type "MEDIA" in it. and Click OK. After the folder is created, you can drag and drop pictures from your computer to the media folder just like you would normally do it when copying files from one location on your computer to another.</p>
<div class="wp-caption alignnone" style="width: 454px"><a href="http://i95.photobucket.com/albums/l132/marc188/blog/winimage1.png"><img title="WinImage" src="http://i95.photobucket.com/albums/l132/marc188/blog/winimage1.png" alt="WinImage" width="444" height="389" /></a><p class="wp-caption-text">Click to Enlarge</p></div>
<div class="wp-caption alignnone" style="width: 448px"><a href="http://i95.photobucket.com/albums/l132/marc188/blog/winimage_create_folder.png"><img title="Create folder" src="http://i95.photobucket.com/albums/l132/marc188/blog/winimage_create_folder.png" alt="Create Folder" width="438" height="345" /></a><p class="wp-caption-text">Click to enlarge</p></div>
<div class="wp-caption alignnone" style="width: 450px"><a href="http://i95.photobucket.com/albums/l132/marc188/blog/winimage_copy_pics.png"><img title="Copy pictures" src="http://i95.photobucket.com/albums/l132/marc188/blog/winimage_copy_pics.png" alt="Copy pictures" width="440" height="362" /></a><p class="wp-caption-text">Click to enlarge</p></div>
<input id="gwProxy" type="hidden" />
<input id="jsProxy" onclick="jsCall();" type="hidden" />
<input id="gwProxy" type="hidden" />
<input id="jsProxy" onclick="jsCall();" type="hidden" />
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://moazzam-khan.com/blog/?p=452" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://moazzam-khan.com/blog/?feed=rss2&amp;p=452</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP and Sabre</title>
		<link>http://moazzam-khan.com/blog/?p=495</link>
		<comments>http://moazzam-khan.com/blog/?p=495#comments</comments>
		<pubDate>Sat, 13 Mar 2010 21:18:18 +0000</pubDate>
		<dc:creator>Moazzam</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php sabre]]></category>
		<category><![CDATA[php socket]]></category>
		<category><![CDATA[sabre]]></category>
		<category><![CDATA[socket]]></category>

		<guid isPermaLink="false">http://moazzam-khan.com/blog/?p=495</guid>
		<description><![CDATA[What is Sabre? Sabre is a company that has data of all flight schedules, etc. And, using their system, you can book flights, hotels, rent cars, etc. Getting PHP to talk with Sabre I tried PHP Soap and nuSoap. They both didn't work for me because of their limitations. So I ended up writing a [...]]]></description>
			<content:encoded><![CDATA[<p><strong>What is Sabre?</strong></p>
<p>Sabre is a company that has data of all flight schedules, etc. And, using their system, you can book flights, hotels, rent cars, etc.</p>
<p><strong>Getting PHP to talk with Sabre</strong></p>
<p>I tried PHP Soap and nuSoap. They both didn't work for me because of their limitations. So I ended up writing a small script of my own that talks with Sabre for me after I realized that the headers being sent by all the SOAP libraries I tried, were not compatible with Sabre's web services.</p>
<p>Sabre checks the "Content-Type" header in your request. If that is not "text/xml", you will always get an error, even if your xml is correct.</p>
<p>Here's a little piece of code that should help with the transport part.  I will leave the generation of XML to you.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Sabre class (for connecting to Sabre web services)
 * @author Moazzam Khan &lt;moazzam at moazzam-khan dot com&gt;
 * @version $Id$
 */</span>
<span style="color: #000000; font-weight: bold;">class</span> Sabre <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$host</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$port</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$timeout</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Sabre<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">timeout</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">30</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> makeRequest<span style="color: #009900;">&#40;</span><span style="color: #000088;">$body</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$header</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;POST /websvc HTTP/1.1<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
					<span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;Host: <span style="color: #006699; font-weight: bold;">{$this-&gt;host}</span>:<span style="color: #006699; font-weight: bold;">{$this-&gt;port}</span>
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Content-Type: text/xml
Content-Length: &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$body</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;
Pragma: no-cache
Cache-Control: no-cache&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fsockopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ssl://&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">host</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">port</span><span style="color: #339933;">,</span> <span style="color: #000088;">$errno</span><span style="color: #339933;">,</span> <span style="color: #000088;">$errstr</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">timeout</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;SOCKET ERROR <span style="color: #006699; font-weight: bold;">$errstr</span> (<span style="color: #006699; font-weight: bold;">$errno</span>)<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">//send the request</span>
				<span style="color: #990000;">fputs</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #000088;">$header</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$body</span><span style="color: #339933;">,</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$header</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$body</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #990000;">stream_set_timeout</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">30</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #990000;">stream_set_blocking</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">feof</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$line</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fread</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2048</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
					<span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$line</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
				<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$ret</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$output</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$ret</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ret</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span>count<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ret</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#41;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ret</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$ret</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ret</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://moazzam-khan.com/blog/?p=495" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://moazzam-khan.com/blog/?feed=rss2&amp;p=495</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Android HttpRequest class (version 2.1)</title>
		<link>http://moazzam-khan.com/blog/?p=490</link>
		<comments>http://moazzam-khan.com/blog/?p=490#comments</comments>
		<pubDate>Wed, 18 Nov 2009 20:41:41 +0000</pubDate>
		<dc:creator>Moazzam</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[android 1.5]]></category>
		<category><![CDATA[android http]]></category>
		<category><![CDATA[android http get]]></category>
		<category><![CDATA[android http post]]></category>
		<category><![CDATA[android http request]]></category>
		<category><![CDATA[android upload file]]></category>

		<guid isPermaLink="false">http://moazzam-khan.com/blog/?p=490</guid>
		<description><![CDATA[Version of of this class had some bugs so I corrected them and here is the latest version Enjoy! package moz.http; &#160; import java.net.*; import java.io.*; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.Map.Entry; import org.apache.http.client.HttpClient; import org.apache.commons.*; import android.util.Log; /** * HTTP Request class * * [...]]]></description>
			<content:encoded><![CDATA[<p>Version of of this class had some bugs so I corrected them and here is the latest version <img src='http://moazzam-khan.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Enjoy!</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">moz.http</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ArrayList</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Enumeration</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Hashtable</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Iterator</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Map</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Set</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Map.Entry</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.http.client.HttpClient</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.commons.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.util.Log</span><span style="color: #339933;">;</span>
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* HTTP Request class
*
* You can use this class and distribute it as long as you give proper credit
* and place and leave this notice intact :). Check my blog for updated
* version(s) of this class (http://moazzam-khan.com)
*
* Usage Examples:
*
* Get Request
* --------------------------------
* HttpData data = HttpRequest.get(&quot;http://example.com/index.php?user=hello&quot;);
* System.out.println(data.content);
*
* Post Request
* --------------------------------
* HttpData data = HttpRequest.post(&quot;http://xyz.com&quot;, &quot;var1=val&amp;var2=val2&quot;);
* System.out.println(data.content);
* Enumeration&lt;String&gt; keys = dat.cookies.keys(); // cookies
* while (keys.hasMoreElements()) {
* 		System.out.println(keys.nextElement() + &quot; = &quot; +
* 				data.cookies.get(keys.nextElement() + &quot;rn&quot;);
*	}
* Enumeration&lt;String&gt; keys = dat.headers.keys(); // headers
* while (keys.hasMoreElements()) {
* 		System.out.println(keys.nextElement() + &quot; = &quot; +
* 				data.headers.get(keys.nextElement() + &quot;rn&quot;);
*	}
*
* Upload a file
* --------------------------------
* ArrayList&lt;File&gt; files = new ArrayList();
* files.add(new File(&quot;/etc/someFile&quot;));
* files.add(new File(&quot;/home/user/anotherFile&quot;));
*
* Hashtable&lt;String, String&gt; ht = new Hashtable&lt;String, String&gt;();
* ht.put(&quot;var1&quot;, &quot;val1&quot;);
*
* HttpData data = HttpRequest.post(&quot;http://xyz.com&quot;, ht, files);
* System.out.println(data.content);
*
* @author Moazzam Khan
*/</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> HttpRequest <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #008000; font-style: italic; font-weight: bold;">/**
        * HttpGet request
        *
        * @param sUrl
        * @return
        */</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> HttpData get<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> sUrl<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                HttpData ret <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HttpData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #003399;">String</span> str<span style="color: #339933;">;</span>
                <span style="color: #003399;">StringBuffer</span> buff <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">StringBuffer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #003399;">URL</span> url <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">URL</span><span style="color: #009900;">&#40;</span>sUrl<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #003399;">URLConnection</span> con <span style="color: #339933;">=</span> url.<span style="color: #006633;">openConnection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                        <span style="color: #003399;">BufferedReader</span> in <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BufferedReader</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">InputStreamReader</span><span style="color: #009900;">&#40;</span>con.<span style="color: #006633;">getInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>str <span style="color: #339933;">=</span> in.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                buff.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span>str<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                        ret.<span style="color: #006633;">content</span> <span style="color: #339933;">=</span> buff.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #666666; font-style: italic;">//get headers</span>
                        Map<span style="color: #339933;">&lt;</span>String, List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;&gt;</span> headers <span style="color: #339933;">=</span> con.<span style="color: #006633;">getHeaderFields</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        Set<span style="color: #339933;">&lt;</span>Entry<span style="color: #339933;">&lt;</span>String, List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;&gt;&gt;</span> hKeys <span style="color: #339933;">=</span> headers.<span style="color: #006633;">entrySet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>Iterator<span style="color: #339933;">&lt;</span>Entry<span style="color: #339933;">&lt;</span>String, List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;&gt;&gt;</span> i <span style="color: #339933;">=</span> hKeys.<span style="color: #006633;">iterator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> i.<span style="color: #006633;">hasNext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                Entry<span style="color: #339933;">&lt;</span>String, List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;&gt;</span> m <span style="color: #339933;">=</span> i.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                                Log.<span style="color: #006633;">w</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;HEADER_KEY&quot;</span>, m.<span style="color: #006633;">getKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                ret.<span style="color: #006633;">headers</span>.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>m.<span style="color: #006633;">getKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, m.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>m.<span style="color: #006633;">getKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;set-cookie&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                                ret.<span style="color: #006633;">cookies</span>.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>m.<span style="color: #006633;">getKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, m.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        Log.<span style="color: #006633;">e</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;HttpRequest&quot;</span>, e.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000000; font-weight: bold;">return</span> ret<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
        <span style="color: #008000; font-style: italic; font-weight: bold;">/**
        * HTTP post request
        *
        * @param sUrl
        * @param ht
        * @return
        * @throws Exception
        */</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> HttpData post<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> sUrl, Hashtable<span style="color: #339933;">&lt;</span>String, String<span style="color: #339933;">&gt;</span> ht<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003399;">String</span> key<span style="color: #339933;">;</span>
                <span style="color: #003399;">StringBuffer</span> data <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">StringBuffer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                Enumeration<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> keys <span style="color: #339933;">=</span> ht.<span style="color: #006633;">keys</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>keys.<span style="color: #006633;">hasMoreElements</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        key <span style="color: #339933;">=</span> keys.<span style="color: #006633;">nextElement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        data.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">URLEncoder</span>.<span style="color: #006633;">encode</span><span style="color: #009900;">&#40;</span>key, <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        data.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;=&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        data.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">URLEncoder</span>.<span style="color: #006633;">encode</span><span style="color: #009900;">&#40;</span>ht.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span>, <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        data.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;amp;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000000; font-weight: bold;">return</span> HttpRequest.<span style="color: #006633;">post</span><span style="color: #009900;">&#40;</span>sUrl, data.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #008000; font-style: italic; font-weight: bold;">/**
        * HTTP post request
        *
        * @param sUrl
        * @param data
        * @return
        */</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> HttpData post<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> sUrl, <span style="color: #003399;">String</span> data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003399;">StringBuffer</span> ret <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">StringBuffer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                HttpData dat <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HttpData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #003399;">String</span> header<span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #666666; font-style: italic;">// Send data</span>
                        <span style="color: #003399;">URL</span> url <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">URL</span><span style="color: #009900;">&#40;</span>sUrl<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #003399;">URLConnection</span> conn <span style="color: #339933;">=</span> url.<span style="color: #006633;">openConnection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        conn.<span style="color: #006633;">setDoOutput</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #003399;">OutputStreamWriter</span> wr <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">OutputStreamWriter</span><span style="color: #009900;">&#40;</span>conn.<span style="color: #006633;">getOutputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        wr.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        wr.<span style="color: #006633;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                        <span style="color: #666666; font-style: italic;">// Get the response</span>
&nbsp;
                        Map<span style="color: #339933;">&lt;</span>String, List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;&gt;</span> headers <span style="color: #339933;">=</span> conn.<span style="color: #006633;">getHeaderFields</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        Set<span style="color: #339933;">&lt;</span>Entry<span style="color: #339933;">&lt;</span>String, List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;&gt;&gt;</span> hKeys <span style="color: #339933;">=</span> headers.<span style="color: #006633;">entrySet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>Iterator<span style="color: #339933;">&lt;</span>Entry<span style="color: #339933;">&lt;</span>String, List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;&gt;&gt;</span> i <span style="color: #339933;">=</span> hKeys.<span style="color: #006633;">iterator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> i.<span style="color: #006633;">hasNext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                Entry<span style="color: #339933;">&lt;</span>String, List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;&gt;</span> m <span style="color: #339933;">=</span> i.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                                Log.<span style="color: #006633;">w</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;HEADER_KEY&quot;</span>, m.<span style="color: #006633;">getKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                dat.<span style="color: #006633;">headers</span>.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>m.<span style="color: #006633;">getKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, m.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>m.<span style="color: #006633;">getKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;set-cookie&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                                dat.<span style="color: #006633;">cookies</span>.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>m.<span style="color: #006633;">getKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, m.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                        <span style="color: #003399;">BufferedReader</span> rd <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BufferedReader</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">InputStreamReader</span><span style="color: #009900;">&#40;</span>conn.<span style="color: #006633;">getInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #003399;">String</span> line<span style="color: #339933;">;</span>
                        <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>line <span style="color: #339933;">=</span> rd.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                ret.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span>line<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                        Log.<span style="color: #006633;">e</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ERROR&quot;</span>, line<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        wr.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        rd.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        Log.<span style="color: #006633;">e</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ERROR&quot;</span>, <span style="color: #0000ff;">&quot;ERROR IN CODE:&quot;</span><span style="color: #339933;">+</span>e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                dat.<span style="color: #006633;">content</span> <span style="color: #339933;">=</span> ret.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">return</span> dat<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #008000; font-style: italic; font-weight: bold;">/**
        * Post request (upload files)
        * @param sUrl
        * @param files
        * @return HttpData
        */</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> HttpData post<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> sUrl, ArrayList<span style="color: #339933;">&lt;</span>File<span style="color: #339933;">&gt;</span> files<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
                Hashtable<span style="color: #339933;">&lt;</span>String, String<span style="color: #339933;">&gt;</span> ht <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Hashtable<span style="color: #339933;">&lt;</span>String, String<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">return</span> HttpRequest.<span style="color: #006633;">post</span><span style="color: #009900;">&#40;</span>sUrl, ht, files<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #008000; font-style: italic; font-weight: bold;">/**
        * Post request (upload files)
        * @param sUrl
        * @param params Form data
        * @param files
        * @return
        */</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> HttpData post<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> sUrl, Hashtable<span style="color: #339933;">&lt;</span>String, String<span style="color: #339933;">&gt;</span> params, ArrayList<span style="color: #339933;">&lt;</span>File<span style="color: #339933;">&gt;</span> files<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                HttpData ret <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HttpData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #003399;">String</span> boundary <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;*****************************************&quot;</span><span style="color: #339933;">;</span>
                        <span style="color: #003399;">String</span> newLine <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;rn&quot;</span><span style="color: #339933;">;</span>
                        <span style="color: #000066; font-weight: bold;">int</span> bytesAvailable<span style="color: #339933;">;</span>
                        <span style="color: #000066; font-weight: bold;">int</span> bufferSize<span style="color: #339933;">;</span>
                        <span style="color: #000066; font-weight: bold;">int</span> maxBufferSize <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4096</span><span style="color: #339933;">;</span>
                        <span style="color: #000066; font-weight: bold;">int</span> bytesRead<span style="color: #339933;">;</span>
&nbsp;
                        <span style="color: #003399;">URL</span> url <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">URL</span><span style="color: #009900;">&#40;</span>sUrl<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #003399;">HttpURLConnection</span> con <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">HttpURLConnection</span><span style="color: #009900;">&#41;</span> url.<span style="color: #006633;">openConnection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        con.<span style="color: #006633;">setDoInput</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        con.<span style="color: #006633;">setDoOutput</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        con.<span style="color: #006633;">setUseCaches</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        con.<span style="color: #006633;">setRequestMethod</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;POST&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        con.<span style="color: #006633;">setRequestProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Connection&quot;</span>, <span style="color: #0000ff;">&quot;Keep-Alive&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        con.<span style="color: #006633;">setRequestProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span>, <span style="color: #0000ff;">&quot;multipart/form-data;boundary=&quot;</span><span style="color: #339933;">+</span>boundary<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #003399;">DataOutputStream</span> dos <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">DataOutputStream</span><span style="color: #009900;">&#40;</span>con.<span style="color: #006633;">getOutputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                        <span style="color: #666666; font-style: italic;">//dos.writeChars(params);</span>
&nbsp;
                        <span style="color: #666666; font-style: italic;">//upload files</span>
                        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>files.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                Log.<span style="color: #006633;">i</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;HREQ&quot;</span>, i<span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                <span style="color: #003399;">FileInputStream</span> fis <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">FileInputStream</span><span style="color: #009900;">&#40;</span>files.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                dos.<span style="color: #006633;">writeBytes</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;--&quot;</span> <span style="color: #339933;">+</span> boundary <span style="color: #339933;">+</span> newLine<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                dos.<span style="color: #006633;">writeBytes</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Disposition: form-data; &quot;</span>
                                <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;name=&quot;</span>file_<span style="color: #0000ff;">&quot;+i+&quot;</span><span style="color: #0000ff;">&quot;;filename=&quot;</span><span style="color: #0000ff;">&quot;
                                + files.get(i).getPath() +&quot;</span><span style="color: #0000ff;">&quot;&quot;</span> <span style="color: #339933;">+</span> newLine <span style="color: #339933;">+</span> newLine<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                bytesAvailable <span style="color: #339933;">=</span> fis.<span style="color: #006633;">available</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                bufferSize <span style="color: #339933;">=</span> <span style="color: #003399;">Math</span>.<span style="color: #006633;">min</span><span style="color: #009900;">&#40;</span>bytesAvailable, maxBufferSize<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> buffer <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span>bufferSize<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                                bytesRead <span style="color: #339933;">=</span> fis.<span style="color: #006633;">read</span><span style="color: #009900;">&#40;</span>buffer, <span style="color: #cc66cc;">0</span>, bufferSize<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>bytesRead <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                        dos.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>buffer, <span style="color: #cc66cc;">0</span>, bufferSize<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                        bytesAvailable <span style="color: #339933;">=</span> fis.<span style="color: #006633;">available</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                        bufferSize <span style="color: #339933;">=</span> <span style="color: #003399;">Math</span>.<span style="color: #006633;">min</span><span style="color: #009900;">&#40;</span>bytesAvailable, maxBufferSize<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                        bytesRead <span style="color: #339933;">=</span> fis.<span style="color: #006633;">read</span><span style="color: #009900;">&#40;</span>buffer, <span style="color: #cc66cc;">0</span>, bufferSize<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                <span style="color: #009900;">&#125;</span>
                                dos.<span style="color: #006633;">writeBytes</span><span style="color: #009900;">&#40;</span>newLine<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                dos.<span style="color: #006633;">writeBytes</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;--&quot;</span> <span style="color: #339933;">+</span> boundary <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;--&quot;</span> <span style="color: #339933;">+</span> newLine<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                fis.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                        <span style="color: #666666; font-style: italic;">// Now write the data</span>
&nbsp;
                        <span style="color: #003399;">Enumeration</span> keys <span style="color: #339933;">=</span> params.<span style="color: #006633;">keys</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #003399;">String</span> key, val<span style="color: #339933;">;</span>
                        <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>keys.<span style="color: #006633;">hasMoreElements</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                key <span style="color: #339933;">=</span> keys.<span style="color: #006633;">nextElement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                val <span style="color: #339933;">=</span> params.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                dos.<span style="color: #006633;">writeBytes</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;--&quot;</span> <span style="color: #339933;">+</span> boundary <span style="color: #339933;">+</span> newLine<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                dos.<span style="color: #006633;">writeBytes</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Disposition: form-data;name=&quot;</span><span style="color: #0000ff;">&quot;
                                + key+&quot;</span><span style="color: #0000ff;">&quot;&quot;</span> <span style="color: #339933;">+</span> newLine <span style="color: #339933;">+</span> newLine <span style="color: #339933;">+</span> val<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                dos.<span style="color: #006633;">writeBytes</span><span style="color: #009900;">&#40;</span>newLine<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                dos.<span style="color: #006633;">writeBytes</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;--&quot;</span> <span style="color: #339933;">+</span> boundary <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;--&quot;</span> <span style="color: #339933;">+</span> newLine<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                        <span style="color: #009900;">&#125;</span>
                        dos.<span style="color: #006633;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                        <span style="color: #003399;">BufferedReader</span> rd <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BufferedReader</span><span style="color: #009900;">&#40;</span>
                        <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">InputStreamReader</span><span style="color: #009900;">&#40;</span>con.<span style="color: #006633;">getInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #003399;">String</span> line<span style="color: #339933;">;</span>
                        <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>line <span style="color: #339933;">=</span> rd.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                ret.<span style="color: #006633;">content</span> <span style="color: #339933;">+=</span> line <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;rn&quot;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                        <span style="color: #666666; font-style: italic;">//get headers</span>
                        Map<span style="color: #339933;">&lt;</span>String, List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;&gt;</span> headers <span style="color: #339933;">=</span> con.<span style="color: #006633;">getHeaderFields</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        Set<span style="color: #339933;">&lt;</span>Entry<span style="color: #339933;">&lt;</span>String, List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;&gt;&gt;</span> hKeys <span style="color: #339933;">=</span> headers.<span style="color: #006633;">entrySet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>Iterator<span style="color: #339933;">&lt;</span>Entry<span style="color: #339933;">&lt;</span>String, List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;&gt;&gt;</span> i <span style="color: #339933;">=</span> hKeys.<span style="color: #006633;">iterator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> i.<span style="color: #006633;">hasNext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                Entry<span style="color: #339933;">&lt;</span>String, List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;&gt;</span> m <span style="color: #339933;">=</span> i.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                                Log.<span style="color: #006633;">w</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;HEADER_KEY&quot;</span>, m.<span style="color: #006633;">getKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                ret.<span style="color: #006633;">headers</span>.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>m.<span style="color: #006633;">getKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, m.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>m.<span style="color: #006633;">getKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;set-cookie&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                                ret.<span style="color: #006633;">cookies</span>.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>m.<span style="color: #006633;">getKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, m.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                        dos.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        rd.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">MalformedURLException</span> me<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
                <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> ie<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
                <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        Log.<span style="color: #006633;">e</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;HREQ&quot;</span>, <span style="color: #0000ff;">&quot;Exception: &quot;</span><span style="color: #339933;">+</span>e.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000000; font-weight: bold;">return</span> ret<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>You will also need the class below:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">moz.http</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Hashtable</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> HttpData <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> content<span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Hashtable</span> cookies <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Hashtable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Hashtable</span> headers <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Hashtable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://moazzam-khan.com/blog/?p=490" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://moazzam-khan.com/blog/?feed=rss2&amp;p=490</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>HTTP Request class for Android (version 2)</title>
		<link>http://moazzam-khan.com/blog/?p=482</link>
		<comments>http://moazzam-khan.com/blog/?p=482#comments</comments>
		<pubDate>Thu, 15 Oct 2009 21:11:01 +0000</pubDate>
		<dc:creator>Moazzam</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[android 1.5 http request]]></category>
		<category><![CDATA[android http request]]></category>
		<category><![CDATA[android upload file]]></category>
		<category><![CDATA[android upload image]]></category>
		<category><![CDATA[java upload file]]></category>

		<guid isPermaLink="false">http://moazzam-khan.com/blog/?p=482</guid>
		<description><![CDATA[Hi Everyone, After some people pointed out the problems they had with version 2 of this class, I took it all out.  Please go to: http://moazzam-khan.com/blog/?p=490 for version 2.1 Share on Facebook]]></description>
			<content:encoded><![CDATA[<p>Hi Everyone,</p>
<p>After some people pointed out the problems they had with version 2 of this class, I took it all out.  Please go to: <a href="http://moazzam-khan.com/blog/?p=490">http://moazzam-khan.com/blog/?p=490</a> for version 2.1</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://moazzam-khan.com/blog/?p=482" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://moazzam-khan.com/blog/?feed=rss2&amp;p=482</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Removing mywebsearch as the default search engine from Firefox</title>
		<link>http://moazzam-khan.com/blog/?p=477</link>
		<comments>http://moazzam-khan.com/blog/?p=477#comments</comments>
		<pubDate>Fri, 02 Oct 2009 19:29:35 +0000</pubDate>
		<dc:creator>Moazzam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mywebsearch]]></category>
		<category><![CDATA[mywebsearch firefox]]></category>
		<category><![CDATA[remove mywebsearch]]></category>

		<guid isPermaLink="false">http://moazzam-khan.com/blog/?p=477</guid>
		<description><![CDATA[If you have accidentally installed myWebSearch as the default search engine for firefox, and want to remove it then do the following : Close Firefox Go to C:\program files\mozilla firefox\chrome\ Delete the files m3ffxtbr.jar and m3ffxtbr.manifest Go to c:\program files\ and delete the mywebsearch folder, if it is there. Share on Facebook]]></description>
			<content:encoded><![CDATA[<p>If you have accidentally installed myWebSearch as the default search engine for firefox, and want to remove it then do the following :</p>
<ol>
<li> Close Firefox</li>
<li> Go to <strong>C:\program files\mozilla firefox\chrome\</strong></li>
<li> Delete the files <strong>m3ffxtbr.jar</strong> and <strong>m3ffxtbr.manifest</strong></li>
<li> Go to <strong>c:\program files\</strong> and delete the <strong>mywebsearch</strong> folder, if it is there.</li>
</ol>
<input id="gwProxy" type="hidden"><!--Session data--></input>
<input id="jsProxy" onclick="jsCall();" type="hidden" />
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://moazzam-khan.com/blog/?p=477" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://moazzam-khan.com/blog/?feed=rss2&amp;p=477</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTTP Request class for Android</title>
		<link>http://moazzam-khan.com/blog/?p=446</link>
		<comments>http://moazzam-khan.com/blog/?p=446#comments</comments>
		<pubDate>Wed, 02 Sep 2009 23:23:12 +0000</pubDate>
		<dc:creator>Moazzam</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[android 1.5]]></category>
		<category><![CDATA[android http get]]></category>
		<category><![CDATA[android http post]]></category>
		<category><![CDATA[android http request]]></category>
		<category><![CDATA[android upload file]]></category>

		<guid isPermaLink="false">http://moazzam-khan.com/blog/?p=446</guid>
		<description><![CDATA[Here is a class that can be used to make HTTP get and HTTP post requests. I haven't commented everything but the usage should be pretty clear from the method signatures. Note: This is for Android 1.5. [java] import java.net.*; import java.io.*; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; import [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a class that can be used to make HTTP get and HTTP post requests. I haven't commented everything but the usage should be pretty clear from the method signatures.</p>
<p>Note: This is for Android 1.5.</p>
<p>[java]<br />
import java.net.*;<br />
import java.io.*;<br />
import java.util.ArrayList;<br />
import java.util.Enumeration;<br />
import java.util.Hashtable;<br />
import java.util.Iterator;<br />
import java.util.List;<br />
import java.util.Map;<br />
import java.util.Set;<br />
import java.util.Map.Entry;</p>
<p>import org.apache.http.client.HttpClient;</p>
<p>import org.apache.commons.*;<br />
import android.util.Log;</p>
<p>public class HttpRequest {</p>
<p>	/**<br />
	 * HttpGet - doesn't read cookies<br />
	 *<br />
	 * @param sUrl<br />
	 * @return<br />
	 */<br />
	public static HttpData get(String sUrl) {<br />
		HttpData ret = new HttpData();<br />
		String str;<br />
		StringBuffer buff = new StringBuffer();<br />
		try {<br />
			URL url = new URL(sUrl);</p>
<p>			BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));<br />
			while ((str = in.readLine()) != null) {<br />
				buff.append(str);<br />
			}<br />
			ret.content = buff.toString();<br />
		} catch (Exception e) {<br />
			Log.e("HttpRequest", e.toString());<br />
		}<br />
		return ret;<br />
	}</p>
<p>	/**<br />
	 * HTTP post request<br />
	 *<br />
	 * @param sUrl<br />
	 * @param ht<br />
	 * @return<br />
	 * @throws Exception<br />
	 */<br />
	public static HttpData post(String sUrl, Hashtable<String, String> ht) throws Exception {<br />
		StringBuffer data = new StringBuffer();<br />
		Enumeration<String> keys = ht.keys();<br />
		while (keys.hasMoreElements()) {<br />
			data.append(URLEncoder.encode(keys.nextElement(), "UTF-8"));<br />
			data.append("=");<br />
			data.append(URLEncoder.encode(ht.get(keys.nextElement()), "UTF-8"));<br />
			data.append("&#038;");<br />
		}<br />
		return HttpRequest.post(sUrl, data.toString());<br />
	}<br />
	/**<br />
	 * HTTP post request<br />
	 *<br />
	 * @param sUrl<br />
	 * @param data<br />
	 * @return<br />
	 */<br />
	public static HttpData post(String sUrl, String data) {<br />
		StringBuffer ret = new StringBuffer();<br />
		HttpData dat = new HttpData();<br />
		String header;<br />
		try {<br />
			// Send data<br />
			URL url = new URL(sUrl);<br />
			URLConnection conn = url.openConnection();<br />
			conn.setDoOutput(true);<br />
			OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());<br />
			wr.write(data);<br />
			wr.flush();</p>
<p>			// Get the response</p>
<p>			Map<String, List<String>> headers = conn.getHeaderFields();<br />
			Set<Entry<String, List<String>>> hKeys = headers.entrySet();<br />
			for (Iterator<Entry<String, List<String>>> i = hKeys.iterator(); i.hasNext();) {<br />
				Entry<String, List<String>> m = i.next();</p>
<p>				Log.w("HEADER_KEY", m.getKey() + "");<br />
				dat.headers.put(m.getKey(), m.getValue().toString());<br />
				if (m.getKey().equals("set-cookie"))<br />
					dat.cookies.put(m.getKey(), m.getValue().toString());<br />
			}<br />
			BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));<br />
			String line;<br />
			while ((line = rd.readLine()) != null) {<br />
				ret.append(line);<br />
			}</p>
<p>			wr.close();<br />
			rd.close();<br />
		} catch (Exception e) {<br />
			Log.e("ERROR", "ERROR IN CODE:"+e.toString());<br />
	    }<br />
		dat.content = ret.toString();<br />
		return dat;<br />
	}<br />
}<br />
[/java]</p>
<p>You will also need this class along with it.</p>
<p>[java]</p>
<p>import java.util.Hashtable;</p>
<p>public class HttpData {<br />
	public String content;<br />
	public Hashtable<String, String> cookies = new Hashtable<String, String>();<br />
	public Hashtable<String, String> headers = new Hashtable<String, String>();<br />
}<br />
[/java]</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://moazzam-khan.com/blog/?p=446" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://moazzam-khan.com/blog/?feed=rss2&amp;p=446</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Google Voice Review</title>
		<link>http://moazzam-khan.com/blog/?p=439</link>
		<comments>http://moazzam-khan.com/blog/?p=439#comments</comments>
		<pubDate>Mon, 10 Aug 2009 18:11:52 +0000</pubDate>
		<dc:creator>Moazzam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://moazzam-khan.com/blog/?p=439</guid>
		<description><![CDATA[I had signed up for Google Voice a week or so ago and I got an email today saying that I was invited to test it out. So, here is a somewhat detailed review of it. Keep in mind that it is still in testing phase . How does it work? Google lets you choose [...]]]></description>
			<content:encoded><![CDATA[<p>I had signed up for Google Voice a week or so ago and I got an email today saying that I was invited to test it out. So, here is a somewhat detailed review of it. Keep in mind that it is still in testing phase <img src='http://moazzam-khan.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p><strong>How does it work?</strong></p>
<p>Google lets you choose a phone number for your Google Voice account. It will, then, ask you for your phone number. You can give it a number of your mobile/cell phone or your home phone. Whenever someone calls your Google voice phone number, you home phone or cell phone will ring (depending on what phone number you gave Google when signing up).</p>
<p>You can have more than one phone ring when your Google Voice number is called. And, you have filter calls. For example, you can have your cell phone ring if your business clients call and have your home phone ring if your friends call. This can be used to prioritize your phone calls.</p>
<p>How do you place calls you ask? You can login to your Google Voice account from your browser and click on place call button. It will ask you for the phone number you wish to call and which phone it should ring (your home phone or any other phones you have added). It will, then, call you on the phone you specify, then it will call the other person and connect you both.</p>
<p>If you wish to access it from your phone (make phone calls, send SMS, etc), Google has made mobile apps for Android and Blackberry. They also made an app for iPhone but Apple rejected it. Google also has a mobile version of Google voice website, so you can always login to your account through your web browser.</p>
<p>[screenshots]</p>
<p><strong>The features:</strong></p>
<p>- <span style="text-decoration: underline;">ListenIn</span> - You can listen to your friends leaving your a voicemail. You don't have to wait will they are done recording it.</p>
<p>- <span style="text-decoration: underline;">Record calls</span> - This, I think, is a great feature. You can record your calls whenever you want. It can be at the start of a conversation or in the middle. Press 4 to start recording and press 4 again to stop recording.</p>
<p>- <span style="text-decoration: underline;">Switch phones</span> - If you are talking on your mobile phone and the voice quality is bad, you can hit * on your mobile phone and all other phones you added to your voice account will start ringing. You can, then, pick up the phone with best reception and start talking again without anyone noticing <img src='http://moazzam-khan.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>You can also make international calls. And, Google has very cheap rates. It would have been good to have unlimited international calls for a flat rate (like MetroPCS does) but it still is better than most international calling plans out there.</p>
<p><strong>It sounds too good to be true</strong></p>
<p>Depending upon how important your privacy is to you, it might be. I read Google's privacy policy. It states that even after you have terminated your account, your phone calls, voicemails, SMS, etc will remain on Google's backup systems. I don't know if other phone carriers that (I should probably read their privacy policy and find out - it's good to know) but yeah. They don't say whether your voicemails, etc will be deleted permanently if you were to delete them.</p>
<p>This shouldn't come as a surprise, though. Gmail does the same thing. Your emails are never physically deleted from their servers. They are just marked as deleted so you don't see them anymore.</p>
<p>Visit these links for more information:</p>
<p><a href="http://www.google.com/support/voice/bin/answer.py?hl=en&amp;answer=115037" target="_blank">http://www.google.com/support/voice/bin/answer.py?hl=en&amp;answer=115037</a></p>
<p><a href="http://www.google.com/googlevoice/legal-notices.html" target="_blank">http://www.google.com/googlevoice/legal-notices.html</a></p>
<p><a href="http://www.google.com/googlevoice/privacy-policy.html" target="_blank">http://www.google.com/googlevoice/privacy-policy.html</a></p>
<p><a href="http://www.google.com/support/voice/bin/answer.py?hl=en&amp;answer=154724" target="_blank">http://www.google.com/support/voice/bin/answer.py?hl=en&amp;answer=154724</a></p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://moazzam-khan.com/blog/?p=439" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://moazzam-khan.com/blog/?feed=rss2&amp;p=439</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cheap cell phone plans</title>
		<link>http://moazzam-khan.com/blog/?p=435</link>
		<comments>http://moazzam-khan.com/blog/?p=435#comments</comments>
		<pubDate>Wed, 29 Jul 2009 06:38:39 +0000</pubDate>
		<dc:creator>Moazzam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[att]]></category>
		<category><![CDATA[cdma]]></category>
		<category><![CDATA[cheap cell phone plans]]></category>
		<category><![CDATA[cheap cellphone plans]]></category>
		<category><![CDATA[sprint]]></category>
		<category><![CDATA[tmobile]]></category>
		<category><![CDATA[unlimited calls]]></category>
		<category><![CDATA[unlimited cell phone plan]]></category>
		<category><![CDATA[unlimited data]]></category>
		<category><![CDATA[unlimited text]]></category>

		<guid isPermaLink="false">http://moazzam-khan.com/blog/?p=435</guid>
		<description><![CDATA[Almost a century ago (when my grandparents were young) land lines were considered to be very advanced technology. Dial tone phones came out when I was a kid. In just a few decades, phones have become so common and mobile that they have become a part of almost everyone's daily life. Cell phones (or mobile [...]]]></description>
			<content:encoded><![CDATA[<p>Almost a century ago (when my grandparents were young) land lines were considered to be very advanced technology. Dial tone phones came out when I was a kid. In just a few decades, phones have become so common and mobile that they have become a part of almost everyone's daily life. Cell phones (or mobile phones) are now so common that everyone and their mother has one. We all know where there is a need, there is someone taking advantage of that need. So, we have carriers like Tmobile, Sprint, Bell, etc. charging their customers based on the minutes used.</p>
<p>The cell phone industry underwent another change (in USA) about a year ago. What was the change? Flat rate plans for cell phones! What was its cause? An unknown company - Metro PCS - that came out of nowhere and took over a chunk of cell phone users with its cheap prices. Their lowest plan goes for $30. It doesn't have voicemail or anything else. However, you can make as many calls as you want and you can receive them. For about $15 more, you can get voicemail, etc. And, unlimited data, unlimited texts, unlimited calls and unlimited international calls.</p>
<p>Even land lines don't offer international calls for that price!  Metro PCS successfully grabbed customers from various national service providers *cough* like Sprint and Tmobile *cough* .</p>
<p><strong>What did this cause?</strong></p>
<p>This made cell phone carriers (at least some of them) rethink their plans too. Sprint is not offering a $50 plan with unlimited calls, unlimited texts and unlimited data. Tmobile is offering a $50 ($89 for families) plan for unlimited calls to already existing customers. You have to get text and data separately.</p>
<p><strong>What's the catch?</strong></p>
<p>Metro PCS has great service is metro cities like New York City, Seattle, etc. It's reception is bad in other areas. However, they are working on increasing their coverage. And, they don't have a very wide selection of phones. In fact, they have only one smart phone. Since Metro PCS operates on CDMA network, you cannot use their service with your current phone (assuming you have a GSM phone like me).</p>
<p>Sprint did the same thing. For their $50 unlimited everything plan, they have a custom set of phones which are regular phones  and they don't offer this service with smart phones. This means if you want to browse the net, you are stuck with the phone keypad and a small screen which means you won't be using that unlimited data a lot. I have seen a lot of people text like crazy on regular flip phones so I think people will use that regardless of their phone.</p>
<p>Tmobile' service is $50 for only calls. If you want unlimited text, it is additional $5 and unlimited internet is $20. The good thing, however, is that it works on a GSM network so you can use it with any GSM phone. The bad thing? Tmobile drops calls very frequently. If your friends text you today, you might get that text tomorrow. Sometimes even voicemail is delayed. The data, on the other hand, is good.</p>
<p>ATT seems to be doing its own thing with iPhones. As far as I know, they charge over a $100 for 400 minutes. However, a lot of people are willing to pay that because of their iPhones.</p>
<p>For more information, visit the links below:</p>
<p><a href="http://metropcs.com" target="_blank">http://metropcs.com</a></p>
<p><a href="http://tmobile.com" target="_blank">http://tmobile.com</a></p>
<p><a href="http://sprint.com" target="_blank">http://sprint.com</a></p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://moazzam-khan.com/blog/?p=435" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://moazzam-khan.com/blog/?feed=rss2&amp;p=435</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google voice</title>
		<link>http://moazzam-khan.com/blog/?p=433</link>
		<comments>http://moazzam-khan.com/blog/?p=433#comments</comments>
		<pubDate>Wed, 29 Jul 2009 05:51:42 +0000</pubDate>
		<dc:creator>Moazzam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[google cell phone]]></category>
		<category><![CDATA[google voice]]></category>

		<guid isPermaLink="false">http://moazzam-khan.com/blog/?p=433</guid>
		<description><![CDATA[Yes, people. It's out. At least for the test phase Google didn't really keep it a secret that it wants to get into the telecom industry. And, we all know that when Google does something, it changes everything! Google voice is an application that runs on your phone and PC. Google will assign you a [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, people. It's out. At least for the test phase Google didn't really keep it a secret that it wants to get into the telecom industry. And, we all know that when Google does something, it changes everything! <img src='http://moazzam-khan.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Google voice is an application that runs on your phone and PC. Google will assign you a phone number. If anyone calls that number, your phone receives the call. You can check your voicemail on the phone or your PC. You can even read transcripts of your voicemail (speech to text). Another great thing about Google voice is that it lets you select which phone should ring when someone calls. For now, you have to get an invite to be able to use Google voice (please send me an invite if you have any left <img src='http://moazzam-khan.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ). However, that will hopefully change in the future.</p>
<p>What does it mean for us as consumers? Hopefully a change in the way telecom industry operates and cheaper prices (a big shout out to MetroPCS for cheap cell phone service). There is one concern, though. Google owns an email service, a video service, online albums, and now phones. Can this lead to the "big brother" concept where "they" watch everything we do? Gmail scans through your email to show you relevant ads.  Google states that no human being goes through them  but how can we be sure? I know the whole privacy thing is an issue of its own. I would like to hear your (the reader's) thoughts on this. Please leave comments and let me know what you think <img src='http://moazzam-khan.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://moazzam-khan.com/blog/?p=433" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://moazzam-khan.com/blog/?feed=rss2&amp;p=433</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
