<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" ><channel><title>CodeAndMore</title> <atom:link href="http://www.codeandmore.com/feed/" rel="self" type="application/rss+xml" /><link>http://www.codeandmore.com</link> <description>Vietnamese custom webware provider</description> <lastBuildDate>Wed, 25 Jan 2012 19:01:25 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=</generator> <item><title>Drupal &#8211; Use thumbnail image field</title><link>http://www.codeandmore.com/2012/01/drupal-use-thumbnail-image-field/</link> <comments>http://www.codeandmore.com/2012/01/drupal-use-thumbnail-image-field/#comments</comments> <pubDate>Wed, 25 Jan 2012 18:22:36 +0000</pubDate> <dc:creator>Tien Do Xuan</dc:creator> <category><![CDATA[Drupal]]></category><guid isPermaLink="false">http://www.codeandmore.com/?p=251</guid> <description><![CDATA[Assume we have image field field_featured_image, but we want to have another image thumbnail field (for example this thumbnail needs to be wider): Add another image field field_featured_image_thumb Enable Views PHP module Add the field_featured_image_thumb field to view, also Global PHP, enter below code into [Output code] &#160; Always remember that Global PHP must be ...]]></description> <content:encoded><![CDATA[<p>Assume we have image field field_featured_image, but we want to have another image thumbnail field (for example this thumbnail needs to be wider):<br /> Add another image field field_featured_image_thumb<br /> Enable Views PHP module<br /> Add the field_featured_image_thumb field to view, also Global PHP, enter below code into [Output code]</p><div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;</pre></div></div><p>Always remember that Global PHP must be placed after two other fields and disable display for two other image fields.<br /> Enjoy.</p> ]]></content:encoded> <wfw:commentRss>http://www.codeandmore.com/2012/01/drupal-use-thumbnail-image-field/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Spam Protection: Alert when there are spammers sending email from your server</title><link>http://www.codeandmore.com/2012/01/spam-protection-alert-when-there-are-spammers-sending-email-from-your-server/</link> <comments>http://www.codeandmore.com/2012/01/spam-protection-alert-when-there-are-spammers-sending-email-from-your-server/#comments</comments> <pubDate>Wed, 25 Jan 2012 05:13:05 +0000</pubDate> <dc:creator>Tien Do Xuan</dc:creator> <category><![CDATA[Linux Tricks]]></category><guid isPermaLink="false">http://www.codeandmore.com/?p=248</guid> <description><![CDATA[For a few recent days we experienced that someone hacked into one of our accounts and use it to send spam massively. We immediately change that account (and all others)&#8217; password and apply higher security protection. But to be sure that we know if any problems sooner (before the server is blacklisted by Google mail, ...]]></description> <content:encoded><![CDATA[<p>For a few recent days we experienced that someone hacked into one of our accounts and use it to send spam massively. We immediately change that account (and all others)&#8217; password and apply higher security protection. But to be sure that we know if any problems sooner (before the server is blacklisted by Google mail, Yahoo mail and other ISPs), we are worrying about how to monitor number of emails currently in queue, if that is abnormal then we know immediately to take action. We got this script from <a href="http://crazyadmins.com/viewtopic.php?f=15&amp;t=55" target="_blank"> http://crazyadmins.com/viewtopic.php?f=15&amp;t=55</a> to monitor mail queue, if that goes higher than 20 emails at a time.</p><div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">#!/bin/bash
# Script from www.crazyadmins.com to alert admin about larger mail queue
# Save the file as eximqueue.sh
&nbsp;
######### Edit here ##########
&nbsp;
_mail_user=your@mail.com # Set this to your email id to receive alerts on mail queue
_limit=200 # Set the limit here
&nbsp;
##############################
&nbsp;
clear;
_result=&quot;/tmp/eximqueue.txt&quot;
_queue=&quot;`exim-bpc`&quot;
&nbsp;
if [ &quot;$_queue&quot; -ge &quot;$_limit&quot; ]; then
   echo &quot;Current queue is: $_queue&quot; &gt; $_result
   echo &quot;Summary of Mail queue&quot; &gt;&gt; $_result
   echo &quot;`exim -bp | exiqsumm`&quot; &gt;&gt; $_result
   mail -s &quot;Number of mails on `hostname` : $_queue&quot; $_mail_user &lt; $_result
   cat $_result
