As The World Falls Downhttp://dement1a.livejournal.com/
As The World Falls Down - LiveJournal.comWed, 28 Sep 2011 19:31:36 GMTLiveJournal / LiveJournal.comdement1a2013038personalhttp://l-userpic.livejournal.com/80421732/2013038As The World Falls Downhttp://dement1a.livejournal.com/
100100http://dement1a.livejournal.com/252264.htmlWed, 28 Sep 2011 19:31:36 GMTUsing javan/whenever on Engine Yard Cloudhttp://dement1a.livejournal.com/252264.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2011/09/28/using-javanwhenever-on-engine-yard/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2011/09/28/using-javanwhenever-on-engine-yard/#comments" rel="nofollow">there</a>.</strong></p>
<p><strong>UPDATE 4.17.2012</strong>: If you're on EY and not using custom chef recipes, you should start. A whenever recipe has been written and is detailed <a href="http://blog.ethanvizitei.com/2010/10/whenever-gem-and-engineyard-appcloud.html" rel="nofollow">here</a>. Info on how to start using custom chef recipes is <a href="https://support.cloud.engineyard.com/entries/21009867-customize-your-environment-with-chef-recipes" rel="nofollow">here</a>. It's not so bad, really. One gotcha: your "appname" in the recipe is not your rails application name, but your EY application name - these can be different things!</p>
<hr />
<p>Things I wish I&#8217;d have known:<br />
1. It does not matter if whenever is in your gemfile, you have to SSH to your EY server and install whenever as such: sudo gem install whenever<br />
2. It will probably complain that you don&#8217;t have i18n installed, so: sudo gem install i18n</p>
<p>EDIT: You will have to repeat the two steps above ANYTIME you restart your EY instance!</p>
<p>3. If you want your crontab updated on deploy, make a file named deploy/before_restart.rb and stick this in it (make sure you replace &#8216;yourAppNameHere&#8217;, derp):</p>
<pre>@rails_env = node[:environment][:framework_env]
run "cd #{release_path}; whenever --set environment=#{@rails_env}; whenever --update-crontab 'yourAppNameHere'"</pre>
<p>This is called a &#8216;deploy hook&#8217; and <a href="http://docs.engineyard.com/use-deploy-hooks-with-engine-yard-appcloud.html" target="_blank" rel="nofollow">here&#8217;s more info</a>.</p>
<p>I found the idea for this in <a href="http://webcache.googleusercontent.com/search?q=cache:ppp5Xh-9FocJ:community.engineyard.com/discussions/questions/786-gems-not-installing+%22%40rails_env+%3D+node%5B:environment%5D%5B:framework_env%5D%22&amp;cd=10&amp;hl=en&amp;ct=clnk&amp;gl=us" target="_blank" rel="nofollow">an old EY forum post</a>.</p>http://dement1a.livejournal.com/252264.htmluncategorizedpublic0http://dement1a.livejournal.com/251953.htmlSat, 10 Sep 2011 03:24:06 GMTIllinois Home Bakeries &#8211; for farmer&#8217;s markets onlyhttp://dement1a.livejournal.com/251953.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2011/09/09/illinois-home-bakeries-for-farmers-markets-only/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2011/09/09/illinois-home-bakeries-for-farmers-markets-only/#comments" rel="nofollow">there</a>.</strong></p><p>Interesting tidbit about a new law that is being passed. IL Senate Bill 840 allows for &#8220;Cottage food operations&#8221; (i.e. you can use your home kitchen), with several stipulations, if and <strong>only </strong>if you are selling goods at a farmers&#8217; market. So if I wanted to sell my cakes at a farmer&#8217;s market and got the appropriate paperwork, I could, but I still couldn&#8217;t sell them to individuals specifically out of my home. I&#8217;d <strong>have </strong>to have a table at a farmer&#8217;s market. Which is pretty much useless to me. Oh well, it&#8217;s a step in the right direction.</p>
<p><a href="http://www.news-gazette.com/news/politics-and-government/2011-08-25/new-law-settles-dispute-public-health-officials.html" target="_blank" rel="nofollow">Article from the News-Gazette<br />
</a><a href="http://www.ilstewards.org/blog/8509" target="_blank" rel="nofollow">Article from the IL Stewardship Alliance<br />
</a><a href="http://ilga.gov/legislation/billstatus.asp?DocNum=840&amp;GAID=11&amp;GA=97&amp;DocTypeID=SB&amp;LegID=55671&amp;SessionID=84" target="_blank" rel="nofollow">Senate bill 840 </a></p>http://dement1a.livejournal.com/251953.htmlcakespublic0http://dement1a.livejournal.com/251361.htmlThu, 16 Jun 2011 03:06:49 GMTSignal boost: Of Fairy Wings And Glittering Crowns (Crowdfunded Fiction)http://dement1a.livejournal.com/251361.html
Originally posted by <span class="ljuser i-ljuser i-ljuser-type-P " data-ljuser="karnythia" lj:user="karnythia" ><a href="http://karnythia.livejournal.com/profile" target="_self" class="i-ljuser-profile" ><img class="i-ljuser-userhead" src="http://l-stat.livejournal.net/img/userinfo.gif?v=17080?v=143.8" /></a><a href="http://karnythia.livejournal.com/" class="i-ljuser-username" target="_self" ><b>karnythia</b></a></span> at <a href="http://karnythia.livejournal.com/1670424.html" rel="nofollow">Of Fairy Wings And Glittering Crowns (Crowdfunded Fiction)</a><div>As some of you already know a few months ago we packed up and moved to Memphis. On paper it was a good plan. In execution...well, we wound up in an apartment where the floors slope at an angle so steep nothing on wheels can stay in place. One of the bedrooms has a hole in ceiling big enough to stick my arm through that we've been trying to get fixed since the week we moved in. And then there's the roach problem (complete with a nest inside the dishwasher), which...let's just say that we landed with the worst landlord possible and he shows no signs of getting better. Fortunately our lease is month to month. Unfortunately, having been here for the last six weeks we have discovered that we don't like Memphis. At all. <br /><br />We're a family of walkers and Memphis is not pedestrian friendly in the slightest. We do have access to a car, but we hate having to drive everywhere. The kids were excited in the beginning, but between the apartment issues and the lack of playmates at any of the parks (it is too hot to play outside and the pools aren't open yet) they're miserable. We'd rather cut our losses now, instead of moving into another apartment in a city that we don't love in the first place. It doesn't help that having attracted the attention of the Cult of The Fetus (aka Jill Stanek & her followers) a few weeks ago, I don't feel super safe here. As silly as it may sound we're ready to head back to Chicago and accept that we are really Chicago kids. But, the expenses of moving down here mean we don't have enough cash to pay bills here, find a new place, and afford all the attendant costs of reworking our lives all over again. In theory we would eventually earn enough to swing it, but that would mean being here for months and we really don't want to do that. <br /><br />So, I'm offering up a YA novel Of Fairy Wings And Glittering Crowns to be written in 60 days and posted chapter by chapter at <a href="http://atypicalprincess.wordpress.com/" rel="nofollow">Atypical Princess</a>. I'll be posting the plot synopsis and character sketches today with an eye towards posting the first chapter tomorrow. There's a Chip In widget below that's not quite accurate (I got a couple of donations yesterday), but will still provide a way for folks to keep track of our goal. If you can't donate I still want you to read, after all what's the point of fiction if you can't share it? All I ask is that if you like it, you link it to your friends and family for their perusal. Thanks so much, I hope you enjoy reading this as much as I plan to enjoy writing it.<br /><br /><blockquote>Selena Newly grew up in a family that took the fun out of dysfunctional. Sharing a house with a mother that never wanted her, aunts who detest each other, and a grandmother that has them all at the mercy of her purse strings hasn't exactly made for an idyllic childhood. In fact it has left her yearning for adulthood since she was old enough to walk. The day her mother throws her out is the best and worst day of her life. She is free, but she has nowhere to go, and no idea how she's going to support herself. When the door into Altanur opens it seems like the answer to all her childhood prayers. Her family isn't really her family, and she's a fairy princess. Unfortunately she's about to learn the hard way that everything has a price, and sometimes that price may be too high.</blockquote><br /><lj-embed id="22" /><lj-repost button="Post this to your journal!"><br /><br />I'm blogging across two platforms. Feel free to comment here or there. <a href="http://karnythia.dreamwidth.org/1663774.html?mode=reply" rel="nofollow">You decide!</a></div>http://dement1a.livejournal.com/251361.htmlpublic0http://dement1a.livejournal.com/251052.htmlWed, 04 May 2011 19:50:55 GMTjsTree: adding Expand All and Collapse All buttonshttp://dement1a.livejournal.com/251052.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2011/05/04/jstree-adding-expand-all-and-collapse-all-buttons/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2011/05/04/jstree-adding-expand-all-and-collapse-all-buttons/#comments" rel="nofollow">there</a>.</strong></p><p>The documentation for jsTree is thorough, but not particularly easy to read. If you are looking for an easy way to add &#8220;Expand All&#8221; and &#8220;Collapse All&#8221; buttons, here&#8217;s one way:</p>
<p><code>&lt;input type="button" value="Collapse All" onclick="$('#tree_container_id').jstree('close_all');"&gt;<br />
&lt;input type="button" value="Expand All" onclick="$('#tree_container_id').jstree('open_all');"&gt;<br />
</code></p>
<p>where &#8216;#tree_container_id&#8217; is, of course, the ID of the container node for your tree.</p>http://dement1a.livejournal.com/251052.htmluncategorizedpublic0http://dement1a.livejournal.com/250134.htmlWed, 23 Mar 2011 18:01:03 GMTMusic industry shifts to being a service? Good news, bad news&#8230;http://dement1a.livejournal.com/250134.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2011/03/23/music-industry-shifts-to-being-a-service-good-news-bad-news/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2011/03/23/music-industry-shifts-to-being-a-service-good-news-bad-news/#comments" rel="nofollow">there</a>.</strong></p><p>Here&#8217;s an interesting read from Ars Technica:</p>
<p><a href="http://arstechnica.com/tech-policy/news/2011/03/is-file-sharing-the-global-future.ars" target="_blank" rel="nofollow">Did file-sharing cause recording industry collapse? Economists say no</a></p>
<p>The most interesting paragraph I see in this article is this one:</p>
<blockquote><p>So what is emerging is an increasingly &#8220;ephemeral&#8221; global music culture based not upon the purchasing of discrete physical packages of music, but on the discovery and subsequent promotion of musicians through file sharing. The big winner in this model is not the digital music file seller, but the touring band, whose music is easily discoverable on the &#8216;Net. As with so much of the rest of the emerging world economy, the shift is away from buying things and towards purchasing services—in this case tickets to concerts and related activities.</p></blockquote>
<p>So I have to wonder &#8211; to my friends (and my husband) who count on selling merch at their unpaid performances &#8211; is this a game changer? Will musicians from now on be ultimately unable to make a living unless they go on the road &#8211; and stay there?</p>http://dement1a.livejournal.com/250134.htmlramblingspublic0http://dement1a.livejournal.com/250049.htmlThu, 10 Mar 2011 00:25:12 GMTTesting CKEditor in Ruby on Rails with Cucumber/Capybarahttp://dement1a.livejournal.com/250049.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2011/03/09/testing-ckeditor-in-ruby-on-rails-with-cucumbercapybara/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2011/03/09/testing-ckeditor-in-ruby-on-rails-with-cucumbercapybara/#comments" rel="nofollow">there</a>.</strong></p><p>I have a textarea with the id of &#8220;request_details&#8221;, made into a CKEditor instance by jQuery: $(&#8216;#request_details&#8217;).ckeditor();</p>
<p>(Check <a href="http://ckeditor.com/blog/CKEditor_for_jQuery" target="_blank" rel="nofollow">this page</a> if you need some help getting CKEditor to work with jQuery, it&#8217;s dead simple)</p>
<p>Feature looks like this: <code>And I fill in "Here are some details" in the CKEditor instance "request_details"</code></p>
<p>Step looks like this:</p>
<p style="padding-left: 30px;"><code>When /^I fill in "([^"]*)" in the CKEditor instance "([^"]*)"$/ do |value, input_id|<br />
browser = page.driver.browser<br />
browser.execute_script("CKEDITOR.instances['#{input_id}'].setData('#{value}');")<br />
end</code></p>http://dement1a.livejournal.com/250049.htmltechpublic0http://dement1a.livejournal.com/249708.htmlWed, 23 Feb 2011 21:52:39 GMTMy least favorite phrasehttp://dement1a.livejournal.com/249708.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2011/02/23/my-least-favorite-phrase/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2011/02/23/my-least-favorite-phrase/#comments" rel="nofollow">there</a>.</strong></p><p>I&#8217;ve decided on my least favorite phrase in the English language:</p>
<p><strong>&#8220;Can&#8217;t you just&#8230;?&#8221;</strong></p>
<p>Why is this my least favorite phrase? Because:</p>
<ol>
<li>It&#8217;s always in conjunction with a task that the questioner does not understand, but assumes should not be difficult at all;</li>
<li>it is inherently second-guessing the person being asked, which is insulting;</li>
<li>and, rather than asking if something is possible, as in &#8220;Can you?&#8221; or &#8220;Could you?&#8221;, the speaker is really saying, &#8220;This must be possible, and if you can&#8217;t do it, you&#8217;re an idiot.&#8221;</li>
</ol>
<p>If you don&#8217;t understand how the system works, or what is involved with doing a task, please, ask if something is possible. Don&#8217;t demean the craftsman or browbeat them into doing whatever it is you want. A resentful craftsman is not on your side, and will not go out of his/her way to help you.</p>http://dement1a.livejournal.com/249708.htmltechramblingspublic1http://dement1a.livejournal.com/249507.htmlSat, 19 Feb 2011 04:25:37 GMTUsing mysql2 on Windowshttp://dement1a.livejournal.com/249507.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2011/02/19/using-mysql2-on-windows/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2011/02/19/using-mysql2-on-windows/#comments" rel="nofollow">there</a>.</strong></p><p>Another edition of Sara uses Rails on Windows! *muppety fanfare*</p>
<p>Trying to get mysql2 to run on Windows is a bit of a pain. I used the lovely installer from <a href="http://railsinstaller.org/" target="_blank" rel="nofollow">Railsinstaller.org</a> and then created an app with :</p>
<blockquote><p>rails new testapp -d mysql</p></blockquote>
<p>and then bundled.</p>
<p>By default this installs the mysql2 gem. There are some gotchas, and hopefully this will help:</p>
<ol>
<li>You have to install mysql first (derp!). Go <a href="http://dev.mysql.com/downloads/mysql/" target="_blank" rel="nofollow">here</a> and pick either the 32 or 64 bit MSI installer, and use <a href="http://allaboutruby.wordpress.com/2006/01/09/installing-rails-on-windows-step-by-step-tutorial/" target="_blank" rel="nofollow">this guide</a> to pick your options during the install (section II). I know, it&#8217;s an old guide, but it works fine. And it has pictures!</li>
<li>You may get this error: &#8220;%1 is not a valid Win32 application.&#8221; This means you need to go <a href="http://www.mysql.com/downloads/connector/c" target="_blank" rel="nofollow">here</a> and get libmysql.dll, and copy it into <strong>c:\RailsInstaller\Ruby1.8.7\bin</strong>. Get the right version or your migrations will fail when you try to add indexes &#8211; the MySQL 5.5.9 64-bit version of libmysql.dll will NOT work! I got this version and it worked just fine: mysql-connector-c-noinstall-6.0.2-win32-vs2005.zip (you don&#8217;t need the MSI installer for this one, just grab a zippy file).</li>
<li>Next error you may get is &#8220;rbreadline.rb:4404: uninitialized constant RbReadline::Encoding (NameError)&#8221;. Thanks to <a href="http://tom.net.nz/2010/09/installing-diaspora-on-windows/" target="_blank" rel="nofollow">this blog post</a> I found the answer is to go into <strong>c:\RailsInstaller\Ruby1.8.7\lib\ruby\site_ruby\1.8\rbreadline.rb</strong>, and comment out line 4404.</li>
</ol>
<p>There you go! Rake away!</p>http://dement1a.livejournal.com/249507.htmltechpublic0http://dement1a.livejournal.com/249093.htmlWed, 16 Feb 2011 01:25:29 GMTGithub, https, and youhttp://dement1a.livejournal.com/249093.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2011/02/15/github-https-and-you/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2011/02/15/github-https-and-you/#comments" rel="nofollow">there</a>.</strong></p><p>Banged my head against this for a while. Starting a new rails project, trying to get rails.js from github, but it&#8217;s failing every time:</p>
<blockquote><p>SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)</p></blockquote>
<p>So (after a lot of googling) I opened up gems/jquery-rails-0.2.7/lib/generators/jquery/install/install_generator.rb and added this just after the beginning of the InstallGenerator class (&#8220;class InstallGenerator &lt; ::Rails::Generators::Base&#8221;) :</p>
<blockquote>
<div>require &#8216;openssl&#8217;</div>
<div>OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE</div>
</blockquote>
<div>All fixed! Pulled down the file with no hiccups.</div>http://dement1a.livejournal.com/249093.htmltechpublic0http://dement1a.livejournal.com/248156.htmlThu, 11 Nov 2010 04:28:00 GMTPik and Git Bash on Windows 7http://dement1a.livejournal.com/248156.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2010/11/11/pik-and-git-bash-on-windows-7/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2010/11/11/pik-and-git-bash-on-windows-7/#comments" rel="nofollow">there</a>.</strong></p><p>Lately I&#8217;ve been installing Ruby on Rails on Windows 7, and have run into a few people trying to make my life easier. One is <a href="http://www.sarahmei.com/blog/" target="_blank" rel="nofollow">Sarah Mei</a>, a wonderful member of devchix who has posted <a href="http://www.wiki.devchix.com/index.php?title=Server_2003" target="_blank" rel="nofollow">a guide for getting things running</a>. Hearts and bunnies and flowers for her.</p>
<p><strong>Pik </strong>is a neat project for Windows that helps you switch between installed versions of ruby. I&#8217;m using the <strong>Git Bash</strong> shell (as mentioned in the guide above), so I had to do a bit of tweaking, and maybe you do too, so here goes:</p>
<p>For some reason the installer didn&#8217;t create my .pik/.pikrc file in my home directory, so if yours didn&#8217;t create either, this is how it should look:</p>
<blockquote>
<pre>#!/bin/sh
pik_path=C:\\pik
function pik {
$pik_path/pik_runner.exe pik.sh $@
[[ -s $USERPROFILE/.pik/pik.sh ]] &amp;&amp; source $USERPROFILE/.pik/pik.sh
unset GEM_HOME
unset GEM_PATH
}</pre>
</blockquote>
<p>Those last two lines within the pik function are because something isn&#8217;t working in the current version and the gems aren&#8217;t being loaded when you switch versions.</p>
<p>Once you have your .pikrc add this line to your .bash_profile (create one if you don&#8217;t have it in your home directory):</p>
<blockquote>
<pre>[[ -s $USERPROFILE/.pik/.pikrc ]] &amp;&amp; source $USERPROFILE/.pik/.pikrc
</pre>
</blockquote>
<p>Hooray!</p>http://dement1a.livejournal.com/248156.htmltechpublic0http://dement1a.livejournal.com/248011.htmlWed, 03 Nov 2010 22:06:24 GMTImageMagick: &#8220;convert: color profile operates on another colorspace `icc&#8217;&#8221;http://dement1a.livejournal.com/248011.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2010/11/03/imagemagick-convert-color-profile-operates-on-another-colorspace-icc/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2010/11/03/imagemagick-convert-color-profile-operates-on-another-colorspace-icc/#comments" rel="nofollow">there</a>.</strong></p><p>Another installment of Sara Beats Her Head Against Tech:</p>
<p>When trying to convert images from RGB to CMYK with ImageMagick, the regular command to convert:</p>
<blockquote><p>convert original.jpg -colorspace CMYK new.jpg</p></blockquote>
<p>worked &#8211; but the converted image&#8217;s colors looked absolutely terrible. So I downloaded some color profiles, and tried to use them:</p>
<blockquote><p>convert original.jpg -colorspace CMYK -profile sRGB_v4_ICC_preference.icc -profile Photoshop5DefaultCMYK.icc new.jpg</p></blockquote>
<p>which just gave me the error:</p>
<blockquote><p>convert: color profile operates on another colorspace `icc&#8217;</p></blockquote>
<p>Searching the internet gave me absolutely no answers on any forum. Then I noticed in the docs, the example given for using profiles when the original has no profile embedded already was:</p>
<blockquote><p>convert rgb_image.jpg -profile sRGB.icc -profile USCoat.icm cmyk_image.jpg</p></blockquote>
<p>Wait. Something&#8217;s missing&#8230; AHA! The -colorspace option was missing!</p>
<blockquote><p>convert original.jpg -profile sRGB_v4_ICC_preference.icc -profile Photoshop5DefaultCMYK.icc new.jpg</p></blockquote>
<p>Works like a champ. So, if you&#8217;re getting the error &#8220;convert: color profile operates on another colorspace `icc&#8217;,&#8221; try making sure you&#8217;re not specifying BOTH the colorspace and the profile(s).</p>http://dement1a.livejournal.com/248011.htmltechpublic3http://dement1a.livejournal.com/247788.htmlTue, 26 Oct 2010 18:34:13 GMTRTFM, Ruby on Rails editionhttp://dement1a.livejournal.com/247788.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2010/10/26/rtfm-ruby-on-rails-edition/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2010/10/26/rtfm-ruby-on-rails-edition/#comments" rel="nofollow">there</a>.</strong></p><p>Since the happymapper google group has been closed to posting, thought I&#8217;d toss this up here.</p>
<p>I posted this question to the group:</p>
<pre>---------------------------------------------------
I have a node that looks like this:</pre>
<pre>&lt;ItemInfo&gt;
&lt;ProductVar text_id="Variable1"&gt;MyValue&lt;/ProductVar&gt;
&lt;ProductVar text_id="Variable2"&gt;MySecondValue&lt;/ProductVar&gt;
&lt;/ItemInfo&gt;
I need both the value of the attribute "text_id" and the element value
"MyValue". I was trying to use something like what I saw in the
"current weather" example:
&lt;aws:current-condition icon="<a href="http://deskwx.weatherbug.com/images/Forecast/icons/cond007.gif" target="_blank" rel="nofollow">http://deskwx.weatherbug.com/images/
Forecast/icons/cond007.gif</a>"&gt;Sunny&lt;/aws:current-condition&gt;
element :current_condition, String, :tag =&gt; 'current-
condition', :attributes =&gt; {:icon =&gt; String}
Which (the example) works just fine on my system. So this is the
mapping I have:
class ItemInfo
include HappyMapper
tag 'ItemInfo'
has_many :product_var, String, :tag =&gt; "ProductVar", :attributes =&gt;
{:text_id =&gt; String}
end
This does not return text_id. I can return
item_info.product_var.text_id if I use "element" in place of
"has_many", but there are always going to be multiple "ProductVar"s,
so that won't work. Whenever I try to replace "element" with
"has_many", I get this error:
undefined method `attribute_nodes' for ["text_id", "Variable1"]:Array
Ideas?
---------------------------------------------------</pre>
<p>Well, if I&#8217;d thought this through and read the code, as suggested here:<br />
<a href="http://railstips.org/blog/archives/2010/10/14/stop-googling/" target="_blank" rel="nofollow">http://railstips.org/blog/archives/2010/10/14/stop-googling/</a><br />
I&#8217;d have figured this out. Since I didn&#8217;t, it took the help of both the wonderful Eric Larson and Damien Le Berrigaud to point out my epic failure to read the docs (in the nicest way possible).</p>
<p>Eric pointed out that what I needed was to make ProductVar its own class:</p>
<pre>---------------------------------------------------
From: Eric Larson
Date: October 22, 2010 10:07:13 AM CDT
Hi Sara,
When I'm happymapping, I like to create a class per each element I'm
parsing, always.
Try something like this:
class Product
include HappyMapper
tag 'ProductVar'
attribute :text_id, String
content :value
end
class ItemInfo
include HappyMapper
tag 'ItemInfo'
has_many :products, Product
end
- - - -
Pseudo code... but it should be very close to working.
Cheers,
- Eric
---------------------------------------------------</pre>
<p>Which I thought was brilliant, but then realized I didn&#8217;t have the method &#8220;content&#8221; available to me because I was using the nokogiri-happymapper gem. So off to Damien I went, to ask if he could merge in the &#8220;content&#8221; method to nokogiri-happymapper, only to have him tell me:</p>
<pre>---------------------------------------------------
You can already do that with text_node. Check the spec: it "should parse text node correctly" in happymapper_spec <img src="http://saratrice.com/wp-includes/images/smilies/icon_smile.gif" alt=":)" />
---------------------------------------------------</pre>
<p>So, had I just read the docs and/or the spec, I&#8217;d have figured this out. SMRT.</p>
<p>Thought I&#8217;d post this just in case anyone else had the same problem.</p>http://dement1a.livejournal.com/247788.htmltechpublic0http://dement1a.livejournal.com/247085.htmlThu, 12 Aug 2010 16:12:19 GMTYes, I&#8217;m schilling, what of it?http://dement1a.livejournal.com/247085.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2010/08/12/yes-im-schilling-what-of-it/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2010/08/12/yes-im-schilling-what-of-it/#comments" rel="nofollow">there</a>.</strong></p><p>Ok, technically I&#8217;m not schilling because I&#8217;m not even pretending I&#8217;m not involved.</p>
<p>Luke and I are paying for the bulk of our wedding costs&#8230; and we&#8217;re coming up a bit short. If you&#8217;re interested in <a href="http://www.thegreatlukeski.com/products-page/" rel="nofollow">buying any of Luke&#8217;s music</a>, now would be the helpful time to do it. &#8220;WHAT A RIPOFF! VOLUME 2&#8243;, an odds-and-ends compilation was just released, as well as the &#8220;GREATEST HITS VOLUME 1&#8243; 2-CD. Also, he&#8217;s always looking for <a href="http://www.artbylukeski.com" rel="nofollow">more work as a caricature artist &#038; cartoonist</a> &#8211; he&#8217;s for hire at parties as well as for individual caricatures/cartoons for gifts, as well as promo art.</p>
<p>I&#8217;m pretty much booked for website work for now, but I&#8217;ll be available after the wedding for more freelance.</p>http://dement1a.livejournal.com/247085.htmluncategorizedpublic0http://dement1a.livejournal.com/246922.htmlWed, 14 Jul 2010 21:48:15 GMTRuby: how to split a string into equal chunkshttp://dement1a.livejournal.com/246922.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2010/07/14/ruby-how-to-split-a-string-into-equal-chunks/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2010/07/14/ruby-how-to-split-a-string-into-equal-chunks/#comments" rel="nofollow">there</a>.</strong></p><p>&#8220;some long test string or other&#8221;.scan(/.{15}/)</p>
<p>Snagged from <a href="http://snippets.dzone.com/posts/show/5621" rel="nofollow">http://snippets.dzone.com/posts/show/5621</a> and posted here so I can find it later.</p>http://dement1a.livejournal.com/246922.htmltechpublic0http://dement1a.livejournal.com/246726.htmlThu, 01 Jul 2010 21:06:51 GMTMmm, beverages.http://dement1a.livejournal.com/246726.html
<div><a href="http://www.livejournal.com/poll/?id=1586626">View Poll: What do you prefer from these choices?</a></div>http://dement1a.livejournal.com/246726.htmlweddingspublic3http://dement1a.livejournal.com/246337.htmlTue, 29 Jun 2010 20:20:26 GMTOMG SPARKLYhttp://dement1a.livejournal.com/246337.html
&nbsp;I admit it, I have a weakness for the sparkly. It's that girl chromosome poking its head out. This is what caught my eye today, from a link out of one of my wedding RSS feeds:<br /><br /><a href="http://www.orangeandblossom.com/item.php?item_id=286&amp;category_id=38" rel="nofollow"><br /><img alt="" src="https://www.orangeandblossom.com/item_images/vintage_rhinestone_necklace_snowflake_starburst.JPG" /></a><br /><br />SPARKLY SPARKLY OMG I WANT THE SPARKLY<br /><br />It's on sale for 20% off. That means if I buy it I'm saving money, right? Right? Hello, is this thing on?... <br /><br />Yeah, I'll probably shoot for something less expensive and ornate, but. Well. The sparkly, it calls to me.http://dement1a.livejournal.com/246337.htmlweddingspublic9http://dement1a.livejournal.com/246232.htmlFri, 25 Jun 2010 00:22:46 GMTSara needs your help!http://dement1a.livejournal.com/246232.html
While walking through Target today, I spotted the slightly-classier-than-white-plastic &quot;plastic flatware&quot; from Diamond. I'd kind of like to use this at my wedding, and... what's that?&nbsp;&quot;Try Me Free?&quot;<br /><br />SWEET.<br /><br />Just one problem. 1 rebate per household. That's where you come in.<br /><br />Yes dear friends, I said you! Here's my<strong> </strong><span style="color: rgb(255, 0, 0);"><strong>evil plan</strong></span> to stick it to Jarden Home Brands, maker of Diamond plasticware.<br /><ol><li>You say &quot;Yes, Sara, I'll paypal you $4 or $5 (depending on where you bought it)&quot;</li><li>I send you a paypal invoice, and you pay it (via personal payments so they don't take a fee out)</li><li>I put your name and address on the rebate and send it in</li><li>6-8 weeks later, you get the rebate check and cash it!</li></ol>Ha ha ha ha ha ha!&nbsp;MUAH HA HA HA HA HA! I'm brilliant!&nbsp;I'll take over the world!&nbsp;I'll...<br /><br />Ok. I'll save $60 or so bucks on wedding stuff. But hey. I&nbsp;have to take my evil victories where I&nbsp;can.<br /><br />Comment here if you'll help!http://dement1a.livejournal.com/246232.htmlweddingscouponsdeviouspublic16http://dement1a.livejournal.com/245547.htmlSat, 22 May 2010 04:54:39 GMTReady for Zombies.http://dement1a.livejournal.com/245547.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2010/05/22/ready-for-zombies/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2010/05/22/ready-for-zombies/#comments" rel="nofollow">there</a>.</strong></p><p>Remember my last post about how I was starting an herb garden, about two months ago, and I wasn&#8217;t expecting anything to actually grow?</p>
<p><a href="http://saratrice.com/wp-content/uploads/2010/05/my-herbs-2010-05-21-23.44.50.jpg" rel="nofollow"><img src="http://saratrice.com/wp-content/uploads/2010/05/my-herbs-2010-05-21-23.44.50.jpg" alt="" title="My Herb Garden" width="500" height="373" /></a></p>
<p>Stuff grew! The big foof of green you see on the left is parsley; I had to separate it out from the others so they didn&#8217;t hog all the sun. The rest in the tray is oregano, basil, tarragon, and catnip. The plant in the soda bottle bottom behind the parsley is a marigold I got from the UU church&#8217;s earth day service. Thinking tomorrow will be a good day for planting outside.</p>http://dement1a.livejournal.com/245547.htmluncategorizedpublic1http://dement1a.livejournal.com/243710.htmlSun, 28 Mar 2010 03:02:16 GMT1,2,3, There are zombies on the lawn&#8230;http://dement1a.livejournal.com/243710.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2010/03/27/123-there-are-zombies-on-the-lawn/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2010/03/27/123-there-are-zombies-on-the-lawn/#comments" rel="nofollow">there</a>.</strong></p><p>Seedling starter tray: $4<br />
Seedling soil: $4<br />
Seeds: $6</p>
<p><a href="http://saratrice.com/wp-content/uploads/2010/03/2010-03-27-21.48.50.jpg" rel="nofollow"><img src="http://saratrice.com/wp-content/uploads/2010/03/2010-03-27-21.48.50-300x224.jpg" alt="" title="Starting my herb garden" width="300" height="224" /></a></p>
<p>Being prepared for <a href="http://plantsvszombies.com" rel="nofollow">zombies on my lawn</a>: Priceless.</p>
<p>Well, here&#8217;s yet again another attempt at me starting an herb garden. Difference this time is that I actually have land to plant on. Yay, home ownership! I&#8217;ve got parsley, catnip, oregano, thyme, tarragon, and basil. Any tips from you green thumbs out there? &#8216;Cause generally anything I plant dies pretty horribly. Black thumbs run in my family. I know I need to keep them watered, but not too watered or I&#8217;ll get root rot. When should I water them? Every other day? Every second day? I have them at a west-facing window so they&#8217;ll get some sunlight filtered through the pine tree back there every day.</p>
<p>Any useful advice appreciated!</p>http://dement1a.livejournal.com/243710.htmluncategorizedpublic1http://dement1a.livejournal.com/243390.htmlFri, 26 Mar 2010 22:06:45 GMTImages showing negative in Safari, and not displaying in IE.http://dement1a.livejournal.com/243390.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2010/03/26/images-showing-negative-in-safari-and-not-displaying-in-ie/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2010/03/26/images-showing-negative-in-safari-and-not-displaying-in-ie/#comments" rel="nofollow">there</a>.</strong></p><p>This problem drove me crazy for a while:</p>
<p>I did a website for recently <a href="http://www.partiallyclips.com" rel="nofollow">an established webcomic</a> and some of the old archive images were showing up in negative on some browsers, and not showing up at all in others. But it didn&#8217;t happen to all the images, and not on all browsers. I beat my head against this for a while.</p>
<p>When you can&#8217;t figure out what&#8217;s wrong with an image, you look at the image properties, rather than beat your head against a wall. This is what I suggest, anyway, because I didn&#8217;t do that.</p>
<p>They were CMYK.</p>
<p>CMYK images show as negative in Safari, and don&#8217;t show up at all in some versions of IE.</p>
<p>Yay. Great. Converted them to RGB, re-uploaded, all fixed.</p>http://dement1a.livejournal.com/243390.htmltechpublic0http://dement1a.livejournal.com/239563.htmlMon, 20 Jul 2009 20:43:39 GMTCross-browser javascript compliance makes my head bleedhttp://dement1a.livejournal.com/239563.html
FIXORED! The solution was not to use display:none, but to shift the "hidden" thumbnails off the page, therefore hiding them, but still displaying them. Stupid IE.<br /><br />Ok, for those of you that know javascript, plz to be looking to see if you know anything that will fix this problem. For the rest of you, skip this post.<br /><br />OK, so I'm working on a site doing a &quot;simple&quot; gallery, but it has one feature I haven't seen before in any other javascript gallery: the client wants to be able to show 1 thumbnail per &quot;set&quot; of photos. A set may be anywhere from 1-5 photos. So, for example, to showcase 13 kitchens, she has 37 photos, but only wants to show 13 thumbnails.<br /><br />See here: <a href='http://gaertnercc.com/cabinetry.html' rel='nofollow'>http://gaertnercc.com/cabinetry.html</a> and click on &quot;view series&quot; to see that there are several photos per thumbnail. Clicking through them eventually gets you back to the first set.<br /><br />The gallery is &quot;Galleria&quot;, a jQuery gallery: <a href='http://devkick.com/lab/galleria/' rel='nofollow'>http://devkick.com/lab/galleria/</a><br /><br />What's the problem? Internet Explorer, of course! If you look at this site in IE and click on &quot;view series&quot;, it throws an error and leaves the big grey box unfilled. Yay.<br /><br />Narrowing down the cause: I have hidden many of these thumbnails since I need to have a &lt;li&gt; item in the list for Galleria to know that it's the next photo. Each &quot;hidden&quot; one has a class of &quot;hideme&quot;. In every other browser, this works fine. It sees the class of &quot;hideme,&quot; doesn't show the thumbnail, and moves on to the next picture without a problem. In IE? It sees that the thumbnail has the style of &quot;display:none&quot; and craps itself. If I remove the &quot;display:none&quot; from the &quot;hideme&quot; class, it works fine, but of course it shows all the thumbnails.<br /><br />Why would IE error when trying to get the img from a &lt;li&gt; element with display:none?<br /><br /><a name='cutid1-end'></a>http://dement1a.livejournal.com/239563.htmlwebsitesfrustratedpublic6http://dement1a.livejournal.com/238440.htmlMon, 08 Jun 2009 22:16:07 GMTRuby on Rails: Autocomplete with jQuery error: &#8220;Couldn&#8217;t find FileData with ID&#8221;http://dement1a.livejournal.com/238440.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2009/06/08/ruby-on-rails-autocomplete-with-jquery-error-couldnt-find-filedata-with-id/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2009/06/08/ruby-on-rails-autocomplete-with-jquery-error-couldnt-find-filedata-with-id/#comments" rel="nofollow">there</a>.</strong></p><p>Just in case anyone else has this problem and does not want to bang their head against the wall for an hour like I did:</p>
<p>When using the <a href="http://github.com/chris/auto_complete_jquery/tree/master" target="_blank" rel="nofollow">autocomplete plugin</a> that uses jQuery instead of scriptaculous, you need to add a route:</p>
<pre>map.auto_complete ':controller/:action',
:requirements =&gt; { :action =&gt; /auto_complete_for_\S+/ },
:conditions =&gt; { :method =&gt; :get }</pre>
<p>As per <a href="http://railsforum.com/viewtopic.php?pid=72135#p72135" target="_blank" rel="nofollow">this post</a> by the author of the plugin, who for some unknown reason hasn&#8217;t included that step with the instructions for the plugin. (WTF?) Otherwise it just sends the request to the show action, which looks at you stupidly and replies, &#8220;Couldn&#8217;t find FileData with ID=auto_complete_for_yourfieldname&#8221;, replacing &#8220;yourfieldname&#8221; with whatever you&#8217;d actually like it to return.</p>http://dement1a.livejournal.com/238440.htmltechpublic0http://dement1a.livejournal.com/238304.htmlTue, 02 Jun 2009 03:45:41 GMTDr. Tiller, RIPhttp://dement1a.livejournal.com/238304.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2009/06/01/dr-tiller-rip/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2009/06/01/dr-tiller-rip/#comments" rel="nofollow">there</a>.</strong></p><p>I am pro-choice. I believe that a woman has the right to control her pregnancy. It is her body, and she is carrying and nourishing the fetus inside her. If it becomes impossible to carry it to full term; if she is abandoned by her family, her friends, and has no possibility of being able to care for a child; if it will tear her apart to birth this child; if the child has a defect such that it will never experience a good quality of life - these are reasons not to carry the child to term. It is a personal decision, and it is one I support in full.</p>
<p>George Tiller, M.D. provided late term abortions. He was one of a handful of doctors that would. Why would someone get a late term abortion? What if, at 21 weeks, you found out your fetus had a severe birth defect that would cause it to be constantly in pain and live only a few years? Dr. Tiller understood that sometimes you have to make hard decisions, and that those decisions should not be made harder by not being able to find quality care. He did not encourage people to get abortions. He only performed them when the woman had made the very difficult decision to have one. <a href="http://andrewsullivan.theatlantic.com/the_daily_dish/2009/06/its-so-personal-a-tiller-patient.html" rel="nofollow">He provided quality care with respect.</a></p>
<p>Abortion is legal in the United States. Whether you agree with it or not, it is a legally available procedure. Murdering doctors for providing a legally available procedure is not heroic. It&#8217;s murder. I agree with President Obama that we should be working towards the goal of lessening the need for abortions - sex education, providing birth control, and being open and frank when discussing pregnancy. Regardless, I still believe that women should have the option to end their pregnancy if they feel it is necessary. Dr. Tiller thought so, too. I hope that his service to the respect and independence of women helps his soul rest easy.</p>http://dement1a.livejournal.com/238304.htmlpoliticalpublic2http://dement1a.livejournal.com/238069.htmlMon, 01 Jun 2009 04:14:23 GMTCarrie&#8217;s Wedding Cakehttp://dement1a.livejournal.com/238069.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2009/06/01/carries-wedding-cake/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2009/06/01/carries-wedding-cake/#comments" rel="nofollow">there</a>.</strong></p><p>I learned several things from this cake, many of them technicalities of cake, and several more general things, such as:</p>
<ol>
<li>Everything will take longer than you think.</li>
<li>Cake is hard work, but it does make you popular.</li>
<li>Try not to break your dishwasher&#8217;s faucet coupler before a large baking project.</li>
<li>The Point of Diminishing Returns is not just a theory.</li>
</ol>
<p>And, without further ado:</p>
<p style="text-align: center;"><a href="http://saratrice.com/wp-content/uploads/2009/06/carrie_wedding_cake.jpg" rel="nofollow"><img title="Carrie&amp;quot;s Wedding Cake" src="http://saratrice.com/wp-content/uploads/2009/06/carrie_wedding_cake.jpg" alt="Carrie&amp;quot;s Wedding Cake" width="453" height="604" /></a></p>
<p style="text-align: center;">Wedding Cake for Carrie Dahlby and Josh Rasey, 5/30/09<br />
Bottom tier - vanilla sour cream cake w/ vanilla buttercream<br />
Middle tier - chocolate cake w/ vanilla buttercream<br />
Top tier - low sugar chocolate cake w/ low sugar Italian meringue buttercream<br />
Entirely covered in marshmallow fondant with fondant roses and heart decorations</p>
<p style="text-align: center;">Based on a <a href="http://www.sedonaweddingcakes.com/" target="_blank" rel="nofollow">Sedona Wedding Cakes</a> design</p>
<p style="text-align: center;">(photo by Jered Perez)</p>http://dement1a.livejournal.com/238069.htmlcakespublic9http://dement1a.livejournal.com/234074.htmlMon, 20 Apr 2009 00:49:38 GMTCarrie &#038; Josh&#8217;s Wedding Shower Cakehttp://dement1a.livejournal.com/234074.html
<p style="border: 1px solid black; padding: 3px;"><strong>Originally published at <a href="http://saratrice.com/2009/04/19/carrie-joshs-wedding-shower-cake/" rel="nofollow">Sara Trice</a>. You can comment here or <a href="http://saratrice.com/2009/04/19/carrie-joshs-wedding-shower-cake/#comments" rel="nofollow">there</a>.</strong></p><p style="text-align: center;"><a href="http://www.saratrice.com/gallery/main.php?g2_itemId=9654" rel="nofollow"><img title="Carrie &amp; Joshs Wedding Shower Cake" src="http://www.saratrice.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=9654&amp;g2_serialNumber=2" alt="" width="604" height="453" /></a></p>
<p style="text-align: center;">Reduced sugar devil&#8217;s food cake with half sugar/half splenda swiss meringue buttercream. Marshmallow fondant used to cover the cake and for pink heart decorations.</p>http://dement1a.livejournal.com/234074.htmluncategorizedpublic9