<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.dzone.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>DZone Snippets: Store, sort and share source code, with tag goodness</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Tue, 24 Nov 2009 23:06:23 GMT</pubDate>
    <description>DZone Snippets: Store, sort and share source code, with tag goodness</description>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://snippets.dzone.com/rss" type="application/rss+xml" /><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Fsnippets.dzone.com%2Frss" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Fsnippets.dzone.com%2Frss" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Fsnippets.dzone.com%2Frss" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://snippets.dzone.com/rss" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Fsnippets.dzone.com%2Frss" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Fsnippets.dzone.com%2Frss" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Fsnippets.dzone.com%2Frss" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
      <title>shoes</title>
      <link>http://feeds.dzone.com/~r/dzone/snippets/~3/fKRFDc6LiYA/8947</link>
      <description>&lt;A href="http://www.nikestreet.com"&gt;cheap nikes&lt;/A&gt;
&lt;br /&gt;&lt;A href="http://www.nikestreet.com/products/?AIR-JORDAN-s70_p1.html"&gt;air jordan&lt;/A&gt;
&lt;br /&gt;&lt;A href="http://www.nikestreet.com/products/?AIR-FORCE-&amp;amp;-JORDAN-s262_p1.html"&gt;cheap air jordans&lt;/A&gt;
&lt;br /&gt;&lt;A href="http://www.nikestreet.com"&gt;wholesale jordan shoes&lt;/A&gt;
&lt;br /&gt;&lt;A href="http://www.nikestreet.com/products/?NIKE-DUNK-s266_p1.html"&gt;cheap dunks&lt;/A&gt;
&lt;br /&gt;&lt;A href="http://www.nikestreet.com"&gt;nike dunk sb&lt;/A&gt;,
&lt;br /&gt;&lt;A href="http://www.nikestreet.com/products/?NIKE-AIR-FORCE-1-s263_p1.html"&gt;cheap air force 1&lt;/A&gt;
&lt;br /&gt;&lt;A href="http://www.nikestreet.com"&gt;nike air force 1s&lt;/A&gt;
&lt;br /&gt;&lt;A href="http://www.nikestreet.com/products/?NIKE-AIR-MAX-s264_p1.html"&gt;cheap air max&lt;/A&gt;
&lt;br /&gt;&lt;A href="http://www.nikestreet.com/products/?NIKE-SHOX-s265_p1.html"&gt;cheap nike shox&lt;/A&gt;
&lt;br /&gt;&lt;A href="http://www.nikestreet.com/products/?WOMEN-SHOES-s303_p1.html"&gt;cheap women shoes&lt;/A&gt;
&lt;br /&gt;&lt;A href="http://www.nikestreet.com/products/?NIKE-AIR-YEEZY-s334_p1.html"&gt;cheap air yeezy&lt;/A&gt;
&lt;br /&gt;&lt;A href="http://www.nikestreet.com/products/?Supra-Shoes-s372_p1.html"&gt;cheap supra&lt;/A&gt;
&lt;br /&gt;&lt;A href="http://www.nikestreet.com/products/?UGG-Women-Boot-n773_p1.html"&gt;cheap ugg boot&lt;/A&gt;
&lt;br /&gt;&lt;A href="http://www.nikestreet.com"&gt;jordan sneakers&lt;/A&gt;
&lt;br /&gt;&lt;A href="http://www.nikestreet.com"&gt;nike sneakers&lt;/A&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/dzone/snippets/~4/fKRFDc6LiYA" height="1" width="1"/&gt;</description>
      <pubDate>Tue, 24 Nov 2009 15:20:06 GMT</pubDate>
      <guid isPermaLink="false">http://snippets.dzone.com/posts/show/8947</guid>
      <author>nikestreet (shoes)</author>
    <feedburner:origLink>http://snippets.dzone.com/posts/show/8947</feedburner:origLink></item>
    <item>
      <title>Using Google Latitude to find your location from the JSON feed</title>
      <link>http://feeds.dzone.com/~r/dzone/snippets/~3/2tILWUsv7vU/8945</link>
      <description>Using the following code it's possible to track your position accurate to 150 meters (updated every 10 minutes). It is assumed you are already subscribed to Google Location and that you have enabled the &lt;a href="http://www.google.com/latitude/apps/badge"&gt;Public Location Badge&lt;/a&gt; [google.com].