fi
&nbsp;
rm -f $_result</pre></div></div><p>The script does not work for us at first time. There for it to work in cron mode we need to add</p><div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">TERM=linux
export TERM</pre></div></div><p>Also to change every command instances to include /usr/sbin/ (otherwise it will report command not found)</p><p>Finally it looks like below</p><div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">#!/bin/bash
TERM=linux
export TERM
# Script from www.crazyadmins.com to alert admin about larger mail queue
# Save the file as eximqueue.sh
&nbsp;
######### Edit here ##########
&nbsp;
_mail_user=your@mail.com # Set this to your email id to receive alerts on mail queue
_limit=200 # Set the limit here
&nbsp;
##############################
&nbsp;
clear;
_result=&quot;/tmp/eximqueue.txt&quot;
_queue=&quot;`/usr/sbin/exim-bpc`&quot;
&nbsp;
if [ &quot;$_queue&quot; -ge &quot;$_limit&quot; ]; then
   echo &quot;Current queue is: $_queue&quot; &gt; $_result
   echo &quot;Summary of Mail queue&quot; &gt;&gt; $_result
   echo &quot;`/usr/sbin/exim -bp | /usr/sbin/exiqsumm`&quot; &gt;&gt; $_result
   mail -s &quot;ALERT: Number of mails on `hostname` : $_queue&quot; $_mail_user &lt; $_result
   cat $_result
