<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0" 
      xmlns:dc="http://purl.org/dc/elements/1.1/"
      xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
      xmlns:admin="http://webns.net/mvcb/"
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>DrQue.Net&#45;&#45; Andrew Que&#39;s corner of the net</title>
    <link>http://www.DrQue.com/</link>
    <description>Andrew Que&#39;s photoblog</description>
    <dc:language>en-us</dc:language>
    <dc:creator>Andrew Que</dc:creator>
    <dc:rights>Copyright 2005-2006</dc:rights>
    <dc:date>2010-03-10T21:03:39Z </dc:date>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>12</sy:updateFrequency>
    <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
      <item>
        <title>03/09/2010 Modeling my room</title>
        <link>http://www.DrQue.net/index.php?ArticleNumber=1944#_1944</link>
        <description>03/09/2010 Modeling my room</description>
        <content:encoded>
<![CDATA[
    <table border="0" cellpadding="0" cellspacing="2">
      <tr>
        <td>
          &nbsp;&nbsp; Yesterday I completed my basic bench layout, and for the most part, everything fits.&nbsp; Part of the reason is that I used Google Sketchup to do a drawing for placement first.<br />&nbsp;&nbsp; The sleeping box has been redesigned.&nbsp; At first I considered cutting the box down to bench height.&nbsp; Our new place is quite small.&nbsp; I instead to use the top of the box as a bunk for our roommate James.&nbsp; So this leaves the box at a height of 4 feet.&nbsp; The biggest change is the door.&nbsp; Previously, the box opened by hinges in the front, done mainly to keep from having to make additional cuts when the box was first assembled.&nbsp; This was not a good design.&nbsp; It leaked a lot of light, and was quite heavy.&nbsp; The sliding door of my box at the Garage works much better.&nbsp; Since Jai sleeps in the box with me, I decided to recycle the sliding door, but add a second one.&nbsp; We both go to bed at different times, and this allows her to get into the box whenever she likes without having to crawl over me.<br /> <div style="text-align: center;"><img align="middle" src="http://www.drque.net/Public/2010-03-09/Image3.png" alt="" /><br />Here is a sketch of the box with one side removed, and the closest door transparent.<br /><br /> <div style="text-align: left;">&nbsp;&nbsp; In order to make the new sliding door system, I had to redesign the frame.&nbsp; My box at the Garage uses a double wall setup, with the door in between.&nbsp; This is functional, but I used a 2x4 for the gap, resulting in 1.5 inches of space for the 5/8&quot; door.&nbsp; This means the door flops around and isn't very snug.&nbsp; I decided this new setup should be a little better.&nbsp; I omitted the inner wall, mainly because I didn't want all the extra wood it would require.<br />&nbsp;&nbsp; So, I build a 2x4 skeleton, edged with 1x3&quot; on the top, left and right, and 1x2&quot; on the bottom.&nbsp; This frame provides the gab for the door to slide long.&nbsp; The door is just 1/2&quot; plywood like the sides and top.&nbsp; It turned out quite well actually.&nbsp; The doors move very smooth in the space allotted, and close up tight.&nbsp; After some caulking, the system should be pretty light tight.<br />&nbsp;&nbsp; I finished the main construction on Thursday, left for the weekend starting Friday, and caulked on Sunday night.&nbsp; Yesterday I installed the bench setup, and finished the ventilation.&nbsp; Still haven't had a full test of light though.<br />&nbsp;&nbsp; Tonight I decided to finish up my model.&nbsp; I measured and drew the bedroom.&nbsp; I added a the monitors and chair, but most of the items in the bedroom I couldn't find good models for.<br /> <div style="text-align: center;"><img src="http://www.drque.net/Public/2010-03-09/Image1.png" alt="" /><br /></div> <div style="text-align: center;">Pictured is the sleeping box and my work bench as seen from the north east corner of the room.<br /><br /><div style="text-align: center;"><img src="http://www.drque.net/Public/2010-03-09/Image4.png" alt="" /><br />Floor plan.<br /></div></div> </div> </div>
        </td>
      </tr>
      <tr>
        <td>
          <table width="100%" cellpadding="0" cellspacing="0">
            <tr>
              <td align="center">
                <table class="CommentTableBody" width="98%">
                  <tr>
                    <td class="CommentTableCell"> 
                      <div style="text-align: center">No comments have been added </div>
                      </td>
                    </tr>
                    <tr>
                      <td class="CommentTableCell"> 
                        <div style="text-align: center">
                          <a href="http://www.DrQue.net/index.php?ArticleNumber=1944&amp;CommentArticle=1944#_1944" >
                            + Add a comment
                          </a>
                        </div>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>

]]>        </content:encoded>
        <dc:subject>Daily photos</dc:subject>
        <dc:date>2010-03-09T20:03:17Z</dc:date>
      </item>
        <item>
          <title>02/27/2010 Internet Charlatans</title>
          <link>http://www.DrQue.net/index.php?ArticleNumber=1943#_1943</link>
          <description>02/27/2010 Internet Charlatans</description>
          <content:encoded>
