<?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>Technology Mug</title>
	<atom:link href="http://www.techmug.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techmug.com</link>
	<description>A mug of knowledge &#38; experiences</description>
	<lastBuildDate>Wed, 01 Sep 2010 00:20:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Digital Marketing for Start Ups</title>
		<link>http://www.techmug.com/digital-marketing-for-start-ups/</link>
		<comments>http://www.techmug.com/digital-marketing-for-start-ups/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 07:21:33 +0000</pubDate>
		<dc:creator>Ali Aurangzeb</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Digital Marketing]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Ideas]]></category>
		<category><![CDATA[budget]]></category>
		<category><![CDATA[Digiatl Marketing]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[Start Ups]]></category>

		<guid isPermaLink="false">http://www.techmug.com/?p=221</guid>
		<description><![CDATA[It’s happening, it’s now and it’s here to stay. That being said, digital marketing is an avenue which leads to the next marketing highway. So be it a startup business, medium sized, multi-national or a corporation, digital marketing is for anyone who wants value for money and optimum utilization for their budgets. What is a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="/digital-marketing-for-start-ups"><img class="alignnone size-full wp-image-231" title="Digital Marketing for Start Ups" src="http://www.techmug.com/wp-content/uploads/2010/08/digital-marketing.jpg" alt="Digital Marketing for Start Ups" width="625" height="250" /></a></p>
<p>It’s happening, it’s now and it’s here to stay. That being said, digital marketing is an avenue which leads to the next marketing highway. So be it a startup business, medium sized, multi-national or a corporation, digital marketing is for anyone who wants value for money and optimum utilization for their budgets.</p>
<h1>What is a Startup Business?</h1>
<p>Is the first question that comes mind. Clearly startup most startups have one thing in common limited financial resources, and the sincere will to spend wisely in order to get the proverbial &#8220;bang for the buck. Considering that, it would be pertinent to direct marketing efforts towards a more focused audience rather than a fragmented one. In order to do that we need to learn the media usage and business habits of the audience we wish to target.</p>
<p><span id="more-221"></span></p>
<p></p>
<p>If the product or service relates to the segment which uses the internet then digital should be the driving force behind the marketing efforts. Now we arrive to the next question of what can be done given the limited finances to achieve maximum results. What are the various ways the digital medium can be used for achieving goals and meeting business objectives?</p>
<p>Digital marketing can be done through various means and can be tailored to meet big budgets as well as small.</p>
<p>To understand how to allocate budget wisely it’s important to understand the following:</p>
<p><img class="alignnone size-full wp-image-223" title="Digital Marketing" src="http://www.techmug.com/wp-content/uploads/2010/08/OwnedMedia.gif" alt="Digital Marketing for Start Ups" width="600" height="327" /></p>
<p>Once the above is understood marketers can evaluate and allocate budget accordingly.</p>
<h1>An example of a startup business doing effective digital marketing</h1>
<p>As the Marketing Manager I had less than $100,000 to spend on media for a consumer product with distribution in 50,000 consumer outlets. Instead of spreading those dollars among the 25 websites in the category with little or no effectiveness, I bought year-round advertising in just two. To the readers of those two websites, we looked like a major national brand. As the company&#8217;s sales grew, the budget expanded, and we were able to add other websites and communications channels.</p>
<p><strong>Note</strong>: Please note this article is a guest post, written by <a href="http://creativejin.com/whoweare.html" target="_blank">Mr. Ali Aurangzeb</a>.</p>
<p>If you like this article, please share it on your favorite website. It may help someone somewhere!</p>
<p></p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://www.techmug.com/digital-marketing-for-start-ups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX Currency Converter with Google API</title>
		<link>http://www.techmug.com/ajax-currency-converter-with-google-api/</link>
		<comments>http://www.techmug.com/ajax-currency-converter-with-google-api/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 15:42:03 +0000</pubDate>
		<dc:creator>Fraz Ahmed</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Converter]]></category>
		<category><![CDATA[Currency]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.techmug.com/?p=211</guid>
		<description><![CDATA[No doubt, Google is a magical search engine. Google also provides many APIs to be incorporated in your application. Today, we will use Google&#8217;s hidden currency conversion API. Why hidden? Because there is no official documentation for it. We will build a currency converter from scratch, it pulls data from Google and display the results [...]]]></description>
			<content:encoded><![CDATA[<p><a href="/ajax-currency-converter-with-google-api"><img class="alignnone size-full wp-image-213" title="Currency Converter with Google API" src="http://www.techmug.com/wp-content/uploads/2010/08/currency-converter-with-google.jpg" alt="" width="625" height="250" /></a></p>
<p>No doubt, Google is a magical search engine. Google also provides many APIs to be incorporated in your application. Today, we will use Google&#8217;s hidden currency conversion API. Why hidden? Because there is no official documentation for it.</p>
<p>We will build a currency converter from scratch, it pulls data from Google and display the results using jQuery AJAX function. For you better understanding, you may visit demo or download source code below:</p>
<p style="text-align: center;"><strong><a href="/demo/currency-converter/" target="_blank">Demo</a> &#8211; <a href="/demo/currency-converter/techmug-currency-converter.zip">Source Code</a></strong></p>
<p>Basically our whole code consist of three components &#8211; HTML for displaying interface, Javascript for AJAX functionality and PHP for fetching and manipulating conversion results from Google.</p>
<p><span id="more-211"></span></p>
<p></p>
<h1>HTML Structure</h1>
<p>HTML structure for this application is simple enough. There are two drop downs, one input field, one button and a div for displaying results. Drop downs are used for selecting From Currency and To Currency while input field is used for entering the desired amount to be converted in your selected currency. Conversion result displays in results div once you click on convert button. When you click on the button, it fires a Javascript function which is described below.</p>
<h1>Javascript</h1>
<p>Following is the code for our AJAX enabled javascript. Below code is executed upon clicking on convert button.</p>
<pre class="brush: jscript;">

$(document).ready(function() {

 $('#convert').click(function(){

 //Get all the values
 var amount = $('#amount').val();
 var from = $('#fromCurrency').val();
 var to = $('#toCurrency').val();

 //Make data string
 var dataString = &quot;amount=&quot; + amount + &quot;&amp;from=&quot; + from + &quot;&amp;to=&quot; + to;

 $.ajax({
 type: &quot;POST&quot;,
 url: &quot;ajax_converter.php&quot;,
 data: dataString,

 success: function(data){
 //Show results div
 $('#results').show();

 //Put received response into result div
 $('#results').html(data);
 }

 });
 });
});
</pre>
<p>Above code is very simple and should be self explanatory, if you are familiar with jQuery AJAX function. For those who does not know, what&#8217;s going on here I tr to explain them.</p>
<p><em>$(&#8216;#convert&#8217;).click(function&#8230;</em> this is the starting point of our code, it means that execute the underneath code of this function when an element with id of  &#8216;convert&#8217; is clicked. In our case this id is used for &#8216;convert&#8217; button.</p>
<p>After that we grab values from our HTML elements by using <em>.val()</em> function of jQuery and assign these values into Javascript variables. These variables are then used in dataString variable.</p>
<p>In our AJAX function we are using POST method and in &#8216;url&#8217;, we provide the url of our PHP file which will provide conversion results back to this AJAX function. We are sending &#8216;dataString&#8217; as data to our PHP script.</p>
<p>After successful iterating to our PHP script, this AJAX function first shows our results div and out the received data into our results div as HTML.</p>
<p></p>
<h1>PHP Code</h1>
<p>The brain of our application is below PHP code.</p>
<pre class="brush: php;">
&lt;?php
//Get Posted data
$amount = $_POST['amount'];
$from = $_POST['from'];
$to = $_POST['to'];

//make string to be put in API
$string = &quot;1&quot;.$from.&quot;=?&quot;.$to;

//Call Google API
$google_url = &quot;http://www.google.com/ig/calculator?hl=en&amp;q=&quot;.$string;

//Get and Store API results into a variable
$result = file_get_contents($google_url);

//Explode result to convert into an array
$result = explode('&quot;', $result);

################################
# Right Hand Side
################################
$converted_amount = explode(' ', $result[3]);
$conversion = $converted_amount[0];
$conversion = $conversion * $amount;
$conversion = round($conversion, 2);

//Get text for converted currency
$rhs_text = ucwords(str_replace($converted_amount[0],&quot;&quot;,$result[3]));

//Make right hand side string
$rhs = $conversion.$rhs_text;

################################
# Left Hand Side
################################
$google_lhs = explode(' ', $result[1]);
$from_amount = $google_lhs[0];

//Get text for converted from currency
$from_text = ucwords(str_replace($from_amount,&quot;&quot;,$result[1]));

//Make left hand side string
$lhs = $amount.&quot; &quot;.$from_text;

################################
# Make the result
################################

echo $lhs.&quot; = &quot;.$rhs;
?&gt;
</pre>
<p>Above code is well commented to make you understand better. In this code we are using some built-in PHP functions &#8211; <a href="http://php.net/manual/en/function.file-get-contents.php" target="_blank">file_get_contents</a>, <a href="http://php.net/manual/en/function.explode.php" target="_blank">explode</a>, <a href="http://php.net/manual/en/function.round.php" target="_blank">round</a> and <a href="http://php.net/manual/en/function.ucwords.php">ucwords</a>.</p>
<ul>
<li>In start we grab the values posted to this script by our AJAX function. We store these values into variables.</li>
<li>We make a string variable using above explained variables.</li>
<li>We concatenate this string variable to Google Currency Calculator API url and store the url in a new variable named $google_url.</li>
<li>We fetch the data of $google_url to $result variable using PHP&#8217;s <a href="http://php.net/manual/en/function.file-get-contents.php" target="_blank">file_get_contents</a> function.</li>
<li>We receive data from Google something similar to<br />
<em><strong>{lhs: &#8220;1 Euro&#8221;,rhs: &#8220;1.2692 U.S. dollars&#8221;,error: &#8220;&#8221;,icc: true}</strong></em></li>
<li>Using PHP&#8217;s <a href="http://php.net/manual/en/function.explode.php" target="_blank">explode</a> function, we separate <strong>lhs</strong> and <strong>rhs</strong> from the received response.</li>
<li>From <strong>rhs</strong> we get the converted value and multiply it by our dsired amount to get total conversion.</li>
<li>Using PHP&#8217;s <a href="http://php.net/manual/en/function.round.php" target="_blank">round</a> function, converted amount is round off to two digits.</li>
<li>After this we use PHP&#8217;s <a href="http://php.net/manual/en/function.ucwords.php">ucwords</a> function to Capitalize our text&#8217;s first letter.</li>
<li>We almost do the same for lhs.</li>
<li>At last we make results by joining lhs and rhs and echo it to give the results back to our AJAX function.</li>
</ul>
<h1>Last words</h1>
<p>In the source code I have applied some CSS to make the user interface better. So don&#8217;t be puzzled with the code in source file.</p>
<p>Finally, you have a working Live Currency Converter. You may use this script in your website to attract more visitors. Just play around the code and let me know if you can enhance it further. Please feel free to ask, your comments are always welcome.</p>
<p>If you like this article, please share it on your favorite website. It may help someone somewhere!</p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://www.techmug.com/ajax-currency-converter-with-google-api/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Facebook Application From Scratch &#8211; 1</title>
		<link>http://www.techmug.com/facebook-application-from-scratch-1/</link>
		<comments>http://www.techmug.com/facebook-application-from-scratch-1/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 18:43:28 +0000</pubDate>
		<dc:creator>Fraz Ahmed</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[fbjs]]></category>
		<category><![CDATA[fbml]]></category>
		<category><![CDATA[share]]></category>

		<guid isPermaLink="false">http://www.techmug.com/?p=97</guid>
		<description><![CDATA[Today, we are starting a series of tutorials for Facebook Application development from scratch. In this series of tutorials, we will develop a fully functional Facebook application. The idea behind our application is simple enough, in this application users will be able to share cakes with their friends, cakes could be posted on users&#8217; or [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-174" title="Facbook Application from Scratch" src="http://www.techmug.com/wp-content/uploads/2010/08/fb-app-share-a-cake-01.jpg" alt="Facbook Application from Scratch" width="625" height="250" /></p>
<p>Today, we are starting a series of tutorials for Facebook Application development from scratch. In this series of tutorials, we will develop a fully functional Facebook application. The idea behind our application is simple enough, in this application users will be able to share cakes with their friends, cakes could be posted on users&#8217; or users&#8217; friends wall. Users will also be able to invite their friends to this application. After completing this tutorial you will be able to:</p>
<ul>
<li>Setup a Facebook Application</li>
<li>Use Facebook Authentication for aplications</li>
<li>Learn FBJS</li>
<li>Learn Facebook Graph API</li>
<li>Learn how to post data on users wall using Facebook Application</li>
<li> Learn how to post data on users&#8217; friends wall using Facebook Application</li>
<li>Create a custom tab for your application</li>
</ul>
<p><span id="more-97"></span><br />
</p>
<h1>Let&#8217;s kick the app!</h1>
<p>To develop Facebook applications you need to have a developer account on facebook.com. Click <a href="http://www.facebook.com/developers/" target="_blank">here</a> and follow simple steps to create your developer account. Once you have created your developer account, go to:</p>
<p><a href="http://www.facebook.com/developers/" target="_blank">http://www.facebook.com/developers/</a></p>
<p>At this stage you should have something similar to below screen. Click on the &#8220;<strong>Set Up New Application</strong>&#8221; button:</p>
<p><em><strong>Tip:</strong> Click on any of below snapshots to view bigger image.</em></p>
<p><a href="http://www.techmug.com/wp-content/uploads/2010/08/fb-setup-01.jpg" class="cboxModal" rel="lightbox[97]" title="Facbook Application Setup"><img class="alignnone size-full wp-image-177" title="Facbook Application Setup" src="http://www.techmug.com/wp-content/uploads/2010/08/fb-setup-01.jpg" alt="Facbook Application Setup" width="618" height="210" /></a></p>
<h1>Create Application</h1>
<p>Give your application a name and choose &#8220;Agree&#8221; for terms and click &#8220;Create Application&#8221;. Congratulations! your new facebook application has been created. Now we will look at some of configurations.</p>
<p><a href="http://www.techmug.com/wp-content/uploads/2010/08/fb-setup-02.jpg" class="cboxModal" rel="lightbox[97]" title="Facebook Application Setup"><img class="alignnone size-full wp-image-178" title="Facebook Application Setup" src="http://www.techmug.com/wp-content/uploads/2010/08/fb-setup-02.jpg" alt="Facebook Application Setup" width="625" height="276" /></a></p>
<h1>Basic Configuration</h1>
<p>When you hit the &#8220;Create Application&#8221; button, you will be redirected to a page similar to below screen. Here you can configure your application according to your needs. For the sack of simplicity we will go for basic configuration. Later in this series of tutorials we will come back here to do more stuff.</p>
<p>For now you should see the same application name, you provided in last step  (Share a Cake in our case). Give your application some description. You should notice &#8216;xxxxxxxxxx&#8217; in below screen shot. in your case you must be having some alpha numeric characters instead of &#8216;xxxxxxxxxx&#8217;.</p>
<p>Three elements <strong>Application ID</strong>, <strong>API Key</strong> and <strong>Application Secret</strong> are very important in order to run our application in the Facebook. We will use this information later in this series. Click on the &#8216;Canvas&#8217; tab at your left hand to proceed.</p>
<p><a href="http://www.techmug.com/wp-content/uploads/2010/08/fb-setup-03.jpg" class="cboxModal" rel="lightbox[97]" title="Facebook Application Setup"><img class="alignnone size-full wp-image-179" title="Facebook Application Setup" src="http://www.techmug.com/wp-content/uploads/2010/08/fb-setup-03.jpg" alt="Facebook Application Setup" width="600" height="258" /></a></p>
<h1>Canvas Settings</h1>
<p>The area where people interact with your facebook application usually is called <strong>Canvas</strong>. The URL to access your applcation is called <strong>Canvas Page URL</strong> and the location where you host your files for facebook application is called <strong>Canvas Callback URL</strong>.</p>
<p><strong>Canvas Page URL</strong> is unique for every facebook application and subject to the availability. While <strong>Canvas Callback URL</strong> is your server URL. Facebook does not host your files, you will need a server to store your application files.</p>
<p>In last, choose<strong> FBML</strong> for Render Method in Canvas Settings. Difference between IFrame and FBML application is a topic &#8211; we are leaving for some later time in future.</p>
<p>Finally click on <strong>Save Changes</strong> button at bottom.</p>
<p><a href="http://www.techmug.com/wp-content/uploads/2010/08/fb-setup-04.jpg" class="cboxModal" rel="lightbox[97]" title="Facebook Application Setup"><img class="alignnone size-full wp-image-180" title="Facebook Application Setup" src="http://www.techmug.com/wp-content/uploads/2010/08/fb-setup-04.jpg" alt="Facebook Application Setup" width="601" height="272" /></a></p>
<h1>We are done!</h1>
<p>That&#8217;s all for setting up your Facebook Application. In upcoming days we are bringing more delicious CAKES for your Facebook Application development hunger. So stay tune with us.</p>
<p></p>
<p>If you like this article, please share it on your favorite website. It may help someone somewhere!</p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://www.techmug.com/facebook-application-from-scratch-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter Revenue Model &#8211; One more way</title>
		<link>http://www.techmug.com/twitter-revenue-model-one-more-way/</link>
		<comments>http://www.techmug.com/twitter-revenue-model-one-more-way/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 18:44:04 +0000</pubDate>
		<dc:creator>Fraz Ahmed</dc:creator>
				<category><![CDATA[Ideas]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Ad]]></category>
		<category><![CDATA[Revenue]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.techmug.com/?p=101</guid>
		<description><![CDATA[Twitter is a fantastic and revolutionary web service of modern IT world. You must have seen &#8216;Recent Tweets&#8217; section across the web. Twitter is enjoying a huge user base which includes not only general internet users but also businesses. They are busy in tweeting all the day. Businesses use twitter to engage with customers while [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-123" title="twitter revenue model" src="http://www.techmug.com/wp-content/uploads/2010/06/twitter-revenue-model-.jpg" alt="twitter revenue model" width="625" height="250" /><br />
Twitter is a fantastic and revolutionary web service of modern IT world. You must have seen <strong>&#8216;</strong>Recent Tweets&#8217; section across the web. Twitter is enjoying a huge user base which includes not only general internet users but also businesses. They are busy in tweeting all the day. Businesses use twitter to engage with customers while some other users have found many ways to make money from their twitter accounts.</p>
<p>There is always a question attach with twitter: can it generate revenue? If so, how? Although we do not see any clear revenue model from twitter yet but there is buzz of <a href="http://social.venturebeat.com/2010/04/12/twitter-ad-model/" target="_blank">&#8216;Promoted Tweets&#8217;</a> now a days.</p>
<p><span id="more-101"></span></p>
<h2>One more way to monetize</h2>
<p>When I was thinking that how twitter can make money, I came across an idea of displaying ads on twitter. I&#8217;ve noticed that there is a great percentage of tweets having a link in them. These links are shorten using <a title="bit.ly" href="http://bit.ly" target="_self">bit.ly</a>. Twitter can us these links effectively to display ads to users.</p>
<p>Idea is simple enough, display an Ad when user clicks on link attached in the tweet. There will be a skip link while displaying Ad. To avoid the user irritation, there is a possibility of displaying an Ad after a specific counter e.g; Ad will be displayed after every 10th click by same user.</p>
<p></p>
<h2>What others saying?</h2>
<p>Below are some other twitter revenue related articles. You might be interesting in reading them:</p>
<ul>
<li><a href="http://www.wired.com/epicenter/2009/12/twitter-earns-first-profit-selling-search-to-google-microsoft/" target="_self">Twitter Earns First Profit Selling Search to Google, Microsoft</a></li>
<li><a href="http://adage.com/digiconf10/article?article_id=143237" target="_self">Twitter Has a Business Model: &#8216;Promoted Tweets&#8217;</a></li>
<li><a href="http://www.digitalmediabuzz.com/2010/03/twitter-revenue-model/" target="_self">Spinning Tweets of Gold: Twitter’s Revenue Model</a></li>
</ul>
<p></p>
<p>If you think there might be a better or another way for twitter to earn revenue, please share it by commenting below. Your comments are always welcome. And don’t forget to share the post on your favorite website. It may also help someone somewhere.</p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://www.techmug.com/twitter-revenue-model-one-more-way/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Detect Javascript and Flash Enabled</title>
		<link>http://www.techmug.com/detect-javascript-and-flash-enabled/</link>
		<comments>http://www.techmug.com/detect-javascript-and-flash-enabled/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 17:56:07 +0000</pubDate>
		<dc:creator>Fraz Ahmed</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[tactic]]></category>

		<guid isPermaLink="false">http://www.techmug.com/?p=73</guid>
		<description><![CDATA[Javascript and Flash are super tools to enhance the usability of your website. You put a lot of efforts to create beautiful form validation and an attractive flash animation. But all the efforts are ruined when the visitor of your website has disabled Javascript or does not have flash plugin installed. Here I&#8217;ll provide you [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-156" title="detect-javascript-flash-enabled" src="http://www.techmug.com/wp-content/uploads/2010/01/detect-javascript-flash-enabled.jpg" alt="" width="625" height="250" /></p>
<p>Javascript and Flash are super tools to enhance the usability of your website. You put a lot of efforts to create beautiful form validation and an attractive flash animation. But all the efforts are ruined when the visitor of your website has disabled Javascript or does not have flash plugin installed. Here I&#8217;ll provide you a little solution to escape from this problem.</p>
<p><span id="more-73"></span></p>
<h2>First Tactic &#8211; Detect Javascript Enabled</h2>
<p>Our first step is to detect whether visitor has Javascript enabled or not. If Javascript is not enable, we will redirect user to an error/instruction page <em>(I create a seperate page where I give instructions to visitor that how to enable Javascript in his/her browser)</em>.</p>
<p>Put below code just after the <em>&lt;head&gt;</em> tag in your web page:</p>
<pre class="brush: php;">
&lt;noscript&gt;
&lt;meta http-equiv=&quot;refresh&quot; content=&quot;0;URL=error-javascript.php&quot; /&gt;
&lt;/noscript&gt;
</pre>
<p>Above code is executed if Javascript is disabled and redirect user to <em>error-javascript.php</em>. We are using <em>&lt;meta&gt;</em> tag for redirection. If Javascript is not disabled, above code will not be executed.</p>
<p></p>
<h2><strong>Second Tactic- Detect Flash Plugin Installed</strong></h2>
<p>There is a Javascript solution to detect Flash Plugin Installed and replace Flash animation with your custom message. In order to accomplish the said task you need to place below Javascript instead of your normal embedded code:</p>
<pre class="brush: jscript;">
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
var MM_contentVersion = 9;
var plugin = (navigator.mimeTypes &amp;&amp; navigator.mimeTypes[&quot;application/x-shockwave-flash&quot;]) ? navigator.mimeTypes[&quot;application/x-shockwave-flash&quot;].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins[&quot;Shockwave Flash&quot;].description.split(&quot; &quot;);
	    for (var i = 0; i &lt; words.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i];
	    }
	var MM_FlashCanPlay = MM_PluginVersion &gt;= MM_contentVersion;
}
else if (navigator.userAgent &amp;&amp; navigator.userAgent.indexOf(&quot;MSIE&quot;)&gt;=0
   &amp;&amp; (navigator.appVersion.indexOf(&quot;Win&quot;) != -1)) {
	document.write('&lt;SCR' + 'IPT LANGUAGE=VBScript\&gt; \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject(&quot;ShockwaveFlash.ShockwaveFlash.&quot; &amp; MM_contentVersion)))\n');
	document.write('&lt;/SCR' + 'IPT\&gt; \n');
}
if ( MM_FlashCanPlay ) {
	document.write('&lt;object classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0&quot; width=&quot;160&quot; height=&quot;120&quot;&gt;');
    document.write('&lt;param name=&quot;movie&quot; value=&quot;animation.swf&quot;&gt;');
    document.write ('&lt;param name=&quot;quality&quot; value=&quot;high&quot;&gt;');
	document.write ('&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;');
    document.write('&lt;embed src=&quot;animation.swf&quot; width=&quot;160&quot; height=&quot;120&quot; quality=&quot;high&quot; pluginspage=&quot;http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;&lt;/object&gt;');
} else{
	document.write('&lt;a href=&quot;./&quot;&gt;&lt;img src=&quot;replaced-image.png&quot; alt=&quot;Flash Plugin not Installed&quot; border=&quot;0&quot;&gt;&lt;/a&gt;');

}
//--&gt;

&lt;/script&gt;
</pre>
<p>Above code detect for Version 9 or greater version of flash plugin. If flash plugin is detected it displays flash animation <em>(animation.swf)</em> else it displays an image <em>(replaced-image.png)</em> instead of flash animation. In the place of image you can write more text and instructions. Everything is upto on you.</p>
<p></p>
<p>Don&#8217;t forget to share the post on your favorite website. It may also help someone somewhere.</p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://www.techmug.com/detect-javascript-and-flash-enabled/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Send Emails / Newsletters using HTML templates and PHP</title>
		<link>http://www.techmug.com/send-emails-newsletters-using-html-templates-and-php/</link>
		<comments>http://www.techmug.com/send-emails-newsletters-using-html-templates-and-php/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 17:44:44 +0000</pubDate>
		<dc:creator>Fraz Ahmed</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[Newsletter]]></category>
		<category><![CDATA[phpmailer]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://www.techmug.com/?p=23</guid>
		<description><![CDATA[HTML emails look attractive, provide easy calls of action. And importantly creates your brand image in the eyes of your clients. But it becomes very difficult to manage your HTML emails if you want to change the look and feel of your email design. Or you may be interested in changing the content of your [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-53 alignleft" title="html-email" src="http://www.techmug.com/wp-content/uploads/2009/05/html-email.jpg" alt="HTML Email" width="272" height="146" /><br />
HTML emails look attractive, provide easy calls of action. And importantly creates your brand image in the eyes of your clients. But it becomes very difficult to manage your HTML emails if you want to change the look and feel of your email design. Or you may be interested in changing the content of your HTML email without playing with your code.</p>
<p>In this tutorial we will be sending HTML emails using PHP. This tutorial will teach you to keep your HTML presentation separate from your PHP code.</p>
<p>You may download all the code files, used in this tutorial, from <a title="Download Code" href="http://www.techmug.com/demo/html-email/html-email.zip">here</a>.</p>
<p><span id="more-23"></span></p>
<h2><strong>How it works?</strong></h2>
<p>Basically there are only three steps to send your branded HTML emails.</p>
<ol>
<li>Read HTML template file from your specified location.</li>
<li>Replace variables with your data, if any.</li>
<li>Finally send email.</li>
</ol>
<h2><strong>What we need?</strong></h2>
<p>Before we move to define the above steps, its worth to mention the requirements of this tutorial. The first thing we need to send emails is PHPMailer class. To learn more about PHPMailer class please visit the official website <a title="PHPMailer" href="http://phpmailer.worxware.com/" target="_blank">here</a>. And the last other thing is your HTML template file.</p>
<p></p>
<h2><strong>Step by step learning</strong></h2>
<p>Here are the steps you need to take in order to develop your own email sending program.</p>
<p><strong>First</strong> of all you need to include the PHPMailer class in your code. To do so you use below code:</p>
<pre class="brush: php;">
&lt;?php
#####################################
# Include PHP Mailer Class
#####################################
require(&quot;class.phpmailer.php&quot;);
?&gt;
</pre>
<p>Before moving further I would like to introduce two PHP functions we will use in our code. First one is for sending emails and second is for reading your HTML template file. First function (sendEmail) accepts five parameters and return false if email is not sent and returns true if email is sent. Parameters are self explanatory in below code:</p>
<pre class="brush: php;">
&lt;?php
#####################################
# Function to send email
#####################################
function sendEmail ($fromName, $fromEmail, $toEmail, $subject, $emailBody) {
$mail = new PHPMailer();
$mail-&gt;FromName = $fromName;
$mail-&gt;From = $fromEmail;
$mail-&gt;AddAddress(&quot;$toEmail&quot;);

$mail-&gt;Subject = $subject;
$mail-&gt;Body = $emailBody;
$mail-&gt;isHTML(true);
$mail-&gt;WordWrap = 150;

if(!$mail-&gt;Send()) {
return false;
} else {
return true;
}
}
?&gt;
</pre>
<p>The other function (readTemplateFile) reads your HTML template file and returns all the stuff found in that file. This function accepts only one parameter which is the location of your HTML file. Below is function:</p>
<pre class="brush: php;">
&lt;?php
#####################################
# Function to Read a file
# and store all data into a variable
#####################################
function readTemplateFile($FileName) {
$fp = fopen($FileName,&quot;r&quot;) or exit(&quot;Unable to open File &quot;.$FileName);
$str = &quot;&quot;;
while(!feof($fp)) {
$str .= fread($fp,1024);
}
return $str;
}
?&gt;
</pre>
<p><strong>Finally</strong> you need to call and pass parameters to above function to complete the task of sending HTML email. Yeah! really we almost done it. Ok we are using a template which send username and password of a user. Please see HTML template file in downloaded file. We break our last and final step in three pieces:</p>
<pre class="brush: php;">
&lt;?php
//Data to be sent (Ideally fetched from Database)
$NameOfUser = &quot;XYZ&quot;;
$Username = &quot;abcdef&quot;;
$password = &quot;123456&quot;;
$UserEmail = &quot;receiver.email@somedomain.com&quot;;
?&gt;
</pre>
<p>First of all we put data into some variables. These variables will be used later in our code. Ideally this data will be fetched from database in real world.</p>
<p>Now we put our HTML template data into other variable:</p>
<pre class="brush: php;">
&lt;?php
//Send email to user containing username and password
//Read Template File
$emailBody = readTemplateFile(&quot;template.html&quot;);
?&gt;
</pre>
<p>So we have all our file data in a variable ($emailBody). And we may change anything in this variable. We will use PHP&#8217;s str_replace function to replace the data:</p>
<pre class="brush: php;">
&lt;?php
//Replace all the variables in template file
$emailBody = str_replace(&quot;#name#&quot;,$NameOfUser,$emailBody);
$emailBody = str_replace(&quot;#username#&quot;,$Username,$emailBody);
$emailBody = str_replace(&quot;#password#&quot;,$password,$emailBody);
?&gt;
</pre>
<p>To understand the above code we take first line of code. It simply replace #name# with the value of $NameOfuser variable in $emailBody variable. And now our new replaced content is stored in $emailBody variable, so now we can use this content to be passed in our email sending function below:</p>
<pre class="brush: php;">
&lt;?php
//Send email
$emailStatus = sendEmail (&quot;Sender Name&quot;, &quot;some.email@yourdomain.com&quot;, $UserEmail, &quot;Email Subject&quot;, $emailBody);
?&gt;
</pre>
<p>If email is not sent successfully, we will display error message else we will show success message:</p>
<pre class="brush: php;">
&lt;?php
//If email function return false
if ($emailStatus != 1) {
echo &quot;An error occured while sending email. Please try again later.&quot;;
} else {
echo &quot;Email with account details were sent successfully.&quot;;
}
?&gt;
</pre>
<p>That&#8217;s all! Now you have fully functional code to send your branded emails. If in future you want to change the design of your email, you just have to replace HTML template file. There is no need of changing your PHP code. Ideally you can use this code to send:</p>
<ul>
<li>Newsletters</li>
<li>Registration Details</li>
<li>Forgot Password email</li>
<li>And for anything you want</li>
</ul>
<p>Besides the benefits of using above code there is one shortcoming too of this code. If your user&#8217;s email client does not support HTML email, he/she will not be able to see your fancy deigned email. But there are ways to prevent this shortcoming.</p>
<p></p>
<p>Hope so you enjoyed this tutorial. Please feel free to ask or comment for this tutorial. And Don’t forget to share the post on your favorite website. It may also help someone somewhere.</p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://www.techmug.com/send-emails-newsletters-using-html-templates-and-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>jMouse Follower</title>
		<link>http://www.techmug.com/jmouse-follower/</link>
		<comments>http://www.techmug.com/jmouse-follower/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 19:33:14 +0000</pubDate>
		<dc:creator>Fraz Ahmed</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[cursor]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[follow]]></category>
		<category><![CDATA[mouse]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[trail]]></category>

		<guid isPermaLink="false">http://www.techmug.com/?p=28</guid>
		<description><![CDATA[What is Mouse Follower?

Mouse Follower or Cursor Trail is typically an image or set of images which follows the cursor in your browser screen.]]></description>
			<content:encoded><![CDATA[<h2><img class="alignnone size-full wp-image-171" title="jMouse Follower" src="http://www.techmug.com/wp-content/uploads/2009/07/jmouse-follower.jpg" alt="jMouse Follower" width="625" height="250" /></h2>
<h2>What is Mouse Follower?</h2>
<p>Mouse Follower or Cursor Trail is typically an image or set of images which follows the cursor in your browser screen.</p>
<h2><strong>Demo and Download</strong></h2>
<p>To understand more clearly visit <a title="jMouse Follower Demo" href="http://www.techmug.com/demo/mouse-follower/" target="_blank">demo</a>. Alternatively you may also download the files from <a title="Download jMouse Follower" href="http://www.techmug.com/demo/mouse-follower/mouse-follower.zip" target="_blank">here</a>.</p>
<h2><strong>Problem:</strong></h2>
<p>Today I was asked to enhance the existing mouse trail feature of a website. They were using 3 or 4 PNG images to make the mouse trail. But the problem was that images were inline. While our client wanted some more advanced animation with mouse trail/follower. And that animation was not possible without using flash animation in it.</p>
<p>From the above its clear that we were need to have a DIV in the script where all of the Flash embedded code may be inserted. I searched for many scripts but the problem was that they were doing well with IE but for Firefox answer was NO.</p>
<p><span id="more-28"></span></p>
<h2><strong>Things to do:</strong></h2>
<p>Eventually I had to play with code. And surely my first choice for Javascript is always jQuery. Basically the concept was so simple, to achieve Mouse Follower effect we need to do following:</p>
<ol>
<li>Create a DIV for Flash Object (You may also use image in this DIV).</li>
<li>Find X and Y co-ordinates of cursor&#8217;s current position.</li>
<li>Change DIV position according to X and Y position of Cursor.</li>
</ol>
<p></p>
<h2><strong>How it works?</strong></h2>
<pre class="brush: jscript;">
&lt;script type=&quot;text/javascript&quot;&gt;// &lt;![CDATA[
$(document).ready(function(){
   $(&quot;*&quot;).mousemove(function(e){
	  $(&quot;#follower&quot;).css({'position' : 'absolute', 'margin-left' : e.pageX+10, 'margin-top' : e.pageY+10, 'display' : 'block', 'z-index' : '999'});
   });
})
// ]]&gt;&lt;/script&gt;
</pre>
<p><strong>Explanation:</strong></p>
<ol>
<li>In the above code first we define use <em>document.ready()</em> it simply call the underneath function on the load of page.</li>
<li><em>$(&#8220;*&#8221;).mousemove(function(e){</em>&#8230; &#8211; this line reads that call the function whenever mouse move on any element of the page. <em>mousemove</em> is a jQuey event. Click <a title="jQuery Events" href="http://docs.jquery.com/Events" target="_blank">here</a> to learn more jQuery events.</li>
<li><em>$(&#8220;#follower&#8221;).css({</em>&#8230; &#8211; this line looks for an element which ID is &#8220;follower&#8221;. This is our Flash Object DIV. In this line we change the CSS style of our DIV. jQuery has made it much easy for us to change the CSS style of any element on the move.</li>
<li>We get X and Y co-ordinates by calling <em>page.X</em> and <em>page.Y</em> builtin functions of jQuery.</li>
<li>We used <em>margin-left</em> and <em>margin-top</em> to style our DIV. Values of both margins are set equivalent of <em>page.X</em> and <em>page.Y</em></li>
<li>So, every time when mouse moves on the page<em>, </em>our DIV changes its position itself. And this all is happening because we have defined the <em>position</em> of our DIV to <em>absolute. </em>So, DIV is free to move anywhere on the page.</li>
<li>We used <em>+10</em> with <em>page.X</em> and <em>page.Y</em> its just because we wanted to move our object a little far from the cursor.</li>
<li>Our DIV has a Flash Object. And we have made this flash animation a transparent one. So, it will not hide any element on the page. Code for our DIV is below:</li>
</ol>
<pre class="brush: php;">
&lt;div id=&quot;follower&quot;&gt;
 &lt;object id=&quot;followers&quot; classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; width=&quot;250&quot; height=&quot;150&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&quot;&gt;
 &lt;param name=&quot;name&quot; value=&quot;follower&quot; /&gt;
 &lt;param name=&quot;align&quot; value=&quot;middle&quot; /&gt;
 &lt;param name=&quot;allowScriptAccess&quot; value=&quot;sameDomain&quot; /&gt;
 &lt;param name=&quot;allowFullScreen&quot; value=&quot;false&quot; /&gt;
 &lt;param name=&quot;quality&quot; value=&quot;high&quot; /&gt;
 &lt;param name=&quot;bgcolor&quot; value=&quot;#ffffff&quot; /&gt;
 &lt;param name=&quot;wmode&quot; value=&quot;transparent&quot; /&gt;
 &lt;param name=&quot;allowScale&quot; value=&quot;false&quot; /&gt;
 &lt;param name=&quot;src&quot; value=&quot;mouse.swf&quot; /&gt;
 &lt;param name=&quot;allowfullscreen&quot; value=&quot;false&quot; /&gt;
 &lt;embed id=&quot;followers&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;250&quot; height=&quot;150&quot; src=&quot;mouse.swf&quot; allowscale=&quot;false&quot; wmode=&quot;transparent&quot; bgcolor=&quot;#ffffff&quot; quality=&quot;high&quot; allowfullscreen=&quot;false&quot; allowscriptaccess=&quot;sameDomain&quot; align=&quot;middle&quot; name=&quot;follower&quot;&gt;&lt;/embed&gt;
 &lt;/object&gt;
&lt;/div&gt;
</pre>
<p></p>
<p>Don’t forget to share the post on your favorite website. It may also help someone somewhere.</p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://www.techmug.com/jmouse-follower/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Cell Phone Number Archiving</title>
		<link>http://www.techmug.com/cell-phone-number-archiving/</link>
		<comments>http://www.techmug.com/cell-phone-number-archiving/#comments</comments>
		<pubDate>Fri, 01 May 2009 08:04:27 +0000</pubDate>
		<dc:creator>Fraz Ahmed</dc:creator>
				<category><![CDATA[Ideas]]></category>

		<guid isPermaLink="false">http://www.techmug.com/?p=6</guid>
		<description><![CDATA[It is common that when we change Sim card of our Mobile Phone we lose all the dialed and received numbers. Although modern mobiles has the ability to keep record of your all calls, but usually they keep record of 20 calls.]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong></p>
<p><img class="size-full wp-image-14 alignleft" style="margin-right: 5px;" title="mobile-phone" src="http://www.techmug.com/wp-content/uploads/2009/05/mobile-phone.jpg" alt="mobile-phone" width="88" height="95" /></p>
<p>It is common that when we change Sim card of our Mobile Phone we lose all the dialed and received numbers. Although modern mobiles has the ability to keep record of your all calls, but usually they keep record of 20 calls. And we lose the numbers we received/dialed some days/weeks ago. however, most of the calls we receive/dial to numbers which are saved in either our phone or Sim card memory. But three are times when you received a call from an unknown number two weeks ago and today you need to know the number, but chances are you have lost that number as new numbers have taken place in your recived call history.</p>
<p><span id="more-6"></span></p>
<p></p>
<p><strong>Idea / Solution:</strong></p>
<p><em>For Mobile Manufacturer:</em><br />
Mobile Manufacturer may introduce an application in handset itself to keep all the calls history in a calender like style. And give users an option to search by date and number.  And a way to clean records automatically after a certain date because data will take space to store the data. Optionally user may send the data to his/her email address directly from cell phone.</p>
<p><em>For Service Providers:</em><br />
Mobile service providers may also enter to take this opportunity and provide a value added service to customers. They may develop an application which keeps all the call history with date and time. And may give user access to the data from company website. It will not be a big matter for mobile service providers to provide this service to their users as the already keep all the calls record.</p>
<p><strong>Ending Words:</strong></p>
<p>Although many mobile service providers provide such service.  Some of them charge against this service while some not. But mobile manufacturers are not using this idea. I hope we will see such a mobile having <strong>Mobile Number Archiving</strong> service.</p>
<p></p>
<p>Don’t forget to share the post on your favorite website. It may also help someone somewhere.</p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://www.techmug.com/cell-phone-number-archiving/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
