<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://srtsolutions.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Lazy Evaluation</title><subtitle type="html">Marina&amp;#39;s coding (mis)adventures</subtitle><id>http://srtsolutions.com/blogs/marinafedner/atom.aspx</id><link rel="alternate" type="text/html" href="http://srtsolutions.com/blogs/marinafedner/default.aspx" /><link rel="self" type="application/atom+xml" href="http://srtsolutions.com/blogs/marinafedner/atom.aspx" /><generator uri="http://communityserver.org" version="3.1.20917.1142">Community Server</generator><updated>2008-03-29T20:01:00Z</updated><entry><title>euler problem #5</title><link rel="alternate" type="text/html" href="http://srtsolutions.com/blogs/marinafedner/archive/2008/05/01/euler-problem-5.aspx" /><id>http://srtsolutions.com/blogs/marinafedner/archive/2008/05/01/euler-problem-5.aspx</id><published>2008-05-02T01:40:00Z</published><updated>2008-05-02T01:40:00Z</updated><content type="html">&lt;p&gt;&lt;i&gt;&amp;nbsp;What is the smallest number that is evenly divisible by all of the numbers from 1 to 20?&lt;/i&gt;&lt;/p&gt;&lt;p&gt;----&lt;/p&gt;&lt;p&gt;To solve this problem easily, we need to remember that the smallest number that is evenly divisible by two numbers is their least common multiple.&amp;nbsp; Armed with this knowledge (and the fact that ruby already has a least common multiple function!), we can write:&lt;/p&gt;

&lt;div id="content"&gt;&lt;p&gt;numbers=(1..20).to_a&lt;br /&gt;puts numbers.inject{ |x,n| x.lcm(n) } 
&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;

&lt;p&gt;So for those of you at SRT (or elsewhere) that still harbor any doubts about ruby, can you beat that?!&amp;nbsp; Fine, ok, so you might say that using a built-in lcm function is kind of lame.&amp;nbsp; So as a bonus, here&amp;#39;s how I implemented lcm myself in a cute way using the greatest common divisor:&lt;/p&gt;