<![CDATA[
      <table border="0" cellpadding="0" cellspacing="2">
        <tr>
          <td>
            &nbsp;&nbsp; Having owned and operated a domain for over 5 years I'm use to people trying to sell me junk because the idiots shysters at Network Solutions won't keep my e-mail address private unless I pay for that &quot;privilege&quot;.&nbsp; I've received e-mails in the past from people wanting to sell me a domain name similar to mine.&nbsp; I ignore them by changing my e-mail address.&nbsp; So when I received an e-mail the other day, I followed standard procedure.&nbsp; To my surprise, I received a second e-mail hour latter to the updated e-mail address.&nbsp; Seems the domain squatters have become more aggressive.&nbsp; To humor myself, I clicked on the &quot;unsubscribe&quot; link.&nbsp; Naturally, I received an e-mail today, this time from a different company.<br />&nbsp;&nbsp; Let's have a look at the e-mails.&nbsp; The first one is from 2/20/2010 9:19 AM<br /> <div style="border: 2px solid rgb(0, 0, 0); color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: x-small; margin-left: 2em; margin-right: 2em;">  Priority Domain Availability Notice for drque.com:<br /><br />In the next few days, drque.com will be listed for sale.&nbsp; Since you have a similar domain name, we thought you might be interested in acquiring drque.com.<br /><br />You can confirm your interest in the domain drque.com by filling out the form here:&nbsp; http://initrustdomain.net/store/prioritynotice/f5e6fffd-fb88-456a-8d65-c3568bc2522c<br /><br />After we receive a confirmation that you are interested in the domain drque.com, our sales staff will be in touch with you promptly to make arrangements.<br /><br />We look forward to hearing back from you.<br /><br />Kind regards,<br />InTrust Domains<br />11605 Meridian Mkt V #124-134<br />Falcon, CO 80831<br /><br />&nbsp;<br /><br />If you are not interested in future priority notices, please simply reply to this message<br /><br />No more please: http://initrustdomain.net/store/unsub/f5e6fffd-fb88-456a-8d65-c3568bc2522c<br />&nbsp;</div> The next from 2/22/2010 7:13 AM<br /> <div style="border: 2px solid rgb(0, 0, 0); color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: x-small; margin-left: 2em; margin-right: 2em;"> Domain Sale Notice:<br /><br />drque.com is coming available for sale in a few days.<br /><br />Since you own the domain drque.net, we thought you'd be interested in drque.com.<br /><br />If you do have interest in acquiring drque.com, please fill up priority notice form availble<br /><br />here: http://initrustdomainnames.com/store/prioritynotice/f5e6fffd-fb88-456a-8d65-c3568bc2522c<br /><br />and we will contact you as soon as the domain is available for purchase.<br /><br />&nbsp;<br /><br />We look forward to hearing back from you.<br /><br />&nbsp;<br /><br />Kind regards,<br /><br />John Timmers<br /><br />InTrust Domains<br /><br />11590 Black Forest Road<br /><br />Colorado Springs, CO 80908-6000<br /><br />&nbsp;=========<br /><br />&nbsp;<br /><br />This e-mail is for the sole use of the intended recipient(s) and contains information belonging to InTrust Domains. and/or John Timmers, which is confidential and/or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking of any action in reliance on the contents of this e-mail information is strictly prohibited.&nbsp; If you have received this e-mail in error, please immediately notify the sender by reply e-mail and destroy all copies of the original message.<br /><br />&nbsp;<br /><br />No more please: http://initrustdomainnames.com/store/unsub/f5e6fffd-fb88-456a-8d65-c3568bc2522c <br /></div> I received this e-mail at 2/23/2010 7:06 AM<br /> <div style="border: 2px solid rgb(0, 0, 0); color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: x-small; margin-left: 2em; margin-right: 2em;"> Domain Sale Notice:<br /><br />drque.com is coming available for sale in a few days.<br /><br />Since you own the domain drque.net, we thought you'd be interested in drque.com.<br /><br />If you do have interest in acquiring drque.com, please fill up priority notice form availble<br /><br />here: http://bestinitrustdomains.biz/store/prioritynotice/f5e6fffd-fb88-456a-8d65-c3568bc2522c<br /><br />and we will contact you as soon as the domain is available for purchase.<br /><br />&nbsp;<br /><br />We look forward to hearing back from you.<br /><br />&nbsp;<br /><br />Kind regards,<br /><br />John Timmers<br /><br />InTrust Domains<br /><br />11590 Black Forest Road<br /><br />Colorado Springs, CO 80908-6000<br /><br />&nbsp;=========<br /><br />&nbsp;<br /><br />This e-mail is for the sole use of the intended recipient(s) and contains information belonging to InTrust Domains. and/or John Timmers, which is confidential and/or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking of any action in reliance on the contents of this e-mail information is strictly prohibited.&nbsp; If you have received this e-mail in error, please immediately notify the sender by reply e-mail and destroy all copies of the original message.<br /><br />&nbsp;<br /><br />No more please: http://bestinitrustdomains.biz/store/unsub/f5e6fffd-fb88-456a-8d65-c3568bc2522c <br /></div> Now I change my e-mail address.&nbsp; The next e-mail is to the new address at 2/23/2010 6:01 PM<br /> <div style="border: 2px solid rgb(0, 0, 0); color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: x-small; margin-left: 2em; margin-right: 2em;"> Hey<br /><br />My name is Eric Taylor from Flex Media.<br />drque.com will be available for a limited time purchase in a few days.<br />Since you own drque.net, I thought you might be interested in drque.com.<br /><br />If you do have an interest in purchasing drque.com, please visit:<br />http://www.flexmediadomains.com/prioritysales/4b846b3f090cf12526ef82f704f38b09fdbc9deccaad84b84605bd89513c5d12580d3cd5dba07ea060e039ae39<br /><br />If the link above doesn't work, please copy the address below and paste it into your web browser:<br />http://www.flexmediadomains.com/prioritysales/4b846b3f090cf12526ef82f704f38b09fdbc9deccaad84b84605bd89513c5d12580d3cd5dba07ea060e039ae39<br /><br />Once drque.com is available for purchase, one of my account specialists will contact you.<br /><br />My goal is to make this the easiest transaction possible for both of us.<br />I can guide you step-by-step over the phone, instant messenger or email on how to secure drque.com if you wish.<br />If you have any concerns or questions, please do not hesitate to contact me.<br />No question is a dumb question.<br /><br />Thank you and have a great day.<br /><br />Eric Taylor<br />Flex Media Inc<br />7777 Davie Road Ext, Suite 106B<br />Hollywood, FL 33024<br />954-584-3750<br />sales@flexmediadomains.com<br />Skype: flexmediadomains<br />ICQ: 576313997<br />AIM: sales@flexmediadomains.com<br />MSN: flexmediadomains@live.com<br />www.flexmediadomains.com<br /><br />This e-mail is for the sole use of the intended recipient(s) and contains information belonging to Flex Media Inc and/or Eric Taylor, which is confidential and/or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking of any action in reliance on the contents of this e-mail information is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender by reply e-mail and destroy all copies of the original message.<br /><br />No more please: http://www.flexmediadomains.com/opt_out.php?prerelease=&amp;id=4b846b3f090cf12526ef82f704f38b09fdbc9deccaad8<br /> </div> And the last e-mail from 2/26/2010 11:26 AM<br /> <div style="border: 2px solid rgb(0, 0, 0); color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: x-small; margin-left: 2em; margin-right: 2em;"> Hi,<br /><br />We thought that you definitely need to know that right now the .com version of your domain is secured by Easy Domain Recovery and is available for purchase at our page.<br /><br />What we do is take different measures to help you promote your brand on the Internet. Little things' effectiveness can compare to securing .com to a domain with any other extension. Everyone knows .com, a lot of users will intuitively seek you at .com extension so don't give a chance to anyone else to use that advantage of yours.<br /><br />There are third parties who may be interested in your domain. Many people out there reserve .coms to existing sites and domains in order to make profit of 'em. We may sell the domain to any of these persons and businesses but this is you who decides whether or not we do so. Please choose one of the following:<br /><br />Secure drque.com right now!<br />Let it go (unsubscribe).<br /><br />Best regards,<br />Tom Harris,<br />Easy Domain Recovery,<br />mailto: tom@easydomainrecovery.com&nbsp; </div> &nbsp;&nbsp;&nbsp; Some interesting things can be learned.&nbsp; First, the use of various domain names to push their products.&nbsp; They use initrustdomain.net, bestinitrustdomains.biz, flexmediadomains.com and easydomainrecovery.com.&nbsp; Both initrustdomain.net and bestinitrustdomains.biz are owned by &quot;Moniker Online Services LLC&quot; who according to &quot;SPAM Trackers&quot; wiki have a long history of criminal activity.&nbsp; The other two domains are &quot;owned&quot; by &quot;DOMAINBULLIES, LLC&quot; and &quot;ENOM, INC.&quot;&nbsp; There isn't much information about them.<br />&nbsp;&nbsp; What gets me is that the Internet is a major source of commerce.&nbsp; Isn't the FTC suppose to be doing something about this?&nbsp; Why then do places like SPAM Tracker talk about groups like Moniker Online Services and how they have operated for years?&nbsp; The more I deal with law and law enforcement, the more less I believe it functions.&nbsp; It is both incapibal of protecting people, and incapibal keeping law enforcement from harassing the people it aims to protect.
          </td>
        </tr>
        <tr>
          <td>
            <table width="100%" cellpadding="0" cellspacing="0">
              <tr>
                <td align="center">
                  <table class="CommentTableBody" width="98%">
                    <tr>
                      <td class="CommentTableCell">
                        1 comment has been made
                      </td>
                    </tr>
                    <tr>
                      <td class="CommentTableCell">
                        <b>From </b><br/>
                        <small>
                          March 1st, 2010 at 4:30AM
                        </small>
                        <br />

                          <table width="100%">
                            <tr>
                              <td class="CommentTableSubCell">
                                &nbsp;&nbsp;&nbsp;How do they know your current/active email address? Are they simply spamming emails to *@drque.net or is Network Solutions selling that information to these drips?<br />
                              </td>
                            </tr>
                          </table>

                        </td>
                      </tr>
                      <tr>
                        <td class="CommentTableCell"> 
                          <div style="text-align: center">
                            <a href="http://www.DrQue.net/index.php?ArticleNumber=1943&amp;CommentArticle=1943#_1943" >
                              + Add a comment
                            </a>
                          </div>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>

]]>          </content:encoded>
          <dc:subject>Daily photos</dc:subject>
          <dc:date>2010-02-27T15:02:10Z</dc:date>
        </item>
          <item>
            <title>02/18/2010</title>
            <link>http://www.DrQue.net/index.php?ArticleNumber=1942#_1942</link>
            <description>02/18/2010</description>
            <content:encoded>
<![CDATA[
        <table border="0" cellpadding="0" cellspacing="2">
          <tr>
            <td>
              &nbsp;&nbsp;&nbsp;   Everyone once and awhile I want to quick put a 3D drawing together, and I'll use Google Sketchup.  Being the math nut that I am, I love it when I need to do a bit of geometry.<br />&nbsp;&nbsp; Today, I happened to need to place an octagon (8=sides parallelogram) such that northern, and eastern edges were also the edges of a square, and the start of the north west corner (X), and south east corner (Z) of the octagon began at the these corners on the square.  When you draw a polygon in sketchup, you need to have a center point (I) and an end point at one of the angles (such as A).  So if I wanted an 8-sided polygon (octagon) to calculate where the center points, and some end point.  If you happen to have Sketchup, try and see if you can eyeball this--you'll find it isn't easy.  A geometric solution is needed.  Luckily, it's easy.<br />  <div style="text-align: center;">   <img src="http://www.drque.net/Public/2010-02-16/D.png" alt="" /> </div> &nbsp; Every angle in an octagon is 45 degrees, which is 360 / 8.  To find the center of an octagon, pick any edge, and measure 67.5 degrees (45 / 1.5) toward the center.  An example in this drawing is line AB or BC.  Where the angles meet is the center, point I.  Note also that when drawing this polygon, it will be done from point I to one of the point A through H.<br />  <div style="text-align: center;">   <img src="http://www.drque.net/Public/2010-02-16/B.png" alt="" />    </div>  &nbsp;&nbsp; In my requirement description, I want this octagon (call it octagon I) to meet up with square WXYZ such that vertex A meets vertex X, and D meets Z.  Sides AB to XY, and DE to ZY and parallel, and vertex A and the same as X, D the same as Z.  Now that we know the 2 verities, and two edges, we can find the center.  Measure an angle starting at X along XY that measure 67.5 degrees clockwise.  And 67.5 counter clockwise starting Z lone ZY.  This is the center point.<br />&nbsp;&nbsp; Draw your octagon starting at this location I, going to either vertex X or Z.  That's it! :) <div style="text-align: center;"><img src="http://www.drque.net/Public/2010-02-16/C.png" alt="" />   &nbsp;&nbsp; <br /></div>
            </td>
          </tr>
          <tr>
            <td>
              <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                  <td align="center">
                    <table class="CommentTableBody" width="98%">
                      <tr>
                        <td class="CommentTableCell"> 
                          <div style="text-align: center">No comments have been added </div>
                          </td>
                        </tr>
                        <tr>
                          <td class="CommentTableCell"> 
                            <div style="text-align: center">
                              <a href="http://www.DrQue.net/index.php?ArticleNumber=1942&amp;CommentArticle=1942#_1942" >
                                + Add a comment
                              </a>
                            </div>
                          </td>
                        </tr>
                      </table>
                    </td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>

]]>            </content:encoded>
            <dc:subject>Daily photos</dc:subject>
            <dc:date>2010-02-18T02:02:54Z</dc:date>
          </item>
              <item>
                <title>02/03/2010 Prime number - Part 2</title>
                <link>http://www.DrQue.net/index.php?ArticleNumber=1941#_1941</link>
                <description>02/03/2010 Prime number - Part 2</description>
                <content:encoded>
