tag:blogger.com,1999:blog-114674472009-06-09T11:36:04.443-07:00Undisclosed RecipientsCarlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.comBlogger25125tag:blogger.com,1999:blog-11467447.post-13995073666334281432009-06-09T11:34:00.000-07:002009-06-09T11:36:04.450-07:00NESIHTMSI couldn't find this acronym anywhere on the intertubes, so let me stake my claim here. It stands for "Nobody Ever Said It Had To Make Sense". Now you know.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-1399507366633428143?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1175876737111978742007-04-06T09:24:00.000-07:002007-04-06T09:25:37.123-07:00Eleven<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/akaD9v460yI"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/akaD9v460yI" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-117587673711197874?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com1tag:blogger.com,1999:blog-11467447.post-1161738258449815992006-10-24T18:03:00.000-07:002006-10-24T18:04:18.470-07:00Googlebombing Campaign '06-AZ-Sen: <a href="http://www.phoenixnewtimes.com/Issues/2006-04-13/news/feature_full.html">Jon Kyl</a><Br><br />--AZ-01: <a href="http://en.wikipedia.org/w/index.php?title=Rick_Renzi&printable=yes#Controversies">Rick Renzi</a><Br><br />--AZ-05: <a href="http://www.azcentral.com/arizonarepublic/local/articles/1022hayworth1022.html">J.D. Hayworth</a><Br><br />--CA-04: <a href="http://en.wikipedia.org/wiki/John_Doolittle#Controversies">John Doolittle</a><Br><br />--CA-11: <a href="http://en.wikipedia.org/wiki/Richard_Pombo#Controversies_and_criticisms">Richard Pombo</a><Br><br />--CA-50: <a href="http://www.kfmb.com/story.php?id=66505">Brian Bilbray</a><Br><br />--CO-04: <a href="http://www.rollingstone.com/politics/story/12054520/the_10_worst_congressmen/10">Marilyn Musgrave</a><Br><br />--CO-05: <a href="http://www.gazette.com/display.php?id=1322626&secid=1">Doug Lamborn</a><Br><br />--CO-07: <a href="http://www.rockymountainnews.com/drmn/elections/article/0,2808,DRMN_24736_5063243,00.html">Rick O'Donnell</a><Br><br />--CT-04: <a href="http://www.connpost.com/news/ci_4509567">Christopher Shays</a><Br><br />--FL-13: <a href="http://www.bradenton.com/mld/bradenton/news/local/15422371.htm?source=rss&channel=bradenton_local">Vernon Buchanan</a><Br><br />--FL-16: <a href="http://en.wikipedia.org/wiki/Mark_Foley_scandal">Joe Negron</a><br><br />--FL-22: <a href="http://www.usnews.com/usnews/politics/campaign_diary/florida/archive/2006/10/the_foley_scandal_affects_the.htm">Clay Shaw</a><br><br />--ID-01: <a href="http://www.summitdaily.com/article/20060923/NEWS/60923003">Bill Sali</a><Br><br />--IL-06: <a href="http://msnbc.msn.com/id/14988252/">Peter Roskam</a><Br><br />--IL-10: <a href="http://cbs2chicago.com/video/?id=25835@wbbm.dayport.com">Mark Kirk</a><Br><br />--IL-14: <a href="http://www.kcci.com/politics/10062284/detail.html">Dennis Hastert</a><Br><br />--IN-02: <a href="http://www.southbendtribune.com/apps/pbcs.dll/article?AID=/20060811/NEWS07/608110314">Chris Chocola</a><Br><br />--IN-08: <a href="http://www.courier-journal.com/localnews/2004/04/21ky/B1-host0421i0-7412.html">John Hostettler</a><Br><br />--IA-01: <a href="http://www.qctimes.net/articles/2005/12/09/news/local/doc439930283db6c088625962.txt">Mike Whalen</a><Br><br />--KS-02: <a href="http://cjonline.com/stories/102306/loc_ryunboyda1.shtml">Jim Ryun</a><br><br />--KY-03: <a href="http://www.courier-journal.com/localnews/2002/08/29/ke082902s267079.htm">Anne Northup</a><Br><br />--KY-04: <a href="http://www.kentucky.com/mld/kentucky/news/15533221.htm">Geoff Davis</a><Br><br />--MD-Sen: <a href="http://www.gazette.net/stories/021006/montsta130223_31925.shtml">Michael Steele</a><Br><br />--MN-01: <a href="http://www.hometown-pages.com/main.asp?SectionID=26&SubSectionID=186&ArticleID=12951&TM=48834.09">Gil Gutknecht</a><Br><br />--MN-06: <a href="http://citypages.com/databank/27/1348/article14760.asp">Michele Bachmann</a><Br><br />--MO-Sen: <a href="http://www.contracostatimes.com/mld/cctimes/news/politics/15174500.htm">Jim Talent</a><Br><br />--MT-Sen: <a href="http://www.billingsgazette.net/articles/2006/07/28/news/state/20-burns.txt">Conrad Burns</a><Br><br />--NV-03: <a href="http://www.lasvegassun.com/sunbin/stories/sun/2006/oct/22/566689009.html?porter">Jon Porter</a><Br><br />--NH-02: <a href="http://www.unionleader.com/article.aspx?headline=Top+aide+to+Bass+resigns&articleId=b65bcd02-f478-4a6d-801a-9a12761c3786">Charlie Bass</a><Br><br />--NJ-07: <a href="http://www.washingtonpost.com/ac2/wp-dyn/A23714-2003Apr3?language=printer">Mike Ferguson</a><Br><br />--NM-01: <a href="http://www.rawstory.com/news/2006/Congresswoman_on_page_board_buried_file_1019.html">Heather Wilson</a><Br><br />--NY-03: <a href="http://www.newsday.com/news/nationworld/ny-usking0817,0,6911475,print.story?coll=ny-top-headlines">Peter King</a><Br><br />--NY-20: <a href="http://blogs.timesunion.com/capitol/?p=983">John Sweeney</a><Br><br />--NY-26: <a href="http://www.democratandchronicle.com/apps/pbcs.dll/article?AID=/20061004/NEWS01/61004020/1002/NEWS">Tom Reynolds</a><Br><br />--NY-29: <a href="http://en.wikipedia.org/wiki/Randy_Kuhl#Personal">Randy Kuhl</a><Br><br />--NC-08: <a href="http://www.newsobserver.com/291/story/254053.html">Robin Hayes</a><Br><br />--NC-11: <a href="http://en.wikipedia.org/wiki/Charles_H._Taylor#Controversies">Charles Taylor</a><Br><br />--OH-01: <a href="http://www.thehill.com/thehill/export/TheHill/News/Frontpage/091906/chabot.html">Steve Chabot</a><Br><br />--OH-02: <a href="http://www.wcpo.com/news/2006/local/10/11/murtha_schmidt.html">Jean Schmidt</a><Br><br />--OH-15: <a href="http://www.columbusdispatch.com/?story=217625">Deborah Pryce</a><Br><br />--OH-18: <a href="http://www.cleveland.com/news/plaindealer/index.ssf?/base/news/1161257895268090.xml&coll=2">Joy Padgett</a><Br><br />--PA-04: <a href="http://www.sharonherald.com/local/local_story_263230124.html?start:int=0">Melissa Hart</a><Br><br />--PA-07: <a href="http://www.phillyburbs.com/pb-dyn/news/28-10162006-727801.html">Curt Weldon</a><Br><br />--PA-08: <a href="http://www.phillyburbs.com/pb-dyn/news/111-01222006-601349.html">Mike Fitzpatrick</a><Br><br />--PA-10: <a href="http://www.timesleader.com/mld/timesleader/15646184.htm">Don Sherwood</a><Br><br />--RI-Sen: <a href="http://www.washingtonpost.com/wp-dyn/content/article/2006/08/05/AR2006080500823.html">Lincoln Chafee</a><br><br />--TN-Sen: <a href="http://www.knoxnews.com/kns/election/article/0,1406,KNS_630_5057450,00.html">Bob Corker</a><Br><br />--VA-Sen: <a href="http://www.cbsnews.com/stories/2006/09/26/politics/main2039589.shtml">George Allen</a><Br><br />--VA-10: <a href="http://www.nationalcenter.org/PRJTHGWolfEarmark1006.html">Frank Wolf</a><Br><br />--WA-Sen: <a href="http://seattlepi.nwsource.com/local/283622_mcgavick02.html">Mike McGavick</a><br><br />--WA-08: <a href="http://seattlepi.nwsource.com/local/287797_reichertsideweb06.html">Dave Reichert</a><Br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-116173825844981599?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1147538371494099302006-05-13T09:39:00.000-07:002006-05-13T09:39:31.503-07:00Everything9-11 changed everything.<br />Cats chase dogs.<br />Rain falls up.<br /><br />Blacks oppress whites.<br />Automobiles create gasoline.<br />Cigarettes cure cancer.<br /><br />Torture is good.<br />And we don't, anyway.<br />Hurricanes never strike<br />populated areas.<br />There is no poverty.<br /><br />Marriage is between one man<br />and one woman.<br />The rich need more money.<br />Corporations have our<br />best interests at heart.<br /><br />War is healthy for children<br />and other living things.<br />9-11 changed<br />everything.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-114753837149409930?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1130684087564527142005-10-30T06:51:00.000-08:002005-10-30T06:54:47.576-08:00The Twelve days of Fitzmas<div align=center><br />On the twelfth day of Fitzmas<br />Fitzgerald sent to jail:<br />Rumsfeld rattling sabers;<br />Mike Brownie sleeping;<br />Tom Delay conspiring;<br />Karl Rove dissembling;<br />Bill Frist diagnosing;<br />Dick Cheney sneering;<br />Scooter Libby lying;<br />George Dubya Bush;<br />Paul Wolfowitz;<br />John Bolton;<br />Condaleezza Rice;<br />and McClellan in the first cell.<br /></div><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-113068408756452714?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1123440917939369972005-08-07T11:47:00.000-07:002005-08-27T14:13:52.376-07:00"The" and "That"I'm reading Bruce Eckel's <em>Thinking In Java </em>now, and I'm at the point where he introduces Singleton. I've tried, and kind of liked, the word "The" for the function that returns the singleton instance:<br /><br />app = Application.The();<br /><br />It seems clear and easy to remember. But I don't use Singleton often enough to have much of a sense of whether this is better or worse than other terms.<br /><br />I'm also using "that" a lot; I find a lot of my methods compare "this" with something else, or involve an interaction with something else of the same type. It flows naturally to say<br /><br />if (this == that)<br /><br />and it's also convenient that "this" and "that" have the same length, so code lines up neatly:<br /><br /><code><br />if (this.foo > that.bar<br /> || that.foo > this.bar)<br /></code><br /><br />These terms remind me of HyperCard's delightful "it".<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-112344091793936997?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1119364098787629612005-06-21T07:28:00.000-07:002005-12-20T11:47:49.840-08:00Healthcare VouchersKevin <a href="http://www.washingtonmonthly.com/archives/individual/2005_06/006520.php">writes:</a><br /><br /><blockquote><br />I was pretty taken aback last week by the white hot blasts of vitriol unleashed at Ezekiel Emanuel over his Universal Healthcare Voucher proposal. The reason I was taken aback is that universal healthcare is a fundamentally liberal idea, and the only real point of contention in the comment threads was over which kind of universal healthcare is better: a single-payer plan or a plan that incorporates competition via insurance companies? Why then was UHV treated as if it was an idea on loan from the Heritage Foundation?<br /></blockquote><br /><br />I'll take a stab at this.<br /><br />Let's stipulate, right out of the gate, that healthcare is not a zero-sum proposition. Vaccination and routine screening, for example, are two areas where we can spend money to save money in other areas. So we can't just say that because private health insurance costs money, it's necessarily better to take it out of the system. Some expenses in health care constitute investment and therefore pay for themselves.<br /><br />But. For-profit insurers are a big part of what is wrong with our current system. For-profit pharmaceutical companies are another big part, but this - vouchers - is about insurance. Insurance takes money out of the system as profit and represents an additional cost because of the layers of transaction and regulation it requires. And it gives us <em>nothing </em>in return. Study after study has found that the only way to solve this is with a single-payer system. So whenever anyone - from Hillary Clinton to Ezekiel Emanuel - stakes out a position that includes private insurers, I for one can't take them seriously.<br /><br />Real reform of America's healthcare system means taking the insurers out of it. Yes, it means doing serious battle with incredibly well-financed vested interests; yes, it's been tried before and failed - but it's the only real option we have. So when yet another well-intentioned soul puts forward a plan to reform healthcare without eliminating private insurance, the most responsible reaction is to slap it down.<br /><br />Furthermore, vouchers - whatever their actual merits may be - have routinely been used by the Right and by Libertarians as a sneaky assault, particularly in the area of education. Suggesting vouchers for healthcare as a way of keeping insurers involved (or of deflecting their attacks) makes me very suspicious. I see this as an either-or tradeoff between private insurance and public healthcare; muddying that picture with vouchers serves no constructive purpose.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111936409878762961?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.comtag:blogger.com,1999:blog-11467447.post-1118370480461908202005-06-09T19:28:00.000-07:002005-06-09T19:28:00.476-07:00What hilzoy said<a href="http://obsidianwings.blogs.com/obsidian_wings/2005/06/more_things_we_.html">Amen.</a><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111837048046190820?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1117482862395600992005-05-30T12:41:00.000-07:002005-05-30T12:54:22.400-07:00McClellan channels OrwellScott McClellan's recent assertion that the Senate has all the information they need to make a decision about John Bolton - justifying the Administration's failure to comply with the Senate's request for deminimized NSA intercepts as given to the candidate - might be summed up as follows:<br /><br /><blockquote>All branches of government are co-equal, but some branches are more co-equal than others.</blockquote><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111748286239560099?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1115999290473126022005-05-13T08:40:00.000-07:002005-05-13T08:48:10.493-07:00Newt and HillaryThe NYT saying that Newt Gingrich is expressing support for Hillary Clinton's 2008 Presidential candidacy. What's up with that?<br /><br />Here's my guess. Newt thinks - as I do - that Hillary would be an incredibly easy candidate for the Republicans to defeat. He thinks - as I do - that she would either win the primary, or, in the course of the primary, do a lot of damage to whichever Democrat defeats her.<br /><br />Newt wants the Republicans to win, so he's supporting Hillary.<br /><br />You heard it here first.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111599929047312602?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1114883666660660292005-04-30T10:52:00.000-07:002005-04-30T10:54:26.660-07:00Strangely enough...It appears that those who <strong>can</strong> remember that "those who cannot remember the past are condemned to repeat it" are condemned to repeat it.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111488366666066029?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1114183748027903062005-04-22T08:28:00.000-07:002005-04-22T08:29:08.026-07:00Pity John Bolton's Family......because he's about to withdraw from the nomination to spend more time with them.<br /><br />I'll bet he kicks the dog, too.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111418374802790306?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1113312718611382712005-04-12T06:30:00.000-07:002005-04-12T06:31:58.613-07:00Proper ReverenceA <a href="http://pharyngula.org/index/weblog/comments/the_proper_reverence_due_those_who_have_gone_before">great post</a> at Pharyngula.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111331271861138271?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1113062614313683022005-04-09T08:50:00.000-07:002005-04-09T09:03:34.316-07:00Data Loom for WindowsYesterday I released the Windows version of Data Loom, my implementation of Alfred Inselberg's Parallel Coordinates visualization.<br /><br />I was quite happy with the Mac version of the program, and the most important features from it translated perfectly well to Windows. The best features are translucent traces - so where there is a concentration of many traces, it appears more prominent than in areas of less dense coverage - and simple but powerful selection: you can select simply (just drag around trace vertices), or toggle-select (hold down the Shift key), or accumulate-select (hold down the Ctrl key), or - and this has always been the most useful, to my surprise - hold down both Ctrl and Shift to refine-select, that is to select from among the already-selected traces.<br /><br />This new implementation is written in C# and requires the .NET libraries (which I'm finding is a significant impediment to adoption, in both this and my exploratory sequence analysis program). I didn't look, even once, at the original Mac C++ implementation, and it still took just two easy weeks. I left off some of the bells and whistles of the original - we'll see whether there's any demand to restore them - but still, I'm very pleased with the pace that C# lets me work at. And TDD - until I got to the interface elements, this was almost 100% test-driven. I still don't "get" how to test-drive user interfaces, despite Phlip's <a href="http://c2.com/cgi/wiki?MiniRubyWiki">best efforts</a> - but I keep trying.<br /><br />If you'd like to use Data Loom, Windows or Mac, you can get it from the <a href="http://groups.yahoo.com/group/dataloom/">Yahoo group</a>.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111306261431368302?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1111970965587859522005-03-27T16:36:00.000-08:002005-03-27T16:54:05.866-08:00Alternative Dispose()Visual Studio writes Dispose() methods for me that look like this:<br /><br /><pre><span style="font-family:Courier New;color:#000000;"><span style="color:#0000ff;"><b>protected</b></span> <span style="color:#0000ff;"><b>override</b></span> <span style="color:#0000ff;"><b>void</b></span> Dispose( <span style="color:#0000ff;"><b>bool</b></span> disposing )<br />{<br /> <span style="color:#0000ff;"><b>if</b></span>( disposing )<br /> {<br /> <span style="color:#0000ff;"><b>if</b></span>(components != <span style="color:#0000ff;"><b>null</b></span>)<br /> {<br /> components.Dispose();<br /> }<br /> }<br /> <span style="color:#0000ff;"><b>base</b></span>.Dispose( disposing );<br />}</span></pre><br /><br />I don't mind - much - it's not like I have to look at it much. But it's a whole lot of indentation to do not very much. I figured the one really important thing it's doing there is calling base.Dispose(), and the conditionals just add a lot of structure to protect the inner clause without interfering with that final line. So I refactored it into this:<br /><br /><pre><span style="font-family:Courier New;color:#000000;"><span style="color:#0000ff;"><b>protected</b></span> <span style="color:#0000ff;"><b>override</b></span> <span style="color:#0000ff;"><b>void</b></span> Dispose(<span style="color:#0000ff;"><b>bool</b></span> disposing)<br /> {<br /> <span style="color:#0000ff;"><b>try</b></span><br /> {<br /> <span style="color:#0000ff;"><b>if</b></span> (!disposing) <span style="color:#0000ff;"><b>return</b></span>;<br /> <span style="color:#0000ff;"><b>if</b></span> (components == <span style="color:#0000ff;"><b>null</b></span>) <span style="color:#0000ff;"><b>return</b></span>;<br /> components.Dispose();<br /> }<br /> <span style="color:#0000ff;"><b>finally</b></span> {<span style="color:#0000ff;"><b>base</b></span>.Dispose(disposing);}<br /> }</span></pre><br /><br />I'm pretty sure the behavior is identical, and it's just a whole lot easier on my eyes. The <span style="color:#0000ff;"><b>return</b></span>/<span style="color:#0000ff;"><b>finally</b></span> interactions are a little scary (<span style="color:#0000ff;"><b>finally</b></span> clause code happens after <span style="color:#0000ff;"><b>return</b></span>, which isn't true of normally structured code) - but I'll (grudgingly) trade that scariness for the reduction in apparent complexity.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111197096558785952?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1111366758558556032005-03-20T16:54:00.000-08:002005-03-20T16:59:18.563-08:00Triangulation<em>Here's something I wrote up a long time ago about one of my favorite programming techniques. I've since learned to call it "triangulation".</em><br /><br /><p>I noticed myself doing something last night that I have done hundreds or thousands of times before, following a habit that I've unconsciously adopted. It worked - again - and I decided to formalize it, to make the practice easier to apply deliberately in the future, to better be able to determine appropriate situations for its application, and to share with others.<br /><br />What I was doing was as follows. I had four little triangles to draw around the outside of circles forming an irregular shape. I wrote a routine to calculate the points of one of the triangles, with values for all of the coordinates that would only work for the first case. I then duplicated this routine, and reworked it for a second triangle. I then generalized the code, writing a routine that could handle any arbitrary triangle-outside-a-circle (within the context of my application), replaced the original two routines with calls to this one, and wrote the routines for the remaining triangles.<br /><br />Here's the recipe: </p><ol><li>Write a specific case; </li><li>Derive a second specific case from the first; </li><li>Write a general solution;</li><li>Apply the general solution to the first two cases;</li><li>Use the general solution as needed.</li></ol><p>and the rationale:<br /><br /><strong>Write a specific case</strong>; This lets you solve the problem once without getting caught up in the abstractions. It gives you something simple to test, and a good motivation: you need this first case to work. You also need the other cases to work, but the motivation for the general case is more abstract - "softer", if you will. You can mess with values as much as you need, and it won't be messing up any other cases.</p><p><br /><strong>Derive a second specific case from the first</strong>; This exposes your first implementation to some stress-testing. It lets you see which parts are stable under different circumstances, and which parts need to be flexible. It gives you a second, more reflective look at the problem - because it is much easier than solving the problem in the first case, you have more of a chance to think about the problem without getting lost in the details. </p><p><br /><strong>Write a general solution</strong>; The bits you didn't need to change in (2) should form the basis for a common solution, with the bits you did need to change representing parameters to the routine. Apply the general solution to the first two cases; If nothing else, this gets rid of embarrassing code bloat - but of course there is much else: you get a chance to test against already-working cases, and identify and resolve discrepancies. </p><p><br /><strong>Use the general solution as needed</strong>. Now that you've got it, put it to work. There may be a few remaining things to fix in the general solutions - a sample size of two is, after all, unlikely to be representative of most problem populations - but these should be small, and the main work of the routine is already behind you. </p><p><br />Note that at every step, except (4), you have something new to test. That's good - you don't save up all the bugs for the final step. It is also a fairly even distribution of thoughtload, so you're never bored or overwhelmed. </p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111136675855855603?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1111287611902258482005-03-19T18:48:00.000-08:002005-03-19T19:00:11.906-08:00Crocodile Tears<img src="http://www.signonsandiego.com/uniontrib/20050319/images/politics.jpg">. <br /><br /><blockquote><br />Florida state Sen. Nancy Argenziano spoke at the Capitol in Tallahassee yesterday about her decision to vote against intervening in the case of Terri Schiavo, whose feeding tube was removed but reinserted twice in the past after legal and legislative efforts to keep her alive.<br /></blockquote><br /><br />When I saw this in this morning's <a href="http://www.signonsandiego.com/uniontrib/20050319/">U-T</a>, I thought: Why can't these supposedly compassionate Republicans spare a little compassion for the truly living? How about shedding a tear for the homeless, for the hungry, for the downtrodden in our country? How about sobbing for the thousands of Iraqis terrorized by our unjust war and occupation?<br /><br />How about some <em>real</em> compassion, and how about letting that compassion guide your actions?<br /><br />Crying on command to energize the base is contemptable.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111128761190225848?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1111172836982089802005-03-18T10:16:00.000-08:002005-03-18T11:10:02.653-08:00A Nice TDD ExperienceSometimes, Test-Driven Development (TDD) works great; other times I find myself slipping away from it. This was one of the great times.<br /><br />I wanted a function to return the longest common substring between two strings. Simple, easy to test. I started with this:<br /><!-- Colorized Code generated by Code Formatter, written by Ehsan Akhgari (Ehsan@beginThread.com) Available at http://www.beginthread.com/article/ehsan/code%20formatter/ --><br /><pre><font color="#000000" face="Courier New">[Test] <font color="#0000FF"><b>public</b></font> <font color="#0000FF"><b>void</b></font> LCS_1() <br /> {Assert.AreEqual(<font color="#669999">""</font>, Matcher.LongestCommonSequence(<font color="#669999">""</font>, <font color="#669999">""</font>));}<br /></font></pre><br /><br />Which was, of course, very easy to make pass:<br /><br /><pre><font color="#000000" face="Courier New"><font color="#0000FF"><b>public</b></font> <font color="#0000FF"><b>static</b></font> <font color="#0000FF"><b>string</b></font> LongestCommonSequence(<font color="#0000FF"><b>string</b></font> s1, <font color="#0000FF"><b>string</b></font> s2)<br /> {<font color="#0000FF"><b>return</b></font> <font color="#669999">""</font>;}<br /></font></pre><br /><br /><br />The next step was to make it return the first string if the strings were the same (or, actually, even if they weren't - the test didn't require a comparison):<br /><br /><pre><font color="#000000" face="Courier New">[Test] <font color="#0000FF"><b>public</b></font> <font color="#0000FF"><b>void</b></font> LCS_2() <br /> {Assert.AreEqual(<font color="#669999">"a"</font>, Matcher.LongestCommonSequence(<font color="#669999">"a"</font>, <font color="#669999">"a"</font>));}<br /></font></pre><br /><br />Which was also very easy to make pass:<br /><br /><pre><font color="#000000" face="Courier New"><font color="#0000FF"><b>public</b></font> <font color="#0000FF"><b>static</b></font> <font color="#0000FF"><b>string</b></font> LongestCommonSequence(<font color="#0000FF"><b>string</b></font> s1, <font color="#0000FF"><b>string</b></font> s2)<br /> {<font color="#0000FF"><b>return</b></font> s1;}</font></pre><br />Notice a certain amount of duplication in the tests? I did:<br /><br /><pre><font color="#000000" face="Courier New"><font color="#0000FF"><b>private</b></font> <font color="#0000FF"><b>void</b></font> LCS(<font color="#0000FF"><b>string</b></font> want, <font color="#0000FF"><b>string</b></font> s1, <font color="#0000FF"><b>string</b></font> s2)<br /> {Assert.AreEqual(want, Matcher.LongestCommonSequence(s1, s2));}<br />[Test] <font color="#0000FF"><b>public</b></font> <font color="#0000FF"><b>void</b></font> LCS_1() {LCS(<font color="#669999">""</font>, <font color="#669999">""</font>, <font color="#669999">""</font>);}<br />[Test] <font color="#0000FF"><b>public</b></font> <font color="#0000FF"><b>void</b></font> LCS_2() {LCS(<font color="#669999">"a"</font>, <font color="#669999">"a"</font>, <font color="#669999">"a"</font>);}<br /></font></pre><br /><br />Unfortunately, I didn't keep all the intermediate steps. But of course I kept the intermediate <em>tests</em>! Tests are forever:<br /><br /><pre><font color="#000000" face="Courier New">[Test] <font color="#0000FF"><b>public</b></font> <font color="#0000FF"><b>void</b></font> LCS_3() {LCS(<font color="#669999">""</font>, <font color="#669999">"t"</font>, <font color="#669999">"a"</font>);}<br />[Test] <font color="#0000FF"><b>public</b></font> <font color="#0000FF"><b>void</b></font> LCS_4() {LCS(<font color="#669999">"a"</font>, <font color="#669999">"ta"</font>, <font color="#669999">"a"</font>);}<br />[Test] <font color="#0000FF"><b>public</b></font> <font color="#0000FF"><b>void</b></font> LCS_5() {LCS(<font color="#669999">"ta"</font>, <font color="#669999">"ta"</font>, <font color="#669999">"ta"</font>);}<br />[Test] <font color="#0000FF"><b>public</b></font> <font color="#0000FF"><b>void</b></font> LCS_6() {LCS(<font color="#669999">"tgggtaa"</font>, <font color="#669999">"ccccctgggtaacccccc"</font>, <font color="#669999">"gggggggggtgggtaagg"</font>);}<br /></font></pre><br /><br />This resulted in a working, slow version of the function. I was iterating over all possible lengths (my like-real data set had 700+ character strings), over all possible positions. With a working function and a suite of tests to <em>keep </em>it working, it was a simple matter to break out of the outer loop as soon as it failed (if a length of 35 didn't work, there was no point in looking for lengths of 36 or greater), to break out of the inner loop as soon as it succeeded (there may be multiple 35-character substrings in common, but we only need one), and to start each inner loop at the starting point of the previous result (if there were no 34-character matches before the 92nd character, there will be no 35-character matches there, either). Here's the final function, which passes all tests and is fast enough:<br /><br /><pre><font color="#000000" face="Courier New"><font color="#0000FF"><b>public</b></font> <font color="#0000FF"><b>static</b></font> <font color="#0000FF"><b>string</b></font> LongestCommonSequence(<font color="#0000FF"><b>string</b></font> s1, <font color="#0000FF"><b>string</b></font> s2)<br /> {<br /> <font color="#0000FF"><b>string</b></font> result = <font color="#669999">""</font>;<br /> <font color="#0000FF"><b>int</b></font> start = 0;<br /> <br /> <font color="#0000FF"><b>for</b></font> (<font color="#0000FF"><b>int</b></font> length = 1; length <= s1.Length; ++length)<br /> {<br /> <font color="#0000FF"><b>for</b></font> (<font color="#0000FF"><b>int</b></font> i = start; i < s1.Length - length + 1; ++i)<br /> {<br /> <font color="#0000FF"><b>string</b></font> snippet = Substring(s1, i, length);<br /> <font color="#0000FF"><b>if</b></font> (!Regex.Match(snippet.ToLower(), <font color="#669999">"^[acgt]*$"</font>).Success) <font color="#0000FF"><b>break</b></font>;<br /> <font color="#0000FF"><b>if</b></font> (s2.IndexOf(snippet) >= 0)<br /> {<br /> start = i;<br /> result = snippet;<br /> <font color="#0000FF"><b>break</b></font>;<br /> }<br /> }<br /> <font color="#0000FF"><b>if</b></font> (result.Length < length) <font color="#0000FF"><b>break</b></font>;<br /> }<br /> <font color="#0000FF"><b>return</b></font> result;<br /> }<br /></font></pre><br /><br />As I look at this, I see that I should probably extract the regex bit into a nice function along the lines of IsJustBases(), and I could squeeze a little more efficiency out of this by ToLower()ing the input parameters instead of the snippet, <em>and</em> I could probably force a bug by mixing cases across s1 and s2. All the changes will be easy and safe, thanks to the existing tests. I can't justify the ToLower() change based on performance, which is adequate, but I certainly can on correctness, if I can show the bug.<br /><br />Thanks to Ehsan Akhgari, whose <a href="http://www.beginthread.com/Article/Ehsan/Code%20Formatter/">Code Formatter</a> has made this post more readable.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111117283698208980?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1111107073591773572005-03-17T16:43:00.000-08:002005-03-17T16:51:13.593-08:00Popcorn - Perfect for Hot AirSeveral years ago I compiled a list of why popcorn is so very well suited for hot air popping. I don't still have the list, but perhaps I can remember most of the items.<br /><br />First off, the much lower density of the popped kernels means that they can be blown away by an airflow that doesn't affect the unpopped ones. So the ones that need the heat, stay in the heat.<br /><br />Next, the low density of popped kernels means they have a lot of resistance to movement, so even though the pop gives them a large initial velocity, they don't fly all over everywhere.<br /><br />And there is that pop, which imparts a lot of energy, mixing things up (in case there are hot and cold spots, a little mixing up can ensure that every kernel gets its fair turn in the heat).<br /><br />And the popped kernels that haven't yet made it all the way out provide a nice buffer to absorb some of that energy, so that if an unpopped kernel gets much of the energy, its movement is dampened and its flight kept short.<br /><br />And it's dense, so it falls back down to the hot surface.<br /><br />That's all I can remember right now; I think there may have been more.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111110707359177357?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1111017987027424802005-03-16T15:40:00.000-08:002005-03-16T16:09:18.623-08:00Propaganda TaxonomyLet's launch the political side of this blog with a brief <span id="google-navclient-hilite" style="COLOR: black; BACKGROUND-COLOR: cyan">taxonomy</span> of the Bush administration's <span id="google-navclient-hilite" style="COLOR: black; BACKGROUND-COLOR: yellow">propaganda</span> techniques. I've just been struck recently by the revelations about manufactured news, and it seemed like it would be good to review the whole mess. So, here goes.<br /><br />Media<br /><ul><li><a href="http://www.alternet.org/mediaculture/20946/">Shills </a>(<a href="http://www.washingtonpost.com/wp-dyn/articles/A56330-2005Jan7.html">Armstrong Williams</a>, <a href="http://www.washingtonpost.com/wp-dyn/articles/A36545-2005Jan25.html">Maggie Gallagher</a>, <a href="http://seattletimes.nwsource.com/html/politics/2002164234_watch29.html">Mike McManus</a>)</li><li>Salting (<a href="http://www.dkosopedia.com/index.php/Jeff_Gannon">Jeff Gannon</a>)</li><li>Fake News (<a href="http://journalism.nyu.edu/pubzone/weblogs/pressthink/2004/03/31/ryan_video.html">Karen Ryan</a>)</li><li><a href="http://www.alternet.org/waroniraq/15220/">Embeds</a></li><li><a href="http://www.americanprogress.org/site/pp.asp?c=biJRJ8OVF&b=37732">Media Intimidation</a></li></ul><p>Lying</p><ul><li><a href="http://www.whitehouse.gov/news/releases/2002/10/20021007-8.html">WMD</a></li><li><a href="http://www.washingtonpost.com/ac2/wp-dyn/A19822-2003Jun21?language=printer">Iraq ties to al Qaeda</a></li><li><a href="http://slate.msn.com/id/2083852/">Tax Cuts</a></li><li><a href="http://www.boston.com/news/nation/washington/articles/2004/12/28/plan_for_social_security_relies_on_an_immediate_familiar_bush_strategy?mode=PF">Social Security</a></li><li>and <a href="http://www.moveleft.com/moveleft_essay_2004_10_07_seven_lies_cheney_told_during_the_vp_debate.asp">smaller lies</a></li></ul><p>Secrets</p><ul><li><a href="http://www.ems.org/energy_policy/cheney_energy_task_force.html">Cheney's energy task force</a></li></ul><p><a href="http://www.thenation.com/doc.mhtml?i=20040308&s=kennedy">Suppressing Science</a></p><p>Terminology</p><ul><li><a href="http://www.freepress.org/columns/display/1/2005/1052">Privatization/ Private Accounts / Personal Accounts </a></li></ul><p><a href="http://edition.cnn.com/2003/US/05/16/nyt.bumiller/">Stage Props</a></p><ul><li><a href="http://www.buzzflash.com/analysis/03/10/ana03291.html">Mission Accomplished</a></li><li><a href="http://www.commondreams.org/headlines03/0122-10.htm">Made in the USA</a></li><li><a href="http://media.portland.indymedia.org/images/2004/02/280352.jpg">Halo</a></li><li><a href="http://www.latimes.com/news/politics/la-na-stagecraft6jul06,1,1298368.story?ctrack=1&cset=true">Rushmore</a></li><li><a href="http://www.washingtonpost.com/wp-dyn/articles/A36180-2004May18.html">Jobs and Growth </a></li></ul><p><a href="http://www.commondreams.org/views04/0125-02.htm">First Amendment Zones</a></p><p>Timing</p><ul><li><a href="http://www.dailykos.com/story/2004/8/9/131227/0193">Friday afternoon press releases</a></li><li><a href="http://www.911citizenswatch.org/modules.php?op=modload&name=News&file=article&sid=488">Delaying 9/11 disclosure until Rice's confirmation as Secretary of State</a></li><li>Rice <a href="http://www.nytimes.com/2004/04/08/politics/08RICE-TEXT.html?ex=1111122000&en=57a0b24a32ed06d9&amp;ei=5070&pagewanted=print&position=">running out the clock </a>in her 9/11 testimony</li></ul><p>I'm sure I've left a lot out here, but it's a start. At times I've thought that dishonesty or hypocrisy were the defining characteristics of this administration, but I'm coming to see that there is something deeper underneath it. Of course there is a great deal of dishonesty (and hypocrisy) documented in the above links, but I think that "message control" (newspeak for "<span id="google-navclient-hilite" style="COLOR: black; BACKGROUND-COLOR: yellow">propaganda</span>") is more fundamental. If they felt it was helpful to them for the public to know the truth about something, I think they would probably be just as energetic about spreading that truth as they are about spreading their lies.</p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111101798702742480?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1110908511081949482005-03-15T09:41:00.001-08:002005-03-15T09:41:51.080-08:00<a href='http://photos1.blogger.com/img/182/2959/640/transpose_relative_values.jpg'><img border='0' style='border:1px solid #000000; margin:2px' src='http://photos1.blogger.com/img/182/2959/320/transpose_relative_values.jpg'></a><br />Transpose-relative values <a href='http://www.hello.com/' target='ext'><img src='http://photos1.blogger.com/pbh.gif' alt='Posted by Hello' border='0' style='border:0px;padding:0px;background:transparent;' align='absmiddle'></a><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111090851108194948?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1110908470037381852005-03-15T09:41:00.000-08:002005-03-15T09:41:10.036-08:00<a href='http://photos1.blogger.com/img/182/2959/640/transpose_relative_formulas.jpg'><img border='0' style='border:1px solid #000000; margin:2px' src='http://photos1.blogger.com/img/182/2959/320/transpose_relative_formulas.jpg'></a><br />Transpose-relative formulas <a href='http://www.hello.com/' target='ext'><img src='http://photos1.blogger.com/pbh.gif' alt='Posted by Hello' border='0' style='border:0px;padding:0px;background:transparent;' align='absmiddle'></a><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111090847003738185?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1110906895528857392005-03-15T09:03:00.000-08:002005-03-15T09:14:55.530-08:00Transpose-relative Cell References for Pairwise ComparisonsI've <a href="http://tinyurl.com/3po6y">proposed </a> to Microsoft a new modifier for cell references. In addition to relative references and absolute references, this modifier (for which I'm suggesting the percent symbol, but any symbol will do) would transpose the reference: if applied to the column, it would advance the column based on the <em>row</em> of the source cell; if applied to the row, it would advance based on the source's <em>column</em>.<br /><br />With this formula in B1:<br /><strong>=$A1*$A%1</strong><br /><br />filled into C1 and B2, you get:<br /><strong>=$A1*$A%2</strong> (C1)<br /><strong>=$A2*$A%1</strong> (B2)<br /><br />My desire for this stems from wanting to do a lot of pairwise comparisons, and wanting to do it without fancy formulas using TRANSPOSE() or (as I've always done) copy-paste-special-transposing the source data column into a row above the table.<br /><br />I have implemented this in my own spreadsheet, and I like how it works.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111090689552885739?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1110906048186870522005-03-15T08:54:00.000-08:002005-03-15T09:00:48.190-08:00Spreadsheet Cut & CopyI'm currently writing a spreadsheet, and a couple of weeks ago I got around to implementing Copy & Paste, then Cut.<br /><br />I was surprised by how different Cut was from Copy; I had thought it would be a simple combination of Copy and Delete. I was wrong; I now understand why Excel's clipboard is so nonstandard, relative to non-spreadsheet applications where Cut is just Copy & Delete.<br /><br />First off, because it changes the document, Cut should itself be undoable, although Copy isn't. I guess this is also true in non-spreadsheet applications.<br /><br />Links into the clip region (including both relative and absolute links) from outside are unaffected in a Copy's Paste, but are updated in a Cut's, because it is really a Move operation.<br /><br />This means, too, that a Cut-Paste is a one-shot deal; when it's done the clipboard is empty, although a Copy-Paste can be repeated <em>ad infinitum</em>.<br /><br />When pasting a single cell, Copy-Paste allows pasting into multiple cells, but Cut-Paste does not; this is an extension to the one-shot rule.<br /><br />Relative links from the clip region to outside are altered to fit the new location in the case of Copy-Paste, but left alone for Cut-Paste.<br /><br />All internal links are updated in a Cut-Paste, but only relative internal links are updated in a Copy-Paste.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111090604818687052?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0tag:blogger.com,1999:blog-11467447.post-1110905613238884342005-03-15T08:49:00.000-08:002005-03-15T08:53:33.240-08:00WelcomeHere's my third attempt at a blog; this time I'm not confining it to <a href="http://onlysyntax.blogspot.com">just programming</a> or <a href="http://carldefeatsbush.blogspot.com">just politics</a>. Whatever strikes my fancy. Enjoy.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11467447-111090561323888434?l=undisclosed-recipients.blogspot.com'/></div>Carlhttp://www.blogger.com/profile/06745593015566949390noreply@blogger.com0