&lt;div id="content"&gt;
&lt;p&gt;def gcd(a,b)&lt;br /&gt;&amp;nbsp; if b==0 : a&lt;br /&gt;&amp;nbsp; else &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gcd(b, a % b )&lt;br /&gt;&amp;nbsp; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;def lcm(a,b)&lt;br /&gt;&amp;nbsp; (a*b)/gcd(a,b)&lt;br /&gt;end &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=3050" width="1" height="1"&gt;</content><author><name>mfedner</name><uri>http://srtsolutions.com/members/mfedner.aspx</uri></author><category term="euler" scheme="http://srtsolutions.com/blogs/marinafedner/archive/tags/euler/default.aspx" /><category term="ruby" scheme="http://srtsolutions.com/blogs/marinafedner/archive/tags/ruby/default.aspx" /></entry><entry><title>Geeky gear</title><link rel="alternate" type="text/html" href="http://srtsolutions.com/blogs/marinafedner/archive/2008/04/12/geeky-gear.aspx" /><id>http://srtsolutions.com/blogs/marinafedner/archive/2008/04/12/geeky-gear.aspx</id><published>2008-04-13T03:51:00Z</published><updated>2008-04-13T03:51:00Z</updated><content type="html">&lt;p&gt;A while ago, we had a discussion here at the office about nerdy t-shirts.&amp;nbsp; We all know what I&amp;#39;m talking about: usually worn by a male geek/programmer with a neckbeard, a black shirt with a &amp;quot;witty&amp;quot; technical reference.&amp;nbsp; Opinions about these shirts vary among SRT employees: some of us find them funny and even wear them on dates [no report on the results, though], some are skeptical.&amp;nbsp; You might guess that I fall into the second camp.&amp;nbsp; Here are the worst offenders in my book:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.thinkgeek.com/images/products/front/geek_love_poem.jpg" alt="geek love poem" align="" border="" height="286" hspace="" width="220" /&gt;&lt;/p&gt;&lt;p&gt;The geek love poem...&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.thinkgeek.com/images/products/front/noplace.jpg" alt="No place like home" align="middle" border="" height="286" hspace="" width="220" /&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;It&amp;#39;s so bad it&amp;#39;s good. &lt;/p&gt;&lt;p&gt;&lt;img src="http://www.thinkgeek.com/images/products/front/binary-people.jpg" alt="2 types of people" align="middle" border="" height="283" hspace="" width="220" /&gt;&lt;/p&gt;&lt;p&gt;The worst one of all.&amp;nbsp; Nearly ubiquitous in computer science buildings on campuses nationwide, but yet still considered brilliant and unique by the wearer.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;And of course, I can&amp;#39;t leave out geeky women&amp;#39;s gear -- in some ways even more horrifying than the men&amp;#39;s stuff.&amp;nbsp; Evidence presented:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;img src="http://image0.etsy.com/il_430xN.8181328.jpg" alt="html earrings" align="middle" border="" height="346" hspace="" width="430" /&gt; &lt;/p&gt;&lt;p&gt;HTML tags -- get it?! &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.thinkgeek.com/images/products/front/httppanties_4up.jpg" alt="HTTPanties" align="middle" border="" height="363" hspace="" width="250" /&gt;&lt;/p&gt;&lt;p&gt;I have no words.&amp;nbsp; Instead I&amp;#39;ll leave you with ThinkGeek&amp;#39;s description of these: &amp;quot;... we bring you &lt;b&gt;HTTPanties&lt;/b&gt;
for the discriminating woman who would prefer a web-savvy and somewhat-direct 
approach in the romance department.&amp;nbsp; Feeling frisky? Well then don the black &amp;quot;200 OK&amp;quot; panties and see where they take 
you. Alternatively, the white &amp;quot;403 Forbidden&amp;quot; style sends a very different 
and hopefully clear message. We think &amp;quot;411 Length Required&amp;quot; and &amp;quot;413 Requested Entity Too Large&amp;quot; are pretty self-explanatory.&amp;quot;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=2760" width="1" height="1"&gt;</content><author><name>mfedner</name><uri>http://srtsolutions.com/members/mfedner.aspx</uri></author><category term="nerd" scheme="http://srtsolutions.com/blogs/marinafedner/archive/tags/nerd/default.aspx" /></entry><entry><title>Euler Problem 4</title><link rel="alternate" type="text/html" href="http://srtsolutions.com/blogs/marinafedner/archive/2008/04/08/euler-problem-4.aspx" /><id>http://srtsolutions.com/blogs/marinafedner/archive/2008/04/08/euler-problem-4.aspx</id><published>2008-04-09T00:35:00Z</published><updated>2008-04-09T00:35:00Z</updated><content type="html">&lt;p&gt;&lt;i&gt;&amp;nbsp;Find the largest palindrome made from the product of two 3-digit numbers.&lt;/i&gt;&lt;/p&gt;&lt;p&gt;-----&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;First, I defined a palindrome recursively: a number is one if its first and last digits are the same, and if the inside is also a palindrome.&lt;/p&gt;

&lt;div id="content"&gt;&lt;p&gt;def palindrome?(digitArr)&lt;br /&gt;&amp;nbsp; if digitArr.empty?&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; true&lt;br /&gt;&amp;nbsp; elsif digitArr.length == 1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; true &lt;br /&gt;&amp;nbsp; else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (digitArr.first == digitArr.last &amp;amp;&amp;amp; palindrome?(digitArr[1..-2]))&amp;nbsp; &lt;br /&gt;&amp;nbsp; end&lt;br /&gt;end&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;

&lt;p&gt;Note that in Ruby, methods can end with a question mark, a convention that really helps readability.&amp;nbsp; Also note that the &amp;quot;else if&amp;quot; keyword is &lt;b&gt;elsif&lt;/b&gt;, which is weird and unhelpful to me.&amp;nbsp; I want that 20 minutes of staring at my code like &amp;quot;wtf?!&amp;quot; (before figuring that out) back.&lt;/p&gt;&lt;p&gt;&amp;nbsp;Then we do a search of all the multiples of two three-digit numbers until we find the biggest palindrome:&lt;/p&gt;