<![CDATA[
          <table border="0" cellpadding="0" cellspacing="2">
            <tr>
              <td>
                <p class="Main">      So my last article on prime numbers led me to ask the question &quot;How many prime numbers are there between 2 and 2<sup>32</sup>&quot;.  I know the quick answer to this question is &quot;a lot&quot;.  2<sup>32</sup> is over four billion&mdash;and that's a fair bit of space to check.  It would be easy to make a for-loop and brute force the entire number range, but this is the age of multi-core CPUs&mdash;and single threaded is so 2000.  Besides, my computer hasn't broken a sweat in awhile.    </p>    <p class="Main">      I decided to do a straight C implementation.  I've been doing C and C&#43;&#43; at work, and C&#43;&#43; has been irritating me lately because I tried to do a &quot;quick and dirty&quot; implementation without too much thought into the classes I'd need.  That's a recipe for disaster, and how you end up with things like microsoft's windows ME.  So vanilla C it was.    </p>    <p class="Main">      Threads and semaphores I used the POSIX standards, and I've tried to demonstrate how to make a dispatcher foreground task with one or more worker threads.  The key to this is the dispatch semaphore.  Normally, semaphores are used to for mutually exclusive lock, or to send signals between threads.  However, they can also be used as a count.  Think of them like a library that has a set number (say 5) of books.  That means 5 people can check that book out, but if a 6th person wants to check that book out, they will have to wait for one of the first 5 to return their copy.  The semaphore does this by keeping a count.  When that count reaches zero, the next task that tries to pend the semaphore will have to wait.  So the dispatcher is a loop that starts by pending the semaphore.  When it gets the semaphore, it will create a task.  The task will do some work, then post the semaphore.  The semaphore count determines how many tasks can run at the same time.  If we limit the number of tasks that can run at once to the number of CPU cores, then we can utilize the CPU to 100%.    </p>    <p class="Main">      First, the dispatcher skeleton code:    </p>       <div style="border: 1px solid rgb(255, 0, 0); overflow: auto; background-color: rgb(0, 0, 128); margin-left: 2em; width: 600px;">      <div style="padding: 2px; color: rgb(255, 255, 0); background-color: rgb(0, 0, 128); font-family: Courier New,Courier,mono; font-size: 14px; font-weight: bold;">         &nbsp;&nbsp;pthread_t&nbsp;Threads<span style="color: White;">[</span>&nbsp;NUMBER_OF_THREADS&nbsp;<span style="color: White;">]</span>; <br />        <br />        &nbsp;&nbsp;sem_init<span style="color: White;">(</span>&nbsp;<span style="color: White;">&amp;</span>Semaphore,&nbsp;NUMBER_OF_THREADS,&nbsp;NUMBER_OF_THREADS&nbsp;<span style="color: White;">)</span>; <br />        <br />        &nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">unsigned</span>&nbsp;ThreadIndex&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: rgb(0, 255, 255);">0</span>; <br />        <br />        &nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">while</span>&nbsp;<span style="color: White;">(</span>&nbsp;NumbersLeft&nbsp;<span style="color: White;">)</span> <br />        &nbsp;&nbsp;<span style="color: White;">{</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;Wait&nbsp;for&nbsp;a&nbsp;free&nbsp;worker&nbsp;thread. <br />        </span>&nbsp;&nbsp;&nbsp;&nbsp;sem_wait<span style="color: White;">(</span>&nbsp;<span style="color: White;">&amp;</span>Semaphore&nbsp;<span style="color: White;">)</span>; <br />        <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;Create&nbsp;a&nbsp;worker&nbsp;thread&nbsp;to&nbsp;check&nbsp;this&nbsp;number&nbsp;set. <br />        </span>&nbsp;&nbsp;&nbsp;&nbsp;pthread_create <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">(</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">&amp;</span>Threads<span style="color: White;">[</span>&nbsp;ThreadIndex&nbsp;<span style="color: White;">]</span>, <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL, <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrimeThread, <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">(</span><span style="color: rgb(255, 255, 255);">void</span>&nbsp;<span style="color: White;">*</span><span style="color: White;">)</span><span style="color: White;">&amp;</span>Data<span style="color: White;">[</span>&nbsp;ThreadIndex&nbsp;<span style="color: White;">]</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">)</span>; <br />        <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">&#43;&#43;</span>ThreadIndex; <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">if</span>&nbsp;<span style="color: White;">(</span>&nbsp;ThreadIndex&nbsp;&gt;<span style="color: White;">=</span>&nbsp;NUMBER_OF_THREADS&nbsp;<span style="color: White;">)</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ThreadIndex&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: rgb(0, 255, 255);">0</span>; <br />        &nbsp;&nbsp;<span style="color: White;">}</span> <br />         </div>    </div>      <p class="Main">      Then, the skeleton of the worker thread:    </p>     <div style="border: 1px solid rgb(255, 0, 0); overflow: auto; background-color: rgb(0, 0, 128); margin-left: 2em; width: 600px;">      <div style="padding: 2px; color: rgb(255, 255, 0); background-color: rgb(0, 0, 128); font-family: Courier New,Courier,mono; font-size: 14px; font-weight: bold;">        <span style="color: rgb(255, 255, 255);">static</span>&nbsp;<span style="color: rgb(255, 255, 255);">void</span>&nbsp;<span style="color: White;">*</span>&nbsp;PrimeThread<span style="color: White;">(</span>&nbsp;<span style="color: rgb(255, 255, 255);">void</span>&nbsp;<span style="color: White;">*</span>&nbsp;ArgumentPointer&nbsp;<span style="color: White;">)</span> <br />        <span style="color: White;">{</span> <br />        &nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">// <br />        </span>&nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;Do&nbsp;prime&nbsp;check. <br />        </span>&nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">// <br />        </span> <br />        &nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;This&nbsp;thread&nbsp;is&nbsp;now&nbsp;complete.&nbsp;&nbsp;Release&nbsp;one&nbsp;count&nbsp;from&nbsp;the&nbsp;dispatch <br />        </span>&nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;semaphore. <br />        </span>&nbsp;&nbsp;sem_post<span style="color: White;">(</span>&nbsp;<span style="color: White;">&amp;</span>Semaphore&nbsp;<span style="color: White;">)</span>; <br />        <br />        &nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;End&nbsp;this&nbsp;thread. <br />        </span>&nbsp;&nbsp;pthread_exit<span style="color: White;">(</span>&nbsp;<span style="color: rgb(0, 255, 255);">0</span>&nbsp;<span style="color: White;">)</span>; <br />        <br />        &nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">return</span>&nbsp;<span style="color: rgb(0, 255, 255);">0</span>; <br />        <br />        <span style="color: White;">}</span>&nbsp; <br />      </div>    </div>       <p class="Main">      Now just launching a thread to check one number is a bit of a waste&mdash;it takes some overhead to start and stop the task.  So we give each thread some range of numbers to check.  A pthread can be passed parameters, and we pass the starting number, along with the amount of numbers to check.  The parameter block is also used for storage of the results.  So here is the full worker thread:    </p>     <div style="border: 1px solid rgb(255, 0, 0); overflow: auto; background-color: rgb(0, 0, 128); margin-left: 2em; width: 600px;">      <div style="padding: 2px; color: rgb(255, 255, 0); background-color: rgb(0, 0, 128); font-family: Courier New,Courier,mono; font-size: 14px; font-weight: bold;">        <span style="color: rgb(255, 255, 255);">static</span>&nbsp;<span style="color: rgb(255, 255, 255);">void</span>&nbsp;<span style="color: White;">*</span>&nbsp;PrimeThread<span style="color: White;">(</span>&nbsp;<span style="color: rgb(255, 255, 255);">void</span>&nbsp;<span style="color: White;">*</span>&nbsp;ArgumentPointer&nbsp;<span style="color: White;">)</span> <br />        <span style="color: White;">{</span> <br />        &nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;Get&nbsp;the&nbsp;work&nbsp;data&nbsp;passed&nbsp;to&nbsp;the&nbsp;thread. <br />        </span>&nbsp;&nbsp;WORK_TYPE&nbsp;<span style="color: White;">*</span>&nbsp;Data&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: White;">(</span>WORK_TYPE&nbsp;<span style="color: White;">*</span><span style="color: White;">)</span>ArgumentPointer; <br />        &nbsp;&nbsp;uint32_t&nbsp;Number&nbsp;<span style="color: White;">=</span>&nbsp;Data-&gt;StartNumber; <br />        &nbsp;&nbsp;uint32_t&nbsp;Count&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: rgb(0, 255, 255);">0</span>; <br />        &nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">unsigned</span>&nbsp;Index; <br />        <br />        &nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;For&nbsp;all&nbsp;the&nbsp;numbers&nbsp;to&nbsp;check... <br />        </span>&nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">for</span>&nbsp;<span style="color: White;">(</span>&nbsp;Index&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: rgb(0, 255, 255);">0</span>;&nbsp;Index&nbsp;&lt;&nbsp;Data-&gt;NumberToCheck;&nbsp;<span style="color: White;">&#43;&#43;</span>Index&nbsp;<span style="color: White;">)</span> <br />        &nbsp;&nbsp;<span style="color: White;">{</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;Is&nbsp;this&nbsp;number&nbsp;a&nbsp;prime? <br />        </span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">if</span>&nbsp;<span style="color: White;">(</span>&nbsp;IsPrime<span style="color: White;">(</span>&nbsp;Number&nbsp;<span style="color: White;">)</span>&nbsp;<span style="color: White;">)</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;Then&nbsp;count&nbsp;it. <br />        </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">&#43;&#43;</span>Count; <br />        <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;Next&nbsp;number. <br />        </span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">&#43;&#43;</span>Number; <br />        &nbsp;&nbsp;<span style="color: White;">}</span> <br />        <br />        &nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;Save&nbsp;results. <br />        </span>&nbsp;&nbsp;Data-&gt;NumberFound&nbsp;<span style="color: White;">=</span>&nbsp;Count; <br />        <br />        &nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;This&nbsp;thread&nbsp;is&nbsp;now&nbsp;complete.&nbsp;&nbsp;Release&nbsp;one&nbsp;count&nbsp;from&nbsp;the&nbsp;dispatch <br />        </span>&nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;semaphore. <br />        </span>&nbsp;&nbsp;sem_post<span style="color: White;">(</span>&nbsp;<span style="color: White;">&amp;</span>Semaphore&nbsp;<span style="color: White;">)</span>; <br />        <br />        &nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;End&nbsp;this&nbsp;thread. <br />        </span>&nbsp;&nbsp;pthread_exit<span style="color: White;">(</span>&nbsp;<span style="color: rgb(0, 255, 255);">0</span>&nbsp;<span style="color: White;">)</span>; <br />        <br />        &nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;Never&nbsp;reached--here&nbsp;for&nbsp;language&nbsp;consistency. <br />        </span>&nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">return</span>&nbsp;<span style="color: rgb(0, 255, 255);">0</span>; <br />        <br />        <span style="color: White;">}</span>&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;PrimeThread <br />        </span> <br />      </div>    </div>      <p class="Main">      The dispatcher has to accumulate the results.  Our could try using a global variable, but you can run into issues with non-atomic access.  Adding 1 might seem a basic operation, but (at least in a RISC system) it takes 3 instructions to add one to a variable in memory: load the data to a register, add the register by 1, and store the register.  You can not (without a semaphore) guarantee that those instructions will not be interrupted by an other thread.  So, the accumulation happens in just one place&mdash;the dispatch loop.    </p>    <p class="Main">      The dispatcher will assign all the work, but it is finished once all the work has been assigned.  We still need to wait for the work to finish.  So the last part of the process looks like this:    </p>      <div style="border: 1px solid rgb(255, 0, 0); overflow: auto; background-color: rgb(0, 0, 128); margin-left: 2em; width: 600px;">      <div style="padding: 2px; color: rgb(255, 255, 0); background-color: rgb(0, 0, 128); font-family: Courier New,Courier,mono; font-size: 14px; font-weight: bold;">        &nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">for</span>&nbsp;<span style="color: White;">(</span>&nbsp;ThreadIndex&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: rgb(0, 255, 255);">0</span>;&nbsp;ThreadIndex&nbsp;&lt;&nbsp;NUMBER_OF_THREADS;&nbsp;<span style="color: White;">&#43;&#43;</span>ThreadIndex&nbsp;<span style="color: White;">)</span> <br />        &nbsp;&nbsp;<span style="color: White;">{</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">if</span>&nbsp;<span style="color: White;">(</span>&nbsp;Data<span style="color: White;">[</span>&nbsp;ThreadIndex&nbsp;<span style="color: White;">]</span><span style="color: White;">.</span>NumberToCheck&nbsp;<span style="color: White;">)</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">{</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;Wait&nbsp;for&nbsp;thread&nbsp;to&nbsp;finish. <br />        </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pthread_join<span style="color: White;">(</span>&nbsp;Threads<span style="color: White;">[</span>&nbsp;ThreadIndex&nbsp;<span style="color: White;">]</span>,&nbsp;NULL&nbsp;<span style="color: White;">)</span>; <br />        <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;Accumulate&nbsp;the&nbsp;number&nbsp;of&nbsp;primes&nbsp;found&nbsp;in&nbsp;this&nbsp;thread. <br />        </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NumberOfPrimes&nbsp;<span style="color: White;">&#43;=</span>&nbsp;Data<span style="color: White;">[</span>&nbsp;ThreadIndex&nbsp;<span style="color: White;">]</span><span style="color: White;">.</span>NumberFound; <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">}</span> <br />        &nbsp;&nbsp;<span style="color: White;">}</span> <br />        <br />        &nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;Let&nbsp;go&nbsp;of&nbsp;dispatch&nbsp;semaphore. <br />        </span>&nbsp;&nbsp;sem_destroy<span style="color: White;">(</span>&nbsp;<span style="color: White;">&amp;</span>Semaphore&nbsp;<span style="color: White;">)</span>; <br />      </div>    </div>       <p class="Main">      Now we can print the results to the screen, and we're done.    </p>    <p class="Main">      I knew this code would tax the CPU rather hard, so I wanted to measure how long the process would take.  &quot;time.h&quot; is a C standard unit.  Unfortunately, &quot;time_spec&quot;, which has a high-resolution method for checking the time, it's part of the C99 standard.  But we can get time in the resolution of seconds, and that's good enough.  To do this, we simply mark the time when the process begins, and mark it again at the end.  The difference (for which there is a function to compute) is the total number of seconds that has elapsed.    </p>    <p class="Main">      The answer: There are 203,280,221 primes between 2 and 4,294,967,295, and it took 6,054 seconds (1 hour, 41 minutes) on a quad-core clocked at 2.5 GHz.    </p>     <p class="Main">      The <a href="/Public/2010-02-02/prime_count.c">full source code is here</a>.    </p>
                </td>
              </tr>
              <tr>
                <td>
                  <table width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                      <td align="center">
                        <table class="CommentTableBody" width="98%">
                          <tr>
                            <td class="CommentTableCell">
                              1 comment has been made
                            </td>
                          </tr>
                          <tr>
                            <td class="CommentTableCell">
                              <b>From </b><br/>
                              <small>
                                February 17th, 2010 at 3:10AM
                              </small>
                              <br />

                                <table width="100%">
                                  <tr>
                                    <td class="CommentTableSubCell">
                                      &nbsp;&nbsp;&nbsp;Excellent post! I always enjoy a solid technical post (and code) It saved me a good week  - Keep up the good work!<br />
                                    </td>
                                  </tr>
                                </table>

                              </td>
                            </tr>
                            <tr>
                              <td class="CommentTableCell"> 
                                <div style="text-align: center">
                                  <a href="http://www.DrQue.net/index.php?ArticleNumber=1941&amp;CommentArticle=1941#_1941" >
                                    + Add a comment
                                  </a>
                                </div>
                              </td>
                            </tr>
                          </table>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>

]]>                </content:encoded>
                <dc:subject>Daily photos</dc:subject>
                <dc:date>2010-02-03T23:02:35Z</dc:date>
              </item>
                  <item>
                    <title>02/02/2010 Prime numbers - Part 1</title>
                    <link>http://www.DrQue.net/index.php?ArticleNumber=1940#_1940</link>
                    <description>02/02/2010 Prime numbers - Part 1</description>
                    <content:encoded>