&lt;br /&gt;
&lt;br /&gt;&lt;code&gt;
&lt;br /&gt;require 'open-uri'
&lt;br /&gt;require 'json'
&lt;br /&gt;
&lt;br /&gt;url = 'http://www.google.com/latitude/apps/badge/api?user=-1375592218544148424&amp;type=json'
&lt;br /&gt;buffer = open(url, "UserAgent" =&gt; "Ruby-GoogleLatitude Reader").read
&lt;br /&gt;
&lt;br /&gt;result = JSON.parse(buffer)
&lt;br /&gt;features = result['features'][0]; properties = features['properties']
&lt;br /&gt;
&lt;br /&gt;longitude, latitude = features['geometry']['coordinates']
&lt;br /&gt;timestamp, placename = properties['timeStamp'], properties['reverseGeocode']
&lt;br /&gt;
&lt;br /&gt;last_update = Time.parse(timestamp.to_s.insert(2,':')[0,5])
&lt;br /&gt;location = [latitude, longitude, placename, last_update.strftime("%I:%M%p")]
&lt;br /&gt;puts "jrobertson is currently located at %s, %s (%s, updated: %s)" % location
&lt;br /&gt;
&lt;br /&gt;#=&gt; jrobertson is currently located at 55.951295, -3.176071 (Edinburgh, City of Edinburgh, UK updated: 12:59PM)
&lt;br /&gt;&lt;/code&gt;
&lt;br /&gt;
&lt;br /&gt;JSON feed:
&lt;br /&gt;&lt;pre&gt;
&lt;br /&gt;{ "type": "FeatureCollection",
&lt;br /&gt;"features": [
&lt;br /&gt;  { "type": "Feature",
&lt;br /&gt;  "geometry": {"type": "Point", "coordinates": [-3.176071, 55.951295]},
&lt;br /&gt;  "properties": {
&lt;br /&gt;    "id": "-1375542218544148324",
&lt;br /&gt;    "accuracyInMeters": 150,
&lt;br /&gt;    "timeStamp": 1259066033,
&lt;br /&gt;    "reverseGeocode": "Edinburgh, City of Edinburgh, UK",
&lt;br /&gt;    "photoUrl": "http://www.google.com/latitude/apps/badge/api?type=photo&amp;photo=CWM7Ji5BAAA.vIzFGPCNlnjDS1F-Qquj4A.P1dLAm4TS_ltZE_dGCY4oQ",
&lt;br /&gt;    "photoWidth": 96,
&lt;br /&gt;    "photoHeight": 96,
&lt;br /&gt;    "placardUrl": "http://www.google.com/latitude/apps/badge/api?type=photo_placard&amp;photo=CWM5JiUBAAA.vIzFGPCNlrjDS5F-Qquj4A.P1dLTu4TS_ltZE_dGCY4oQ&amp;moving=true&amp;stale=false&amp;lod=1&amp;format=png",
&lt;br /&gt;    "placardWidth": 56,
&lt;br /&gt;    "placardHeight": 59
&lt;br /&gt;    }
&lt;br /&gt;  }
&lt;br /&gt;]
&lt;br /&gt;}
&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;Resources:
&lt;br /&gt; - &lt;a href="http://radar.oreilly.com/2009/05/googles-sneaky-launch-of-latitudes-location-sharing-api.html"&gt;Google's Sneaky Launch of Latitude's Location-Sharing API - O'Reilly Radar&lt;/a&gt; [oreilly.com]
&lt;br /&gt; - &lt;a href="http://www.google.com/support/forum/p/Google+Mobile/thread?tid=0b261499d30e1165&amp;hl=en#all"&gt;Google Latitude API and Public Access - Google Mobile Help&lt;/a&gt; [google.com]
&lt;br /&gt; - &lt;a href="http://www.google.com/latitude/apps"&gt;Google Latitude&lt;/a&gt; [google.com]
&lt;br /&gt; - &lt;a href="http://snippets.dzone.com/posts/show/8941"&gt;Using Google Latitude to find your location from the KML feed&lt;/a&gt; [dzone.com]
&lt;br /&gt; - &lt;a href="http://snippets.dzone.com/posts/show/6133"&gt;Read JSON data using Ruby&lt;/a&gt; [dzone.com]&lt;img src="http://feeds.feedburner.com/~r/dzone/snippets/~4/2tILWUsv7vU" height="1" width="1"/&gt;</description>
      <pubDate>Tue, 24 Nov 2009 14:38:00 GMT</pubDate>
      <guid isPermaLink="false">http://snippets.dzone.com/posts/show/8945</guid>
      <author>jrobertson (James Robertson)</author>
    <feedburner:origLink>http://snippets.dzone.com/posts/show/8945</feedburner:origLink></item>
    <item>
      <title>Inserting a string into a string</title>
      <link>http://feeds.dzone.com/~r/dzone/snippets/~3/TiSZjuN48Bo/8943</link>
      <description>Source: &lt;a href="http://ruby-doc.org/core/classes/String.html#M000773"&gt;Class: String&lt;/a&gt; [ruby-doc.org]
