<?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:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0" xml:base="http://www.konordo.com/blog">
  <channel>
    <title>Drupal Blog</title>
    <link>http://www.konordo.com/blog</link>
    <description>Konordo Drupal Blog</description>
    <language>en</language>
          <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/konordo" /><feedburner:info uri="konordo" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fkonordo" 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%2Fkonordo" 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%2Fkonordo" 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/konordo" 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%2Fkonordo" 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%2Fkonordo" 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%2Fkonordo" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><item>
    <title>MySQL Order by before Group by</title>
    <link>http://feedproxy.google.com/~r/konordo/~3/2ckX8ipWJxg/mysql-order-group</link>
    <description>&lt;div class="tweetbutton"&gt;&lt;a href="http://twitter.com/share" class="twitter-share-button"  data-count="horizontal" data-via="konordo" data-related=":" data-text="" data-url="http://www.konordo.com/blog/mysql-order-group" data-lang="en"&gt;Tweet&lt;/a&gt;&lt;/div&gt;&lt;p&gt;In a custom module, I needed to get the latest node that each user published. It is fairly easy to goup by users, but it needs a little something to actually accomplish the sorting.&lt;/p&gt;
&lt;p&gt;The following query worked for me, we need to do the sorting in a nested select:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
pager_query("SELECT * FROM (SELECT * FROM node order by created DESC) as node WHERE nid IN ($placeholders)  GROUP BY uid",10,0,$count_query);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;
In case the following error comes up:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
Error: 1248 - SQLSTATE: 42000 ER_DERIVED_MUST_HAVE_ALIAS
&lt;/code&gt;&lt;/pre&gt;&lt;script src="http://feedproxy.google.com/~s/konordo/?i=http://www.konordo.com/blog/mysql-order-group" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/konordo?a=2ckX8ipWJxg:iPz_MeM_uQk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/konordo?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/konordo/~4/2ckX8ipWJxg" height="1" width="1"/&gt;</description>
     <pubDate>Wed, 08 Feb 2012 00:51:29 +0000</pubDate>
 <dc:creator>konordo</dc:creator>
 <guid isPermaLink="false">73 at http://www.konordo.com</guid>
  <feedburner:origLink>http://www.konordo.com/blog/mysql-order-group</feedburner:origLink></item>
  <item>
    <title>Create an ubercart order programmatically and update address and products.</title>
    <link>http://feedproxy.google.com/~r/konordo/~3/hcY33K-Y8mM/create-ubercart-order-programmatically-and-update-address-and-products</link>
    <description>&lt;div class="tweetbutton"&gt;&lt;a href="http://twitter.com/share" class="twitter-share-button"  data-count="horizontal" data-via="konordo" data-related=":" data-text="" data-url="http://www.konordo.com/blog/create-ubercart-order-programmatically-and-update-address-and-products" data-lang="en"&gt;Tweet&lt;/a&gt;&lt;/div&gt;&lt;p&gt;One of my latests tasks was to allow a link that would take a user id and a node id as an argument, and automatically create a new order that would have some fields pre populated and ready for further editing. Scope is to use the user id as the client that does the order and to automatically select the product depending on the taxonomy term of the provided node.&lt;/p&gt;
&lt;p&gt;In my case I offer a series of links through a custom view template, that uses data from each row results to built the link. &lt;/p&gt;
&lt;p&gt;Here is the code for my module, hopefully it will be useful for someone:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
&amp;lt;?php

&lt;/code&gt;&lt;/pre&gt;&lt;script src="http://feedproxy.google.com/~s/konordo/?i=http://www.konordo.com/blog/create-ubercart-order-programmatically-and-update-address-and-products" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/konordo?a=hcY33K-Y8mM:tKOsUH-6CYM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/konordo?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/konordo/~4/hcY33K-Y8mM" height="1" width="1"/&gt;</description>
     <category domain="http://www.konordo.com/blog/drupal">drupal</category>
 <pubDate>Mon, 31 Oct 2011 19:19:48 +0000</pubDate>
 <dc:creator>konordo</dc:creator>
 <guid isPermaLink="false">63 at http://www.konordo.com</guid>
  <feedburner:origLink>http://www.konordo.com/blog/create-ubercart-order-programmatically-and-update-address-and-products</feedburner:origLink></item>
  <item>
    <title>Remove duplicate entries from views results... the hard way.</title>
    <link>http://feedproxy.google.com/~r/konordo/~3/SkYwmhIp4AA/remove-duplicate-entries-views-results-hard-way</link>
    <description>&lt;div class="tweetbutton"&gt;&lt;a href="http://twitter.com/share" class="twitter-share-button"  data-count="horizontal" data-via="konordo" data-related=":" data-text="" data-url="http://www.konordo.com/blog/remove-duplicate-entries-views-results-hard-way" data-lang="en"&gt;Tweet&lt;/a&gt;&lt;/div&gt;&lt;p&gt;In some cases it is seems impossible to get rid of the duplicate entries that views return in the output.&lt;br /&gt;