fi
&nbsp;
rm -f $_result</pre></div></div><p>Set up this to run each minute and we feel better now. Hope that will save you sometime too.</p> ]]></content:encoded> <wfw:commentRss>http://www.codeandmore.com/2012/01/spam-protection-alert-when-there-are-spammers-sending-email-from-your-server/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Further codeandmore.com optimization</title><link>http://www.codeandmore.com/2012/01/further-codeandmore-com-optimization/</link> <comments>http://www.codeandmore.com/2012/01/further-codeandmore-com-optimization/#comments</comments> <pubDate>Sun, 01 Jan 2012 10:37:30 +0000</pubDate> <dc:creator>Tien Do Xuan</dc:creator> <category><![CDATA[Optimization]]></category><guid isPermaLink="false">http://www.codeandmore.com/?p=237</guid> <description><![CDATA[Today we optimized CodeAndMore to just have 17 requests, 100/100 score for performance grade given by Pingdom Tools: &#160; 100/100 performance score on Pingdom Tools YSlow Score is now 99. Highest possible if we know Google Analytisc always is set to score B. PageSpeed score is 99. Still of course.]]></description> <content:encoded><![CDATA[<p>Today we optimized CodeAndMore to just have 17 requests, <strong>100/100 score for performance grade</strong> given by Pingdom Tools:</p><p><a href="http://cdn.codeandmore.com/wp-content/uploads/2012/01/Tools100.jpg"><img class="alignnone size-full wp-image-243" title="Tools100" src="http://cdn.codeandmore.com/wp-content/uploads/2012/01/Tools100.jpg" alt="Pingdom Tools 100/100 performance score" width="620" height="481" /></a></p><p>&nbsp;</p><p><a title="100/100 performance score on Pingdom Tools" href="http://tools.pingdom.com/fpt/#!/Hl7mdb1bh/http://www.codeandmore.com" target="_blank">100/100 performance score on Pingdom Tools</a></p><p><strong>YSlow Score is now 99</strong>. Highest possible if we know Google Analytisc always is set to score B.</p><p><a href="http://cdn.codeandmore.com/wp-content/uploads/2012/01/YSlow99.jpg"><img class="alignnone size-full wp-image-238" title="YSlow99" src="http://cdn.codeandmore.com/wp-content/uploads/2012/01/YSlow99.jpg" alt="99 score on YSlow" width="740" height="583" /></a></p><p><strong>PageSpeed score is 99</strong>. Still of course.</p><p><a href="http://cdn.codeandmore.com/wp-content/uploads/2012/01/PageSpeed99.jpg"><img class="alignnone size-full wp-image-239" title="PageSpeed99" src="http://cdn.codeandmore.com/wp-content/uploads/2012/01/PageSpeed99.jpg" alt="PageSpeed 99 Score" width="740" height="583" /></a></p> ]]></content:encoded> <wfw:commentRss>http://www.codeandmore.com/2012/01/further-codeandmore-com-optimization/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Nginx on a VPS &#8211; user trick</title><link>http://www.codeandmore.com/2011/12/nginx-on-a-vps-user-trick/</link> <comments>http://www.codeandmore.com/2011/12/nginx-on-a-vps-user-trick/#comments</comments> <pubDate>Sat, 31 Dec 2011 12:45:24 +0000</pubDate> <dc:creator>Tien Do Xuan</dc:creator> <category><![CDATA[Linux Tricks]]></category> <category><![CDATA[Optimization]]></category><guid isPermaLink="false">http://codeandmore.com/?p=234</guid> <description><![CDATA[As we know, Nginx is faster than Apache to serve static files. Recently CodeAndMore installs nginx as its default however we met difficulty with &#8220;nginx&#8221; user, which is different than WHM &#8211; Apache &#8211; PHP user. Difficult to backup by Cpanel, harder to upload files via SFTP etc&#8230; Until we found that it is possible ...]]></description> <content:encoded><![CDATA[<p>As we know, Nginx is faster than Apache to serve static files. Recently CodeAndMore installs nginx as its default however we met difficulty with &#8220;nginx&#8221; user, which is different than WHM &#8211; Apache &#8211; PHP user. Difficult to backup by Cpanel, harder to upload files via SFTP etc&#8230;</p><p>Until we found that it is possible to change user that Nginx runs on. Assume your Cpanel account user is <em><strong>ucpanel </strong></em>(replace this with your Cpanel username).</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>nginx.conf</pre></div></div><p>Change it from <em>user nginx;</em> to <em>user ucpanel;</em></p><p>Then restart Nginx:</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">service nginx restart</pre></div></div><p>nginx runs with fastcgi, php-fpm so we will need to change user that fastcgi runs on too.</p><p>If you use scripts from <a title="Linode VPS" href="http://www.linode.com/?r=7fa198e2c7aa9f5cc5bae5b072a54ba01d8a1807" target="_blank">Linode</a> then:</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php-fastcgi</pre></div></div><p>Replace <em>nginx</em> with <em>ucpanel</em></p><p>Then kill the fastcgi process and start it again:</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>php-fastcgi start</pre></div></div><p>Now Nginx runs as normal Cpanel user, we can assign its root folder to /home/ucpanel/public_html and switch Apache / Nginx much easier, also full Cpanel backup much easier too.</p><p>Enjoy!.</p> ]]></content:encoded> <wfw:commentRss>http://www.codeandmore.com/2011/12/nginx-on-a-vps-user-trick/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Upgrade php to 5.3.x &#8211; ffmpeg</title><link>http://www.codeandmore.com/2011/08/upgrade-php-to-5-3-x-ffmpeg/</link> <comments>http://www.codeandmore.com/2011/08/upgrade-php-to-5-3-x-ffmpeg/#comments</comments> <pubDate>Mon, 15 Aug 2011 08:57:37 +0000</pubDate> <dc:creator>Tien Do Xuan</dc:creator> <category><![CDATA[Linux Tricks]]></category><guid isPermaLink="false">http://codeandmore.com/?p=231</guid> <description><![CDATA[When we tried to upgrade Plesk PHP to 5.3.x ffmpeg-php does not work so we have to upgrade that as well. Procedure is: login as root mkdir /src cd /src wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fffmpeg-php%2Ffiles%2Fffmpeg-php%2F0.6.0%2F&#038;ts=1313398332&#038;use_mirror=ncu tar -xjf ffmpeg-php-0.6.0.tbz2 cd ffmpeg-php-0.6.0 OK so we have ffmpeg 0.6.0 (latest, and it was very long time ago since its last commit), ...]]></description> <content:encoded><![CDATA[<p>When we tried to upgrade Plesk PHP to 5.3.x ffmpeg-php does not work so we have to upgrade that as well.<br /> Procedure is: login as root<br /> <code>mkdir /src<br /> cd /src<br /> wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fffmpeg-php%2Ffiles%2Fffmpeg-php%2F0.6.0%2F&#038;ts=1313398332&#038;use_mirror=ncu<br /> tar -xjf ffmpeg-php-0.6.0.tbz2<br /> cd ffmpeg-php-0.6.0</code><br /> OK so we have ffmpeg 0.6.0 (latest, and it was very long time ago since its last commit), now try to compile it:<br /> <code>phpize<br /> ./configure<br /> ./make</code><br /> Here we have errors:<br /> <code>error: 'PIX_FMT_RGBA32' undeclared (first use in this function)</code><br /> With reference link: http://ubuntuforums.org/showpost.php?p=7022607&#038;postcount=8, thank you Arvand<br /> We solve the problem as follow commands:<br /> <code>vi ffmpeg_frame.c<br /> :%s/PIX_FMT_RGBA32/PIX_FMT_RGB32<br /> :w<br /> :q!<br /> ./configure<br /> make<br /> make install</code></p><p>Then finally add extension=&#8221;ffmpeg.so&#8221; inside php.ini, which normally can be found in /etc/php.ini<br /> Or add that as a ffmpeg.ini file in /etc/php.d/ with content<br /> <code>extension=ffmpeg.so</code><br /> Restart apache:<br /> <code>service httpd restart</code><br /> And done, enjoy!</p> ]]></content:encoded> <wfw:commentRss>http://www.codeandmore.com/2011/08/upgrade-php-to-5-3-x-ffmpeg/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>@font-face kit generator</title><link>http://www.codeandmore.com/2011/06/font-face-kit-generator/</link> <comments>http://www.codeandmore.com/2011/06/font-face-kit-generator/#comments</comments> <pubDate>Sat, 25 Jun 2011 18:54:44 +0000</pubDate> <dc:creator>Tien Do Xuan</dc:creator> <category><![CDATA[Tools]]></category><guid isPermaLink="false">http://codeandmore.com/?p=229</guid> <description><![CDATA[http://fontface.codeandmore.com/ simple and works.]]></description> <content:encoded><![CDATA[<p><a title="@font-face kit generator" href="http://fontface.codeandmore.com/" target="_blank">http://fontface.codeandmore.com/</a> simple and works.</p> ]]></content:encoded> <wfw:commentRss>http://www.codeandmore.com/2011/06/font-face-kit-generator/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>CSS Sprite for codeandmore.com</title><link>http://www.codeandmore.com/2011/01/css-sprite-for-codeandmore-com/</link> <comments>http://www.codeandmore.com/2011/01/css-sprite-for-codeandmore-com/#comments</comments> <pubDate>Thu, 13 Jan 2011 10:25:42 +0000</pubDate> <dc:creator>Tien Do Xuan</dc:creator> <category><![CDATA[Optimization]]></category><guid isPermaLink="false">http://codeandmore.com/?p=203</guid> <description><![CDATA[We have 127 elements on home page of codeandmore.com: http://tools.pingdom.com/?url=http://codeandmore.com/&#38;treeview=0&#38;column=objectID&#38;order=1&#38;type=0&#38;save=true, and we expecting less than 50 elements so: less requests faster load Current progress: optimized to less than 40 elements. Loading speed optimized. More details to come.]]></description> <content:encoded><![CDATA[<p>We have 127 elements on home page of codeandmore.com:</p><p>http://tools.pingdom.com/?url=http://codeandmore.com/&amp;treeview=0&amp;column=objectID&amp;order=1&amp;type=0&amp;save=true, and we expecting less than 50 elements so:</p><ul><li>less requests</li><li>faster load</li></ul><p><a href="http://cdn.codeandmore.com/wp-content/uploads/2011/01/CodeAndMorePingdomTools_1294914160368.png" target="_blank"><img class="alignnone size-large wp-image-204" title="CodeAndMorePingdomTools_1294914160368" src="http://cdn.codeandmore.com/wp-content/uploads/2011/01/CodeAndMorePingdomTools_1294914160368-295x1024.png" alt="" width="295" height="1024" /></a></p><p>Current progress: optimized to less than 40 elements. Loading speed optimized.</p><div id="attachment_215" class="wp-caption alignnone" style="width: 310px"><a href="http://cdn.codeandmore.com/wp-content/uploads/2011/01/Pingdom-Tools_1295282335252.png"><img class="size-large wp-image-215 " title="Pingdom Test Result after, 38 elements" src="http://cdn.codeandmore.com/wp-content/uploads/2011/01/Pingdom-Tools_1295282335252-498x1024.png" alt="Pingdom Test Result after, 38 elements" width="300" height="616" /></a><p class="wp-caption-text">Pingdom Test Result after, 38 elements</p></div><div id="attachment_214" class="wp-caption alignnone" style="width: 310px"><a href="http://cdn.codeandmore.com/wp-content/uploads/2011/01/pagespeedscore.jpg" target="_blank"><img class="size-medium wp-image-214 " title="PageSpeed score 98/100" src="http://cdn.codeandmore.com/wp-content/uploads/2011/01/pagespeedscore-300x194.jpg" alt="PageSpeed score 98/100" width="300" height="194" /></a><p class="wp-caption-text">PageSpeed score 98/100</p></div><div id="attachment_211" class="wp-caption alignnone" style="width: 310px"><a href="http://cdn.codeandmore.com/wp-content/uploads/2011/01/YSlowscore.jpg" target="_blank"><img class="size-medium wp-image-211 " title="YSlow score - Grade A - 91/100" src="http://cdn.codeandmore.com/wp-content/uploads/2011/01/YSlowscore-300x173.jpg" alt="YSlow score - Grade A - 91/100" width="300" height="173" /></a><p class="wp-caption-text">YSlow score - Grade A - 91/100</p></div><p>More details to come.</p> ]]></content:encoded> <wfw:commentRss>http://www.codeandmore.com/2011/01/css-sprite-for-codeandmore-com/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Gumball3000</title><link>http://www.codeandmore.com/2011/01/gumball3000/</link> <comments>http://www.codeandmore.com/2011/01/gumball3000/#comments</comments> <pubDate>Sat, 08 Jan 2011 18:19:01 +0000</pubDate> <dc:creator>Tien Do Xuan</dc:creator> <category><![CDATA[Homepage Slider]]></category><guid isPermaLink="false">http://codeandmore.com/?p=155</guid> <description><![CDATA[A big Drupal site with news, video, custom shopping cart, shipping country/weight, WorldPay payment gateway, with lots of custom coding.]]></description> <content:encoded><![CDATA[<p>A big Drupal site with news, video, custom shopping cart, shipping  country/weight, WorldPay payment gateway, with lots of custom coding.</p> ]]></content:encoded> <wfw:commentRss>http://www.codeandmore.com/2011/01/gumball3000/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>TheFasterTimes</title><link>http://www.codeandmore.com/2011/01/thefastertimes/</link> <comments>http://www.codeandmore.com/2011/01/thefastertimes/#comments</comments> <pubDate>Sat, 08 Jan 2011 18:18:58 +0000</pubDate> <dc:creator>Tien Do Xuan</dc:creator> <category><![CDATA[Homepage Slider]]></category><guid isPermaLink="false">http://codeandmore.com/?p=159</guid> <description><![CDATA[A big news site based on multi bloggers. WordPress MU with lots of custom coding on front end and multi complex features backend.]]></description> <content:encoded><![CDATA[<p>A big news site based on multi bloggers. WordPress MU with lots of  custom coding on front end and multi complex features  backend.</p> ]]></content:encoded> <wfw:commentRss>http://www.codeandmore.com/2011/01/thefastertimes/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>RosemontPharma</title><link>http://www.codeandmore.com/2011/01/rosemontpharma/</link> <comments>http://www.codeandmore.com/2011/01/rosemontpharma/#comments</comments> <pubDate>Sat, 08 Jan 2011 18:16:17 +0000</pubDate> <dc:creator>Tien Do Xuan</dc:creator> <category><![CDATA[Homepage Slider]]></category><guid isPermaLink="false">http://codeandmore.com/?p=171</guid> <description><![CDATA[A custom Joomla solution, custom registration, custom product catalog with pdf (price list not article) generation. Complex back end.]]></description> <content:encoded><![CDATA[<p>A custom Joomla solution, custom registration, custom product catalog  with pdf (price list not article) generation. Complex back end.</p> ]]></content:encoded> <wfw:commentRss>http://www.codeandmore.com/2011/01/rosemontpharma/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Content Delivery Network via cdn.codeandmore.com

Served from: tiendoxuan.codeandmore.com @ 2012-02-07 09:27:18 -->