&lt;br /&gt;&lt;snip&gt;
&lt;br /&gt;Inserts other_str before the character at the given index, modifying str. Negative indices count from the end of the string, and insert after the given character. The intent is insert aString so that it starts at the given index.
&lt;br /&gt;
&lt;br /&gt;&lt;code&gt;
&lt;br /&gt;"abcd".insert(0, 'X')    #=&gt; "Xabcd"
&lt;br /&gt;"abcd".insert(3, 'X')    #=&gt; "abcXd"
&lt;br /&gt;"abcd".insert(4, 'X')    #=&gt; "abcdX"
&lt;br /&gt;"abcd".insert(-3, 'X')   #=&gt; "abXcd"
&lt;br /&gt;"abcd".insert(-1, 'X')   #=&gt; "abcdX"
&lt;br /&gt;&lt;/code&gt;
&lt;br /&gt;&lt;/snip&gt;
&lt;br /&gt;
&lt;br /&gt;or
&lt;br /&gt;&lt;code&gt;"abcd".sub(/^.{2}/,'\0X') #=&gt; abXcd&lt;/code&gt;&lt;img src="http://feeds.feedburner.com/~r/dzone/snippets/~4/TiSZjuN48Bo" height="1" width="1"/&gt;</description>
      <pubDate>Tue, 24 Nov 2009 14:18:36 GMT</pubDate>
      <guid isPermaLink="false">http://snippets.dzone.com/posts/show/8943</guid>
      <author>jrobertson (James Robertson)</author>
    <feedburner:origLink>http://snippets.dzone.com/posts/show/8943</feedburner:origLink></item>
    <item>
      <title>Using Google Latitude to find your location from the KML feed</title>
      <link>http://feeds.dzone.com/~r/dzone/snippets/~3/IKRenzZA6FM/8941</link>
      <description>Using the following code it's possible to track your position accurate to 150 meters (updated every 10 minutes). It is assumed you are already subscribed to Google Location and that you have enabled the &lt;a href="http://www.google.com/latitude/apps/badge"&gt;Public Location Badge&lt;/a&gt; [google.com].
