tag:blogger.com,1999:blog-84021191976114779592023-11-16T02:44:14.727-08:00PHP Developer BlogRoy Toledohttp://www.blogger.com/profile/01984467586146972946noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-8402119197611477959.post-16331794217382849702011-09-03T02:11:00.000-07:002011-09-03T02:11:23.991-07:00How To add a HTTPS address to your etc/hosts FileFirst Open your hosts file on <code>/etc/hosts </code>on Linux OR C:\Windows\System32\drivers\etc on Windows systems<br />
<br />
As known, the default port for web browsing is port 80, so every record inserted in the hosts file as default use port 80. <br />
<br />
In order to add an "https" address just specify the ssl port for the desired record like so:<br />
<br />
<code>127.0.0.1:443 mysite.com</code><br />
<br />
Now https://mysite.com will be handled by your localhost Roy Toledohttp://www.blogger.com/profile/01984467586146972946noreply@blogger.com0tag:blogger.com,1999:blog-8402119197611477959.post-37902582654952874182011-09-02T10:44:00.000-07:002011-09-05T09:32:11.955-07:00How To Add Social Like and Share buttons to your site or blogThe internet is going social and if there's a free easy way to get more publicity and attract more people then why not?!<br />
<br />
To get a good coverage of social sharing you'll need three most important buttons<br />
provided by Google, Facebook and Twitter social networks<br />
So, to get a social buttons stripe just like that:<br />
<style>
/* Helpt to Align Buttons */
.social_buttons span {float:left;}
</style><br />
<div class="social_buttons"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=155577994527327&xfbml=1">
</script><fb:like href="" layout="button_count" send="true" show_faces="false"></fb:like><a class="twitter-share-button" data-count="horizontal" data-via="toledoroy" href="http://twitter.com/share">Tweet</a><script src="http://platform.twitter.com/widgets.js" type="text/javascript">
</script><script type="text/javascript">
(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;po.src = 'https://apis.google.com/js/plusone.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })();
</script><g:plusone size="medium"></g:plusone></div><br />
<br />
You'll need the following code:<br />
<br />
<br />
<br />
<h1>Google plusone</h1><br />
Code: <br />
<code><br />
<script type="text/javascript"><br />
(function() {<br />
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;<br />
po.src = 'https://apis.google.com/js/plusone.js';<br />
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);<br />
})();<br />
</script><br />
<g:plusone size="medium"></g:plusone><br />
</code><br />
<br />
for more info and more versions of the Google plusone button see: <a href="http://www.google.com/webmasters/+1/button/">http://www.google.com/webmasters/+1/button/</a><br />
<br />
<br />
<h1>Twitter Tweet Button</h1><br />
Code:<br />
<code> <a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" >Tweet</a><br />
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></code><br />
<br />
<br />
for more info and more versions of the Tweet Button see: <a href="http://twitter.com/about/resources/tweetbutton">http://twitter.com/about/resources/tweetbutton</a><br />
<br />
<br />
<h1>Facebook Like Button</h1><br />
Code:<br />
<code> <div id="fb-root"><br />
</div><br />
<script src="http://connect.facebook.net/en_US/all.js#appId=155577994527327&amp;xfbml=1"><br />
</script><br />
<fb:like layout="button_count" send="true" show_faces="false"></fb:like><br />
</code><br />
<br />
for more info and more versions of the Facebook Like button see: <a href="http://developers.facebook.com/docs/reference/plugins/like/">http://developers.facebook.com/docs/reference/plugins/like/</a> <br />
<br />
<br />
<h1>The Complete Code:</h1><code><br />
<div class="social_buttons"></code><br />
<code><!-- Facebook --><br />
<div id="fb-root"></div><br />
<script src="http://connect.facebook.net/en_US/all.js#appId=155577994527327&amp;xfbml=1"></script></code><br />
<code><span><fb:like layout="button_count" send="true" show_faces="false"></fb:like></span></code><code> </code><br />
<code><br />
</code><br />
<code><!-- Twitter --></code><br />
<code><span></code><code><a class="twitter-share-button" data-count="horizontal" href="http://twitter.com/share">Tweet</a></code><code></span></code><br />
<code><script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script></code><br />
<code><br />
</code><br />
<code><!-- Google --></code><br />
<code><script type="text/javascript"><br />
(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;po.src = 'https://apis.google.com/js/plusone.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })();<br />
</script></code><br />
<code><span></code><code><g:plusone size="medium"></g:plusone></code><code></span></code><br />
<code></code><br />
<code></div><br />
<br />
</code>Roy Toledohttp://www.blogger.com/profile/01984467586146972946noreply@blogger.com2tag:blogger.com,1999:blog-8402119197611477959.post-34485390664318164372011-07-29T07:39:00.000-07:002011-08-03T17:13:29.868-07:00Calculate time-diff and calculate age from birth dateOn my searches I've found many many different, complicated functions for time difference and many different functions calculate age, But for such a simple task I thought there should be a simpler solution.<br />
so here are a few good simple ways to calculate time differences and age<br />
<br />
good and simple function that because of the versatility of strtotime function can support many different date formats: <br />
<code><br />
function dateDiff($from, $to = "now")<br />
{<br />
return round((strtotime($to) - strtotime($from))/60/60/24);<br />
}<br />
</code><br />
and if age calculation is what you desire,<br />
a simple function to calculate age by birth date<br />
<code><br />
/**<br />
* Calc age from MySQL date format<br />
* @param string $date YY-mm-dd (MySQL Date Format)<br />
*/<br />
function calcAge($date)<br />
{<br />
//Break the date into an array<br />
list($Y,$m,$d) = explode("-",$date);<br />
//Calculate Year Diff<br />
$age = date("Y")-$Y;<br />
//Subtract a year if exact birth date hasn't passed yet<br />
if(date("md") < $m.$d) $age--;<br />
//And finally return the age<br />
return $age;<br />
}</code>Roy Toledohttp://www.blogger.com/profile/01984467586146972946noreply@blogger.com0