<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Discrete &amp; discrete.{ Work, Twitter, Github }</description><title>Singletons Going Steady</title><generator>Tumblr (3.0; @mattdennewitz)</generator><link>http://mattdennewitz.com/</link><item><title>Indexing real-time many-to-many changes with Haystack</title><description>&lt;p&gt;Unless I&amp;#8217;m missing something, &lt;a href="http://haystacksearch.org/" target="_blank"&gt;django-haystack&lt;/a&gt;&amp;#8217;s &lt;a href="https://github.com/toastdriven/django-haystack/blob/v1.2.7/haystack/indexes.py#L255" target="_blank"&gt;RealTimeSearchIndex&lt;/a&gt; cares only about &lt;code&gt;post_save&lt;/code&gt; and &lt;code&gt;post_delete&lt;/code&gt;. That&amp;#8217;s generally fine, but you&amp;#8217;re not going to have access your many-to-many relationships when an instance is prepared for indexing. Django saves instance data and many to many data in three steps:&lt;/p&gt;

&lt;ol&gt;&lt;li&gt;Instance data is saved first to ensure a primary key is ready when building relationships to and from this object. &lt;/li&gt;
&lt;li&gt;Next, the many-to-many field is cleared.&lt;/li&gt;
&lt;li&gt;Finally, the many-to-many data is saved.&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;Now, the &lt;code&gt;post_save&lt;/code&gt; signal fires between steps one and two. This means when &lt;code&gt;post_save&lt;/code&gt; is fired, your many-to-many data hasn&amp;#8217;t been saved, and is not available on the model instance Haystack has ahold of.&lt;/p&gt;

&lt;p&gt;The trick here is to connect each many-to-many field on the model to Django&amp;#8217;s &lt;code&gt;m2m_changed&lt;/code&gt; signal and selectively listen to the actions it passes along when fired. &lt;code&gt;m2m_changed&lt;/code&gt; is pretty chatty, so we only want to listen for a select few scenarios: really, anything &amp;#8220;post&amp;#8221;.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s a quick solution I&amp;#8217;ve put together using the &lt;code&gt;_setup_save&lt;/code&gt; hook (and &lt;code&gt;_teardown_save&lt;/code&gt;) the framework provides.&lt;/p&gt;

&lt;script src="https://gist.github.com/2847650.js?file=gistfile1.py"&gt;&lt;/script&gt;&lt;p&gt;Haystack is a great option for indexing your site&amp;#8217;s content with a number of search backends. It makes total sense to leave this kind of functionality out, and the hooks built in for extensions like this are perfect.&lt;/p&gt;

&lt;p&gt;By the way, if I&amp;#8217;ve missed something obvious, please let me know!&lt;/p&gt;</description><link>http://mattdennewitz.com/post/24168126889</link><guid>http://mattdennewitz.com/post/24168126889</guid><pubDate>Thu, 31 May 2012 20:43:00 -0500</pubDate><category>python</category><category>django</category><category>programming</category><category>solr</category><category>search</category><category>haystack</category></item><item><title>Audio</title><description>&lt;embed type="application/x-shockwave-flash" src="http://assets.tumblr.com/swf/audio_player_black.swf?audio_file=http://www.tumblr.com/audio_file/23295422493/tumblr_m488ydo1RF1qasrej&amp;color=FFFFFF&amp;logo=soundcloud" height="27" width="207" quality="best" wmode="opaque"&gt;&lt;/embed&gt;&lt;br/&gt;&lt;br/&gt;</description><link>http://mattdennewitz.com/post/23295422493</link><guid>http://mattdennewitz.com/post/23295422493</guid><pubDate>Fri, 18 May 2012 11:39:49 -0500</pubDate></item><item><title>sapta-loka:


The American Southwest
Photograph by Neil Krug
</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_m41rl3wAXl1qd2hdto1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;a class="tumblr_blog" href="http://sapta-loka.tumblr.com/post/23116279018/the-american-southwest-photograph-by-neil-krug" target="_blank"&gt;sapta-loka&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The American Southwest&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Photograph by Neil Krug&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://mattdennewitz.com/post/23124050423</link><guid>http://mattdennewitz.com/post/23124050423</guid><pubDate>Tue, 15 May 2012 16:45:51 -0500</pubDate></item><item><title>Outtake!</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_m42pwn8Jcy1qasrejo1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Outtake!&lt;/p&gt;</description><link>http://mattdennewitz.com/post/23109253929</link><guid>http://mattdennewitz.com/post/23109253929</guid><pubDate>Tue, 15 May 2012 12:00:23 -0500</pubDate></item><item><title>One more, just for fun</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_m42pg30wlZ1qasrejo1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;One more, just for fun&lt;/p&gt;</description><link>http://mattdennewitz.com/post/23108866753</link><guid>http://mattdennewitz.com/post/23108866753</guid><pubDate>Tue, 15 May 2012 11:50:27 -0500</pubDate></item><item><title>Had a weird moment while cutting assets</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_m42pbg7jvL1qasrejo1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Had a weird moment while cutting assets&lt;/p&gt;</description><link>http://mattdennewitz.com/post/23108758372</link><guid>http://mattdennewitz.com/post/23108758372</guid><pubDate>Tue, 15 May 2012 11:47:40 -0500</pubDate></item><item><title>Cruel.

rubentomas:


A screenshot from Revolution, a new show...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_m400fa6A7j1qak44eo1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Cruel.&lt;/p&gt;

&lt;p&gt;&lt;a class="tumblr_blog" href="http://rubentomas.tumblr.com/post/23026141928/a-screenshot-from-revolution-a-new-show-being" target="_blank"&gt;rubentomas&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A screenshot from Revolution, a new show being produced by JJ Abrams and directed by Jon Favreau.&lt;/p&gt;
&lt;p&gt;The show is about every inkling of technology just stopping sometime during/after 2012.&lt;/p&gt;
&lt;p&gt;But when the Cubs win the World Series, we’ll know it’s the turning point of human history.&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://mattdennewitz.com/post/23051836165</link><guid>http://mattdennewitz.com/post/23051836165</guid><pubDate>Mon, 14 May 2012 14:44:53 -0500</pubDate></item><item><title>"The compendium is a better model than the aggregate. A list of things is most useful when it is..."</title><description>“The compendium is a better model than the aggregate. A list of things is most useful when it is large enough to show diversity and juxtaposition, but small enough to provide coherence: a tiny bestiary, not an infinite zoo.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Ian Bogost – &lt;a href="http://www.theatlantic.com/technology/archive/2012/04/the-new-aesthetic-needs-to-get-weirder/255838/" target="_blank"&gt;The New Aesthetic Needs to Get Weirder&lt;/a&gt;&lt;/em&gt;</description><link>http://mattdennewitz.com/post/22590188698</link><guid>http://mattdennewitz.com/post/22590188698</guid><pubDate>Mon, 07 May 2012 10:45:48 -0500</pubDate></item><item><title>Stormy weather</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_m3k1x3UrBo1qasrejo1_500.jpg"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://24.media.tumblr.com/tumblr_m3k1x3UrBo1qasrejo2_500.jpg"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://25.media.tumblr.com/tumblr_m3k1x3UrBo1qasrejo3_500.jpg"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://25.media.tumblr.com/tumblr_m3k1x3UrBo1qasrejo4_500.jpg"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;p&gt;Stormy weather&lt;/p&gt;</description><link>http://mattdennewitz.com/post/22447926717</link><guid>http://mattdennewitz.com/post/22447926717</guid><pubDate>Sat, 05 May 2012 10:05:27 -0500</pubDate></item><item><title>liam-kinsler:

April 30th, 2012 - Yu Darvish strikes out 9 in 7...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_m3bw46Q3j61qiuukyo1_500.jpg"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://24.media.tumblr.com/tumblr_m3bw46Q3j61qiuukyo2_400.gif"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://24.media.tumblr.com/tumblr_m3bw46Q3j61qiuukyo4_400.gif"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://24.media.tumblr.com/tumblr_m3bw46Q3j61qiuukyo5_400.gif"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://24.media.tumblr.com/tumblr_m3bw46Q3j61qiuukyo6_400.gif"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://24.media.tumblr.com/tumblr_m3bw46Q3j61qiuukyo7_400.gif"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://25.media.tumblr.com/tumblr_m3bw46Q3j61qiuukyo8_400.gif"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://24.media.tumblr.com/tumblr_m3bw46Q3j61qiuukyo9_400.gif"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://24.media.tumblr.com/tumblr_m3bw46Q3j61qiuukyo10_400.gif"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://25.media.tumblr.com/tumblr_m3bw46Q3j61qiuukyo11_400.gif"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;p&gt;&lt;a href="http://liam-kinsler.tumblr.com/post/22178477543/april-30th-2012-yu-darvish-strikes-out-9-in-7" class="tumblr_blog" target="_blank"&gt;liam-kinsler&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;April 30th, 2012&lt;/strong&gt;&lt;br/&gt; - &lt;em&gt;Yu Darvish strikes out 9 in 7 innings pitched.&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;</description><link>http://mattdennewitz.com/post/22209494563</link><guid>http://mattdennewitz.com/post/22209494563</guid><pubDate>Tue, 01 May 2012 15:11:16 -0500</pubDate></item><item><title>On repeat. Read about it or buy it, just do something.</title><description>&lt;embed type="application/x-shockwave-flash" src="http://assets.tumblr.com/swf/audio_player_black.swf?audio_file=http://www.tumblr.com/audio_file/22123700577/tumblr_m3as3n7elq1qasrej&amp;color=FFFFFF&amp;logo=soundcloud" height="27" width="207" quality="best" wmode="opaque"&gt;&lt;/embed&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;On repeat. &lt;a href="http://pitchfork.com/reviews/albums/16513-icon-give-thank/" target="_blank"&gt;Read about it&lt;/a&gt; or &lt;a href="http://igetrvng.com/discography/123/" target="_blank"&gt;buy it&lt;/a&gt;, just do something.&lt;/p&gt;</description><link>http://mattdennewitz.com/post/22123700577</link><guid>http://mattdennewitz.com/post/22123700577</guid><pubDate>Mon, 30 Apr 2012 09:54:59 -0500</pubDate></item><item><title>Just incredible</title><description>&lt;iframe src="https://embed.spotify.com/?uri=spotify:track:5CyGGzOfgBQkWwSDKfZM1c&amp;view=coverart" frameborder="0" allowtransparency="true" style="width:500px;height:580px;"&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Just incredible&lt;/p&gt;</description><link>http://mattdennewitz.com/post/21769611445</link><guid>http://mattdennewitz.com/post/21769611445</guid><pubDate>Wed, 25 Apr 2012 00:21:30 -0500</pubDate></item><item><title>A few albums on repeat lately</title><description>&lt;p&gt;&lt;ul&gt;&lt;li&gt;Actress: RIP&lt;/li&gt;
&lt;li&gt;The Congos/Sun Araw/M. Geddes Gengras: Icon Give Thank&lt;/li&gt;
&lt;li&gt;The Notwist: Neon Golden&lt;/li&gt;
&lt;li&gt;Television: Marquee Moon&lt;/li&gt;
&lt;li&gt;Karen Dalton: 1966&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;</description><link>http://mattdennewitz.com/post/21696565443</link><guid>http://mattdennewitz.com/post/21696565443</guid><pubDate>Mon, 23 Apr 2012 22:27:17 -0500</pubDate></item><item><title>“Tolstoy looks up Anna Karenina on...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_m09pb5GTNC1rnw5qjo1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;“Tolstoy looks up &lt;em&gt;Anna Karenina&lt;/em&gt; on Goodreads”&lt;/p&gt;
&lt;p&gt;&lt;a class="tumblr_blog" href="http://beatonna.tumblr.com/post/18610912371/i-love-reading-bad-reviews-of-classic-books-on" target="_blank"&gt;beatonna&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I love reading bad reviews of classic books on Amazon and Goodreads&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://mattdennewitz.com/post/21178048211</link><guid>http://mattdennewitz.com/post/21178048211</guid><pubDate>Sun, 15 Apr 2012 18:27:30 -0500</pubDate></item><item><title>Photo</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_ls8r48ZmqY1qzlv0zo1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;</description><link>http://mattdennewitz.com/post/20933613240</link><guid>http://mattdennewitz.com/post/20933613240</guid><pubDate>Wed, 11 Apr 2012 19:20:05 -0500</pubDate></item><item><title>Photo</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_m1au6lvaCk1qasrejo1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;</description><link>http://mattdennewitz.com/post/19739248861</link><guid>http://mattdennewitz.com/post/19739248861</guid><pubDate>Thu, 22 Mar 2012 13:32:45 -0500</pubDate></item><item><title>Photo</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_m0namaIo7k1qasrejo1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;</description><link>http://mattdennewitz.com/post/19031125338</link><guid>http://mattdennewitz.com/post/19031125338</guid><pubDate>Fri, 09 Mar 2012 19:25:21 -0600</pubDate></item><item><title>Thinking About Perfect Songs</title><description>&lt;p&gt;Right now, I&amp;#8217;m sitting around talking with two co-workers about our unforgivably subjective &amp;#8220;12 Perfect Songs&amp;#8221; after going over Mark Richardson&amp;#8217;s 2008 list. I really like the concept of building a list like this because I think it puts me in a place about music that I don&amp;#8217;t visit, in that I really have to think critically, and out loud. So, here goes&amp;#8230;&lt;/p&gt;

