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

<channel>
	<title>Geek.ro</title>
	<atom:link href="http://www.geek.ro/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geek.ro</link>
	<description>Just another sysadmin weblog</description>
	<pubDate>Mon, 10 Oct 2011 10:36:41 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>BOFH style</title>
		<link>http://www.geek.ro/2011/bofh-style/</link>
		<comments>http://www.geek.ro/2011/bofh-style/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 10:36:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Fun Stuff]]></category>

		<guid isPermaLink="false">http://www.geek.ro/?p=58</guid>
		<description><![CDATA[Webmaster : hey dude  how can I prevent receicing to my webmaster account 5k spam emails every day?
Sysadmin: fixed that
Sysadmin: I removed your account
Sysamdin: 0 spam from now on
Webmaster: LOL!!!
Webmaster: removed my account?
Webmaster: what du mean
Webmaster: now I have no more email?
Sysadmin: well yea, but zero spam
Sysadmin: so its cool
Webmaster: CRAP! NO I WANT THE [...]]]></description>
			<content:encoded><![CDATA[<p>Webmaster : hey dude  how can I prevent receicing to my webmaster account 5k spam emails every day?<br />
Sysadmin: fixed that<br />
Sysadmin: I removed your account<br />
Sysamdin: 0 spam from now on<br />
Webmaster: LOL!!!<br />
Webmaster: removed my account?<br />
Webmaster: what du mean<br />
Webmaster: now I have no more email?<br />
Sysadmin: well yea, but zero spam<br />
Sysadmin: so its cool<br />
Webmaster: CRAP! NO I WANT THE SPAM!<br />
Webmaster: SEND ME THE SPAM!<br />
Sysadmin:  :))<br />
Webmaster: I want to be spammed!<br />
Webmaster: hahaha</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geek.ro/2011/bofh-style/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PleskFatalException out of webspace in Webspace.php</title>
		<link>http://www.geek.ro/2011/pleskfatalexception-out-of-webspace-in-webspacephp/</link>
		<comments>http://www.geek.ro/2011/pleskfatalexception-out-of-webspace-in-webspacephp/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 18:33:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Plesk]]></category>

		<category><![CDATA[out of webspace]]></category>

		<category><![CDATA[webspace.php]]></category>

		<guid isPermaLink="false">http://www.geek.ro/?p=52</guid>
		<description><![CDATA[Spent a few hours debugging this error and it seems transvhosts.pl breaks some things when trying to change the vhosts directory.
Some things you need to check:
check /etc/psa/psa.conf  for HTTPD_VHOSTS_D and make sure the path doesn&#8217;t contain a trailing slash.
check the hosting,smb_apsProvisionEnvironments,subdomains, sys_users tables in the psa database and make sure the home field points to [...]]]></description>
			<content:encoded><![CDATA[<p>Spent a few hours debugging this error and it seems transvhosts.pl breaks some things when trying to change the vhosts directory.</p>
<p>Some things you need to check:</p>
<p>check /etc/psa/psa.conf  for HTTPD_VHOSTS_D and make sure the path doesn&#8217;t contain a trailing slash.</p>
<p>check the hosting,smb_apsProvisionEnvironments,subdomains, sys_users tables in the psa database and make sure the home field points to the right path.</p>
<p>You can use the mysql REPLACE function if not:</p>
<p>update sys_users set home=REPLACE(home,&#8221;OLD_PATH&#8221;,&#8221;NEW_PATH&#8221;);</p>
<p>Check that the domain has an entry in the hosting table.</p>
<p>Check that the home field in the sys_users table points to the same path as in the hosting table.<br />
This ended up fixing it for me, in sys_users I had /www/vhosts/domain.com and in hosting /www/vhosts/ANOTHERdomain.com/something</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geek.ro/2011/pleskfatalexception-out-of-webspace-in-webspacephp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to delete spam comments from wordpress</title>
		<link>http://www.geek.ro/2010/how-to-delete-spam-comments-from-wordpress/</link>
		<comments>http://www.geek.ro/2010/how-to-delete-spam-comments-from-wordpress/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 17:34:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[wordpress]]></category>

		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://www.geek.ro/?p=47</guid>
		<description><![CDATA[Once you put a blog up you will be the target of many link spammers looking for link juice. You can add a series of plugins to prevent them from clogging your database
but if you&#8217;re lazy like me you can delete them once in a while using a simple sql query:
DELETE FROM wp_comments WHERE comment_approved=0;
This [...]]]></description>
			<content:encoded><![CDATA[<p>Once you put a blog up you will be the target of many link spammers looking for link juice. You can add a series of plugins to prevent them from clogging your database<br />
but if you&#8217;re lazy like me you can delete them once in a while using a simple sql query:</p>
<p><strong>DELETE FROM wp_comments WHERE comment_approved=0;</strong></p>
<p>This deletes all unapproved comments, not necessarily all of them being spam.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geek.ro/2010/how-to-delete-spam-comments-from-wordpress/feed/</wfw:commentRss>
		</item>
		<item>
		<title>maildrop whitelists and blacklists</title>
		<link>http://www.geek.ro/2010/how-to-setup-whitelists-and-blacklists-with-maildrop/</link>
		<comments>http://www.geek.ro/2010/how-to-setup-whitelists-and-blacklists-with-maildrop/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 12:50:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Sysadmin]]></category>

		<category><![CDATA[maildrop]]></category>

		<category><![CDATA[maildropfilter]]></category>

		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://www.geek.ro/?p=18</guid>
		<description><![CDATA[SpamAssassin and greylisting are great tools for reducing the amount of spam thats cluttering our mailboxes, however theres always those false positives that in a business environment can become quite critical.
One of the ways to improve the delivery of important emails is to create whitelists, respectively blacklists, to make sure we are not missing anything [...]]]></description>
			<content:encoded><![CDATA[<p>SpamAssassin and <a href="http://www.greylisting.org/">greylisting </a>are great tools for reducing the amount of spam thats cluttering our mailboxes, however theres always those false positives that in a business environment can become quite critical.<br />
One of the ways to improve the delivery of important emails is to create whitelists, respectively blacklists, to make sure we are not missing anything vital.<br />
<a href="www.courier-mta.org/maildrop/">Maildrop</a> has some very nice filtering capabilities, but as with any complex software its easy to make mistakes.<br />
It took me some time to play around, trying to create a whitelist, till I found the lookup function which seems the perfect fit for this.<br />
Heres my new mailfilter config which now has a white/black - list.</p>
<pre><code>SHELL=/bin/sh
SPAM="/path/to/spam/Maildir/"
MAILBOX="/path/to/user/Maildir/"</code>

/^From:.*/
getaddr($MATCH) =~ /^.*/;
MATCH=tolower($MATCH)

if ( lookup($MATCH, "geek.ro-blacklist") )
         to "$SPAM"
if( lookup($MATCH, "geek.ro-whitelist") )
         to "$MAILBOX"
if (/^X-Spam-Status:  *Yes*/)
         to "$SPAM"
to "$MAILBOX"</pre>
<p>the geek.ro-whitelist, geek.ro-blacklist files are just regexes to match against the sender&#8217; email address, (e.g. .*@domain\.com), one per line.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geek.ro/2010/how-to-setup-whitelists-and-blacklists-with-maildrop/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Learn how to count()</title>
		<link>http://www.geek.ro/2009/learn-how-to-count/</link>
		<comments>http://www.geek.ro/2009/learn-how-to-count/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 12:40:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[mysql_num_rows]]></category>

		<guid isPermaLink="false">http://www.geek.ro/?p=7</guid>
		<description><![CDATA[PHP makes lazy programmers. I don&#8217;t want to turn this into a bashing post but as a sysadmin I&#8217;ve come across a lot of misbehaving scripts that are slowing my servers down to a halt. The general acceptance is that not the language makes bad code but the programmer, which is true, but the wide [...]]]></description>
			<content:encoded><![CDATA[<p>PHP makes lazy programmers. I don&#8217;t want to turn this into a bashing post but as a sysadmin I&#8217;ve come across a lot of misbehaving scripts that are slowing my servers down to a halt. The general acceptance is that not the language makes bad code but the programmer, which is true, but the wide spread of php snippets turned everyone with a browser into a coder. Unfortunately, or not, programming takes a lot more than gluing together some pieces of code.<br />
While the vast information present on the web can help you a lot in improving your coding skills theres something that no paper will teach you and that is common sense.<br />
This are two recent cases of awful programming I encountered lately and which made by head twist at the lack of thought from the supposed coder.<br />
<strong>Case 1:</strong><br />
$query = &#8220;SELECT * FROM table WHERE cond=true&#8221;;<br />
$res   = mysql_fetch_array($query);<br />
$num   = mysql_num_rows($res);</p>
<p>I just looked up the manual page for <a href="http://php.net/mysql_num_rows">mysql_num_rows</a> and I see where most got their bad habits from.<br />
<strong>Why this is bad:</strong><br />
You might not notice the performance problems of this query if you have a small table or if you&#8217;re running the mysql server on localhost. What this query does is generate a lot of useless traffic/IO and when you have this query running several times per minute or on a huge table it will have your server crawl no matter the hardware you have behind it. What you are doing is fetching all the rows from the database and then counting them, just imagine selecting 1mil records every time a page loads just to see how many of them you have and you&#8217;ll get a sense of whats wrong with this type of approach.<br />
<strong>Solution</strong>:<br />
$query = &#8220;SELECT count(*) FROM table WHERE cond=true&#8221;;<br />
$num   = mysql_fetch_row($query);<br />
Same result a lot less overhead.<br />
<strong>Case 2:</strong><br />
$query = &#8220;SELECT * FROM table WHERE cont=true&#8221;;<br />
while ($res = mysql_fetch_assoc($query)) {<br />
array_push($ids,$res['id']);<br />
}<br />
<strong>Why this is bad:</strong><br />
Again you are selecting an entire dataset when you need only a fraction of it.<br />
<strong> Solution:</strong><br />
$query = &#8220;SELECT id FROM table WHERE cond=true&#8221;;<br />
while ($res = mysql_fetch_assoc($query)) {<br />
array_push($ids,$res['id']);<br />
}</p>
<p>Keep in mind that all snippets you find on the net are just examples and are made so that they apply for a wide variety of cases, this doesn&#8217;t mean that it is the best approach for your scenario. Keep all things minimal and work only with the data you really need.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geek.ro/2009/learn-how-to-count/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Amavis - MySQL server has gone away</title>
		<link>http://www.geek.ro/2009/amavis-mysql-server-has-gone-away/</link>
		<comments>http://www.geek.ro/2009/amavis-mysql-server-has-gone-away/#comments</comments>
		<pubDate>Tue, 26 May 2009 13:01:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Sysadmin]]></category>

		<category><![CDATA[amavis]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.geek.ro/2009/05/amavis-mysql-server-has-gone-away/</guid>
		<description><![CDATA[I found this error cluttering my system logs:
May 26 06:39:16 zeus amavis[10981]: (10981-04) NOTICE: reconnecting in response to: err=2006, HY000, DBD::mysql::st execute failed: MySQL server has gone away at (eval 86) line 166, GEN54 line 5.
After a bit of debugging it turns out amavis keeps an open connection to mysql and depending on your wait_timeout [...]]]></description>
			<content:encoded><![CDATA[<p>I found this error cluttering my system logs:<br />
May 26 06:39:16 zeus amavis[10981]: (10981-04) NOTICE: reconnecting in response to: err=2006, HY000, DBD::mysql::st execute failed: MySQL server has gone away at (eval 86) line 166, GEN54 line 5.</p>
<p>After a bit of debugging it turns out amavis keeps an open connection to mysql and depending on your wait_timeout setting it might lose the connection and need to reconnect.<br />
In order to fix this you just need to increase your wait_timeout to a comfortable value.</p>
<p>mysql set global wait_timeout=28800;<br />
Query OK, 0 rows affected (0.00 sec)</p>
<p>You also need to edit your my.cnf file to make sure the change is persistent across mysql restarts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geek.ro/2009/amavis-mysql-server-has-gone-away/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

