<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: tip code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 25 Jul 2008 02:44:48 GMT</pubDate>
    <description>DZone Snippets: tip code</description>
    <item>
      <title>SSL Cert  on the cheap.</title>
      <link>http://snippets.dzone.com/posts/show/3642</link>
      <description>Stolen from: http://groups.google.com/group/rubyonrails-talk/browse_frm/thread/148ada4b0d33cfac?hl=en&lt;br /&gt;&lt;br /&gt;If cost is an issue, you may wish to investigate Reverse Proxying with a&lt;br /&gt;single external certificate and multiple internal certificates (either&lt;br /&gt;self-signed or issued from an internal CA). </description>
      <pubDate>Wed, 07 Mar 2007 21:17:19 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3642</guid>
      <author>MattScilipoti (Matt Scilipoti)</author>
    </item>
    <item>
      <title>Cross browser compatibility tip: Conditional Compile in IE</title>
      <link>http://snippets.dzone.com/posts/show/2107</link>
      <description>From: http://www.javascriptkit.com/javatutors/conditionalcompile.shtml&lt;br /&gt;Conditional Compilation of JScript/ JavaScript in IE&lt;br /&gt;&lt;br /&gt;In IE, there is a little known feature called conditional compilation. Supported since IE4, this feature starting getting some attention when it began showing up in some Ajax related JavaScripts. An absolute form of object detection, conditional compilation lets you dictate to IE whether to compile certain parts of your JScript or JavaScript code depending on predefined and user defined conditions. Think of it as conditional comments for your script that can also be molded to work gracefully with non IE browsers as well.&lt;br /&gt;&lt;br /&gt;Thanks to: http://www.vivabit.com/bollocks/2006/04/06/introducing-dom-builder#c856&lt;br /&gt;&lt;br /&gt;#48: Avatar kentaromiura / 19th April '06&lt;br /&gt;&lt;br /&gt;You could do like I do here: &lt;a hfef="http://freeforumzone.leonardo.it/viewmessaggi.aspx?f=19716&amp;idd=176"&gt;Crazy corners&lt;/a&gt; using IE conditional comment&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var cn=&#226;&#8364;?class&#226;&#8364;?;&lt;br /&gt;&lt;br /&gt;/@cc_on&lt;br /&gt;&lt;br /&gt;cn="className";&lt;br /&gt;&lt;br /&gt;@/&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;so you use cn insted of class or classname _; bye&lt;br /&gt;</description>
      <pubDate>Fri, 26 May 2006 21:48:47 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2107</guid>
      <author>MattScilipoti (Matt Scilipoti)</author>
    </item>
    <item>
      <title>tip: recover from failed rails 'down' migration</title>
      <link>http://snippets.dzone.com/posts/show/1772</link>
      <description>From: http://jamis.jamisbuck.org/articles/2005/12/14/two-tips-for-working-with-databases-in-rails&lt;br /&gt;&lt;br /&gt;The second tip is handy when you&#8217;re working on a migration. I find that the process (for me) works like this:&lt;br /&gt;&lt;br /&gt;    * Create the migration and run it.&lt;br /&gt;    * Discover I forgot something.&lt;br /&gt;    * Migrate down to the previous schema version.&lt;br /&gt;    * Change the migration and run it again.&lt;br /&gt;&lt;br /&gt;(Repeat as necessary.) However, being the imperfect programmer that I am, I find that I often implement the #down method incorrectly, forgetting to drop a table or remove a column. Thus, when I try to run the migration again, it fails saying that the table/column already exists.&lt;br /&gt;&lt;br /&gt;Using script/console and ActiveRecord::Schema, it becomes a cinch to clean up the artifacts:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ActiveRecord::Schema.define do&lt;br /&gt;    drop_table :foos&lt;br /&gt;    remove_column :bars, :blitz&lt;br /&gt;    remove_column :bars, :things&lt;br /&gt;  end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 26 Mar 2006 02:53:55 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1772</guid>
      <author>MattScilipoti (Matt Scilipoti)</author>
    </item>
    <item>
      <title>tip: Database, For  'Event occurred' use bool from date.</title>
      <link>http://snippets.dzone.com/posts/show/1771</link>
      <description>From: http://jamis.jamisbuck.org/articles/2005/12/14/two-tips-for-working-with-databases-in-rails&lt;br /&gt;First tip: I&#8217;ve found recently that if I have a boolean field in the database that is being used to mark whether some event occurred (referrals.pending, or feeds.subscribed) it is often more effective to make the field a datetime and record the moment that the event occurred. Then, a NULL can be used to indicate that the event has not yet occurred. Thus, you have referrals.applied_at with a method on Referral like this:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  def pending?&lt;br /&gt;    applied_at.nil?&lt;br /&gt;  end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This gives you the capability down the road to not only report whether the event occurred, but how frequently over various periods of time.</description>
      <pubDate>Sun, 26 Mar 2006 02:51:49 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1771</guid>
      <author>MattScilipoti (Matt Scilipoti)</author>
    </item>
  </channel>
</rss>