&lt;p&gt;Thinking about what I would include, I know the discussion includes &amp;#8220;I See A Darkness&amp;#8221;. It would probably also force my hand to admit that the next song, Hefner&amp;#8217;s &amp;#8220;Don&amp;#8217;t Flake Out On Me&amp;#8221; isn&amp;#8217;t as good as I believe it is, but it makes my list. I&amp;#8217;d have to bring &amp;#8220;Avalon&amp;#8221; to the party, and pick up Brian Eno&amp;#8217;s &amp;#8220;Baby&amp;#8217;s On Fire&amp;#8221; along the way. That solo! Throbbing Gristle&amp;#8217;s &amp;#8220;What A Day&amp;#8221;, Skinny Puppy&amp;#8217;s &amp;#8220;Dig It&amp;#8221; are coming, too, even of they don&amp;#8217;t make the cut. Animal Collective&amp;#8217;s &amp;#8220;Brothersport&amp;#8221; is there, too. Definitely &amp;#8220;Paranoid Android&amp;#8221;. Harry Chapin&amp;#8217;s &amp;#8220;Mr. Tanner&amp;#8221; or &amp;#8220;WOLD&amp;#8221;. Elton John&amp;#8217;s &amp;#8220;Daniel&amp;#8221;. Jim Croce&amp;#8217;s &amp;#8220;Operator&amp;#8221;. &amp;#8220;My Sweet Lord&amp;#8221;. &amp;#8220;Suspicious Minds&amp;#8221;. Y&amp;#8217;know?&lt;/p&gt;

&lt;p&gt;And to think of everything I can&amp;#8217;t remember off the top of my head. And, anyways, what even makes any of these perfect?&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s only ever an impromptu list of my favorite songs. I&amp;#8217;m having a hard time thinking critically about what is and isn&amp;#8217;t a perfect song, and maybe that&amp;#8217;s why I hold Mark&amp;#8217;s list in high regard. If there&amp;#8217;s one person that I&amp;#8217;d want to make a list of thy material, it&amp;#8217;s Mark. He nailed it. To me, it&amp;#8217;s such an overwhelming concept.&lt;/p&gt;</description><link>http://mattdennewitz.com/post/16678228279</link><guid>http://mattdennewitz.com/post/16678228279</guid><pubDate>Sat, 28 Jan 2012 23:45:45 -0600</pubDate></item><item><title>Larry Cuba (thx Tamas)</title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/HcvN1dt0yJo?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;p class="p1"&gt;Larry Cuba (thx Tamas)&lt;/p&gt;&lt;/p&gt;</description><link>http://mattdennewitz.com/post/16135116606</link><guid>http://mattdennewitz.com/post/16135116606</guid><pubDate>Thu, 19 Jan 2012 16:26:01 -0600</pubDate></item><item><title>Esoteric Ramblings about +</title><description>&lt;a href="http://walksaber.blogspot.com/2010/03/esoteric-ramblings-about.html"&gt;Esoteric Ramblings about +&lt;/a&gt;: &lt;p&gt;A reminder that placing a single statistic on a pedestal freezes it in time, and that is counterproductive.&lt;/p&gt;</description><link>http://mattdennewitz.com/post/15461588138</link><guid>http://mattdennewitz.com/post/15461588138</guid><pubDate>Sat, 07 Jan 2012 12:45:20 -0600</pubDate><category>sabermetrics</category><category>baseball</category><category>ERA+</category></item></channel></rss>