&lt;div id="content"&gt;&lt;p&gt;def search(i,j)&lt;br /&gt;&amp;nbsp; maxPal=0&lt;br /&gt;&amp;nbsp; while i &amp;gt; 99 do&lt;br /&gt;&amp;nbsp;&amp;nbsp; j=999&lt;br /&gt;&amp;nbsp;&amp;nbsp; while j &amp;gt; 99 do&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if palindrome?((i*j).to_s.split(&amp;quot;&amp;quot;)) then &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(i*j)&amp;gt; maxPal then maxPal = i*j&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;br /&gt;&amp;nbsp;&amp;nbsp; j-=1&lt;br /&gt;&amp;nbsp;&amp;nbsp; end&lt;br /&gt;&amp;nbsp; i-=1&lt;br /&gt;&amp;nbsp; end&lt;br /&gt;&amp;nbsp; return maxPal&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;puts search(999,999)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;

&lt;p&gt;There&amp;#39;s probably a prettier way to do this.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=2699" width="1" height="1"&gt;</content><author><name>mfedner</name><uri>http://srtsolutions.com/members/mfedner.aspx</uri></author><category term="euler" scheme="http://srtsolutions.com/blogs/marinafedner/archive/tags/euler/default.aspx" /><category term="ruby" scheme="http://srtsolutions.com/blogs/marinafedner/archive/tags/ruby/default.aspx" /></entry><entry><title>Euler Problem 3</title><link rel="alternate" type="text/html" href="http://srtsolutions.com/blogs/marinafedner/archive/2008/04/08/euler-problem-3.aspx" /><id>http://srtsolutions.com/blogs/marinafedner/archive/2008/04/08/euler-problem-3.aspx</id><published>2008-04-09T00:07:00Z</published><updated>2008-04-09T00:07:00Z</updated><content type="html">&lt;p&gt;&lt;i&gt;&amp;nbsp;What is the largest prime factor of the number 600851475143 ?&lt;/i&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;-----&lt;/p&gt;&lt;p&gt;&amp;nbsp;I wrote this piece of disgusting, un-Rubylike Ruby to get the answer by creating a list of a number&amp;#39;s prime factors:&lt;/p&gt;

&lt;div id="content"&gt;&lt;p&gt;&amp;nbsp;def factor(composite)&lt;br /&gt;&amp;nbsp; i=1&lt;br /&gt;&amp;nbsp; flag=false&lt;br /&gt;&amp;nbsp; primefactors =[]&lt;br /&gt;&amp;nbsp; while (i &amp;lt; composite)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i=i+1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; primefactors.each{|p| flag=true if (i%p).zero?}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if flag then flag=false &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else # if it is a prime&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; primefactors.push(i)&amp;nbsp;&amp;nbsp; &amp;nbsp;#add the prime (since it&amp;#39;s a prime factor)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (composite%i).zero?&amp;nbsp;&amp;nbsp; # as long as n is divisbible by the prime&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; composite /=&amp;nbsp; i&amp;nbsp;&amp;nbsp;&amp;nbsp; # divide n by the prime&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;br /&gt;&amp;nbsp; end&lt;br /&gt;&amp;nbsp; primefactors&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;puts factor(600851475143).last&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;

&lt;p&gt;And then I learned that ruby has a prime number generator.&amp;nbsp; All I need to do is:&lt;/p&gt;

&lt;div id="content"&gt;&lt;p&gt;require &amp;#39;mathn&amp;#39;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;n = 600851475143&lt;br /&gt;factor = 0&lt;br /&gt;primes = Prime.new&lt;br /&gt;while n &amp;gt; 1&lt;br /&gt;&amp;nbsp; factor = primes.next&lt;br /&gt;&amp;nbsp; while (n % factor).zero? &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n /= factor &lt;br /&gt;&amp;nbsp; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;puts factor&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;/div&gt;