Not an elegant way, but this small module would do the trick...&lt;/p&gt;
&lt;p&gt;So let's create a module the usual way, and put the following code in the .module file.&lt;br /&gt;
This one is called remove_duplicates.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; 
&amp;lt;?php
function remove_duplicates_views_pre_render(&amp;$view)
{
  $used_nids = array();

          foreach ($view-&gt;result as $row)
      {
        if (!in_array($row-&gt;nid, $used_nids))
        {
          $new_view_result[] = $row;
          $used_nids[] = $row-&gt;nid;
&lt;/code&gt;&lt;/pre&gt;&lt;script src="http://feedproxy.google.com/~s/konordo/?i=http://www.konordo.com/blog/remove-duplicate-entries-views-results-hard-way" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/konordo?a=SkYwmhIp4AA:pippGFmhDWI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/konordo?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/konordo/~4/SkYwmhIp4AA" height="1" width="1"/&gt;</description>
     <category domain="http://www.konordo.com/blog/drupal">drupal</category>
 <category domain="http://www.konordo.com/blog/drupal-quick-tips">drupal quick tips</category>
 <category domain="http://www.konordo.com/blog/views">Views</category>
 <pubDate>Tue, 25 Oct 2011 22:27:46 +0000</pubDate>
 <dc:creator>konordo</dc:creator>
 <guid isPermaLink="false">62 at http://www.konordo.com</guid>
  <feedburner:origLink>http://www.konordo.com/blog/remove-duplicate-entries-views-results-hard-way</feedburner:origLink></item>
  <item>
    <title>Drupal - Load user's Content Profile, given the UID </title>
    <link>http://feedproxy.google.com/~r/konordo/~3/GpalhbnXrbo/drupal-load-users-content-profile-given-uid</link>
    <description>&lt;div class="tweetbutton"&gt;&lt;a href="http://twitter.com/share" class="twitter-share-button"  data-count="horizontal" data-via="konordo" data-related=":" data-text="" data-url="http://www.konordo.com/blog/drupal-load-users-content-profile-given-uid" data-lang="en"&gt;Tweet&lt;/a&gt;&lt;/div&gt;&lt;p&gt;There are so many reasons to use Content Profile instead of the user's core profile. For once, profiles are created as separate nodes and therefore the full flexibility of CCK and VIews come in the game. This way it is possible to build some really sophisticated profiles, which is usually what is needed for any website.&lt;/p&gt;
&lt;p&gt;I had to look around for an easy solution on how to load the user's content profile programmatically, so the following might come in helpful. &lt;/p&gt;
&lt;script src="http://feedproxy.google.com/~s/konordo/?i=http://www.konordo.com/blog/drupal-load-users-content-profile-given-uid" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/konordo?a=GpalhbnXrbo:C5q53fzgzJk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/konordo?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/konordo/~4/GpalhbnXrbo" height="1" width="1"/&gt;</description>
     <category domain="http://www.konordo.com/blog/drupal">drupal</category>
 <category domain="http://www.konordo.com/blog/php">PHP</category>
 <pubDate>Sun, 28 Aug 2011 10:24:06 +0000</pubDate>
 <dc:creator>konordo</dc:creator>
 <guid isPermaLink="false">61 at http://www.konordo.com</guid>
  <feedburner:origLink>http://www.konordo.com/blog/drupal-load-users-content-profile-given-uid</feedburner:origLink></item>
  <item>
    <title>How to test cron in Centos </title>
    <link>http://feedproxy.google.com/~r/konordo/~3/sjIBozBQe-c/how-test-cron-centos</link>
    <description>&lt;div class="tweetbutton"&gt;&lt;a href="http://twitter.com/share" class="twitter-share-button"  data-count="horizontal" data-via="konordo" data-related=":" data-text="" data-url="http://www.konordo.com/blog/how-test-cron-centos" data-lang="en"&gt;Tweet&lt;/a&gt;&lt;/div&gt;&lt;p&gt;Here you can find some simple tests that would confirm the smooth functionality of your crontab.&lt;/p&gt;
&lt;h2 class="title"&gt;Test if cron is running&lt;/h2&gt;
&lt;p&gt;Type the following command: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ps ax | grep cron &lt;/code&gt;&lt;/pre&gt;&lt;p&gt;
Make sure that cron shows up. Expected output should be something like&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
[konordo@konordoserv]# ps ax | grep cron
 1185 pts/1    S+     0:00 grep cron
 1771 ?        Ss     0:00 crond
 &lt;/code&gt;&lt;/pre&gt;&lt;h2 class="title"&gt;Test if cron is working&lt;/h2&gt;
&lt;p&gt;Add the following entry to your crontab. To do so, enter the command &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;crontab -e&lt;/code&gt;&lt;/pre&gt;&lt;script src="http://feedproxy.google.com/~s/konordo/?i=http://www.konordo.com/blog/how-test-cron-centos" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/konordo?a=sjIBozBQe-c:4rlgm7Fiqro:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/konordo?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/konordo/~4/sjIBozBQe-c" height="1" width="1"/&gt;</description>
     <category domain="http://www.konordo.com/blog/centos">CentOS</category>
 <category domain="http://www.konordo.com/blog/server-configuration">Server configuration</category>
 <pubDate>Sun, 03 Jul 2011 16:13:16 +0000</pubDate>
 <dc:creator>konordo</dc:creator>
 <guid isPermaLink="false">59 at http://www.konordo.com</guid>
  <feedburner:origLink>http://www.konordo.com/blog/how-test-cron-centos</feedburner:origLink></item>
  </channel>
</rss>

