<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0' version='2.0'><channel><atom:id>tag:blogger.com,1999:blog-12016744</atom:id><lastBuildDate>Mon, 28 May 2012 01:49:19 +0000</lastBuildDate><category>TrialPay</category><category>Conferences</category><category>MySQL</category><category>Ham Radio</category><category>SQL Converter</category><category>Marketing</category><category>Encryption</category><category>Ruby on Rails</category><category>Security</category><category>Business Development</category><category>Civil liberties</category><category>Optimization</category><category>Self-defense</category><category>Launch Pad</category><category>Sample Code</category><title>Frank's Blog</title><description>On Software Development &amp;amp; Entrepreneurship.  Aiming to be eager to serve as per 1 Peter 5:2.</description><link>http://blog.rietta.com/</link><managingEditor>noreply@blogger.com (Frank Rietta)</managingEditor><generator>Blogger</generator><openSearch:totalResults>77</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-8961640795694541074</guid><pubDate>Mon, 07 May 2012 02:35:00 +0000</pubDate><atom:updated>2012-05-06T22:35:22.651-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Ruby on Rails</category><title>New GIT Time Extractor Gem</title><description>&lt;p&gt;I am happy to announce that &lt;a href="https://github.com/rietta/git_time_extractor/wiki" target="_blank"&gt;the git_time_extractor project&lt;/a&gt;, released publicly on github.com in February, is &lt;a href="https://rubygems.org/gems/git_time_extractor" target="_blank"&gt;now officially available as a RubyGem&lt;/a&gt;! &lt;/p&gt;&lt;p&gt;&lt;b&gt;git_time_extractor&lt;/b&gt; is a small command-line tool that produces a CSV time log for each developer/contributor to a project tracked in GIT. It uses the commit timestamps and three basic reasonable assumptions, approved by the developer's accountant. &lt;/p&gt;&lt;p&gt;It other words, computes the estimated time spent by developers working on code within a GIT repository. This is particularly useful for verifying developer timesheets and for tax purposes. &lt;/p&gt;&lt;h3&gt;The benefits are&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Save money on taxes by producing documents required by accountant to properly apply for certain tax credits &lt;/li&gt;&lt;li&gt;Track development time without time sheets&lt;/li&gt;&lt;li&gt;Compute time records based on the timestamps of each code commit by each developer&lt;/li&gt;&lt;li&gt;Compare these results with other time-sheets or metrics to measure the effectiveness of your team members&lt;/li&gt;&lt;/ul&gt; &lt;h3&gt;To do this, git_time_extractor makes a few assumptions&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;A series of commits within 3 hours are part of the same working session &lt;/li&gt;&lt;li&gt;A first commit is considered to represent 30 minutes of working time &lt;/li&gt;&lt;li&gt;Frequent commits increases the accuracy of the estimated time&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;To get started&lt;/h3&gt;&lt;div&gt;Installing is easy from your computer with Ruby installed. &amp;nbsp;From the command line, run:&lt;/div&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;gem install git_time_extractor&lt;/span&gt;&lt;/blockquote&gt;&lt;div&gt;Then go one of your GIT project directories, and run:&lt;/div&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;git_time_extractor &amp;gt; output_time.csv&lt;/span&gt;&lt;/blockquote&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;p&gt;&lt;div&gt;Then open the output_time.csv file with your favorite spreadsheet editor, be it Microsoft Excel, OpenOffice Calc, Google Apps, or something else.&lt;/div&gt;&lt;/p&gt; &lt;h3&gt;Upcoming talk at the AtlRug Meeting&lt;/h3&gt;&lt;p&gt;I am giving a short talk on the new git_time_extractor gem at &lt;a href="http://www.meetup.com/atlantaruby/"&gt;the May 9, 2012, Atlanta Ruby Users Group meeting&lt;/a&gt; at 6:30 pm.  If you are in the metro Atlanta area, please join us.  It's a good group of developers.  There is usually free pizza and good company as well.   &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-8961640795694541074?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/05/new-git-time-extractor-gem.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>1</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-6653516016802828741</guid><pubDate>Wed, 18 Apr 2012 13:43:00 +0000</pubDate><atom:updated>2012-04-18T09:43:40.729-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Ruby on Rails</category><title>mod_deflate: Dramatic website speed increase with Apache compression on Ubuntu Linux</title><description>It's easy to dramatically improve the loading speed of your website by enabling compression support in your Apache web server.  This works without needing to make any changes to your backend or database code no matter what programming platform your development team uses. &lt;br/&gt;&lt;br/&gt;I recently added this change to a Ruby on Rails-based web application running on a Ubuntu Linux dedicated virtual server.  That particular page observed a 72% decrease in bandwidth required to deliver the homepage.   &lt;br/&gt;&lt;br/&gt;It has been my experience with our internal and with client RoR sites that mod_deflate tends to provide a 62% to 72% savings on bandwidth required to deliver each page. This is significant for visitors on slower connections or mobile phones.  It is well worth enabling for most applications.   &lt;h1&gt;Three Easy Steps&lt;/h1&gt;&lt;h3&gt;Step 1: Enable mod_deflate in your Apache2 installation&lt;/h3&gt; &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sudo a2enmod deflate&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt; Step 2:&amp;nbsp;Edit /etc/apache2/httpd.conf to configure mod_deflate to compress certain file types&lt;/h3&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;IfModule mod_deflate.c&amp;gt;   &lt;br/&gt;# compress text, html, javascript, css, xml:   &lt;br/&gt;AddOutputFilterByType DEFLATE text/plain   &lt;br/&gt;AddOutputFilterByType DEFLATE text/html   &lt;br/&gt;AddOutputFilterByType DEFLATE text/xml   &lt;br/&gt;AddOutputFilterByType DEFLATE text/css   &lt;br/&gt;AddOutputFilterByType DEFLATE application/xml   &lt;br/&gt;AddOutputFilterByType DEFLATE application/xhtml+xml   &lt;br/&gt;AddOutputFilterByType DEFLATE application/rss+xml   &lt;br/&gt;AddOutputFilterByType DEFLATE application/javascript   &lt;br/&gt;AddOutputFilterByType DEFLATE application/x-javascript   &lt;br/&gt;AddOutputFilterByType DEFLATE image/x-icon &lt;br/&gt;&amp;lt;/IfModule&amp;gt; &lt;br/&gt;&lt;/span&gt;&lt;br /&gt;&lt;h3&gt; Step 3: Restart Apache to enable the changes&amp;nbsp;&lt;/h3&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sudo apachectl graceful&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;h1&gt;Test if it Worked&lt;/h1&gt; Once you have made the changes, test if the deflate is working properly by browsing through the website with all of your browsers.  Then confirm that the connection is running deflate using a third party tool.  One such is &lt;a href="http://www.whatsmyip.org/http-compression-test/" target="_blank"&gt;http://www.whatsmyip.org/http-compression-test/&lt;/a&gt;.  &lt;h1&gt;References&lt;/h1&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/mod_deflate.html" target="_blank"&gt;Apache Module mod_deflate&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.whatsmyip.org/http-compression-test/" target="_blank"&gt;HTTP Compression Test&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-6653516016802828741?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/04/moddeflate-dramatic-website-speed.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-4059078278222014211</guid><pubDate>Tue, 17 Apr 2012 19:26:00 +0000</pubDate><atom:updated>2012-04-17T15:26:18.436-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>MySQL</category><category domain='http://www.blogger.com/atom/ns#'>SQL Converter</category><title>Big data a big deal for SQL Server 2012, users say</title><description>TechTarget just published an article by&amp;nbsp;Alan Earls in which both&amp;nbsp;&lt;span style="background-color: white; font-family: Calibri, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 19px;"&gt;Sanjay Bhatia, a fellow founder of Atlanta-based database company (and ATDC graduate), and myself were quoted.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: white; line-height: 19px;"&gt;&lt;span style="font-family: Calibri, Helvetica, Arial, sans-serif;"&gt;&lt;a href="http://searchsqlserver.techtarget.com/news/2240148415/Big-data-a-big-deal-for-SQL-Server-2012-users-say" target="_blank"&gt;Big data a big deal for SQL Server 2012, users say&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;blockquote class="tr_bq"&gt;For Frank Rietta, the fact that Microsoft has been willing to work with an established open source project is the best part of SQL Server 2012.&lt;/blockquote&gt;&lt;blockquote class="tr_bq"&gt;Rietta is talking about the Apache Hadoop integration with SQL Server 2012. He is a software developer and president of Atlanta-based Rietta Inc., one of the member companies at the Advanced Technology Development Center (ATDC), which runs the incubator program at the Georgia Institute of Technology.&lt;/blockquote&gt;&lt;blockquote class="tr_bq"&gt;“Big data is becoming increasingly important even for small startups,” he said. And Microsoft’s partnering with established open source project is “refreshing,” he said.&lt;/blockquote&gt;&lt;/blockquote&gt;Please check out Alan's entire article. &amp;nbsp;The database server space is getting very interesting for small businesses and startups, who increasingly have access to technology that was previously only accessible to the largest organizations.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-4059078278222014211?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/04/big-data-big-deal-for-sql-server-2012.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-1921438554391528520</guid><pubDate>Thu, 12 Apr 2012 21:32:00 +0000</pubDate><atom:updated>2012-04-12T17:32:30.631-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>SQL Converter</category><title>SQL Saturday in Atlanta; SQL Converter to support PostgreSQL</title><description>I am looking forward to being at the SQL Saturday event at Georgia State University in Atlanta this Saturday! &amp;nbsp;&lt;a href="http://sqlsaturday.com/111/eventhome.aspx"&gt;http://sqlsaturday.com/111/eventhome.aspx&lt;/a&gt;. &amp;nbsp;It's exciting to see the traction that the SQL Converter Expert Conversion service is getting. &amp;nbsp;We're going to be adding some really great stuff soon, including PostgreSQL support.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-1921438554391528520?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/04/sql-saturday-in-atlanta-sql-converter.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-5771850337951480082</guid><pubDate>Thu, 05 Apr 2012 18:16:00 +0000</pubDate><atom:updated>2012-04-05T15:31:48.974-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Security</category><category domain='http://www.blogger.com/atom/ns#'>Encryption</category><title>What is Protected Personally Identifiable Information? Do I really have to hash users' passwords?</title><description>&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-size: 19px; font-weight: bold;"&gt;The Short Answer&lt;/span&gt;&lt;/div&gt;The legal answer depends on which Federal, State, and local laws apply to your company. &amp;nbsp;And I am not a lawyer. &amp;nbsp;However, for companys whose nexus is in Georgia, where my company is located, the Georgia General Assembly has given some guidance in the data breach law. &lt;br /&gt;&lt;br /&gt;And yes, you &lt;b&gt;really do have to hash your users' passwords&lt;/b&gt; or you risk having to do a full blown Data Breach Notification if the user's table is ever compromised!&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;   The Details&lt;/h3&gt;The exact definition of personal information varies among states.&lt;br /&gt;&lt;br /&gt;However, since my company is located in the State of Georgia, and so are many of our clients, I will use the Georgia State Data Breach Notification Law as an example.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;OCGA 10-1-911 (Official Georgia State Law)&lt;/b&gt;&amp;nbsp;defines it as:&lt;br /&gt;&lt;br /&gt;“Personal information” means an individual's first name or first initial and last name in combination with any one or more of the following data elements, when &lt;b&gt;either the name or the data elements are not encrypted or redacted&lt;/b&gt;:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Social security number;&lt;/li&gt;&lt;li&gt;Driver's license number or state identification card number;&lt;/li&gt;&lt;li&gt;Account number, credit card number, or debit card number, if circumstances exist wherein such a number could be used without additional identifying information, access codes, or passwords;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Account passwords&lt;/b&gt; or personal identification numbers or other access codes; or&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;The term “personal information” &lt;b&gt;does not&lt;/b&gt; include publicly available information that is lawfully made available to the general public from federal, state, or local government records.&lt;br /&gt;&lt;br /&gt;In general, the Georgia General Assembly has expressed concern over the threat of identity theft.&lt;br /&gt;&lt;br /&gt;My understanding is that &lt;b&gt;if you do not hash the passwords in your database and it is leaked then you have to do a full formal data breach notification&lt;/b&gt;. People tend to use the same passwords are multiple places. Secure hash algorithms with salting are your friends here.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;   Other Potentially Applicable Laws&lt;/h3&gt;&lt;div&gt;In general, security standards are either required for all entities that handle certain information (law mandates) or by contractual agreements with a private party or a government agency.&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;h4&gt;   U.S. Laws&lt;/h4&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;State Data Breach Laws&lt;/li&gt;&lt;li&gt;Health Insurance Portability and Accountability Act&lt;/li&gt;&lt;li&gt;Gramm-Leach-Bliley Act&lt;/li&gt;&lt;li&gt;Sarbanes–Oxley Act of 2002 (SOX)&lt;/li&gt;&lt;li&gt;Family Educational Rights and Privacy Act (FERPA)&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&amp;nbsp; &lt;br /&gt;&lt;h4&gt;   Contractual Agreements&lt;/h4&gt;&lt;/div&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Payment Card Industry Digital Security Standards (PCI-DSS)&lt;/li&gt;&lt;li&gt;Federal Data Security Standards&lt;/li&gt;&lt;li&gt;NIST SP 800-53, Recommended Security Controls for Federal Information Systems&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-5771850337951480082?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/04/what-is-protected-personally.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>1</thr:total><georss:featurename>fuseBOX @ Johns Creek</georss:featurename><georss:point>34.0508309 -84.1769968</georss:point><georss:box>34.0491864 -84.17946429999999 34.0524754 -84.1745293</georss:box></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-6168497559513011090</guid><pubDate>Mon, 02 Apr 2012 17:09:00 +0000</pubDate><atom:updated>2012-04-02T13:09:14.928-04:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>MySQL</category><category domain='http://www.blogger.com/atom/ns#'>SQL Converter</category><title>New Lines in Cell Data: The SQL Converter Expert Conversion Service Can Handle It!</title><description>The SQL Converter Team just had a client whose spreadsheet contained lots of new line characters in individual cell data. &amp;nbsp;Microsoft Excel 2010 on Windows was removing these new lines when saving the data as CSV or even when attempting to run it through the classic &lt;a href="http://www.sqlconverter.com/excel.html" target="_blank"&gt;SQL Converter for Excel add-in&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Despite the native Excel limitation, the &lt;a href="http://www.sqlconverter.com/expert.html" target="_blank"&gt;SQL Converter Expert Conversion Service&lt;/a&gt; was able to handle the data and convert it to MySQL 5. &amp;nbsp;We updated our Ruby-based conversion tool to directly read cell data from an Excel 2010 document and created a SQL dump file that preserved the new line characters within the cell data.&lt;br /&gt;&lt;br /&gt;Do you have spreadsheet data that needs to be converted into SQL? &amp;nbsp;Just send us your spreadsheet and let our professional data conversion specialists do the conversion to SQL for you. Nothing could be easier. &amp;nbsp;Learn more at:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sqlconverter.com/expert.html"&gt;http://www.sqlconverter.com/expert.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-6168497559513011090?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/04/new-lines-in-cell-data-sql-converter.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-741126883706583211</guid><pubDate>Sat, 03 Mar 2012 14:29:00 +0000</pubDate><atom:updated>2012-03-03T09:30:43.633-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>MySQL</category><title>Best Data Types for Currency/Money in MySQL?</title><description>&lt;div style="text-align: center;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; font-size: large;"&gt;So you want to know what the best data type is for storing currency/money values in MySQL?&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;The Short Answer&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;When handling money in MySQL, use DECIMAL(13,2) if you know the precision of your money values or use DOUBLE if you just want a quick good-enough approximate value.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;The Details&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On some database management systems (DBMS) there is a data type specially set aside for handling money. &amp;nbsp;However, MySQL doesn't have one so the choice of best representation is left to the programmer. &lt;br /&gt;&lt;br /&gt;Since about 1999, using MySQL 3, I have generally used the DOUBLE data type to represent money values as it stores decimals at reasonably high precision. The values stored are approximations, but the number of decimals treated accurately is enough for normal money values. &amp;nbsp;The ROUND function is helpful when doing aggregation queries, such as:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;SELECT&lt;/b&gt;&lt;br /&gt;&amp;nbsp; &lt;b&gt;ROUND&lt;/b&gt;(&lt;b&gt;SUM&lt;/b&gt;(&lt;span class="Apple-style-span" style="color: blue;"&gt;amount&lt;/span&gt;), 2) &lt;b&gt;AS&lt;/b&gt; &lt;span class="Apple-style-span" style="color: blue;"&gt;total_amount&lt;/span&gt;&lt;br /&gt;&lt;b&gt;FROM&lt;/b&gt; &lt;span class="Apple-style-span" style="color: blue;"&gt;orders&lt;/span&gt;&lt;br /&gt;&lt;b&gt;WHERE&lt;/b&gt; &lt;span class="Apple-style-span" style="color: blue;"&gt;created_at&lt;/span&gt; &amp;gt; '&lt;span class="Apple-style-span" style="color: #38761d;"&gt;2012-01-01&lt;/span&gt;'&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;However, since MySQL 5 there are some better data types for storing exact money values. &amp;nbsp;From the MySQL manual:&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;"The DECIMAL and NUMERIC types store exact numeric data values. These types are used when it is important to preserve exact precision, for example with monetary data. In MySQL, NUMERIC is implemented as DECIMAL, so the following remarks about DECIMAL apply equally to NUMERIC."&lt;/blockquote&gt;The DECIMAL data type requires you to specify the number of digits before the decimal point and the number of digits after the decimal point.&lt;br /&gt;&lt;br /&gt;So if your application needs to handle money values up to a trillion dollars (or euros or pounds), then this should work:&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;DECIMAL(13, 2)&lt;/blockquote&gt;However, considering the rate that the central banks are printing money these days, we might all soon need to be processing larger values for currency.&lt;br /&gt;&lt;br /&gt;I hope this helps.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;References&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.0/en/fixed-point-types.html" target="_blank"&gt;MySQL:&amp;nbsp;10.2.2. Fixed-Point Types (Exact Value)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.0/en/floating-point-types.html" target="_blank"&gt;MySQL:&amp;nbsp;10.2.3. Floating-Point Types (Approximate Value)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;One Last Thing&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;One of the services my company offers is database conversion solutions. &amp;nbsp;Are you looking to convert spreadsheet data to a MySQL database? &amp;nbsp;Check out &lt;a href="http://www.sqlconverter.com/expert.html" target="_blank"&gt;SQL Converter's new Expert Conversion Service&lt;/a&gt;. &amp;nbsp;The classic Excel macro is still available as well.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-741126883706583211?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/03/best-data-types-for-currencymoney-in.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>2</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-3948781463923180933</guid><pubDate>Fri, 02 Mar 2012 00:15:00 +0000</pubDate><atom:updated>2012-03-01T19:15:37.781-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>SQL Converter</category><title>Working on SQL Converter for Excel Refresh for 64-bit Excel</title><description>Even though Microsoft is known for being fanatical about maintaining backwards&amp;nbsp;compatibility, SQL Converter for Excel apparently doesn't work so well in 64-bit Excel 2010 on Windows 7. &amp;nbsp;Unfortunately that was an&amp;nbsp;environment&amp;nbsp;that we did not have on any of our systems. &amp;nbsp;I am configuring a new copy Windows 7 Pro in a Parallels virtual machine so that I can get a refresh working.&lt;br /&gt;&lt;br /&gt;In the mean time, check out our new Expert Conversion Service at&amp;nbsp;&lt;a href="http://www.sqlconverter.com/expert.html"&gt;http://www.sqlconverter.com/expert.html&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-3948781463923180933?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/03/working-on-sql-converter-for-excel.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-1462548975128823152</guid><pubDate>Thu, 23 Feb 2012 02:55:00 +0000</pubDate><atom:updated>2012-02-22T21:55:31.426-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Business Development</category><title>Startup Riot 2012 is done; congratulations to the winners</title><description>&lt;a href="http://www.startupriot.com/" target="_blank"&gt;Startup Riot 2012&lt;/a&gt; at the &lt;a href="http://www.tabernacleatl.com/index" target="_blank"&gt;Tabernacle in Atlanta&lt;/a&gt; was enjoyable and informative. &amp;nbsp;Anytime you get that many entrepreneurs and investors together in one place, good things will happen. &amp;nbsp;The conversations alone are well worth the price of admission.&lt;br /&gt;&lt;br /&gt;Congratulations to the winners:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;a href="http://www.viacycle.com/" target="_blank"&gt;ViaCycle&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://salesloft.com/" target="_blank"&gt;SalesLoft&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://Driver.ly/"&gt;Driver.ly&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Three minute pitches in front of a live audience and a panel of celebrity judges are tough. You all stuck your necks out in a big way and came home with the prize. &amp;nbsp;Good job!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-1462548975128823152?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/02/startup-riot-2012-is-done.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>1</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-8459136374923491137</guid><pubDate>Fri, 03 Feb 2012 05:20:00 +0000</pubDate><atom:updated>2012-02-03T00:22:13.936-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Ruby on Rails</category><title>[Rails] Good Random Positive Integer</title><description>Tonight I needed a quick way to generate a good pseudo random number. &amp;nbsp;The following statement in Ruby will generate a positive integer between 0 and the maximum integer supported on the system.&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;SecureRandom.random_number((2**(0.size * 8-2)-1))&lt;/span&gt;&lt;/blockquote&gt;Running that 10 times as a test on my system returned:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;479960941838047707&lt;/li&gt;&lt;li&gt;4598189742420362323&lt;/li&gt;&lt;li&gt;4319555246297899788&lt;/li&gt;&lt;li&gt;79907720343840910&lt;/li&gt;&lt;li&gt;1019099276589074756&lt;/li&gt;&lt;li&gt;1753578159791031009&lt;/li&gt;&lt;li&gt;51485412595337811&lt;/li&gt;&lt;li&gt;3333462064391733874&lt;/li&gt;&lt;li&gt;2622897372121370782&lt;/li&gt;&lt;li&gt;4287564549349999056&lt;/li&gt;&lt;/ul&gt;That's all for tonight.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt; Sources&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://api.rubyonrails.org/v3.0.9/classes/ActiveSupport/SecureRandom.html#method-c-random_number"&gt;Secure random number generator interface&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/535721/ruby-max-integer"&gt;Ruby max integer&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-8459136374923491137?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/02/rails-good-random-positive-integer.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-1598903792533235980</guid><pubDate>Fri, 27 Jan 2012 16:45:00 +0000</pubDate><atom:updated>2012-01-27T11:45:32.287-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Security</category><category domain='http://www.blogger.com/atom/ns#'>Encryption</category><title>OpenSSL: Generating an RSA Key from the Command Line</title><description>A few of weeks ago, I posted about how to&amp;nbsp;&lt;span class="Apple-style-span" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 18px;"&gt;&lt;a href="http://2012/01/openssl-encrypt-file-with-password-from.html"&gt;Encrypt a File with a Password from the Command Line using OpenSSL&lt;/a&gt;. While very useful in its own right, the real power of the OpenSSL library is its ability to support the use of public key cryptograph for e&lt;/span&gt;ncrypting or validating data in an unattended manner (where the password is not required to encrypt) is done with public keys.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;The Commands to Run&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can generate a pubic and private RSA key pair like this:&lt;br /&gt;&lt;div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;blockquote class="tr_bq"&gt;&lt;b&gt; openssl genrsa -des3 -out&lt;/b&gt;private.pem &lt;b&gt;2048&lt;/b&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;That generates a &lt;b&gt;2048&lt;/b&gt;-bit RSA key pair, encrypts them with a password you provide, and writes them to a file. You need to next extract the public key file. You will use this, for instance, on your web server to encrypt content so that it can only be read with the private key:&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;blockquote class="tr_bq"&gt;&lt;b&gt; openssl rsa -in &lt;/b&gt;private.pem &lt;b&gt;-out&lt;/b&gt; public.pem &lt;b&gt;-outform PEM -pubout&lt;/b&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;The Generated Key Files&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The generated files are base64-encoded encryption keys in plain text format. &amp;nbsp;If you select a password for your private key, its file will be encrypted with your password. &amp;nbsp;Be sure to remember this password or the key pair becomes useless.&lt;br /&gt;&lt;br /&gt;The &lt;i&gt;private.pem &lt;/i&gt;file&amp;nbsp;looks something like this:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;-----BEGIN RSA PRIVATE KEY-----&lt;br /&gt;Proc-Type: 4,ENCRYPTED&lt;br /&gt;DEK-Info: DES-EDE3-CBC,32495A90F3FF199D&lt;br /&gt;lrMAsSjjkKiRxGdgR8p5kZJj0AFgdWYa3OT2snIXnN5+/p7j13PSkseUcrAFyokc&lt;br /&gt;V9pgeDfitAhb9lpdjxjjuxRcuQjBfmNVLPF9MFyNOvhrprGNukUh/12oSKO9dFEt&lt;br /&gt;s39F/2h6Ld5IQrGt3gZaBB1aGO+tw3ill1VBy2zGPIDeuSz6DS3GG/oQ2gLSSMP4&lt;br /&gt;OVfQ32Oajo496iHRkdIh/7Hho7BNzMYr1GxrYTcE9/Znr6xgeSdNT37CCeCH8cmP&lt;br /&gt;aEAUgSMTeIMVSpILwkKeNvBURic1EWaqXRgPRIWK0vNyOCs/+jNoFISnV4pu1ROF&lt;br /&gt;92vayHDNSVw9wHcdSQ75XSE4Msawqv5U1iI7e2lD64uo1qhmJdrPcXDJQCiDbh+F&lt;br /&gt;hQhF+wAoLRvMNwwhg+LttL8vXqMDQl3olsWSvWPs6b/MZpB0qwd1bklzA6P+PeAU&lt;br /&gt;sfOvTqi9edIOfKqvXqTXEhBP8qC7ZtOKLGnryZb7W04SSVrNtuJUFRcLiqu+w/F/&lt;br /&gt;MSxGSGalYpzIZ1B5HLQqISgWMXdbt39uMeeooeZjkuI3VIllFjtybecjPR9ZYQPt&lt;br /&gt;FFEP1XqNXjLFmGh84TXtvGLWretWM1OZmN8UKKUeATqrr7zuh5AYGAIbXd8BvweL&lt;br /&gt;Pigl9ei0hTculPqohvkoc5x1srPBvzHrirGlxOYjW3fc4kDgZpy+6ik5k5g7JWQD&lt;br /&gt;lbXCRz3HGazgUPeiwUr06a52vhgT7QuNIUZqdHb4IfCYs2pQTLHzQjAqvVk1mm2D&lt;br /&gt;kh4myIcTtf69BFcu/Wuptm3NaKd1nwk1squR6psvcTXOWII81pstnxNYkrokx4r2&lt;br /&gt;7YVllNruOD+cMDNZbIG2CwT6V9ukIS8tl9EJp8eyb0a1uAEc22BNOjYHPF50beWF&lt;br /&gt;ukf3uc0SA+G3zhmXCM5sMf5OxVjKr5jgcir7kySY5KbmG71omYhczgr4H0qgxYo9&lt;br /&gt;Zyj2wMKrTHLfFOpd4OOEun9Gi3srqlKZep7Hj7gNyUwZu1qiBvElmBVmp0HJxT0N&lt;br /&gt;mktuaVbaFgBsTS0/us1EqWvCA4REh1Ut/NoA9oG3JFt0lGDstTw1j+orDmIHOmSu&lt;br /&gt;7FKYzr0uCz14AkLMSOixdPD1F0YyED1NMVnRVXw77HiAFGmb0CDi2KEg70pEKpn3&lt;br /&gt;ksa8oe0MQi6oEwlMsAxVTXOB1wblTBuSBeaECzTzWE+/DHF+QQfQi8kAjjSdmmMJ&lt;br /&gt;yN+shdBWHYRGYnxRkTatONhcDBIY7sZV7wolYHz/rf7dpYUZf37vdQnYV8FpO1um&lt;br /&gt;Ya0GslyRJ5GqMBfDS1cQKne+FvVHxEE2YqEGBcOYhx/JI2soE8aA8W4XffN+DoEy&lt;br /&gt;ZkinJ/+BOwJ/zUI9GZtwB4JXqbNEE+j7r7/fJO9KxfPp4MPK4YWu0H0EUWONpVwe&lt;br /&gt;TWtbRhQUCOe4PVSC/Vv1pstvMD/D+E/0L4GQNHxr+xyFxuvILty5lvFTxoAVYpqD&lt;br /&gt;u8gNhk3NWefTrlSkhY4N+tPP6o7E4t3y40nOA/d9qaqiid+lYcIDB0cJTpZvgeeQ&lt;br /&gt;ijohxY3PHruU4vVZa37ITQnco9az6lsy18vbU0bOyK2fEZ2R9XVO8fH11jiV8oGH&lt;br /&gt;-----END RSA PRIVATE KEY-----&lt;/span&gt;&lt;/blockquote&gt;and the public key, &lt;i&gt;public.pem&lt;/i&gt;, file looks like:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;-----BEGIN PUBLIC KEY-----&lt;br /&gt;MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxzYuc22QSst/dS7geYYK&lt;br /&gt;5l5kLxU0tayNdixkEQ17ix+CUcUbKIsnyftZxaCYT46rQtXgCaYRdJcbB3hmyrOa&lt;br /&gt;vkhTpX79xJZnQmfuamMbZBqitvscxW9zRR9tBUL6vdi/0rpoUwPMEh8+Bw7CgYR0&lt;br /&gt;FK0DhWYBNDfe9HKcyZEv3max8Cdq18htxjEsdYO0iwzhtKRXomBWTdhD5ykd/fAC&lt;br /&gt;VTr4+KEY+IeLvubHVmLUhbE5NgWXxrRpGasDqzKhCTmsa2Ysf712rl57SlH0Wz/M&lt;br /&gt;r3F7aM9YpErzeYLrl0GhQr9BVJxOvXcVd4kmY+XkiCcrkyS1cnghnllh+LCwQu1s&lt;br /&gt;YwIDAQAB&lt;br /&gt;-----END PUBLIC KEY-----&lt;/span&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Protecting Your Keys&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Depending on the nature of the information you will protect, it's important to keep the private key backed up and secret.&amp;nbsp;&lt;/li&gt;&lt;li&gt;The public key can be distributed anywhere or embedded in your web application scripts, such as in your PHP, Ruby, or other scripts.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Again, backup your keys!&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Remember, if the key goes away the data encrypted to it is gone.&lt;/li&gt;&lt;li&gt;Keeping a printed copy of the key material in a sealed envelope in a bank safety deposit box is a good way to protect important keys against loss due to fire or hard drive failure.&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;span class="Apple-style-span" style="font-family: inherit; font-size: large;"&gt;&lt;b&gt;But! &amp;nbsp;How do I use this Key?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Don't worry, I will write about how to use your freshly minted RSA keys in a future blog post. &amp;nbsp;In the mean time checkout the PHP functionality at&amp;nbsp;&lt;a href="http://us2.php.net/openssl_seal"&gt;http://us2.php.net/openssl_seal&lt;/a&gt;. &amp;nbsp;Hint, you can use your new public key with openssl_seal.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;I hope this helps!&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;i&gt;Oh, and one last thing. &amp;nbsp;If you, dear reader, were planning any funny business with the private key that I have just published here. &amp;nbsp;Know that they were made especially for this series of blog posts. I do not use them for anything else.&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-1598903792533235980?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/01/openssl-generating-rsa-key-from-command.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-3881422486620544469</guid><pubDate>Tue, 24 Jan 2012 15:39:00 +0000</pubDate><atom:updated>2012-01-24T10:39:06.867-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Ruby on Rails</category><title>Rails: Point DNS to 127.0.0.1 to Test Wildcard Subdomains on WEBrick</title><description>Want quick method for testing domain/subdomain-based routing logic in your Rails applications?&amp;nbsp;Point a subdomain and wildcard subdomain of your company's DNS to&amp;nbsp;127.0.0.1,&amp;nbsp;your localhost IP address. &lt;br /&gt;&lt;br /&gt;Then you can use that domain to access your local test web server on your local machine.&lt;br /&gt;&lt;br /&gt;For example, I added DNS "A" records for:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;test.rietta.com -&amp;gt; 127.0.0.1&lt;/li&gt;&lt;li&gt;*.test.rietta.com -&amp;gt; 127.0.0.1&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Now Rietta's developers can each access his local&amp;nbsp;WEBrick server with:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;http://test.rietta.com:3000/&lt;/li&gt;&lt;li&gt;http://something-made-up-on-the-spot.test.rietta.com:3000/&lt;/li&gt;&lt;li&gt;http://something-else.test.rietta.com:3000/&lt;/li&gt;&lt;li&gt;etc&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Editing your /etc/hosts file is also an option, but that does not support wildcard domains.&lt;br /&gt;&lt;br /&gt;Feel free to use my test subdomains if you want. &amp;nbsp;They will simply point back to your computer.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-3881422486620544469?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/01/rails-point-dns-to-127001-to-test.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-7458163660760361270</guid><pubDate>Wed, 18 Jan 2012 05:19:00 +0000</pubDate><atom:updated>2012-01-18T00:19:18.918-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Ruby on Rails</category><title>Rails: Gmail Reply-To on Contact Form Email</title><description>Most websites have a contact form for visitors to fill out a message that is then e-mailed to the owner or support contact for the website. &lt;br /&gt;&lt;br /&gt;When working with a Rails app that will be hosted in a cloud environment that does not supply outbound email delivery it can be convenient to use a Gmail (or Google Apps) account at first for outbound delivery.&lt;br /&gt;&lt;br /&gt;The trouble is that Google's SMTP server will rewrite the email address set in the email message to match the address of the account. &amp;nbsp;You can add verified alias emails to your Gmail account, but obviously you cannot do that for all of your website visitors' addresses.&lt;br /&gt;&lt;br /&gt;Suppose your website's account is my_great_rails_app@gmail.com and you do something like the following in your application's mailer:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sender_email_address = "&lt;span class="Apple-style-span" style="color: #38761d;"&gt;website_user@example.com&lt;/span&gt;"&lt;br /&gt;mail( &lt;b&gt;:to&lt;/b&gt; =&amp;gt; "&lt;span class="Apple-style-span" style="color: #38761d;"&gt;your_email@example.com&lt;/span&gt;",&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;:from&lt;/b&gt; =&amp;gt;&amp;nbsp;sender_email_address,&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;:subject&lt;/b&gt; =&amp;gt; "Message from Your Website")&lt;/span&gt;&lt;/blockquote&gt;When you get the message it will be from&amp;nbsp;my_great_rails_app@gmail.com and not from website_user@example.com. &amp;nbsp;Worse, if you did not think to include a copy of the sender's email in the body of the message you will have no record of who sent it. &amp;nbsp;That's just not good!&lt;br /&gt;&lt;br /&gt;The easiest solution is to set the reply-to header like this:&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sender_email_address = "&lt;span class="Apple-style-span" style="color: #38761d;"&gt;website_user@example.com&lt;/span&gt;"&lt;br /&gt;mail(&amp;nbsp;&lt;b&gt;:to&lt;/b&gt;&amp;nbsp;=&amp;gt; "&lt;span class="Apple-style-span" style="color: #38761d;"&gt;your_email@example.com&lt;/span&gt;",&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;b&gt;:from&lt;/b&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;sender_email_address,&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;b&gt;:'reply-to'&lt;/b&gt;&amp;nbsp;=&amp;gt; sender_email_address,&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;b&gt;:subject&lt;/b&gt;&amp;nbsp;=&amp;gt; "Message from Your Website")&lt;/span&gt;&lt;/blockquote&gt;Now the emails from your website will still be from&amp;nbsp;my_great_rails_app@gmail.com, but when you hit reply in your e-mail client your message will be addressed to website_user@example.com. &amp;nbsp;So you can reply without any extra work.&lt;br /&gt;&lt;br /&gt;I hope this helps.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-7458163660760361270?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/01/rails-gmail-reply-to-on-contact-form.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>3</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-7873139570591416496</guid><pubDate>Tue, 17 Jan 2012 06:12:00 +0000</pubDate><atom:updated>2012-01-17T01:12:38.977-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Civil liberties</category><category domain='http://www.blogger.com/atom/ns#'>Security</category><title>Wikipedia *blackout* tomorrow in protest to SOPA/PIPA</title><description>&lt;br /&gt;Tomorrow (Jan 18) &lt;a href="http://wikimediafoundation.org/wiki/English_Wikipedia_anti-SOPA_blackout" target="_blank"&gt;Wikipedia will be shut down for 24 hours in protest of Congress' continuation of consideration of the Stop Online Privacy Act (SOPA) and Protect IP Act (PIPA)&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The Wikipedia blackout demonstrates the chilling nature of what can happen when websites can be shutdown on mere accusation without due process. &amp;nbsp;The new requirements could even stifle &lt;a href="http://www.booz.com/global/home/what_we_think/reports_and_white_papers/ic-display/49953075?tid=39964387&amp;amp;pg=all" target="_blank"&gt;early-stage investment in internet startup companies&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;According to Sue Gardner, Executive Director of the Wikimedia Foundation:&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;"The reality is that we don’t think SOPA is going away, and PIPA is still quite active. Moreover, SOPA and PIPA are just indicators of a much broader problem. All around the world, we’re seeing the development of legislation seeking to regulate the Internet in other ways while hurting our online freedoms. Our concern extends beyond SOPA and PIPA: they are just part of the problem. We want the Internet to remain free and open, everywhere, for everyone."&lt;/blockquote&gt;Both the House and Senate bills could be more properly called the legalized authorization of denial of service without due process acts. &amp;nbsp;Both bills are immensely dangerous to the freedom of speech on the internet.&lt;br /&gt;&lt;br /&gt;Please learn as much as you can and write to your representativies in Congress, both in the House and in the Senate.&lt;br /&gt;&lt;br /&gt;A good resource is&amp;nbsp;&lt;a href="https://www.eff.org/deeplinks/2012/01/how-pipa-and-sopa-violate-white-house-principles-supporting-free-speech" target="_blank"&gt;How PIPA and SOPA Violate White House Principles Supporting Free Speech and Innovation&lt;/a&gt;.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-7873139570591416496?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/01/wikipedia-blackout-tomorrow-in-protest.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-1822657435412872223</guid><pubDate>Sat, 14 Jan 2012 19:55:00 +0000</pubDate><atom:updated>2012-01-14T17:49:43.949-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Ruby on Rails</category><title>Rails: TypeError: nil can't be coerced into Float</title><description>When working on Ruby on Rails website some of the common errors that you need to check for is &lt;i&gt;nil&lt;/i&gt; objects when something else was expected. &amp;nbsp;For instance, suppose one of your ActiveRecord models has a price field. &amp;nbsp;Further suppose that the user left this field blank instead of entering 0.0 as the price. &lt;br /&gt;&lt;br /&gt;The computation:&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;quantity = 3&lt;br /&gt;...&lt;br /&gt;amount_to_charge = price_field *&amp;nbsp;quantity&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;Will fail with a "TypeError: nil can't be coerced into Float" exception. &amp;nbsp;Your user will be shown the dreaded red "We're sorry, but something went wrong" page.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-S-IJNBNQmfM/TxHZkndZ57I/AAAAAAAAAOU/_1DQ2gzBPTY/s1600/Rails_Default_500_Error_Page.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="84" src="http://3.bp.blogspot.com/-S-IJNBNQmfM/TxHZkndZ57I/AAAAAAAAAOU/_1DQ2gzBPTY/s320/Rails_Default_500_Error_Page.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;A few observations:&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;This is correct behavior because Ruby as a language cannot assume that a &lt;i&gt;nil&lt;/i&gt; object is equivalent to 0. &amp;nbsp;It&amp;nbsp;will not automatically convert the value to 0 for the purposes of completing the computation.&lt;/li&gt;&lt;li&gt;&lt;i&gt;nil&lt;/i&gt; implements &lt;b&gt;to_f&lt;/b&gt;, which returns 0.0 as a &lt;i&gt;float&lt;/i&gt;.&lt;/li&gt;&lt;li&gt;&lt;i&gt;nil&lt;/i&gt; implements &lt;b&gt;to_i&lt;/b&gt;, which returns 0 as an &lt;i&gt;integer&lt;/i&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;In the current example, it is reasonable to treat &lt;i&gt;nil&lt;/i&gt;&amp;nbsp;as a &lt;i&gt;0.0&lt;/i&gt;. &amp;nbsp;The following will do that:&lt;/div&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;quantity = 3&lt;br /&gt;...&lt;br /&gt;amount_to_charge = price_field.to_f * quantity&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;The same will work with integers using &lt;b&gt;to_i&lt;/b&gt;. &amp;nbsp;Instances when &lt;i&gt;nil &lt;/i&gt;can reasonably considered 0 is only something that you, as the programmer can decide. &amp;nbsp;In most cases it would be better to include good validations and default values in all of your models to avoid this situation altogether.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;I hope this helps!&lt;/div&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-1822657435412872223?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/01/rails-typeerror-nil-cant-be-coerced.html</link><author>noreply@blogger.com (Frank Rietta)</author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-S-IJNBNQmfM/TxHZkndZ57I/AAAAAAAAAOU/_1DQ2gzBPTY/s72-c/Rails_Default_500_Error_Page.png' height='72' width='72'/><thr:total>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-328495720844001971</guid><pubDate>Mon, 09 Jan 2012 05:22:00 +0000</pubDate><atom:updated>2012-01-09T00:22:18.850-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Security</category><category domain='http://www.blogger.com/atom/ns#'>Encryption</category><title>OpenSSL: Encrypt a File with a Password from the Command Line</title><description>Do you know how to use OpenSSL to protect sensitive information in storage instead of just in transit across the network? &amp;nbsp;In fact, your can use the OpenSSL command line too to encrypt a file on your Mac OS X, Linux, or FreeBSD based computer. &amp;nbsp;Support for the library are included by default in PHP and Ruby. &amp;nbsp;So there is no reason not to use it to add additional security to your web applications.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Encrypting a File from the Command Line&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;In terminal, suppose you wanted to encrypt a file with a password (symmetric key encryption). &lt;br /&gt;&lt;br /&gt;To do this using the OpenSSL command line tool, you could run this:&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;b&gt;openssl aes-128-cbc -in &lt;/b&gt;Archive.zip&lt;b&gt; -out &lt;/b&gt;Archive.zip.aes128&lt;/blockquote&gt;To decrypt it (notice the addition of the -d flag that triggers a decrypt instead of an encrypt action):&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;b&gt;openssl aes-128-cbc -d -in &lt;/b&gt;Archive.zip.aes128&lt;b&gt;&amp;nbsp;-out &amp;nbsp;&lt;/b&gt;Archive.zip&lt;/blockquote&gt;This example uses the Advanced Encryption Standard (AES) cipher in cipher-block chaining mode. &amp;nbsp;The file is very strongly encrypted for normal purposes assuming that you picked a good passphrase.&lt;br /&gt;&lt;br /&gt;According to Bruce Schneier, "...for new applications I suggest that people don't use AES-256. AES-128 provides more than enough security margin for the forseeable future. But if you're already using AES-256, there's no reason to change" (&lt;a href="http://www.schneier.com/blog/archives/2009/07/another_new_aes.html" target="_blank"&gt;Another New AES Attack&lt;/a&gt;, July 30, 2009).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Built into Ruby and PHP&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;The OpenSSL library is a very standardized open source security library. It's built into the majority of platforms, including Mac OS X, Linux, FreeBSD, iOS, and Android. &amp;nbsp;Compatible SSL libraries are also built into Java and even the Microsoft platforms.&lt;br /&gt;&lt;br /&gt;In future articles, we will explore the usage of OpenSSL for encryption and verification in website projects. In the mean time, check out these API references for both PHP and Ruby.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://us.php.net/openssl" target="_blank"&gt;OpenSSL Support in PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/index.html" target="_blank"&gt;OpenSSL in Ruby 1.9.2&lt;/a&gt;&amp;nbsp;&amp;nbsp;(for your Ruby on Rails)&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Impressive Array of Options&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;On my Mac OS X system, the default openssl install supports and impressive set of 49 algorithms to choose from. &lt;br /&gt;&lt;ul&gt;&lt;li&gt;aes-128-cbc&lt;/li&gt;&lt;li&gt;aes-128-ecb&lt;/li&gt;&lt;li&gt;aes-192-cbc&lt;/li&gt;&lt;li&gt;aes-192-ecb&lt;/li&gt;&lt;li&gt;aes-256-cbc&lt;/li&gt;&lt;li&gt;aes-256-ecb&lt;/li&gt;&lt;li&gt;base64&lt;/li&gt;&lt;li&gt;bf&lt;/li&gt;&lt;li&gt;bf-cbc&lt;/li&gt;&lt;li&gt;bf-cfb&lt;/li&gt;&lt;li&gt;bf-ecb&lt;/li&gt;&lt;li&gt;bf-ofb&lt;/li&gt;&lt;li&gt;camellia-128-cbc&lt;/li&gt;&lt;li&gt;camellia-128-ecb&lt;/li&gt;&lt;li&gt;camellia-192-cbc&lt;/li&gt;&lt;li&gt;camellia-192-ecb&lt;/li&gt;&lt;li&gt;camellia-256-cbc&lt;/li&gt;&lt;li&gt;camellia-256-ecb&lt;/li&gt;&lt;li&gt;cast&lt;/li&gt;&lt;li&gt;cast-cbc&lt;/li&gt;&lt;li&gt;cast5-cbc&lt;/li&gt;&lt;li&gt;cast5-cfb&lt;/li&gt;&lt;li&gt;cast5-ecb&lt;/li&gt;&lt;li&gt;cast5-ofb&lt;/li&gt;&lt;li&gt;des&lt;/li&gt;&lt;li&gt;des-cbc&lt;/li&gt;&lt;li&gt;des-cfb&lt;/li&gt;&lt;li&gt;des-ecb&lt;/li&gt;&lt;li&gt;des-ede&lt;/li&gt;&lt;li&gt;des-ede-cbc&lt;/li&gt;&lt;li&gt;des-ede-cfb&lt;/li&gt;&lt;li&gt;des-ede-ofb&lt;/li&gt;&lt;li&gt;des-ede3&lt;/li&gt;&lt;li&gt;des-ede3-cbc&lt;/li&gt;&lt;li&gt;des-ede3-cfb&lt;/li&gt;&lt;li&gt;des-ede3-ofb&lt;/li&gt;&lt;li&gt;des-ofb&lt;/li&gt;&lt;li&gt;des3&lt;/li&gt;&lt;li&gt;desx&lt;/li&gt;&lt;li&gt;idea&lt;/li&gt;&lt;li&gt;idea-cbc&lt;/li&gt;&lt;li&gt;idea-cfb&lt;/li&gt;&lt;li&gt;idea-ecb&lt;/li&gt;&lt;li&gt;idea-ofb&lt;/li&gt;&lt;li&gt;rc2&lt;/li&gt;&lt;li&gt;rc2-40-cbc&lt;/li&gt;&lt;li&gt;rc2-64-cbc&lt;/li&gt;&lt;li&gt;rc2-cbc&lt;/li&gt;&lt;li&gt;rc2-cfb&lt;/li&gt;&lt;li&gt;rc2-ecb&lt;/li&gt;&lt;li&gt;rc2-ofb&lt;/li&gt;&lt;li&gt;rc4&lt;/li&gt;&lt;li&gt;rc4-40&lt;/li&gt;&lt;li&gt;seed&lt;/li&gt;&lt;li&gt;seed-cbc&lt;/li&gt;&lt;li&gt;seed-cfb&lt;/li&gt;&lt;li&gt;seed-ecb&lt;/li&gt;&lt;li&gt;seed-ofb&lt;/li&gt;&lt;li&gt;zlib&lt;/li&gt;&lt;/ul&gt;This truly is the swiss army knife of encryption tools. &amp;nbsp;You should use it too.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-328495720844001971?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/01/openssl-encrypt-file-with-password-from.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-8867494820582336579</guid><pubDate>Wed, 04 Jan 2012 21:51:00 +0000</pubDate><atom:updated>2012-01-04T16:51:16.783-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Business Development</category><title>Dale Sizemore of FLIPSFILM was on ShowBiz Atlanta Radio</title><description>Dale Sizemore of&amp;nbsp;&lt;a href="https://www.flipsfilm.com/" target="_blank"&gt;flipsfilm.com&lt;/a&gt;, one of my company's clients, was just on the inaugural radio broadcast of &lt;a href="http://showbizatlanta.businessradiox.com/2011/12/28/launch/" target="_blank"&gt;ShowBiz Atlanta with host Dana Barrett&lt;/a&gt;. &amp;nbsp;I believe this is Dale's third radio interview in the last month!&lt;br /&gt;&lt;br /&gt;FLIPSFilm is working to really change the landscape of film permit processing in Georgia to benefit the local communities, local vendors, and of course the film industry. &amp;nbsp;My team is glad to be a part of building the technology that supports their innovation.&lt;br /&gt;&lt;br /&gt;Dale has also recently started blogging himself at&amp;nbsp;&lt;a href="http://blog.flipsfilm.com/" target="_blank"&gt;The Wrap Party&lt;/a&gt;. &amp;nbsp;It should be a good resource for anyone&amp;nbsp;wanting to be involved with movies and TV production&amp;nbsp;in Georgia.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-8867494820582336579?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/01/dale-sizemore-of-flipsfilm-was-on.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total><georss:featurename>Johns Creek, GA, USA</georss:featurename><georss:point>34.0289259 -84.198579</georss:point><georss:box>33.923649899999994 -84.35650749999999 34.1342019 -84.0406505</georss:box></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-5610021925289485028</guid><pubDate>Tue, 03 Jan 2012 14:59:00 +0000</pubDate><atom:updated>2012-01-03T11:40:40.281-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Marketing</category><category domain='http://www.blogger.com/atom/ns#'>Conferences</category><category domain='http://www.blogger.com/atom/ns#'>Business Development</category><title>Startup Riot Atlanta 2012 Registration is Open</title><description>Sanjay Parekh (&lt;a href="http://twitter.com/sanjay" target="_blank"&gt;@sanjay&lt;/a&gt; on Twitter) just announced that registration is open for &lt;a href="http://startupriot.com/" target="_blank"&gt;Startup Riot 2012&lt;/a&gt; in Atlanta. &lt;br /&gt;&lt;br /&gt;I went as a regular entrepreneur attendee (non-presenting) last year in 2011. &amp;nbsp;It's well worth your time to try to make it to the SHOW if you can schedule Feb 22, 2012, to attend. Just remember that this is absolutely not an event for pitching services. &amp;nbsp;Make new friends. &amp;nbsp;Get energized talking with and having lunch with other technology entrepreneurs. &amp;nbsp;It's great.&lt;br /&gt;&lt;br /&gt;This year they have three events:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;"Startup Riot MAKE" is a four day hackathon proceeding the conference&lt;/li&gt;&lt;li&gt;"Startup Riot JOIN" is the career fair featuring startup companies&lt;/li&gt;&lt;li&gt;"Startup Riot SHOW" is the big show at the Tabernacle in Atlanta where many entrepreneurs will present for 3 minutes.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Check it out. I hope to see you there.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-5610021925289485028?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/01/startup-riot-atlanta-2012-registration.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total><georss:featurename>Atlanta, GA, USA</georss:featurename><georss:point>33.7489954 -84.3879824</georss:point><georss:box>33.6433744 -84.5459109 33.8546164 -84.2300539</georss:box></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-3970402992608431500</guid><pubDate>Mon, 02 Jan 2012 05:58:00 +0000</pubDate><atom:updated>2012-02-06T14:02:11.201-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Sample Code</category><category domain='http://www.blogger.com/atom/ns#'>Ruby on Rails</category><title>Integrate Blog Content with your Rails 3 Website with Pure Ruby Code and RSS</title><description>&lt;br /&gt;The full sample code used for this post is available as a Ruby on Rails 3.1 project at&amp;nbsp;&lt;a href="https://github.com/rietta/SimpleBlogFeed" target="_blank"&gt;https://github.com/rietta/SimpleBlogFeed&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Suppose you have built an amazing new website using Ruby on Rails 3. It has tons of features and some great content. &amp;nbsp;However, one thing it is lacking is a solid blog section. You would like to avoid writing your own blog code in Rails since there are already tons of solid blog applications to choose from - Wordpress, Moveable Type, Typepad, Blogger.com, and more.&lt;br /&gt;&lt;br /&gt;I personally like Blogger.com because: &lt;br /&gt;&lt;ol&gt;&lt;li&gt;Its run by Google and integrates nicely with Google Analytics and my Google Apps account&lt;/li&gt;&lt;li&gt;It supports being run as a subdomain of your website with a simple DNS entry (blog.example.com instead of just exampleblog.blogspot.com)&lt;/li&gt;&lt;li&gt;Supports RSS feeds for both the main blog and for labels&lt;/li&gt;&lt;li&gt;Posts are indexed quickly for Google Search results&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Parsing a Blog RSS Feed in Ruby 1.9&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Ruby supports loading RSS feeds natively without requiring any gem! &amp;nbsp;To see if yourself, fire up IRB on your command line and run the following:&lt;/div&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;require 'rss'&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;blog_posts = RSS::Parser.parse(open('http://blog.rietta.com/feeds/posts/default?alt=rss').read, false).items[0...5]&lt;/span&gt;&lt;/blockquote&gt;The RSS module (which is a native part of Ruby) will load the latest five blog posts from this blog into the blog_posts Array object. &amp;nbsp;Each post in the array is an instance of&amp;nbsp;RSS::Rss::Channel::Item. &amp;nbsp;The object has quite a few methods and attributes, but the ones of primary interest to us are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;:title&lt;/li&gt;&lt;li&gt;:description&lt;/li&gt;&lt;li&gt;:link&lt;/li&gt;&lt;li&gt;:guid&lt;/li&gt;&lt;li&gt;:pubDate&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Integrating with a Rails 3 Website&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;In your controller:&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;# It is important to require the RSS module. &amp;nbsp;If you leave this off, the blog feed will not load.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;require 'rss'&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;class PagesController &amp;lt; ApplicationController&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; def index&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;begin&lt;/span&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;@latest_blog_posts = RSS::Parser.parse(open('http://blog.rietta.com/feeds/posts/default?alt=rss').read, false).items[0...5]&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;rescue&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;# Do nothing, just continue. &amp;nbsp;The view will skip the blog section if the feed is nil.&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;@latest_blog_posts = nil&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;end&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; end&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;In your view that includes the blog:&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;h1&amp;gt;Simple Blog Feed&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;% unless @latest_blog_posts.nil? %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;The latest &amp;lt;%= pluralize(@latest_blog_posts.count, "post") %&amp;gt; from the blog.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;lt;% @latest_blog_posts.each do |post| %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&amp;lt;% if nil != post &amp;amp;&amp;amp; post.respond_to?(:pubDate) %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;&amp;lt;li&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;&amp;lt;%= link_to post.title, post.link, :target =&amp;gt; "_blank" %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;     &lt;/span&gt;(&amp;lt;%= time_ago_in_words(post.pubDate) %&amp;gt; ago via blog feed)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&amp;lt;% end %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;lt;% end %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;% else %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;lt;em&amp;gt;No blog posts to show.&amp;lt;/em&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;lt;% end %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Resulting in the following:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The result will be a bullet list of the latest posts (up to 5) that looks something like this:&lt;br /&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-F-cdFQiOqlY/TwEifEDWirI/AAAAAAAAAIc/QetLIhwAIms/s1600/simple_blog_feed_screenshot.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="215" src="http://4.bp.blogspot.com/-F-cdFQiOqlY/TwEifEDWirI/AAAAAAAAAIc/QetLIhwAIms/s320/simple_blog_feed_screenshot.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;A Simple Blog Feed Formatted as a Bulleted List&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;Loading Feeds for Specific Labels&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Blogger supports full site, comments-only, and label-specific feeds in Atom and RSS format as per &lt;a href="http://support.google.com/blogger/bin/answer.py?hl=en&amp;amp;answer=97933" target="_blank"&gt;Blogger Feed URLs&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;An RSS feed for a label is referenced like this: &lt;a href="http://blog.rietta.com/feeds/posts/default/-/Marketing?alt=rss"&gt;http://blog.rietta.com/feeds/posts/default/-/Marketing?alt=rss&lt;/a&gt;. The label appears after the -/. It is case sensitive such that "Marketing" is not the same as "marketing".&lt;br /&gt;&lt;br /&gt;Please note that at the time of this writing the Google page had an error in that they were showing the a label feed as "http://www.googleblog.blogspot.com/feeds/posts/default?alt=rss/-/privacy". &amp;nbsp;Unfortunately, this does not work. &amp;nbsp;Attempting to access that feed like that results in an "Unsupported alt type" error from Blogger's web server.&lt;br /&gt;&lt;br /&gt;The example code includes a full example of loading feeds from a couple of different labels.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Loading Feeds from Your Twitter&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;Twitter used to make it easy to get the RSS feed for your tweets. &amp;nbsp;You can still access them through the following URL (be sure to replace the xxxxx with the Twitter username you want to use):&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=xxxxx&lt;/blockquote&gt;(see &lt;a href="http://seo-alien.com/tips-and-tricks/find-twitter-rss-feed/" target="_blank"&gt;Here is How to Find Your Twitter RSS Feed and Your Twitter Favorites RSS Feed&lt;/a&gt; for a fuller explanation of the Twitter feed urls.)&lt;br /&gt;&lt;span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; display: inline !important; float: none; font-family: Times; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;Further Reading&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="https://github.com/rietta/SimpleBlogFeed" target="_blank"&gt;Full Example Code for this Post (github.com/rietta/SimpleBlogFeed)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://support.google.com/blogger/bin/answer.py?hl=en&amp;amp;answer=97933" target="_blank"&gt;Blogger Feed URLs&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://seo-alien.com/tips-and-tricks/find-twitter-rss-feed/" target="_blank"&gt;Twitter Feed RSS&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.developer.com/services/article.php/3733171/Consuming-RSS-Feeds-with-Ruby.htm" target="_blank"&gt;Consuming RSS Feeds with Ruby&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Rss" target="_blank"&gt;Really Simple Syndication (RSS) - Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Blog_software" target="_blank"&gt;Blog software - Wikipedia&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-3970402992608431500?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2012/01/integrate-blog-content-with-your-rails.html</link><author>noreply@blogger.com (Frank Rietta)</author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-F-cdFQiOqlY/TwEifEDWirI/AAAAAAAAAIc/QetLIhwAIms/s72-c/simple_blog_feed_screenshot.png' height='72' width='72'/><thr:total>1</thr:total><georss:featurename>Johns Creek, GA, USA</georss:featurename><georss:point>34.0289259 -84.198579</georss:point><georss:box>33.923649899999994 -84.35650749999999 34.1342019 -84.0406505</georss:box></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-2012431802829251874</guid><pubDate>Mon, 26 Dec 2011 16:14:00 +0000</pubDate><atom:updated>2011-12-26T11:35:44.398-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Marketing</category><category domain='http://www.blogger.com/atom/ns#'>Ruby on Rails</category><title>How to automate copyright notice updates in Ruby on Rails</title><description>I sure hope everyone had a wonderful Christmas with their families. I am personally enjoying taking a few days off work and doing some reading. &amp;nbsp;On Christmas morning, I bought a copy of &lt;a href="http://www.amazon.com/Rework-ebook/dp/B002MUAJ2A" target="_blank"&gt;Rework (Kindle edition)&lt;/a&gt;&amp;nbsp;by &lt;a href="http://twitter.com/jasonfried" target="_blank"&gt;Jason Fried&lt;/a&gt; and &lt;a href="http://twitter.com/dhh" target="_blank"&gt;David Heinemeier Hansson&lt;/a&gt;. &amp;nbsp;The "Go" Chapter alone is worth the price of admission! &lt;br /&gt;&lt;br /&gt;One day I may share more about this book. &amp;nbsp;However, today it seems like a great time to share another Ruby on Rails coding trick with you. &amp;nbsp;That is how to automatically have your web apps update their copyright notices.&lt;br /&gt;&lt;br /&gt;With only a few days remaining until the end of 2011, copyright notice update day is coming soon. &amp;nbsp;That is the day that many webmasters tweak the content of their page footers to reflect the new year.&lt;br /&gt;&lt;br /&gt;However, suppose you wanted to automate the update process in a website written in Ruby on Rails. &amp;nbsp;Here is one way to do it with a simple layout helper function. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;In helpers/layout_helper.rb:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;b&gt;def copyright_notice_year_range(start_year)&lt;/b&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span class="Apple-style-span" style="color: #38761d;"&gt;# In case the input was not a number (nil.to_i will return a 0)&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; start_year = start_year.to_i&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&lt;span class="Apple-style-span" style="color: #38761d;"&gt; &amp;nbsp; # Get the current year from the system&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; current_year = Time.new.year&amp;nbsp;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;&amp;nbsp; &amp;nbsp; # When the current year is more recent than the start year, return a string &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;&amp;nbsp; &amp;nbsp; # of a range (e.g., 2010 - 2012). Alternatively, as long as the start year  &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;&amp;nbsp; &amp;nbsp; # is reasonable, return it as a string.  Otherwise, return the current year  &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;&amp;nbsp; &amp;nbsp; # from the system. &lt;/span&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&amp;nbsp; &amp;nbsp; &lt;b&gt;if &lt;/b&gt;current_year &lt;span class="Apple-style-span" style="color: #bf9000;"&gt;&amp;gt;&lt;/span&gt; start_year &lt;span class="Apple-style-span" style="color: #bf9000;"&gt;&amp;amp;&amp;amp;&lt;/span&gt; start_year &lt;span class="Apple-style-span" style="color: #bf9000;"&gt;&amp;gt;&lt;/span&gt; &lt;span class="Apple-style-span" style="color: #990000;"&gt;2000&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "#{start_year} - #{current_year}"&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;b&gt;elsif&lt;/b&gt; start_year &lt;span class="Apple-style-span" style="color: #bf9000;"&gt;&amp;gt;&lt;/span&gt; &lt;span class="Apple-style-span" style="color: #990000;"&gt;2000&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "#{start_year}"&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;b&gt;else&lt;/b&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "#{current_year}"&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;b&gt;end&lt;/b&gt;&lt;br /&gt;&amp;nbsp; &lt;b&gt;end&lt;/b&gt;&lt;/blockquote&gt;&lt;b&gt;In layouts/application.html.erb (or your footer partial):&lt;/b&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;© &lt;b&gt;&amp;lt;%= copyright_notice_year_range(&lt;span class="Apple-style-span" style="color: #990000;"&gt;2010&lt;/span&gt;) %&amp;gt;&lt;/b&gt;&amp;nbsp;&amp;lt;%= link_to "YOUR COMPANY, INC.", "#" %&amp;gt;&amp;nbsp;&amp;nbsp;All Rights Reserved.&amp;nbsp;&amp;nbsp;&lt;/blockquote&gt;What is happening here? &amp;nbsp;The layout template calls&amp;nbsp;copyright_notice_year_range, supplying the first year that the website was copyrighted as an integer. &amp;nbsp;The helper returns the string that should be shown after the copyright symbol. &amp;nbsp;Given the example above, on January 1, 2012, the notice will read:&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;© 2010 - 2012&amp;nbsp;&lt;a href="#" target=""&gt;YOUR COMPANY, INC&lt;/a&gt;. &amp;nbsp;All Rights Reserved.&lt;/blockquote&gt;Be sure to replace the # with your company's main website URL.&lt;br /&gt;&lt;br /&gt;Here's wishing everyone a happy and prosperous 2012!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-2012431802829251874?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2011/12/how-to-automate-copyright-notice.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>1</thr:total><georss:featurename>Birmingham, AL, USA</georss:featurename><georss:point>33.5206608 -86.80249</georss:point><georss:box>33.3088588 -87.118347 33.7324628 -86.48663300000001</georss:box></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-4953469056232434787</guid><pubDate>Wed, 21 Dec 2011 14:56:00 +0000</pubDate><atom:updated>2011-12-21T11:10:32.782-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Security</category><category domain='http://www.blogger.com/atom/ns#'>Ruby on Rails</category><category domain='http://www.blogger.com/atom/ns#'>Optimization</category><title>Conditionally Including Resources on SSL or non-SSL to Avoid Mixed Content Security Warnings in Ruby on Rails</title><description>When building content that can be delivered on an encrypted HTTPS connection it is necessary to reference all of the embedded resources, 3rd party badge images, embedded YouTube videos, etc, from an HTTPS url. &amp;nbsp;Otherwise a mixed content error will imply to your users that the website is not safe, ouch!&lt;br /&gt;&lt;br /&gt;&lt;b&gt;For instance, consider this YouTube video reference:&lt;/b&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;lt;iframe height="&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;349&lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;" src="&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;https://www.youtube.com/embed/P3LaGQciUXs?hl=en&amp;amp;fs=1&lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;" width="&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;425&lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;"&amp;gt;&amp;lt;/iframe&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;This works great when the page is loaded either over an SSL or a non-SSL connection. &amp;nbsp;The trouble is that the encrypted resource can take longer to load than a non-SSL resource because the user's browser has to negotiate a new encrypted connection with the third party server. When the security is needed this is good. &amp;nbsp;When it is not, this just increases the chance that the user will go away and never come back (&lt;a href="http://blog.kissmetrics.com/loading-time/" target="_blank"&gt;How Loading Time Affects Your Bottom Line&lt;/a&gt;)&amp;nbsp;- especially on a mobile device.&lt;br /&gt;&lt;br /&gt;In a Ruby on Rails view, you can use the &lt;strong&gt;request.ssl? &lt;/strong&gt;flag to conditionally supply either a https or a http for the external website reference, like this &lt;strong&gt;&amp;lt;%= request.ssl? &lt;span class="Apple-style-span" style="color: #990000;"&gt;? &lt;/span&gt;"&lt;span class="Apple-style-span" style="color: #38761d;"&gt;https://&lt;/span&gt;" : "&lt;span class="Apple-style-span" style="color: #38761d;"&gt;http://&lt;/span&gt;" %&amp;gt;&lt;/strong&gt;.  In your Ruby HTML view (or partial) it would look something like this:  &lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="background-color: white; color: blue;"&gt;&amp;lt;iframe height="&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #38761d;"&gt;349&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: blue;"&gt;" src="&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #38761d;"&gt;&amp;lt;%= request.ssl? &lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #990000;"&gt;?&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #38761d;"&gt;&lt;b&gt; "https://" : "http://" %&amp;gt;&lt;/b&gt;www.youtube.com/embed/P3LaGQciUXs?hl=en&amp;amp;fs=1&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: blue;"&gt;" width="&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #38761d;"&gt;425&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: blue;"&gt;"&amp;gt;&amp;lt;/iframe&amp;gt; &lt;/span&gt;&lt;/blockquote&gt;With that the video will be included as http:// on an non-SSL page and as https:// on an SSL page.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;However, there is an even better way that does not require a ternary operator in your view. &amp;nbsp;&lt;/b&gt;While researching for this post I came across &lt;a href="http://paulirish.com/2010/the-protocol-relative-url/" target="_blank"&gt;the protocol-releative URL reference in HTML&lt;/a&gt;&amp;nbsp;(hat tip to &lt;a href="http://twitter.com/paul_irish" target="_blank"&gt;Paul Irish&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;The trick works like this:&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;lt;img src="&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;//domain.com/img/logo.png&lt;/span&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;" /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;The same video could be included with:&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span class="Apple-style-span" style="background-color: white; color: blue;"&gt;&amp;lt;iframe height="&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #38761d;"&gt;349&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: blue;"&gt;" src="&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #38761d;"&gt;&lt;b&gt;//www.youtube.com/embed/P3LaGQciUXs?hl=en&amp;amp;fs=1&lt;/b&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: blue;"&gt;" width="&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #38761d;"&gt;425&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: blue;"&gt;"&amp;gt;&amp;lt;/iframe&amp;gt; &lt;/span&gt;&lt;/blockquote&gt;The only downside is that this might not work reliably in Internet Explorer 6. &amp;nbsp;If you care about IE6, you have to use the ternary conditional server-side code in your Rails HTML template.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-4953469056232434787?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2011/12/conditionally-including-resources-on.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total><georss:featurename>Johns Creek, GA, USA</georss:featurename><georss:point>34.0289259 -84.198579</georss:point><georss:box>33.923649899999994 -84.35650749999999 34.1342019 -84.0406505</georss:box></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-273612797137063041</guid><pubDate>Mon, 19 Dec 2011 17:01:00 +0000</pubDate><atom:updated>2011-12-19T12:50:02.411-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>MySQL</category><category domain='http://www.blogger.com/atom/ns#'>Ruby on Rails</category><title>Adding RANDOM alias to RAND in MySQL without Changing Ruby on Rails Code</title><description>While building the new website for &lt;a href="http://www.sqlconverter.com/"&gt;www.sqlconverter.com&lt;/a&gt;, I recently ran into a slight compatibility issue between the SQLite3 database used for local initial development and MySQL when the site was prepared for production. &amp;nbsp;What was the compatibility issue? &amp;nbsp;It was the random function! &lt;br /&gt;&lt;br /&gt;The issue popped up in the function used by the main page to return three random testimonials (in random order) for presentation on the homepage. &amp;nbsp;The RoR code for the function is:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;In models/testimonial.rb:&lt;/b&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;def self.top_random&lt;br /&gt;&amp;nbsp; &amp;nbsp; number_to_return = 3&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;b style="background-color: #ffe599;"&gt;Testimonial.find(:all, :limit =&amp;gt; number_to_return, :order =&amp;gt; "RANDOM()")&lt;/b&gt;&lt;br /&gt;end&lt;/blockquote&gt;&lt;br /&gt;&lt;b&gt;The highlighted ActiveRecord call more or less translates into this SQL:&lt;/b&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;SELECT * FROM testimonials ORDER BY RANDOM() LIMIT 3&lt;/blockquote&gt;&lt;br /&gt;The SQL server is expected to return three (3) entries in random order. It works great in SQLite and PostgreSQL. &amp;nbsp;It also works great in MySQL, except MySQL doesn't have RANDOM() but rather has a RAND() - which does the exact same thing.&lt;br /&gt;&lt;br /&gt;However, I did not want to have to change the RoR code, which was already passing its unit tests. &amp;nbsp;Besides doing so would cause the code to not work in the other databases, which define the RANDOM function. The quickest solution turns out to be to define a custom RANDOM function for MySQL!&lt;br /&gt;&lt;br /&gt;&lt;b&gt;MySQL statement to define RANDOM() as an alias for its native RAND()&lt;/b&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;CREATE FUNCTION random() RETURNS FLOAT NO SQL SQL SECURITY INVOKER RETURN rand();&lt;/blockquote&gt;&lt;br /&gt;(This SQL statement was originally posted&amp;nbsp;at&amp;nbsp;&lt;a href="http://stackoverflow.com/questions/1549494/selecting-random-in-rails-sqlite-vs-mysql" target="_blank"&gt;Selecting random in rails sqlite vs mysql&lt;/a&gt;&amp;nbsp;by&amp;nbsp;&lt;a href="http://stackoverflow.com/users/3736/jason-weathered" target="_blank"&gt;Jason Weathered&lt;/a&gt;, thank you Jason!).&lt;br /&gt;&lt;br /&gt;And everything worked. &amp;nbsp;I hope this will help you too.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-273612797137063041?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2011/12/adding-random-alias-to-rand-in-mysql.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total><georss:featurename>5805 State Bridge Road, Suite G 158, Johns Creek, GA</georss:featurename><georss:point>34.0289259 -84.198579</georss:point><georss:box>33.9236614 -84.35650749999999 34.134190399999994 -84.0406505</georss:box></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-1431207090459619576</guid><pubDate>Sat, 17 Dec 2011 22:48:00 +0000</pubDate><atom:updated>2012-02-03T13:15:44.034-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Ruby on Rails</category><category domain='http://www.blogger.com/atom/ns#'>SQL Converter</category><title>SQL Converter 2 for Excel Website Update</title><description>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.sqlconverter.com/" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;" target="_blank"&gt;&lt;img border="0" height="200" src="http://www.sqlconverter.com/assets/icons/conversion_circle_illustration.png" width="195" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;From My Company's Homepage:&lt;/b&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;a href="http://rietta.com/"&gt;Rietta&lt;/a&gt;&amp;nbsp;is proud to announce that we have updated the website for &lt;a href="http://www.sqlconverter.com/"&gt;SQL Converter for Excel at www.sqlconverter.com&lt;/a&gt;. Next year is the 10th anniversary of the initial public release of the program.&lt;/blockquote&gt;&lt;a href="http://rietta.com/"&gt;&lt;/a&gt;I originally wrote the Excel add-in that converts Excel files to MySQL while a student at Georgia Tech as a Visual Basic macro. Over the last nine (9) years it has been used by hundreds of customers in many industries, including by many small businesses, several&amp;nbsp;publicly&amp;nbsp;traded companies, government agencies, and educational institutions.&lt;br /&gt;&lt;br /&gt;The current version is still a macro that works fine with Microsoft Excel for Windows, but it is time to build a solution that works for more platforms, including my personally&amp;nbsp;preferred&amp;nbsp;Mac OS X and Linux systems. To this end, we are currently working on a web-based service to provide cloud-based spreadsheet to database conversions. &amp;nbsp;However, the first step towards deploying the new service is migrating the current infrastructure to Ruby on Rails.&lt;br /&gt;&lt;br /&gt;The original sqlconverter.com website was written in PHP and hosted on a typical shared Linux server&amp;nbsp;environment, but the new one is entirely in &lt;a href="http://rubyonrails.org/" target="_blank"&gt;Ruby on Rails 3.1&lt;/a&gt;. We setup the routing such that the old URL structure was maintained for search engine optimization (SEO) purposes. We also implemented canonical links to avoid duplicate content penalties due to the pages being accessed through more than one path.&amp;nbsp;One of these days I should write a bit more about the tricks employed.&lt;br /&gt;&lt;br /&gt;If you routinely work with spreadsheets provided by customers or team members and need to get that data into a MySQL database for your projects, please check SQL Converter out. &amp;nbsp;Also please feel free to let me know if you have any questions about it!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-1431207090459619576?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2011/12/sql-converter-2-for-excel-website.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total><georss:featurename>Johns Creek, GA, USA</georss:featurename><georss:point>34.0289259 -84.198579</georss:point><georss:box>33.9764669 -84.292833 34.081384899999996 -84.10432499999999</georss:box></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-1377313306834989320</guid><pubDate>Thu, 15 Dec 2011 05:00:00 +0000</pubDate><atom:updated>2012-01-05T15:26:11.689-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Launch Pad</category><category domain='http://www.blogger.com/atom/ns#'>SQL Converter</category><title>SQLCONVERTER.COM Major Website Update</title><description>Rietta is proud to announce that we have updated the website for &lt;a href="http://www.sqlconverter.com/" target="_blank"&gt;SQL Converter for Excel at www.sqlconverter.com&lt;/a&gt;. Next year is the 10th anniversary of the initial public release of the program.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-1377313306834989320?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2011/12/sqlconvertercom-major-website-update.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-12016744.post-2405855211734587428</guid><pubDate>Thu, 20 Oct 2011 04:00:00 +0000</pubDate><atom:updated>2012-01-05T15:18:05.180-05:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>Launch Pad</category><title>7JOBS.COM Launch</title><description>Rietta is proud to announce the grand opening of &lt;a href="http://7jobs.com/" target="_blank"&gt;7jobs.com - You're Smart. Get Hired.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12016744-2405855211734587428?l=blog.rietta.com' alt='' /&gt;&lt;/div&gt;</description><link>http://blog.rietta.com/2011/10/7jobscom-launch.html</link><author>noreply@blogger.com (Frank Rietta)</author><thr:total>0</thr:total><georss:featurename>Roswell, GA, USA</georss:featurename><georss:point>34.0231553 -84.3615928</georss:point><georss:box>33.9178908 -84.5195213 34.128419799999996 -84.2036643</georss:box></item></channel></rss>