&lt;p&gt;&amp;nbsp;I am slightly ashamed.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=2698" width="1" height="1"&gt;</content><author><name>mfedner</name><uri>http://srtsolutions.com/members/mfedner.aspx</uri></author><category term="euler" scheme="http://srtsolutions.com/blogs/marinafedner/archive/tags/euler/default.aspx" /><category term="ruby" scheme="http://srtsolutions.com/blogs/marinafedner/archive/tags/ruby/default.aspx" /><category term="incompetence" scheme="http://srtsolutions.com/blogs/marinafedner/archive/tags/incompetence/default.aspx" /></entry><entry><title>Project Euler: Problem 2</title><link rel="alternate" type="text/html" href="http://srtsolutions.com/blogs/marinafedner/archive/2008/04/06/project-euler-problem-2.aspx" /><id>http://srtsolutions.com/blogs/marinafedner/archive/2008/04/06/project-euler-problem-2.aspx</id><published>2008-04-06T23:55:00Z</published><updated>2008-04-06T23:55:00Z</updated><content type="html">&lt;p&gt;The problem:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Find the sum of all the even-valued terms in the [Fibonacci] sequence which do not exceed four million.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s my fibonacci function:&lt;/p&gt;

&lt;div id="content"&gt;&lt;p&gt;def fib(limit =nil)&lt;br /&gt;&amp;nbsp; f1 = 0&lt;br /&gt;&amp;nbsp; f2 = 1&lt;br /&gt;&amp;nbsp; while (not limit or f2 &amp;lt;= limit)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yield f2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f1,f2 = f2, f1+f2&lt;br /&gt;&amp;nbsp; end&lt;br /&gt;end&lt;/p&gt;&lt;/div&gt;

&lt;p&gt;And here&amp;#39;s how I use it to get the answer:&lt;/p&gt;

&lt;div id="content"&gt;&lt;p&gt;evens=[]&lt;br /&gt;fib { |x| if x%2==0 : evens.push(x) end ; if x&amp;gt;4000000: break end}&lt;br /&gt;puts evens.inject {|sum, n| sum+n} &lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;I learned about the awesomeness of &amp;#39;yield&amp;#39; by doing this problem, so it was totally worth it.&amp;nbsp; yield let me calculate as many fibonacci terms as I needed, but not more, and without having to calculate any term more than once.&amp;nbsp;&amp;nbsp;  &lt;/p&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=2669" width="1" height="1"&gt;</content><author><name>mfedner</name><uri>http://srtsolutions.com/members/mfedner.aspx</uri></author><category term="euler" scheme="http://srtsolutions.com/blogs/marinafedner/archive/tags/euler/default.aspx" /><category term="ruby" scheme="http://srtsolutions.com/blogs/marinafedner/archive/tags/ruby/default.aspx" /></entry><entry><title>Project Euler in Ruby</title><link rel="alternate" type="text/html" href="http://srtsolutions.com/blogs/marinafedner/archive/2008/04/06/project-euler-in-ruby.aspx" /><id>http://srtsolutions.com/blogs/marinafedner/archive/2008/04/06/project-euler-in-ruby.aspx</id><published>2008-04-06T17:31:00Z</published><updated>2008-04-06T17:31:00Z</updated><content type="html">&lt;p&gt;I&amp;#39;m taking Bill Wagner up on his &lt;a href="http://srtsolutions.com/blogs/billwagner/archive/2008/03/25/project-euler-problem-1.aspx" title="project euler" target="_blank"&gt;Project Euler challenge&lt;/a&gt;, but in Ruby.&amp;nbsp; I&amp;#39;ve secretly wanted to learn Ruby for a long time, and this looks like the perfect chance.&amp;nbsp; So if my code makes your eyes bleed, it&amp;#39;s cause I&amp;#39;m a total n00b.&amp;nbsp; Without further ado (because the excitement was becoming unbearable... I agree, Ruby &lt;span style="font-style:italic;"&gt;is&lt;/span&gt; sexy!), here&amp;#39;s my code that prints the answer to Problem 1:&lt;/p&gt;


&lt;p&gt;&lt;i&gt;If we list all the natural numbers below 10 that are multiples of 3
or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.&amp;nbsp; Find the sum of all the multiples of 3 or 5 below 1000.&lt;/i&gt;&lt;/p&gt;

