<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vidul Nikolaev Petrov &#187; senseless</title>
	<atom:link href="http://www.vidul.com/category/senseless/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vidul.com</link>
	<description>my web space</description>
	<lastBuildDate>Sat, 24 Sep 2011 06:11:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Lotto checking script</title>
		<link>http://www.vidul.com/2008/02/12/lotto-checking-script/</link>
		<comments>http://www.vidul.com/2008/02/12/lotto-checking-script/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 19:16:00 +0000</pubDate>
		<dc:creator>Vidul</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[senseless]]></category>

		<guid isPermaLink="false">urn:uuid:{a.guid}</guid>
		<description><![CDATA[The idea comes from http://www.waider.ie/hacks/workshop/perl/lotto.pl script.
Should I be so wasteful? No:
irb

my_numbers       = &#91;1,2,3,4,5,6&#93;
winning_numbers = &#91;1,2,3,41,42,43&#93;
&#160;
result = 6 - &#40;winning_numbers - my_numbers&#41;.size
&#160;
puts &#34;#{result} &#34; +
  if not result.eql? 0
    &#34;hits&#34;
  else
    &#34;hit&#34;
  end






		
			Share this on Blinklist
		
		
			Share this on del.icio.us
		
		
			Digg this!
		
		
			Share this [...]]]></description>
			<content:encoded><![CDATA[<p>The idea comes from <a href="http://www.waider.ie/hacks/workshop/perl/lotto.pl">http://www.waider.ie/hacks/workshop/perl/lotto.pl script</a>.</p>
<p>Should I be so wasteful? No:</p>
<p><strong>irb</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:arial,verdana,monospace;">my_numbers       = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span>,<span style="color:#006666;">2</span>,<span style="color:#006666;">3</span>,<span style="color:#006666;">4</span>,<span style="color:#006666;">5</span>,<span style="color:#006666;">6</span><span style="color:#006600; font-weight:bold;">&#93;</span>
winning_numbers = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span>,<span style="color:#006666;">2</span>,<span style="color:#006666;">3</span>,<span style="color:#006666;">41</span>,<span style="color:#006666;">42</span>,<span style="color:#006666;">43</span><span style="color:#006600; font-weight:bold;">&#93;</span>
&nbsp;
result = <span style="color:#006666;">6</span> <span style="color:#006600; font-weight:bold;">-</span> <span style="color:#006600; font-weight:bold;">&#40;</span>winning_numbers <span style="color:#006600; font-weight:bold;">-</span> my_numbers<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">size</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;#{result} &quot;</span> <span style="color:#006600; font-weight:bold;">+</span>
  <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#9966CC; font-weight:bold;">not</span> result.<span style="color:#9900CC;">eql</span>? <span style="color:#006666;">0</span>
    <span style="color:#996600;">&quot;hits&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">else</span>
    <span style="color:#996600;">&quot;hit&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>



<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-blinklist">
			<a href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=http://www.vidul.com/2008/02/12/lotto-checking-script/&amp;Title=Lotto+checking+script" rel="nofollow" title="Share this on Blinklist">Share this on Blinklist</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.vidul.com/2008/02/12/lotto-checking-script/&amp;title=Lotto+checking+script" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.vidul.com/2008/02/12/lotto-checking-script/&amp;title=Lotto+checking+script" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.vidul.com/2008/02/12/lotto-checking-script/&amp;title=Lotto+checking+script" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.vidul.com/2008/02/12/lotto-checking-script/&amp;title=Lotto+checking+script" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.vidul.com/2008/02/12/lotto-checking-script/" rel="nofollow" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Lotto+checking+script+-+http://b2l.me/bmk5r+" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-newsvine">
			<a href="http://www.newsvine.com/_tools/seed&amp;save?u=http://www.vidul.com/2008/02/12/lotto-checking-script/&amp;h=Lotto+checking+script" rel="nofollow" title="Seed this on Newsvine">Seed this on Newsvine</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.vidul.com/2008/02/12/lotto-checking-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>String Iterator</title>
		<link>http://www.vidul.com/2008/01/14/string-iterator/</link>
		<comments>http://www.vidul.com/2008/01/14/string-iterator/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 22:08:00 +0000</pubDate>
		<dc:creator>Vidul</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[senseless]]></category>

		<guid isPermaLink="false">urn:uuid:{a.guid}</guid>
		<description><![CDATA[
class String
  class Iterator &#60; String
&#160;
    def initialize&#40;str='', next_char=0&#41;
      @next_char = next_char
      super&#40;str&#41;
    end
&#160;
    def next
      return nil if @next_char &#62; self.size
&#160;
      @next_char += 1
&#160;
 [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:arial,verdana,monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC0066; font-weight:bold;">String</span>
  <span style="color:#9966CC; font-weight:bold;">class</span> Iterator <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#CC0066; font-weight:bold;">String</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>str=<span style="color:#996600;">''</span>, next_char=<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0066ff; font-weight:bold;">@next_char</span> = next_char
      <span style="color:#9966CC; font-weight:bold;">super</span><span style="color:#006600; font-weight:bold;">&#40;</span>str<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#9966CC; font-weight:bold;">next</span>
      <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">nil</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@next_char</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">size</span>
&nbsp;
      <span style="color:#0066ff; font-weight:bold;">@next_char</span> <span style="color:#006600; font-weight:bold;">+</span>= <span style="color:#006666;">1</span>
&nbsp;
      get_char<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">def</span> prev
      <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">nil</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@next_char</span> <span style="color:#006600; font-weight:bold;">&lt;</span> = <span style="color:#006666;">0</span>
&nbsp;
      <span style="color:#0066ff; font-weight:bold;">@next_char</span> <span style="color:#006600; font-weight:bold;">-</span>= <span style="color:#006666;">1</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@next_char</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006666;">0</span>
&nbsp;
      get_char<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    private
    <span style="color:#9966CC; font-weight:bold;">def</span> get_char<span style="color:#006600; font-weight:bold;">&#40;</span>pos=<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">if</span> block_given?
        <span style="color:#9966CC; font-weight:bold;">yield</span> <span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">//</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#91;</span>@next_char<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#40;</span>pos<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      <span style="color:#9966CC; font-weight:bold;">else</span>
        <span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">//</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#91;</span>@next_char<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#40;</span>pos<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
s = <span style="color:#6666ff; font-weight:bold;">String::Iterator</span>.<span style="color:#9900CC;">new</span> <span style="color:#996600;">&quot;abcdef&quot;</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">while</span> char = s.<span style="color:#9966CC; font-weight:bold;">next</span>
  <span style="color:#CC0066; font-weight:bold;">puts</span> char
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">while</span> char = s.<span style="color:#9900CC;">prev</span>
  <span style="color:#CC0066; font-weight:bold;">puts</span> char
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>



<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-center">
<ul class="socials">
		<li class="sexy-blinklist">
			<a href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=http://www.vidul.com/2008/01/14/string-iterator/&amp;Title=String+Iterator" rel="nofollow" title="Share this on Blinklist">Share this on Blinklist</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.vidul.com/2008/01/14/string-iterator/&amp;title=String+Iterator" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.vidul.com/2008/01/14/string-iterator/&amp;title=String+Iterator" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.vidul.com/2008/01/14/string-iterator/&amp;title=String+Iterator" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.vidul.com/2008/01/14/string-iterator/&amp;title=String+Iterator" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.vidul.com/2008/01/14/string-iterator/" rel="nofollow" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=String+Iterator+-+http://b2l.me/bj3y3+" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-newsvine">
			<a href="http://www.newsvine.com/_tools/seed&amp;save?u=http://www.vidul.com/2008/01/14/string-iterator/&amp;h=String+Iterator" rel="nofollow" title="Seed this on Newsvine">Seed this on Newsvine</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.vidul.com/2008/01/14/string-iterator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