<![CDATA[
              <table border="0" cellpadding="0" cellspacing="2">
                <tr>
                  <td>
                    <p class="Main">      So I mentioned       <a href="http://www.drque.net/index.php?ArticleNumber=1939#_1939">yesterday</a>      that I wrote a simple program to check to see if some numbers in a list were prime or not.  I didn't post it because I wanted to spend a little more time with it&mdash;giving it an article on it's own.    </p>    <p class="Main">      Finding prime numbers goes back a long time.  The easiest way to see if a number is prime is to simply check and see if the number is divisible by all the prime numbers up to the square root of the number in question.      </p>    <p class="Main">      A number (call it x) is prime if there are no two number (call them a and b) such that a * b = x.  All non-prime numbers can be expressed as the product of two or more prime numbers.  For example, 125 can be made from 5 * 25, but 25 can be made from 5 * 5.  So 5 * 5 * 5 = 125, and represents the most factored version of 125.  This is true of any number.  Since it takes at least two prime numbers to create a factor, we only need to check the primes up to &radic;<span style="text-decoration: overline;">x</span> (or the square root) of the number.  This is because the if x = a * a, then &radic;<span style="text-decoration: overline;">x</span> = a.  If x = a * b, and b is greater a, then a must be less then &radic;<span style="text-decoration: overline;">x</span>. Thus, we only need to check primes up to &radic;<span style="text-decoration: overline;">x</span>.    </p>    <p class="Main">      This makes for a nice brute-force test method, and it's pretty simple to implement.  If we're going to test a number, we need all the primes up to the square root of that number.  For what I needed, the number was capped at 32-bits&mdash;or 2<sup>32</sup>.  &radic;<span style="text-decoration: overline;">2<sup>32</sup></span> = (2<sup>32</sup>)<sup>1/2</sup> = 2<sup>16</sup> = 65536.  So I need a list of all the prime numbers up to 2<sup>16</sup>.  We can make the list fairly quick.  Have a look at this function:    </p>        <div style="border: 1px solid rgb(255, 0, 0); overflow: auto; background-color: rgb(0, 0, 128); margin-left: 2em; width: 600px;">      <div style="padding: 2px; color: rgb(255, 255, 0); background-color: rgb(0, 0, 128); font-family: Courier New,Courier,mono; font-size: 14px; font-weight: bold;">         <span style="color: rgb(255, 255, 255);">enum</span>&nbsp;<span style="color: White;">{</span>&nbsp;NUMBER_OF_LOOKUP_PRIMES&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: rgb(0, 255, 255);">6542</span>&nbsp;<span style="color: White;">}</span>; <br />        <span style="color: rgb(255, 255, 255);">unsigned</span>&nbsp;PrimeNumbers<span style="color: White;">[</span>&nbsp;NUMBER_OF_LOOKUP_PRIMES&nbsp;<span style="color: White;">]</span>; <br />        <br />        <span style="color: rgb(255, 255, 255);">void</span>&nbsp;GeneratePrimeNumberLookup<span style="color: White;">(</span><span style="color: White;">)</span> <br />        <span style="color: White;">{</span> <br />        &nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">unsigned</span>&nbsp;Index; <br />        &nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">unsigned</span>&nbsp;PrimeNumberCount&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: rgb(0, 255, 255);">0</span>; <br />        <br />        &nbsp;&nbsp;PrimeNumbers<span style="color: White;">[</span>&nbsp;PrimeNumberCount<span style="color: White;">&#43;&#43;</span>&nbsp;<span style="color: White;">]</span>&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: rgb(0, 255, 255);">2</span>; <br />        <br />        &nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">for</span>&nbsp;<span style="color: White;">(</span>&nbsp;Index&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: rgb(0, 255, 255);">3</span>;&nbsp;Index&nbsp;&lt;&nbsp;<span style="color: rgb(0, 255, 255);">0x10000ul</span>;&nbsp;<span style="color: White;">&#43;&#43;</span>Index&nbsp;<span style="color: White;">)</span> <br />        &nbsp;&nbsp;<span style="color: White;">{</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">bool</span>&nbsp;IsPrime&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: rgb(255, 255, 255);">true</span>; <br />        <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">unsigned</span>&nbsp;SubIndex&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: rgb(0, 255, 255);">0</span>; <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">while</span>&nbsp;<span style="color: White;">(</span>&nbsp;<span style="color: White;">(</span>&nbsp;SubIndex&nbsp;&lt;&nbsp;PrimeNumberCount&nbsp;<span style="color: White;">)</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">&amp;&amp;</span>&nbsp;<span style="color: White;">(</span>&nbsp;IsPrime&nbsp;<span style="color: White;">)</span>&nbsp;<span style="color: White;">)</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">{</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;Does&nbsp;it&nbsp;divide&nbsp;evenly&nbsp;by&nbsp;this&nbsp;prime&nbsp;number? <br />        </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">if</span>&nbsp;<span style="color: White;">(</span>&nbsp;<span style="color: rgb(0, 255, 255);">0</span>&nbsp;<span style="color: White;">==</span>&nbsp;<span style="color: White;">(</span>&nbsp;Index&nbsp;<span style="color: White;">%</span>&nbsp;PrimeNumbers<span style="color: White;">[</span>&nbsp;SubIndex&nbsp;<span style="color: White;">]</span>&nbsp;<span style="color: White;">)</span>&nbsp;<span style="color: White;">)</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">{</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IsPrime&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: rgb(255, 255, 255);">false</span>; <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">break</span>;&nbsp;<span style="color: rgb(153, 153, 153);">//&nbsp;&lt;-&nbsp;We&nbsp;can&nbsp;stop&nbsp;checking. <br />        </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">}</span> <br />        <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">&#43;&#43;</span>SubIndex; <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">}</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp; <br />        <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">if</span>&nbsp;<span style="color: White;">(</span>&nbsp;IsPrime&nbsp;<span style="color: White;">)</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrimeNumbers<span style="color: White;">[</span>&nbsp;PrimeNumberCount<span style="color: White;">&#43;&#43;</span>&nbsp;<span style="color: White;">]</span>&nbsp;<span style="color: White;">=</span>&nbsp;Index; <br />        &nbsp;&nbsp;<span style="color: White;">}</span> <br />        <br />        <span style="color: White;">}</span> <br />       </div>    </div>        <p class="Main">      We have an array to hold our prime numbers.  We set the first entry in the array to two&mdash;the first prime number (1 is prime, but who cares).  From this, we can test to check the rest of the numbers.  We loop from 3 to 2<sup>16</sup>.  For each number, we see if any of the primes already in the list will divide evenly into the number under question.  If any of them do, they are not prime.      </p>    <p class="Main">      It happens that there are 6542 prime numbers between 2 and 2<sup>16</sup>.  Knowing that, we can cap the array size of our lookup table at this value&mdash;the number of primes in this range will never change.    </p>    <p class="Main">      We now have enough prime numbers to check any number up to 2<sup>32</sup>.  Unlike the function that generates the prime lookup table, we can throw in one more speed improvement: we only need to check up to the square root of the number in question.  So here are the guts of the prime test function:    </p>       <div style="border: 1px solid rgb(255, 0, 0); overflow: auto; background-color: rgb(0, 0, 128); margin-left: 2em; height: 300px; width: 600px;">      <div style="padding: 2px; color: rgb(255, 255, 0); background-color: rgb(0, 0, 128); font-family: Courier New,Courier,mono; font-size: 14px; font-weight: bold;">        <span style="color: rgb(255, 255, 255);">bool</span>&nbsp;IsPrime<span style="color: White;">(</span>&nbsp;uint32_t&nbsp;Number&nbsp;<span style="color: White;">)</span> <br />        <span style="color: White;">{</span> <br />        &nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">bool</span>&nbsp;IsPrime&nbsp;&nbsp;&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: rgb(255, 255, 255);">true</span>; <br />        &nbsp;&nbsp;uint16_t&nbsp;Root&nbsp;&nbsp;<span style="color: White;">=</span>&nbsp;SquareRoot<span style="color: White;">(</span>&nbsp;Number&nbsp;<span style="color: White;">)</span>; <br />        &nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">unsigned</span>&nbsp;Index&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: rgb(0, 255, 255);">0</span>; <br />        <br />        &nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">while</span>&nbsp;<span style="color: White;">(</span>&nbsp;<span style="color: White;">(</span>&nbsp;Index&nbsp;&lt;&nbsp;NUMBER_OF_LOOKUP_PRIMES&nbsp;<span style="color: White;">)</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">&amp;&amp;</span>&nbsp;<span style="color: White;">(</span>&nbsp;PrimeNumbers<span style="color: White;">[</span>&nbsp;Index&nbsp;<span style="color: White;">]</span>&nbsp;&lt;<span style="color: White;">=</span>&nbsp;Root&nbsp;<span style="color: White;">)</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">&amp;&amp;</span>&nbsp;<span style="color: White;">(</span>&nbsp;IsPrime&nbsp;<span style="color: White;">)</span>&nbsp;<span style="color: White;">)</span> <br />        &nbsp;&nbsp;<span style="color: White;">{</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">if</span>&nbsp;<span style="color: White;">(</span>&nbsp;<span style="color: rgb(0, 255, 255);">0</span>&nbsp;<span style="color: White;">==</span>&nbsp;<span style="color: White;">(</span>&nbsp;Number&nbsp;<span style="color: White;">%</span>&nbsp;PrimeNumbers<span style="color: White;">[</span>&nbsp;Index&nbsp;<span style="color: White;">]</span>&nbsp;<span style="color: White;">)</span>&nbsp;<span style="color: White;">)</span> <br />        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IsPrime&nbsp;<span style="color: White;">=</span>&nbsp;<span style="color: rgb(255, 255, 255);">false</span>; <br />        <br />        &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: White;">&#43;&#43;</span>Index; <br />        &nbsp;&nbsp;<span style="color: White;">}</span> <br />        <br />        &nbsp;&nbsp;<span style="color: rgb(255, 255, 255);">return</span>&nbsp;IsPrime; <br />        <span style="color: White;">}</span> <br />      </div>    </div>       <p class="Main">      Note that can add two short cuts.  First, checking up to the root of the number like we discussed.  And second, we test to see if the number is even&mdash;2 is the only even number that is prime.      </p>    <p class="Main">      That's it.  Now we have a simple to implement prime number test that works on numbers up to 2<sup>32</sup>.        <a href="/Public/2010-02-02/prime_test.c">Here is the full source code</a>      to a command line version of the test.  Compile it, pass it a number (or several), and the program will tell you if the number is prime or not. <br /></p><p class="Main">&nbsp;</p><p class="Main">(thanks Erica for the correction)<br /></p>
                    </td>
                  </tr>
                  <tr>
                    <td>
                      <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                          <td align="center">
                            <table class="CommentTableBody" width="98%">
                              <tr>
                                <td class="CommentTableCell"> 
                                  <div style="text-align: center">No comments have been added </div>
                                  </td>
                                </tr>
                                <tr>
                                  <td class="CommentTableCell"> 
                                    <div style="text-align: center">
                                      <a href="http://www.DrQue.net/index.php?ArticleNumber=1940&amp;CommentArticle=1940#_1940" >
                                        + Add a comment
                                      </a>
                                    </div>
                                  </td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>

]]>                    </content:encoded>
                    <dc:subject>Daily photos</dc:subject>
                    <dc:date>2010-02-02T23:02:35Z</dc:date>
                  </item>
                      <item>
                        <title>02/01/2010 A good 32-bit LFSR polynomial</title>
                        <link>http://www.DrQue.net/index.php?ArticleNumber=1939#_1939</link>
                        <description>02/01/2010 A good 32-bit LFSR polynomial</description>
                        <content:encoded>
<![CDATA[
                  <table border="0" cellpadding="0" cellspacing="2">
                    <tr>
                      <td>
                        <p class="Main">       At work on Friday I came across an interesting math problem.  I needed a pseudo random bit stream, and I needed the generator function to be fast.  The typical random number function is a        <a href="http://en.wikipedia.org/wiki/Linear_congruential_generator">Linear congruential generator</a>, most often        <span style="font-family: Courier New,Courier,mono; font-size: 14px;">f(x) = (1103515245 * x &#43; 12345) mod 2<sup>32</sup>-1</span>.         The modulus remainder is implied&mdash;the arithmetic is simply allowed to overflow.  Multiplies are usually expensive in terms of CPU cycles.  A faster generator is a        <a href="http://en.wikipedia.org/wiki/LFSR">linear feedback shift register (LFSR)</a>, which are comprised of shifts and XORes.  I've used LFSR a number of times when I needed random data, without looking too much at the &quot;random&quot; stream of data it produced.     </p>     <p class="Main">       Using a 32-bit        <a href="http://en.wikipedia.org/wiki/LFSR#Galois_LFSRs">Galois LFSR</a>       with the polynomial x<sup>32</sup> &#43; x<sup>31</sup> &#43; x<sup>29</sup> &#43; x &#43; 1, and a seed of 0x12345678 produced this output:     </p>       <div style="border: 1px solid rgb(255, 0, 0); margin-left: 3em; background-color: rgb(0, 0, 128); width: 300px;">        <div style="color: rgb(255, 255, 0); background-color: rgb(0, 0, 128); font-family: Courier New,Courier,mono; font-size: 14px; font-weight: bold;">          2B3C091A 159E048D 8ACF0246 4566D123<br />         A2B36891 D158E448 68AC7224 34563912<br />         1A2B1C89 8D14DE44 468A6F22 23453791<br />         91A3CBC8 48D0B5E4 24685AF2 12342D79<br />         891A16BC 448D0B5E 2247D5AF 9122BAD7<br />         C8915D6B E449FEB5 F225AF5A 791387AD<br />         BC8893D6 5E4449EB AF2224F5 D791127A<br />         6BC9D93D B5E5BC9E 5AF38E4F AD789727<br />         D6BC4B93 EB5E25C9 F5AF12E4 7AD6D972<br />         3D6B6CB9 9EB4E65C 4F5A732E 27AD3997<br />         93D7CCCB C9EAB665 E4F55B32 727BFD99<br />         B93CAECC 5C9E5766 2E4F2BB3 9726C5D9<br />         CB9362EC 65C8E176 32E470BB 9972385D<br />         CCB91C2E 665DDE17 B32FBF0B D9968F85<br />         ECCB47C2 7664F3E1 BB3279F0 5D993CF8<br />         2ECDCE7C 1767B73E 0BB28B9F 85D945CF<br />         C2EDF2E7 E177A973 F0BA84B9 F85D425C<br />         7C2FF12E 3E16A897 9F0B544B CF84FA25<br />         E7C27D12 73E13E89 B9F1CF44 5CF9B7A2<br />         2E7D8BD1 973F95E8 4B9E9AF4 25CF4D7A<br />         12E6F6BD 89737B5E 44B8EDAF A25C76D7<br />         D12E3B6B E8971DB5 F44ADEDA 7A256F6D<br />         BD13E7B6 5E88A3DB AF4451ED D7A228F6<br />         6BD1147B B5E9DA3D DAF5BD1E 6D7B8E8F<br />         B6BC9747 DB5E4BA3 EDAF25D1 F6D6C2E8<br />        </div>     </div>      <p class="Main">        If you haven't noticed, the pattern &quot;scrolls&quot; digits to the right.  This is what one would expect&mdash;this is a &quot;shift&quot; register after all.  Each number is different, and the period between any two number (except for zero) is 2<sup>32</sup>.  However, the pattern between each successive number is fairly obvious.  This is because of the polynomial.  The shift register only introduces bits 31, 29, 1 and 0 when clocked.  Otherwise, output is simply shifted to the right by one.  I've arranged the data in 4 columns because each digit (nibble) is 4 bits, so after 4 bits, the nibble is completely shifted right by one.     </p>     <p class="Main">        While this pattern probably would work fine for what I was trying to do, I thought there must be a better solution.  A polynomial with more taps should produce a better random stream.  But how exactly does one go about generating a polynomial for a shift register?     </p>     <p class="Main">        What is need is a irreducible <a href="http://en.wikipedia.org/wiki/Primitive_polynomial">primitive polynomial</a>.  One can put any polynomial (i.e. any number as the polynomial term) into a LFSR they like, but it may not (probably won't) produce a maximum length shift register.  That is, a 32-bit word has 2<sup>32</sup> possibilities.  With the correct polynomial, the output of a 32-bit LFSR will produce 2<sup>32</sup> unique outputs before repeating.  Without the correct polynomial, one of two things will happen.  The output will happen after less then 2<sup>32</sup> iterations.  Or the output will never repeat and some smaller sub-sequence will repeat.     </p>     <p class="Main">        The polynomial of a LFSR is XORed in with the shifted data.  My thought was, if I wanted a better random pattern, we'd better XOR more bits.  And not just more bits, but spread out more or less evenly.  This should change the stream of data quite a bit.     </p>     <p class="Main">        So how does one create an irreducible primitive polynomial?  Good question.  I still don't have a complete solution, but I do have part of the solution.  I found a program written by a         <a href="http://notabs.org/primitivepolynomials/primitivepolynomials.htm">Scott Duplichan</a>        that generates primitive polynomials&mdash;although not necessarily irreducible.  It's designed to generate huge primitive polynomials&mdash;on the order of thousands of bits.  However, it also would do 32-bit.  What was nice about this program was that I could tell it the &quot;weight&quot; I wanted.  That is, how many bits I wanted set.  The number has to be odd, so I chose to generate polynomials with 15 bits.     </p>     <p class="Main">        There are a lot of primitive polynomials with a weight of 15&mdash;millions.  And most of them did not have bit patterns that were uniformly distributed.  For example, one of the first polynomials produced was 0x00041FFF.  While there are 15-bits set, there are pretty much all on one side.  The program didn't have a way to tell it to generate polynomials that had uniform distribution, but it did have the ability to find a set number of polynomials.  That was good enough for me.  I set the program off to find ten million primitive polynomials, and went off to do something else.  Just over an hour latter (4152 seconds actually), I had 10 million primitive polynomials with 15-bits set.     </p>     <p class="Main">        The next task was to find polynomials with a more uniform bit distribution.  To do this, I wiped up a filter program to only save polynomials that had, at most, 3-bits of the same bits in a row.  This significantly reduced the number of polynomials.  But I still did not have a list of irreducible primitive polynomials.  I started reading about how to test for this, but it was taking too much time.  It would be easier to brute force this problem.  I wanted a polynomial that was maximum length&mdash;that is, produced 2<sup>32</sup> unique values before repeating.  Any polynomial that did this was what I looking for.       </p>     <p class="Main">        It only takes a few seconds to brute-force check all 2<sup>32</sup> possibilities for a LFSR.  With the bit distribution restrictions, there were only 9,441 of the original ten million polynomials to check.  So, I launched a brute-force attack, and went home for the weekend.     </p>     <p class="Main">        When I came back this morning, I had a list of 40 irreducible primitive polynomials.  I'm not sure how long it took to complete this search, but that was irrelevant&mdash;I had my data.       </p>     <p class="Main">        Forty was still more polynomials then I needed.  So I decided to reduce the list a little further.  I just wanted prime polynomials.  This is an other brute-force test.  Any number is prime if all none of the prime number up to the square root of the number divide evenly into it.   My list was reduced from 40 to 10.  I picked the first number from the list, but any would have worked.     </p>        <p class="Main">        Again, my 32-bit Galois LFSR, this time with the polynomial 0x19253292B, and a seed of 0x12345678 produced this output:     </p>      <div style="border: 1px solid rgb(255, 0, 0); margin-left: 3em; background-color: rgb(0, 0, 128); width: 300px;">        <div style="color: rgb(255, 255, 0); background-color: rgb(0, 0, 128); font-family: Courier New,Courier,mono; font-size: 14px; font-weight: bold;">          2B3C091A 159E048D 8ACF0246 6C4C9370<br />         362649B8 1B1324DC 24A2803D 9251401E<br />         6003B25C 192ACB7D 8C9565BE 6F61A08C<br />         1E9BC215 A666F359 D33379AC 40B2AE85<br />         A0595742 7907B9F2 15A8CEAA 0AD46755<br />         856A33AA 42B519D5 88719EB9 ED13DD0F<br />         DFA2FCD4 6FD17E6A 1EC3AD66 264AC4E0<br />         13256270 20B9A36B B977C3E6 7590F3A0<br />         3AC879D0 1D643CE8 0EB21E74 07590F3A<br />         2A8795CE 3C68D8B4 1E346C5A 0F1A362D<br />         878D1B16 6AED9FD8 1C5DDDBF A705FC8C<br />         7AA9EC15 947FE459 E314E07F F18A703F<br />         F8C5381F D5498E5C 438FD57D 88ECF8ED<br />         C4767C76 623B3E3B 98368D4E 4C1B46A7<br />         8F26B100 47935880 0AE2BE13 85715F09<br />         EB93BDD7 DCE2CCB8 6E71665C 1E13A17D<br />         A622C2ED D3116176 40A3A2E8 097AC327<br />         84BD6193 EB75A29A 5C91C31E 0763F3DC<br />         2A9AEBBD 954D75DE 638DA8BC 18EDC60D<br />         A55DF155 FB85EAF9 D4E9E72F C35FE1C4<br />         4884E2B1 A4427158 522138AC 003B8E05<br />         A936D551 D49B6AA8 4366A707 A1B35383<br />         F9F2BB92 7CF95DC9 9757BCB7 E280CC08<br />         71406604 38A03302 1C501981 8E280CC0<br />         47140660 238A0330 11C50198 21C9929F<br />       </div>     </div>      <p class="Main">        And this looks much better.  But just because you can't see a pattern doesn't mean one doesn't exist.  In fact, one obviously exists&mdash;the data is from an equation.  But without the equation, how good does the random data look?  The quickest way to find out if data is random is to try and compress it.  If it compresses, it isn't very random.  For example, with 256 MBs of data from the original polynomial, we gets a stream that 7-zip could compress 54% of it's original size.  With the new polynomial, 7-zip was only able to compress it to 99.964% of it's original size.     </p>     <p class="Main">        Compression isn't the best judge of a file's randomness.  I knew there were better algorithms out for generating an entropy number.  Doing a quick search, I found         <a href="http://www.fourmilab.ch/random/">this program</a>        originally written by         <a href="http://en.wikipedia.org/wiki/John_Walker_%28programmer%29">John Walker</a><a>&mdash;one         of the co-founders of         </a><a href="http://en.wikipedia.org/wiki/AutoCAD">AutoCAD</a>.          It dates back to 1985, but the nice thing about math (unlike computer hardware) is it still works fine after 25 years.     </p>     <p class="Main">        The program produces the         <a href="http://en.wikipedia.org/wiki/Chi-square_distribution">chi-square distribution</a>,         which is given as percentage.  When this percentage is close (or near) to 0% or %100, the data stream is said to not be very random&mdash;even 95% or 5% are suspect.  The chi-square distribution of the first data set is 0.01%, or not even close to random.  The chi-square distribution for the new polynomial is 38.58%.  For comparison, the chi-square distribution of some output of the         <a href="http://en.wikipedia.org/wiki/XTEA">XTEA encryption algorithm</a> in a feedback loop had chi-square distribution of 26.5%.  Encryption algorithms desire to produce highly random output.     </p>      <p class="Main">       So our new polynomial of 0x9253292B produces a good psudo-random data stream when used in a 32-bit LFSR.     </p>
                        </td>
                      </tr>
                      <tr>
                        <td>
                          <table width="100%" cellpadding="0" cellspacing="0">
                            <tr>
                              <td align="center">
                                <table class="CommentTableBody" width="98%">
                                  <tr>
                                    <td class="CommentTableCell"> 
                                      <div style="text-align: center">No comments have been added </div>
                                      </td>
                                    </tr>
                                    <tr>
                                      <td class="CommentTableCell"> 
                                        <div style="text-align: center">
                                          <a href="http://www.DrQue.net/index.php?ArticleNumber=1939&amp;CommentArticle=1939#_1939" >
                                            + Add a comment
                                          </a>
                                        </div>
                                      </td>
                                    </tr>
                                  </table>
                                </td>
                              </tr>
                            </table>
                          </td>
                        </tr>
                      </table>

]]>                        </content:encoded>
                        <dc:subject>Daily photos</dc:subject>
                        <dc:date>2010-02-01T23:02:35Z</dc:date>
                      </item>
                            <item>
                              <title>01/05/2010</title>
                              <link>http://www.DrQue.net/index.php?ArticleNumber=1938#_1938</link>
                              <description>01/05/2010</description>
                              <content:encoded>
<![CDATA[
                      <table border="0" cellpadding="0" cellspacing="2">
                        <tr>
                          <td>
                            <table border="0" style="float: left; margin: 5px;" cellpadding="0" cellspacing="0">
                              <tr>

                                <td>
                                  <img src="http://www.DrQue.net/ Gallery/2010_01_01/300x300/Desirae11.jpg" style="border: 0px" alt="" />
                                </td>

                              </tr>
                              <tr>

                                <td align="center">
                                  <b>Desirae</b>
                                  <table width="100%" cellpadding="0" cellspacing="0">
                                    <tr>
                                      <td align="center">
                                        <table style="margin-top: 4px">
                                          <tr>
                                            <td>
                                            </td>
                                          </tr>
                                        </table>
                                      </td>
                                    </tr>
                                  </table>
                                </td>

                              </tr>
                            </table>
                            &nbsp;&nbsp; It might be a while before I post pictures.&nbsp; This evening, my camera started acting really strange.&nbsp; As soon as I put the battery in it, the shuttle started snapping--even with the camera turned off.&nbsp; I tried several things, but nothing seemed to work.&nbsp; Once and awhile, I got the message &quot;Err 99&quot;.&nbsp; After some reading on the web, I found this is a fairly common problem with the 20D when the shutter system dies.&nbsp; Seems the average cost of repair is around $200.&nbsp; So the question is, repair or upgrade?
                          </td>
                        </tr>
                        <tr>
                          <td>
                            <table width="100%" cellpadding="0" cellspacing="0">
                              <tr>
                                <td align="center">
                                  <table class="CommentTableBody" width="98%">
                                    <tr>
                                      <td class="CommentTableCell">
                                        3 comments have been made
                                      </td>
                                    </tr>
                                    <tr>
                                      <td class="CommentTableCell">
                                        <b>From </b><br/>
                                        <small>
                                          January 31st, 2010 at 5:27PM
                                        </small>
                                        <br />

                                          <table width="100%">
                                            <tr>
                                              <td class="CommentTableSubCell">
                                                &nbsp;&nbsp;&nbsp;Moar liek &quot;Dies Irae,&quot; amirite?<br />
                                              </td>
                                            </tr>
                                          </table>

                                        </td>
                                      </tr>
                                      <tr>
                                        <td class="CommentTableCell">
                                          <b>From </b><br/>
                                          <small>
                                            January 27th, 2010 at 6:30AM
                                          </small>
                                          <br />

                                            <table width="100%">
                                              <tr>
                                                <td class="CommentTableSubCell">
                                                  &nbsp;&nbsp;&nbsp;UPGRADE! (if it isn't too late for my opinion)<br />
                                                </td>
                                              </tr>
                                            </table>

                                          </td>
                                        </tr>
                                        <tr>
                                          <td class="CommentTableCell">
                                            <b>From </b><br/>
                                            <small>
                                              January 19th, 2010 at 4:03AM
                                            </small>
                                            <br />

                                              <table width="100%">
                                                <tr>
                                                  <td class="CommentTableSubCell">
                                                    &nbsp;&nbsp;&nbsp;That was an inspiring post,
Cool piercings,
Thanks for writing, most people don't bother.<br />
                                                  </td>
                                                </tr>
                                              </table>

                                            </td>
                                          </tr>
                                          <tr>
                                            <td class="CommentTableCell"> 
                                              <div style="text-align: center">
                                                <a href="http://www.DrQue.net/index.php?ArticleNumber=1938&amp;CommentArticle=1938#_1938" >
                                                  + Add a comment
                                                </a>
                                              </div>
                                            </td>
                                          </tr>
                                        </table>
                                      </td>
                                    </tr>
                                  </table>
                                </td>
                              </tr>
                            </table>

]]>                              </content:encoded>
                              <dc:subject>Daily photos</dc:subject>
                              <dc:date>2010-01-05T20:01:43Z</dc:date>
                            </item>
                              <item>
                                <title>01/04/2010</title>
                                <link>http://www.DrQue.net/index.php?ArticleNumber=1937#_1937</link>
                                <description>01/04/2010</description>
                                <content:encoded>
<![CDATA[
                            <table border="0" cellpadding="0" cellspacing="2">
                              <tr>
                                <td>
                                  <table border="0" style="float: left; margin: 5px;" cellpadding="0" cellspacing="0">
                                    <tr>

                                      <td>
                                        <img src="http://www.DrQue.net/Gallery/2010_01_01/300x300/Kelvin.jpg" style="border: 0px" alt="" />
                                      </td>

                                    </tr>
                                    <tr>

                                      <td align="center">
                                        <table width="100%" cellpadding="0" cellspacing="0">
                                          <tr>
                                            <td align="center">
                                              <table style="margin-top: 4px">
                                                <tr>
                                                  <td>
                                                  </td>
                                                </tr>
                                              </table>
                                            </td>
                                          </tr>
                                        </table>
                                      </td>

                                    </tr>
                                  </table>
                                  &nbsp;&nbsp; Kelvin at coffee on New Year's day.
                                </td>
                              </tr>
                              <tr>
                                <td>
                                  <table width="100%" cellpadding="0" cellspacing="0">
                                    <tr>
                                      <td align="center">
                                        <table class="CommentTableBody" width="98%">
                                          <tr>
                                            <td class="CommentTableCell"> 
                                              <div style="text-align: center">No comments have been added </div>
                                              </td>
                                            </tr>
                                            <tr>
                                              <td class="CommentTableCell"> 
                                                <div style="text-align: center">
                                                  <a href="http://www.DrQue.net/index.php?ArticleNumber=1937&amp;CommentArticle=1937#_1937" >
                                                    + Add a comment
                                                  </a>
                                                </div>
                                              </td>
                                            </tr>
                                          </table>
                                        </td>
                                      </tr>
                                    </table>
                                  </td>
                                </tr>
                              </table>

]]>                                </content:encoded>
                                <dc:subject>Daily photos</dc:subject>
                                <dc:date>2010-01-04T20:01:43Z</dc:date>
                              </item>
                                <item>
                                  <title>01/03/2010</title>
                                  <link>http://www.DrQue.net/index.php?ArticleNumber=1936#_1936</link>
                                  <description>01/03/2010</description>
                                  <content:encoded>
<![CDATA[
                              <table border="0" cellpadding="0" cellspacing="2">
                                <tr>
                                  <td>
                                    <table border="0" style="float: left; margin: 5px;" cellpadding="0" cellspacing="0">
                                      <tr>

                                        <td>
                                          <img src="http://www.DrQue.net/Gallery/2010_01_01/300x300/Jennifer.jpg" style="border: 0px" alt="" />
                                        </td>

                                      </tr>
                                      <tr>

                                        <td align="center">
                                          <table width="100%" cellpadding="0" cellspacing="0">
                                            <tr>
                                              <td align="center">
                                                <table style="margin-top: 4px">
                                                  <tr>
                                                    <td>
                                                      <small>
                                                        (<a href="http://www.DrQue.net/Gallery/2010_01_01/600x600/Jennifer.jpg" onclick="window.open(this.href,'_blank');return false;">600x600</a>)
                                                      </small>
                                                      <small>
                                                        (<a href="http://www.DrQue.net/Gallery/2010_01_01/900x900/Jennifer.jpg" onclick="window.open(this.href,'_blank');return false;">900x900</a>)
                                                      </small>
                                                      <small>
                                                        (<a href="http://www.DrQue.net/Gallery/2010_01_01/1800x1800/Jennifer.jpg" onclick="window.open(this.href,'_blank');return false;">1800x1800</a>)
                                                      </small>
<br />                                                    </td>
                                                  </tr>
                                                </table>
                                              </td>
                                            </tr>
                                          </table>
                                        </td>

                                      </tr>
                                    </table>
                                    &nbsp;&nbsp; Jenny at the New Year's Eve gathering.
                                  </td>
                                </tr>
                                <tr>
                                  <td>
                                    <table width="100%" cellpadding="0" cellspacing="0">
                                      <tr>
                                        <td align="center">
                                          <table class="CommentTableBody" width="98%">
                                            <tr>
                                              <td class="CommentTableCell"> 
                                                <div style="text-align: center">No comments have been added </div>
                                                </td>
                                              </tr>
                                              <tr>
                                                <td class="CommentTableCell"> 
                                                  <div style="text-align: center">
                                                    <a href="http://www.DrQue.net/index.php?ArticleNumber=1936&amp;CommentArticle=1936#_1936" >
                                                      + Add a comment
                                                    </a>
                                                  </div>
                                                </td>
                                              </tr>
                                            </table>
                                          </td>
                                        </tr>
                                      </table>
                                    </td>
                                  </tr>
                                </table>

]]>                                  </content:encoded>
                                  <dc:subject>Daily photos</dc:subject>
                                  <dc:date>2010-01-03T20:01:43Z</dc:date>
                                </item>
                                  <item>
                                    <title>01/02/2010</title>
                                    <link>http://www.DrQue.net/index.php?ArticleNumber=1935#_1935</link>
                                    <description>01/02/2010</description>
                                    <content:encoded>
<![CDATA[
                                <table border="0" cellpadding="0" cellspacing="2">
                                  <tr>
                                    <td>
                                      <table border="0" style="float: left; margin: 5px;" cellpadding="0" cellspacing="0">
                                        <tr>

                                          <td>
                                            <img src="http://www.DrQue.net/Gallery/2010_01_01/300x300/Jai&amp;Que.jpg" style="border: 0px" alt="" />
                                          </td>

                                        </tr>
                                        <tr>

                                          <td align="center">
                                            <table width="100%" cellpadding="0" cellspacing="0">
                                              <tr>
                                                <td align="center">
                                                  <table style="margin-top: 4px">
                                                    <tr>
                                                      <td>
                                                        <small>
                                                          (<a href="http://www.DrQue.net/Gallery/2010_01_01/600x600/Jai&amp;Que.jpg" onclick="window.open(this.href,'_blank');return false;">600x600</a>)
                                                        </small>
                                                        <small>
                                                          (<a href="http://www.DrQue.net/Gallery/2010_01_01/900x900/Jai&amp;Que.jpg" onclick="window.open(this.href,'_blank');return false;">900x900</a>)
                                                        </small>
                                                        <small>
                                                          (<a href="http://www.DrQue.net/Gallery/2010_01_01/1800x1800/Jai&amp;Que.jpg" onclick="window.open(this.href,'_blank');return false;">1800x1800</a>)
                                                        </small>
<br />                                                      </td>
                                                    </tr>
                                                  </table>
                                                </td>
                                              </tr>
                                            </table>
                                          </td>

                                        </tr>
                                      </table>
                                      &nbsp;&nbsp; Jai and myself at coffee New Years Day.
                                    </td>
                                  </tr>
                                  <tr>
                                    <td>
                                      <table width="100%" cellpadding="0" cellspacing="0">
                                        <tr>
                                          <td align="center">
                                            <table class="CommentTableBody" width="98%">
                                              <tr>
                                                <td class="CommentTableCell">
                                                  1 comment has been made
                                                </td>
                                              </tr>
                                              <tr>
                                                <td class="CommentTableCell">
                                                  <b>From </b><br/>
                                                  <small>
                                                    January 31st, 2010 at 5:29PM
                                                  </small>
                                                  <br />

                                                    <table width="100%">
                                                      <tr>
                                                        <td class="CommentTableSubCell">
                                                          &nbsp;&nbsp;&nbsp;Oooh, Coffee! ;-)<br />
                                                        </td>
                                                      </tr>
                                                    </table>

                                                  </td>
                                                </tr>
                                                <tr>
                                                  <td class="CommentTableCell"> 
                                                    <div style="text-align: center">
                                                      <a href="http://www.DrQue.net/index.php?ArticleNumber=1935&amp;CommentArticle=1935#_1935" >
                                                        + Add a comment
                                                      </a>
                                                    </div>
                                                  </td>
                                                </tr>
                                              </table>
                                            </td>
                                          </tr>
                                        </table>
                                      </td>
                                    </tr>
                                  </table>

]]>                                    </content:encoded>
                                    <dc:subject>Daily photos</dc:subject>
                                    <dc:date>2010-01-02T20:01:43Z</dc:date>
                                  </item>
                                </channel>
                              </rss>