&lt;div id="content"&gt;&lt;p&gt;answer = (0..999).&lt;b&gt;select&lt;/b&gt; { |a| a%3 ==0 || a%5==0 }&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;puts&lt;/span&gt; answer.&lt;span style="font-weight:bold;"&gt;inject&lt;/span&gt; { |sum, n| sum+n }&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;

&lt;p&gt;I love the built-in ruby function &lt;b&gt;inject&lt;/b&gt;, which is like foldl in some functional languages.&amp;nbsp; (See a cute demo &lt;a href="http://foldl.com/" title="Foldl"&gt;here&lt;/a&gt;.) &amp;nbsp; Overall the code is very similar to Bill&amp;#39;s C# version.&amp;nbsp; I wonder if that&amp;#39;ll still be the case as we get to the more complex problems.&lt;/p&gt;&lt;p&gt;&amp;nbsp;[4/08/08: correction of a typo in the code] &lt;br /&gt;&lt;/p&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=2666" width="1" height="1"&gt;</content><author><name>mfedner</name><uri>http://srtsolutions.com/members/mfedner.aspx</uri></author><category term="euler" scheme="http://srtsolutions.com/blogs/marinafedner/archive/tags/euler/default.aspx" /><category term="ruby" scheme="http://srtsolutions.com/blogs/marinafedner/archive/tags/ruby/default.aspx" /></entry><entry><title>The Google Data query interface</title><link rel="alternate" type="text/html" href="http://srtsolutions.com/blogs/marinafedner/archive/2008/03/29/the-google-data-query-interface.aspx" /><id>http://srtsolutions.com/blogs/marinafedner/archive/2008/03/29/the-google-data-query-interface.aspx</id><published>2008-03-30T00:01:00Z</published><updated>2008-03-30T00:01:00Z</updated><content type="html">&lt;p&gt;I know I&amp;#39;m not the only one with tons of my data stored somewhere on Google&amp;#39;s servers these days (frightening, I know.)&amp;nbsp; Luckily, there&amp;#39;s the Google Data API, which lets us access and modify our Google data programmatically, should we decide to, say, display it on our websites or build custom applications to process it. &lt;/p&gt;&lt;p&gt;The API uses HTTP requests to transfer data, building on top of RSS and Atom the ability to send a query and receive a feed of matching results.&amp;nbsp; This is cool, because it means we can access our data easily, just by creating the appropriate HTTP query.&amp;nbsp; Here&amp;#39;s what I mean:&lt;/p&gt;&lt;p&gt;This is the XML feed of our SRT Events Google Calendar:&amp;nbsp; http://www.google.com/calendar/feeds/v2433p4md2226qtd3ja1annifc%40group.calendar.google.com/public/basic&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;We can add query parameters to the end of this URL:&amp;nbsp; http://www.google.com/calendar/feeds/v2433p4md2226qtd3ja1annifc%40group.calendar.google.com/public/basic?max-results=10&amp;amp;orderby=starttime&lt;/p&gt;&lt;p&gt;That new-and-improved feed is the full calendar feed of events, filtered to leave only 10 results and ordered by the start date of the event.&amp;nbsp; Note that in addition to a standard set of parameters for all
Google Data, there are some special ones defined for each app, like
&amp;quot;racy&amp;quot; in YouTube.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Here&amp;#39;s the metadata for the most-viewed YouTube videos:&lt;/p&gt;&lt;p&gt;http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed&lt;/p&gt;&lt;p&gt;and adding these query parameters gives us just the family-friendly ones, ordered by rating.&lt;/p&gt;&lt;p&gt;http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed?orderby=rating&amp;amp;racy=exclude&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Now that we&amp;#39;ve got these custom feeds, we can just use any standard libraries to parse or display them. Pretty cool.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;img src="http://srtsolutions.com/aggbug.aspx?PostID=2595" width="1" height="1"&gt;</content><author><name>mfedner</name><uri>http://srtsolutions.com/members/mfedner.aspx</uri></author><category term="google" scheme="http://srtsolutions.com/blogs/marinafedner/archive/tags/google/default.aspx" /></entry></feed>