<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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>Comments for RightBrain Networks</title>
	<atom:link href="http://www.rightbrainnetworks.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rightbrainnetworks.com</link>
	<description></description>
	<lastBuildDate>Wed, 04 Aug 2010 16:52:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on Base36 Conversion in PostgreSQL by Jamie</title>
		<link>http://www.rightbrainnetworks.com/blog/base36-conversion-in-postgresql/comment-page-1/#comment-696</link>
		<dc:creator>Jamie</dc:creator>
		<pubDate>Wed, 04 Aug 2010 16:52:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rightbrainnetworks.com/?p=148#comment-696</guid>
		<description>Certainly.  You may use it in anyway you wish; no attribution is necessary.  Though, as I mentioned in the original posting, you may want to test the performance of the functions or maybe even reconsider whether this is a task that should be done within the DB.</description>
		<content:encoded><![CDATA[<p>Certainly.  You may use it in anyway you wish; no attribution is necessary.  Though, as I mentioned in the original posting, you may want to test the performance of the functions or maybe even reconsider whether this is a task that should be done within the DB.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Base36 Conversion in PostgreSQL by P</title>
		<link>http://www.rightbrainnetworks.com/blog/base36-conversion-in-postgresql/comment-page-1/#comment-695</link>
		<dc:creator>P</dc:creator>
		<pubDate>Tue, 03 Aug 2010 22:40:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rightbrainnetworks.com/?p=148#comment-695</guid>
		<description>May I use these in a commercial project? If so may I make changes if attribution is provided?</description>
		<content:encoded><![CDATA[<p>May I use these in a commercial project? If so may I make changes if attribution is provided?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Rounding datetimes and timestamps in PostgreSQL by Jamie</title>
		<link>http://www.rightbrainnetworks.com/blog/rounding-datetimes-and-timestamps-in-postgresql/comment-page-1/#comment-691</link>
		<dc:creator>Jamie</dc:creator>
		<pubDate>Tue, 29 Jun 2010 13:34:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rightbrainnetworks.com/?p=163#comment-691</guid>
		<description>Interesting solution... Thanks for taking the time to write it up and post!</description>
		<content:encoded><![CDATA[<p>Interesting solution&#8230; Thanks for taking the time to write it up and post!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Rounding datetimes and timestamps in PostgreSQL by Anonymous</title>
		<link>http://www.rightbrainnetworks.com/blog/rounding-datetimes-and-timestamps-in-postgresql/comment-page-1/#comment-690</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Tue, 29 Jun 2010 08:42:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rightbrainnetworks.com/?p=163#comment-690</guid>
		<description>Hi,

You may like this solution also...

== Solution #1

You could build a 60 rows table with two columns : &quot;minute&quot; and &quot;nearest&quot;. Those 60 rows are pre-computed. Make &quot;minute&quot; the PK. 

By joining, you can get the nearest increment, and then you can compute back the rounded timestamp.

create table report.nearest
(
	&quot;minute&quot; integer,
	nearest time,
	constraint nearest_pk primary key (&quot;minute&quot;)
) ;

--
-- To be done once, when application is deployed
--

insert into report.nearest values (0, time &#039;00:00&#039;) ;
insert into report.nearest values (1, time &#039;00:00&#039;) ;
...
insert into report.nearest values (14, time &#039;00:00&#039;) ;
insert into report.nearest values (15, time &#039;00:15&#039;) ;
insert into report.nearest values (16, time &#039;00:16&#039;) ;
...

create table report.billing
(
	tstamp   timestamp,
	whatever integer
) ;

insert into report.billing values(timestamp &#039;2001-02-16 20:14:12&#039;, 1) ;
insert into report.billing values(timestamp &#039;2001-02-16 20:15:34&#039;, 2) ;

select
	B.tstamp,
	N.nearest,
	date_trunc(&#039;hour&#039;, B.tstamp) + N.nearest as rounded
from
	report.billing B,
	report.nearest N
where
	extract(minute from B.tstamp) = N.&quot;minute&quot; ;

Results are :

 TSTAMP              NEAREST  ROUNDED
 ------------------- -------- -------------------
 2001-02-16 20:14:12 00:00:00 2001-02-16 20:00:00
 2001-02-16 20:15:34 00:15:00 2001-02-16 20:15:00

The underlying principle is simple: you can tradeoff storage for computing power (and way back). Here, storage is table report.nearest and computing power is your round_timestamp function.

Btw, in database terminology, I guess &quot;nearest&quot; is a dimension table and &quot;billing&quot; is the fact table.

I don&#039;t know if this solution &quot;is the most elegant&quot; as you state but it is &quot;full SQL&quot;: usually, this is to be prefered because database engines are better at &quot;crunching&quot; sets of data and optmizing SQL requests rather than running procedural code.

== Solution #2

If you manage lots of billing records within a batch process (I mean 100K or millions rows maybe), you may consider to compute more data ahead of the batch time window.

Maybe extract(minute from B.tstamp) could be precomputed in a new column when the billing record is created ? The effect on whole performance of the application could be good ... or worse, it depends on the environment and must be validated.

Note: this denormalizes the data model to get better performance and should be documented.


Hope this helps.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>You may like this solution also&#8230;</p>
<p>== Solution #1</p>
<p>You could build a 60 rows table with two columns : &#8220;minute&#8221; and &#8220;nearest&#8221;. Those 60 rows are pre-computed. Make &#8220;minute&#8221; the PK. </p>
<p>By joining, you can get the nearest increment, and then you can compute back the rounded timestamp.</p>
<p>create table report.nearest<br />
(<br />
	&#8220;minute&#8221; integer,<br />
	nearest time,<br />
	constraint nearest_pk primary key (&#8220;minute&#8221;)<br />
) ;</p>
<p>&#8211;<br />
&#8211; To be done once, when application is deployed<br />
&#8211;</p>
<p>insert into report.nearest values (0, time &#8216;00:00&#8242;) ;<br />
insert into report.nearest values (1, time &#8216;00:00&#8242;) ;<br />
&#8230;<br />
insert into report.nearest values (14, time &#8216;00:00&#8242;) ;<br />
insert into report.nearest values (15, time &#8216;00:15&#8242;) ;<br />
insert into report.nearest values (16, time &#8216;00:16&#8242;) ;<br />
&#8230;</p>
<p>create table report.billing<br />
(<br />
	tstamp   timestamp,<br />
	whatever integer<br />
) ;</p>
<p>insert into report.billing values(timestamp &#8216;2001-02-16 20:14:12&#8242;, 1) ;<br />
insert into report.billing values(timestamp &#8216;2001-02-16 20:15:34&#8242;, 2) ;</p>
<p>select<br />
	B.tstamp,<br />
	N.nearest,<br />
	date_trunc(&#8216;hour&#8217;, B.tstamp) + N.nearest as rounded<br />
from<br />
	report.billing B,<br />
	report.nearest N<br />
where<br />
	extract(minute from B.tstamp) = N.&#8221;minute&#8221; ;</p>
<p>Results are :</p>
<p> TSTAMP              NEAREST  ROUNDED<br />
 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
 2001-02-16 20:14:12 00:00:00 2001-02-16 20:00:00<br />
 2001-02-16 20:15:34 00:15:00 2001-02-16 20:15:00</p>
<p>The underlying principle is simple: you can tradeoff storage for computing power (and way back). Here, storage is table report.nearest and computing power is your round_timestamp function.</p>
<p>Btw, in database terminology, I guess &#8220;nearest&#8221; is a dimension table and &#8220;billing&#8221; is the fact table.</p>
<p>I don&#8217;t know if this solution &#8220;is the most elegant&#8221; as you state but it is &#8220;full SQL&#8221;: usually, this is to be prefered because database engines are better at &#8220;crunching&#8221; sets of data and optmizing SQL requests rather than running procedural code.</p>
<p>== Solution #2</p>
<p>If you manage lots of billing records within a batch process (I mean 100K or millions rows maybe), you may consider to compute more data ahead of the batch time window.</p>
<p>Maybe extract(minute from B.tstamp) could be precomputed in a new column when the billing record is created ? The effect on whole performance of the application could be good &#8230; or worse, it depends on the environment and must be validated.</p>
<p>Note: this denormalizes the data model to get better performance and should be documented.</p>
<p>Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Adding a &#8220;disable&#8221; feature to the script.aculo.us Ajax.Autocompleter by kEpEx</title>
		<link>http://www.rightbrainnetworks.com/blog/adding-a-disable-feature-to-the-scriptalicious-ajax-autocompleter/comment-page-1/#comment-652</link>
		<dc:creator>kEpEx</dc:creator>
		<pubDate>Fri, 09 Apr 2010 06:06:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rightbrainnetworks.com/?p=8#comment-652</guid>
		<description>Nice solution! help me a lot!! strange u have no comments!! but really nice &amp; elegant solution :) thank you very much for share!</description>
		<content:encoded><![CDATA[<p>Nice solution! help me a lot!! strange u have no comments!! but really nice &amp; elegant solution <img src='http://www.rightbrainnetworks.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  thank you very much for share!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Deploying a Pylons App to Production, Step-by-Step (Part 1 of 2) by Victory</title>
		<link>http://www.rightbrainnetworks.com/blog/deploying-a-pylons-app-to-production-step-by-step-part-1-of-2/comment-page-1/#comment-42</link>
		<dc:creator>Victory</dc:creator>
		<pubDate>Sun, 14 Feb 2010 23:55:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rightbrainnetworks.com/?p=27#comment-42</guid>
		<description>I think fastcgi is one way to go, but I have good luck with mod_wsgi, if you would like me to do a guest post on how to setup apache and mod_wsgi just hit me up on email. I am keeping pylons of my blog for the moment because its not really geared towards my audience, however i think more documentation would be handy.

Victory</description>
		<content:encoded><![CDATA[<p>I think fastcgi is one way to go, but I have good luck with mod_wsgi, if you would like me to do a guest post on how to setup apache and mod_wsgi just hit me up on email. I am keeping pylons of my blog for the moment because its not really geared towards my audience, however i think more documentation would be handy.</p>
<p>Victory</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Deploying a Pylons App to Production, Step-by-Step (Part 2 of 2) by mech</title>
		<link>http://www.rightbrainnetworks.com/blog/deploying-a-pylons-app-to-production-step-by-step-part-2-of-2/comment-page-1/#comment-27</link>
		<dc:creator>mech</dc:creator>
		<pubDate>Sat, 13 Feb 2010 10:24:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rightbrainnetworks.com/?p=100#comment-27</guid>
		<description>I&#039;m about to deploy my Pylons project and deal with the production/performance problems. It&#039;s an excellent article, exactly what I need. Not too long, and covering all the subjects needed.  Thank you very much for sharing this information.</description>
		<content:encoded><![CDATA[<p>I&#8217;m about to deploy my Pylons project and deal with the production/performance problems. It&#8217;s an excellent article, exactly what I need. Not too long, and covering all the subjects needed.  Thank you very much for sharing this information.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Google Password Generator Gadget by web pixy</title>
		<link>http://www.rightbrainnetworks.com/blog/google-password-generator-gadget/comment-page-1/#comment-585</link>
		<dc:creator>web pixy</dc:creator>
		<pubDate>Wed, 19 Mar 2008 11:57:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rightbrainnetworks.com/2007/01/30/google-password-generator-gadget/#comment-585</guid>
		<description>That seems like a great gadget to use! I always find it hard to think of a good password and it will be very useful for me. Thanks a lot!</description>
		<content:encoded><![CDATA[<p>That seems like a great gadget to use! I always find it hard to think of a good password and it will be very useful for me. Thanks a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Who Killed the Webmaster? by MTLtechdude</title>
		<link>http://www.rightbrainnetworks.com/blog/who-killed-the-webmaster/comment-page-3/#comment-577</link>
		<dc:creator>MTLtechdude</dc:creator>
		<pubDate>Tue, 12 Feb 2008 15:15:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rightbrainnetworks.com/2007/01/28/who-killed-the-webmaster/#comment-577</guid>
		<description>I though webmasters had gone the way of the Cou Cou bird when bubble 1.0 burst but am still surprised when I see Job postings for webmasters specially when they are posted by medium to large businesses who actually run their business online. The fact is real  Webmasters were always a myth, like unicorns many people believed in them but I have yet to meet anyone who ever met a real one, I have met good web developers, good programmers, good web designers and good system administrators,  I have been in the biz foe a long time and have never met one that was good at all 4 at least not deserving the &#039;Master&#039; title. What really peeves me these days are the Guru and Ninja titles. I am seeing these pop up here and there. Should wee look at the frequency of these mythical title titles as a  sign that bubble 2.0 is about to burst?</description>
		<content:encoded><![CDATA[<p>I though webmasters had gone the way of the Cou Cou bird when bubble 1.0 burst but am still surprised when I see Job postings for webmasters specially when they are posted by medium to large businesses who actually run their business online. The fact is real  Webmasters were always a myth, like unicorns many people believed in them but I have yet to meet anyone who ever met a real one, I have met good web developers, good programmers, good web designers and good system administrators,  I have been in the biz foe a long time and have never met one that was good at all 4 at least not deserving the &#8216;Master&#8217; title. What really peeves me these days are the Guru and Ninja titles. I am seeing these pop up here and there. Should wee look at the frequency of these mythical title titles as a  sign that bubble 2.0 is about to burst?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on 10 things you (probably) didn’t know about PHP. by Tim</title>
		<link>http://www.rightbrainnetworks.com/blog/10-things-you-probably-didnt-know-about-php/comment-page-2/#comment-197</link>
		<dc:creator>Tim</dc:creator>
		<pubDate>Wed, 23 Jan 2008 18:08:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rightbrainnetworks.com/2006/09/18/10-things-you-probably-didnt-know-about-php/#comment-197</guid>
		<description>I&#039;m still learning PHP, but I&#039;ve already come to love the ternary operator for simple (non-nested) assignments...it keeps code simpler and less visually jarring.  To help visually parse the ternary statement, however, I place parens around each of the pieces, like so:

$var = (testvalue) ? (truevalue) : (falsevalue);

which makes it quite easy to read.</description>
		<content:encoded><![CDATA[<p>I&#8217;m still learning PHP, but I&#8217;ve already come to love the ternary operator for simple (non-nested) assignments&#8230;it keeps code simpler and less visually jarring.  To help visually parse the ternary statement, however, I place parens around each of the pieces, like so:</p>
<p>$var = (testvalue) ? (truevalue) : (falsevalue);</p>
<p>which makes it quite easy to read.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