&lt;br /&gt;
&lt;br /&gt;&lt;code&gt;
&lt;br /&gt;require 'open-uri'
&lt;br /&gt;require 'rexml/document'
&lt;br /&gt;include REXML
&lt;br /&gt;
&lt;br /&gt;url = 'http://www.google.com/latitude/apps/badge/api?user=-1475592318547148484&amp;type=kml'
&lt;br /&gt;buffer = open(url, 'UserAgent' =&gt; 'Ruby-GoogleLatitude Reader').read
&lt;br /&gt;doc = Document.new(buffer)
&lt;br /&gt;xpath = 'Document/Placemark/Point/coordinates/text()'
&lt;br /&gt;longitude, latitude = XPath.first(doc.root, xpath).to_s.split(/,/)
&lt;br /&gt;puts "jrobertson is currently located at %s, %s" % [latitude, longitude]
&lt;br /&gt;#=&gt; jrobertson is currently located at 55.951295, -3.176071
&lt;br /&gt;&lt;/code&gt;
&lt;br /&gt;
&lt;br /&gt;KML feed:
&lt;br /&gt;&lt;pre&gt;
&lt;br /&gt;&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;br /&gt;&lt;kml xmlns="http://www.opengis.net/kml/2.2"&gt;
&lt;br /&gt;  &lt;Document&gt;
&lt;br /&gt;    &lt;Style id="-1375592218544146423"&gt;
&lt;br /&gt;      &lt;IconStyle&gt;
&lt;br /&gt;        &lt;Icon&gt;
&lt;br /&gt;        &lt;href&gt;&lt;![CDATA[http://www.google.com/latitude/apps/badge/api?type=photo_placard&amp;photo=yT45MiUBAAA.vIzFGPCNlpjDS5F-Qquj4A.cSXRZh8qLHjiUKdJuzwiNg&amp;moving=true&amp;stale=false&amp;lod=1&amp;format=png]]&gt;&lt;/href&gt;
&lt;br /&gt;        &lt;/Icon&gt;
&lt;br /&gt;        &lt;scale&gt;1&lt;/scale&gt;
&lt;br /&gt;        &lt;hotSpot x="0.5"  y="0.0" xunits="fraction" yunits="fraction"/&gt;
&lt;br /&gt;      &lt;/IconStyle&gt;
&lt;br /&gt;    &lt;/Style&gt;
&lt;br /&gt;    &lt;Placemark&gt;
&lt;br /&gt;      &lt;styleUrl&gt;#-1375542216544248494&lt;/styleUrl&gt;
&lt;br /&gt;      &lt;description&gt;Accurate to 150 meters as of 10 minutes ago. http://www.google.com/latitude/apps/badge&lt;/description&gt;
&lt;br /&gt;      &lt;Point&gt;
&lt;br /&gt;        &lt;coordinates&gt;-3.176071,55.951295&lt;/coordinates&gt;
&lt;br /&gt;      &lt;/Point&gt;
&lt;br /&gt;    &lt;/Placemark&gt;
&lt;br /&gt;  &lt;/Document&gt;
&lt;br /&gt;&lt;/kml&gt;
&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;Resources:
&lt;br /&gt; - &lt;a href="http://radar.oreilly.com/2009/05/googles-sneaky-launch-of-latitudes-location-sharing-api.html"&gt;Google's Sneaky Launch of Latitude's Location-Sharing API - O'Reilly Radar&lt;/a&gt; [oreilly.com]
&lt;br /&gt; - &lt;a href="http://www.google.com/support/forum/p/Google+Mobile/thread?tid=0b261499d30e1165&amp;hl=en#all"&gt;Google Latitude API and Public Access - Google Mobile Help&lt;/a&gt; [google.com]
&lt;br /&gt; - &lt;a href="http://www.google.com/latitude/apps"&gt;Google Latitude&lt;/a&gt; [google.com]&lt;img src="http://feeds.feedburner.com/~r/dzone/snippets/~4/IKRenzZA6FM" height="1" width="1"/&gt;</description>
      <pubDate>Tue, 24 Nov 2009 13:22:20 GMT</pubDate>
      <guid isPermaLink="false">http://snippets.dzone.com/posts/show/8941</guid>
      <author>jrobertson (James Robertson)</author>
    <feedburner:origLink>http://snippets.dzone.com/posts/show/8941</feedburner:origLink></item>
    <item>
      <title>Removing methods from an object</title>
      <link>http://feeds.dzone.com/~r/dzone/snippets/~3/EzkPAVbl_vQ/8939</link>
      <description>Source: &lt;a href="http://media.pragprog.com/titles/ppmetr/spells.pdf"&gt;Metaprogramming Ruby&lt;/a&gt; [pragprog.com] via &lt;a href="http://twitter.com/IndianGuru/status/5995333276"&gt;IndianGuru&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;snip&gt;
&lt;br /&gt;Remove methods from an object to turn them into Ghost Methods (74).
&lt;br /&gt;
&lt;br /&gt;&lt;code&gt;
&lt;br /&gt;class C
&lt;br /&gt;  def method_missing(name, *args)
&lt;br /&gt;    "a Ghost Method"
&lt;br /&gt;  end
&lt;br /&gt;end
&lt;br /&gt;obj = C.new
&lt;br /&gt;obj.to_s # =&gt; "#&lt;C:0x357258&gt;"
&lt;br /&gt;class C
&lt;br /&gt;  instance_methods.each do |m|
&lt;br /&gt;    undef_method m unless m.to_s =~ /method_missing|respond_to?|^__/
&lt;br /&gt;  end
&lt;br /&gt;end
&lt;br /&gt;obj.to_s # =&gt; "a Ghost Method"
&lt;br /&gt;&lt;/code&gt;
&lt;br /&gt;&lt;/snip&gt;
&lt;br /&gt;
&lt;br /&gt;While undefining the following output was observed:
&lt;br /&gt;&lt;pre&gt;
&lt;br /&gt;(irb):214: warning: undefining `object_id' may cause serious problem
&lt;br /&gt;=&gt; [:method_missing, :dclone, :nil?, :===, :=~, :!~, :eql?, :class, :clone, 
&lt;br /&gt;:dup, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, 
&lt;br /&gt;:frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, 
&lt;br /&gt;:private_methods, :public_methods, :instance_variables, :instance_variable_get, 
&lt;br /&gt;:instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, 
&lt;br /&gt;:is_a?, :tap, :send, :public_send, :respond_to?, :extend, :display, :method, 
&lt;br /&gt;:public_method, :define_singleton_method, :hash, :__id__, :object_id, :to_enum, 
&lt;br /&gt;:enum_for, :gem, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__]
&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;Resources:
&lt;br /&gt; - &lt;a href="http://eigenclass.org/hiki/bounded+space+instance_exec"&gt;eigenclass - The dangers of #undef_method, #instance_exec recalled for memleaking!&lt;/a&gt; [eigenclass.org]
&lt;br /&gt; - &lt;a href="http://ruby-doc.org/core/classes/Module.html#M001652"&gt;Class: Module&lt;/a&gt; [ruby-doc.org]
&lt;br /&gt; - &lt;a href="http://snippets.dzone.com/posts/show/7844"&gt;Create disposable methods in Ruby using undef&lt;/a&gt; [dzone.com]&lt;img src="http://feeds.feedburner.com/~r/dzone/snippets/~4/EzkPAVbl_vQ" height="1" width="1"/&gt;</description>
      <pubDate>Tue, 24 Nov 2009 10:03:35 GMT</pubDate>
      <guid isPermaLink="false">http://snippets.dzone.com/posts/show/8939</guid>
      <author>jrobertson (James Robertson)</author>
    <feedburner:origLink>http://snippets.dzone.com/posts/show/8939</feedburner:origLink></item>
    <item>
      <title>www.aypearl.com interpret Features of Gemstone Jewelry</title>
      <link>http://feeds.dzone.com/~r/dzone/snippets/~3/iNqkH99yIVY/8937</link>
      <description>&lt;br /&gt;When it refers to the &lt;a href="http://www.aypearl.com/semi-precious-jewelry/"&gt;&lt;b&gt;semiprecious jewelry&lt;/b&gt;&lt;/a&gt; that everyone more or less likely to understand, but to gemstone jewelry do not know whether you know a half.
&lt;br /&gt;
&lt;br /&gt;In fact, like precious stones and minerals in general, are mined from the earth's crust in the product. Reason is called a "semi-precious stones" because of its stripes, hardness, color, transparency, durability, rarity, crystal form and degree of market acceptance of recognition, are different from other minerals, so it has a special ornamental decorative purposes. With different precious stones In addition, the higher the output of semi-precious stones, compared with Pearl jewelry and diamonds, it is not so expensive.
&lt;br /&gt;Many people are fascinated with gemstones as they symbolize beauty, grace and style. Moreover, gemstone jewelry is durable, and they also have religious and astrological significance. For this reason, gemstones should be chosen with great care and preferably be verified by gemologists and jewelry professionals.
&lt;br /&gt;Including four kinds of precious stones, namely diamonds, rubies, sapphires and emeralds. While the rest of the gems, such as &lt;a href="http://www.aypearl.com/wholesale-crystal-jewelry/"&gt;&lt;b&gt;crystal jewelry&lt;/b&gt;&lt;/a&gt;, agate, pearl, carnelian, etc. are all semi-precious stones.  Although there is no semi-precious stones such as diamonds, precious gemstones, but also highly decorative and collectible value. A wide range of semi-precious stones, the more common are: a variety of crystal jewelry, agate, pearls, amber and so on, other issues such as coral, malachite, olivine, Tiger's Eye semi-precious stones and so on.
&lt;br /&gt;People are enamored of gemstone jewelry, particularly gemstone rings, presumably for their stylish and quite often eye catchy finish. Much sought-after gemstone jewelry is gemstone necklaces. These gemstone necklaces again come in different styles - made with small stones, with midsize stones and large stones.
&lt;br /&gt;When choosing jewelry, make sure that it has the potential to be mixed with other jewelry for achieving a different look without changing around too many pieces. The one distinct feature of &lt;a href="http://www.aypearl.com/semi-precious-jewelry/"&gt;&lt;b&gt;gemstone jewelry&lt;/b&gt;&lt;/a&gt; is its versatility because gemstones are of different types - blue sapphires, jades, red garnets, zirconium, quartz, ruby, diamond, emerald, coral, pearl, opals and onyx - and available in a plethora of colors and countless combination of gemstones can be used in making gemstone jewelry.
&lt;br /&gt;gemstone jewelry consisting of rings, gemstone necklaces, anklets, earrings and bracelets reflect and at times, enhances the personality of the wearer. Apart from the technological, scientific, and metaphysical significance, investors and hobbyists are also fond of buying gemstones for their relative rarity, their unmatched elegance and pride of possession.
&lt;br /&gt;It is a matter of deep concern that many stones are becoming increasingly scarcer because the earth is not producing them prolifically as it used to, and stocks of these stones are getting slowly depleted in the secondary market.
&lt;br /&gt;
&lt;br /&gt;More knowledge of jewelry and the trend of &lt;a href="http://www.aypearl.com/"&gt;&lt;b&gt;fashion jewelry&lt;/b&gt;&lt;/a&gt;in this winter,please visit www.aypearl.com,&lt;a href="http://www.aypearl.com/"&gt;&lt;b&gt;wholesale jewelry&lt;/b&gt;&lt;/a&gt; online.Please enter your sole coupon code &lt;b&gt;Ay9902&lt;/b&gt;  when submit order, Then you can enjoy the special discount.
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/dzone/snippets/~4/iNqkH99yIVY" height="1" width="1"/&gt;</description>
      <pubDate>Tue, 24 Nov 2009 06:33:00 GMT</pubDate>
      <guid isPermaLink="false">http://snippets.dzone.com/posts/show/8937</guid>
      <author>fairy0610 (fairy)</author>
    <feedburner:origLink>http://snippets.dzone.com/posts/show/8937</feedburner:origLink></item>
    <item>
      <title>Sinatra-Rscript: Unifying the transformation of XML documents</title>
      <link>http://feeds.dzone.com/~r/dzone/snippets/~3/o2HWULRbAGs/8935</link>
      <description>To render HTML in Sintra-Rscript the following code will transform an XML document (in RecordX format) with an XSL link emdedded in the summary of the document.
&lt;br /&gt;
&lt;br /&gt;If the XML document does not contain the XSL URL then the registry is used to retrieve the XSL URL.
&lt;br /&gt;
&lt;br /&gt;&lt;code&gt;
&lt;br /&gt;out = render_to(:content_type =&gt; 'html', :doc =&gt; doc)
&lt;br /&gt;
&lt;br /&gt;# ...
&lt;br /&gt;
&lt;br /&gt;def render_to(opts={})  
&lt;br /&gt;  o = {
&lt;br /&gt;    :content_type =&gt; 'html',
&lt;br /&gt;    :file_path =&gt; ''
&lt;br /&gt;  }.merge(opts)
&lt;br /&gt;
&lt;br /&gt;  cat_doc = o[:doc]
&lt;br /&gt;  file_path = o[:file_path]
&lt;br /&gt;  text_xsl_url = cat_doc.root.elements['summary/xsl_url/text()']
&lt;br /&gt;
&lt;br /&gt;  if text_xsl_url.is_a? REXML::Text then
&lt;br /&gt;    xsl_url  = text_xsl_url.to_s
&lt;br /&gt;    h = {}
&lt;br /&gt;  else
&lt;br /&gt;    xslid = run_projectx('registry', 'get-key', :path =&gt; 'system/xml_root/directory/xslid').first
&lt;br /&gt;    xsl_url = run_projectx('registry', 'get-key', :path =&gt; 'system/xslid/' + xslid).first
&lt;br /&gt;
&lt;br /&gt;    filename = File.basename(file_path)
&lt;br /&gt;
&lt;br /&gt;    parent_file_path = File.dirname(file_path)
&lt;br /&gt;    parent_file_path.sub!(/\/?[^\/]+$/,'') if filename == 'dir.xml' 
&lt;br /&gt;
&lt;br /&gt;    if File.dirname(file_path) == '.' then
&lt;br /&gt;      parent_file_path = '' #'/dir.xml'
&lt;br /&gt;    else
&lt;br /&gt;      parent_file_path = '/' + parent_file_path  + (parent_file_path.length &gt; 0 ? '/' : '') + 'dir.xml'
&lt;br /&gt;    end
&lt;br /&gt;
&lt;br /&gt;    h = {:params =&gt; ['parent_dir', parent_file_path, 'current_dir', File.dirname(file_path)]}
&lt;br /&gt;  end
&lt;br /&gt;
&lt;br /&gt;  url = 'http://rorbuilder.info/r/heroku/guide.xsl'
&lt;br /&gt;  xsl_doc = Document.new(open(url, "UserAgent" =&gt; "Sinatra-Rscript").read)
&lt;br /&gt;
&lt;br /&gt;  node = Element.new('xsl:include')
&lt;br /&gt;  xsl_doc.root.add_element node
&lt;br /&gt;  node.add_attribute('href', xsl_url)
&lt;br /&gt;  @content_type = "text/" + o[:content_type]
&lt;br /&gt;  
&lt;br /&gt;  nokogiri_transform_doc_xsl(cat_doc, xsl_doc, h)
&lt;br /&gt;    
&lt;br /&gt;end
&lt;br /&gt;&lt;/code&gt;
&lt;br /&gt;
&lt;br /&gt;Currently it's assumed the XML file which doesn't have an embedded XSL_URL will be a dir.xml file.
&lt;br /&gt;
&lt;br /&gt;Code implemented within http://rorbuilder.info/r/heroku/script/render.rb&lt;img src="http://feeds.feedburner.com/~r/dzone/snippets/~4/o2HWULRbAGs" height="1" width="1"/&gt;</description>
      <pubDate>Tue, 24 Nov 2009 00:32:12 GMT</pubDate>
      <guid isPermaLink="false">http://snippets.dzone.com/posts/show/8935</guid>
      <author>jrobertson (James Robertson)</author>
    <feedburner:origLink>http://snippets.dzone.com/posts/show/8935</feedburner:origLink></item>
    <item>
      <title>Update TableA using value from TableB</title>
      <link>http://feeds.dzone.com/~r/dzone/snippets/~3/La25QwxzcpI/8933</link>
      <description>// Update a table using values from another table by joining on the PK
&lt;br /&gt;
&lt;br /&gt;&lt;code&gt;
&lt;br /&gt;UPDATE 
&lt;br /&gt;	cx 
&lt;br /&gt;SET 
&lt;br /&gt;	cx.DeliveryDay = c.DeliveryDay
&lt;br /&gt;FROM 
&lt;br /&gt;	SV_CustomerExtended cx 
&lt;br /&gt;		INNER JOIN OM_Customer c 
&lt;br /&gt;			ON (cx.CustomerID = c.CustomerID);
&lt;br /&gt;GO
&lt;br /&gt;&lt;/code&gt;&lt;img src="http://feeds.feedburner.com/~r/dzone/snippets/~4/La25QwxzcpI" height="1" width="1"/&gt;</description>
      <pubDate>Mon, 23 Nov 2009 16:24:59 GMT</pubDate>
      <guid isPermaLink="false">http://snippets.dzone.com/posts/show/8933</guid>
      <author>a7awo (Billy)</author>
    <feedburner:origLink>http://snippets.dzone.com/posts/show/8933</feedburner:origLink></item>
    <item>
      <title>Write HTML using Markdown</title>
      <link>http://feeds.dzone.com/~r/dzone/snippets/~3/paYMjUMAxU0/8929</link>
      <description>&lt;snip&gt;Markdown is a text-to-HTML conversion tool for web writers.&lt;/snip&gt;
&lt;br /&gt;&lt;pre&gt;
&lt;br /&gt;A First Level Header                 &lt;h1&gt;A First Level Header&lt;/h1&gt;
&lt;br /&gt;====================                 
&lt;br /&gt;                                     
&lt;br /&gt;A Second Level Header                &lt;h2&gt;A Second Level Header&lt;/h2&gt;
&lt;br /&gt;---------------------                
&lt;br /&gt;                                     
&lt;br /&gt;Now is the time for all good         &lt;p&gt;Now is the time for all good&lt;/p&gt;
&lt;br /&gt;                                     
&lt;br /&gt;### Header 3                         &lt;h3&gt;Header 3&lt;/h3&gt;
&lt;br /&gt;                                     
&lt;br /&gt;&gt; This is a blockquote.              &lt;blockquote&gt;&lt;p&gt;This is a blockquote.&lt;/p&gt;&lt;/blockquote&gt;
&lt;br /&gt;                                     
&lt;br /&gt;&gt; ## This is an H2 in a blockquote   &lt;blockquote&gt;&lt;h2&gt;This is an H2 in a blockquote&lt;/h2&gt;&lt;/blockquote&gt;
&lt;br /&gt;                                     
&lt;br /&gt;these words *are emphasized*.        these words &lt;em&gt;are emphasized&lt;/em&gt;.
&lt;br /&gt;these words _are emphasized_.        these words &lt;em&gt;are emphasized&lt;/em&gt;.
&lt;br /&gt;                                     
&lt;br /&gt;two asterisks for *emphasis**.       two asterisks for &lt;strong&gt;emphasis&lt;/strong&gt;.
&lt;br /&gt;prefer, __two underscores__?         prefer, &lt;strong&gt;two underscores&lt;/strong&gt;?
&lt;br /&gt;                                     
&lt;br /&gt;+   Candy.                           &lt;ul&gt;&lt;li&gt;Candy.&lt;/li&gt;
&lt;br /&gt;+   Gum.                             &lt;li&gt;Gum.&lt;/li&gt;
&lt;br /&gt;+   Booze.                           &lt;li&gt;Booze.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;                                     
&lt;br /&gt;-   Candy.                           &lt;ul&gt;&lt;li&gt;Candy.&lt;/li&gt;
&lt;br /&gt;-   Gum.                             &lt;li&gt;Gum.&lt;/li&gt;
&lt;br /&gt;-   Booze.                           &lt;li&gt;Booze.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;                                     
&lt;br /&gt;1.  Red                              &lt;ol&gt;&lt;li&gt;Red&lt;/li&gt;
&lt;br /&gt;2.  Green                            &lt;li&gt;Green&lt;/li&gt;
&lt;br /&gt;3.  Blue                             &lt;li&gt;Blue&lt;/li&gt;&lt;/ol&gt;
&lt;br /&gt;                                     
&lt;br /&gt;+   Another item.                    &lt;ul&gt;&lt;li&gt;Another item.
&lt;br /&gt;    but with a paragraph             &lt;p&gt;but with a paragraph&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;                                     
&lt;br /&gt;is [link45](http://example/).        &lt;p&gt;is &lt;a href="http://example/"&gt;link45&lt;/a&gt;.&lt;/p&gt;
&lt;br /&gt;                                     
&lt;br /&gt;[link46](http://exmpl/ "abc")        &lt;a href="http://exmpl/" title="abc"&gt;link46&lt;/a&gt;
&lt;br /&gt;                                     
&lt;br /&gt;more traffic from [here][1]          &lt;p&gt;more traffic from &lt;a href="http://here.com/" title="Here"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;br /&gt;                                     
&lt;br /&gt;[1]: http://here.com/  "Here"        
&lt;br /&gt;                                     
&lt;br /&gt;and [here and there][here2].         &lt;p&gt;and &lt;a href="http://herenthere/"&gt;here and there&lt;/a&gt;&lt;/p&gt;
&lt;br /&gt;                                     
&lt;br /&gt;[here2]: http;//herenthere/          
&lt;br /&gt;                                     
&lt;br /&gt;![alt text](img.jpg "Title")         &lt;a href="img.jpg" alt="text" title="Title"&gt;&lt;/a&gt;
&lt;br /&gt;                                     
&lt;br /&gt;![alt text][id]                      &lt;a href="path/img.jpg" alt="text" title="Title"&gt;&lt;/a&gt;
&lt;br /&gt;                                     
&lt;br /&gt;[id]: /path/img.jpg "Title"          
&lt;br /&gt;                                     
&lt;br /&gt;using any `&lt;xml&gt;` tags.              &lt;p&gt;using any `&amp;lt;xml&amp;gt;` tags.&lt;/p&gt;
&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;Note: To specify an entire block of pre-formatted code, indent every line of the block by 4 spaces or 1 tab. Just like with code spans, &amp;, &lt;, and &gt; characters will be escaped automatically.
&lt;br /&gt;
&lt;br /&gt;Resources:
&lt;br /&gt; - &lt;a href="http://daringfireball.net/projects/markdown/basics"&gt;Daring Fireball: Markdown Basics&lt;/a&gt; [daringfireball.net]
&lt;br /&gt;
&lt;br /&gt;*update: 23-Nov-09 @ 9:50am*
&lt;br /&gt;The formatting is displayed 100% correctly from &lt;a href="http://rorbuilder.info/markdown.html"&gt;http://rorbuilder.info/markdown.html&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/dzone/snippets/~4/paYMjUMAxU0" height="1" width="1"/&gt;</description>
      <pubDate>Mon, 23 Nov 2009 09:33:04 GMT</pubDate>
      <guid isPermaLink="false">http://snippets.dzone.com/posts/show/8929</guid>
      <author>jrobertson (James Robertson)</author>
    <feedburner:origLink>http://snippets.dzone.com/posts/show/8929</feedburner:origLink></item>
    <item>
      <title>Create a 2 column-layout in plain text format</title>
      <link>http://feeds.dzone.com/~r/dzone/snippets/~3/wgwCg-janlI/8919</link>
      <description>The following Sinatra-Rscript RSF job accepts 2 textarea inputs and then generates a 2 column layout suitable for a plain text layout.
&lt;br /&gt;
&lt;br /&gt;&lt;code&gt;
&lt;br /&gt;&lt;job id='p167'&gt;
&lt;br /&gt;  &lt;script&gt;
&lt;br /&gt;    &lt;![CDATA[
&lt;br /&gt;      
&lt;br /&gt;      render_form = Proc.new do 
&lt;br /&gt;form1 =&lt;&lt;FORM1
&lt;br /&gt;&lt;h1&gt;Twin box&lt;/h1&gt;
&lt;br /&gt;&lt;p&gt;just enter text into both boxes and it will be formatted into 2 columns:&lt;/p&gt;
&lt;br /&gt;&lt;form method=POST&gt;
&lt;br /&gt;  &lt;textarea cols='30' rows='6' name='mess1'&gt;&lt;/textarea&gt;
&lt;br /&gt;  &lt;textarea cols='30' rows='6' name='mess2'&gt;&lt;/textarea&gt;
&lt;br /&gt;  &lt;input type='submit' value='submit'/&gt;
&lt;br /&gt;&lt;/form&gt;
&lt;br /&gt;FORM1
&lt;br /&gt;        erb form1
&lt;br /&gt;      end
&lt;br /&gt;
&lt;br /&gt;      @@get_routes['twin/form'] = render_form
&lt;br /&gt;
&lt;br /&gt;      render_result = Proc.new do |local_params| 
&lt;br /&gt;        alist1 = local_params[:mess1].split(/\r\n/)
&lt;br /&gt;        alist2 = local_params[:mess2].split(/\r\n/)
&lt;br /&gt;        max_width = alist1.max_by {|x| x.length}.length + 2
&lt;br /&gt;
&lt;br /&gt;        erb "&lt;pre&gt;%s&lt;/pre&gt;" % alist1.zip(alist2).map {|x| "%-#{max_width}s %s\n" % x}.join
&lt;br /&gt;      end
&lt;br /&gt;
&lt;br /&gt;      @@post_routes['twin/form'] = render_result
&lt;br /&gt;
&lt;br /&gt;      template :layout do
&lt;br /&gt;        "&lt;!DOCTYPE html&gt;
&lt;br /&gt;        &lt;html&gt;&lt;%= yield %&gt;&lt;/html&gt;"
&lt;br /&gt;      end
&lt;br /&gt;
&lt;br /&gt;      "route twin/form added"
&lt;br /&gt;
&lt;br /&gt;    ]]&gt;
&lt;br /&gt;  &lt;/script&gt;
&lt;br /&gt;&lt;/job&gt;
&lt;br /&gt;&lt;/code&gt;
&lt;br /&gt;
&lt;br /&gt;Here's a sample of the input &lt;a href="http://twitxr.com/image/280310/"&gt;text used to create a 2 column-layout&lt;/a&gt; [twitxr.com].
&lt;br /&gt;
&lt;br /&gt;output:
&lt;br /&gt;&lt;pre&gt;
&lt;br /&gt;Tested     Observed
&lt;br /&gt;-------    ---------
&lt;br /&gt;abc        def
&lt;br /&gt;a123       d345
&lt;br /&gt;a456yyyu   d556
&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;pre&gt;
&lt;br /&gt;Tested                      Observed
&lt;br /&gt;-------                     ---------
&lt;br /&gt;abc                         def
&lt;br /&gt;a123                        d345
&lt;br /&gt;a456yyyu                    d556
&lt;br /&gt;etrttreettey5v56vv er65yy   
&lt;br /&gt;&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/dzone/snippets/~4/wgwCg-janlI" height="1" width="1"/&gt;</description>
      <pubDate>Mon, 23 Nov 2009 01:11:40 GMT</pubDate>
      <guid isPermaLink="false">http://snippets.dzone.com/posts/show/8919</guid>
      <author>jrobertson (James Robertson)</author>
    <feedburner:origLink>http://snippets.dzone.com/posts/show/8919</feedburner:origLink></item>
  </channel>
</rss>
