<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Technology Musings</title>
    <link>http://www.bartlettpublishing.com/site/bartpub/blog/3</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>Comparing Research vs Practical Languages</title>
      <description>&lt;p&gt;I recently ran across this &lt;a href=&quot;http://adam.chlipala.net/mlcomp/&quot; target=&quot;_blank&quot;&gt;excellent comparison between Standard ML and Objective Caml&lt;/a&gt;.&amp;nbsp; It is good, because it describes the different types of choices that are often made between languages used for research and those used for practical projects.&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Tue, 13 Jul 2010 15:30:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/301</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/301</guid>
    </item>
    <item>
      <title>Cross-browser DIV Rotation by arbitrary degrees in CSS and/or javascript</title>
      <description>&lt;p&gt;I've spent most of the day on this, so I thought I would share. &amp;nbsp;Most people don't know this, but CSS3 has some *really* cool stuff coming - auto-rounded corners, gradients, and.... DIV rotations! &amp;nbsp;Unfortunately, it will be about 5 years before any of this becomes mainstream. &amp;nbsp;IE8 only has the very beginnings of CSS3 support.&lt;/p&gt;
&lt;p&gt;So is there any way to get this on current browsers? &amp;nbsp;Yes! &amp;nbsp;The fine folks at &lt;a href=&quot;http://www.css3please.com/&quot;&gt;CSS3Please.com&lt;/a&gt; have given us a way to do some of these cool effects using existing CSS. &amp;nbsp;If you just want, just go their, edit the stylesheet on the web page (yes! it is editable!), and copy/paste the resulting CSS into your CSS file.&lt;/p&gt;
&lt;p&gt;But what if you want dynamic rotation? &amp;nbsp;Well, I looked at the CSS3Please source code, and figured out how it was all being calculated. &amp;nbsp;The IE6, IE7, and IE8 part is the worst, because it relies on a DirectX Matrix transform operation (isn't Internet Explorer always fun to work with?). &amp;nbsp;Not superfun, but do-able. &amp;nbsp;However, to get this calculated, we will need a Matrix library. &amp;nbsp;So, first, download and install the&amp;nbsp;&lt;a href=&quot;http://sylvester.jcoglan.com/&quot; target=&quot;_blank&quot;&gt;sylvester&lt;/a&gt;&amp;nbsp;javascript library. &amp;nbsp;Then, put this javascript into your page:&lt;/p&gt;
&lt;pre&gt;&amp;lt;script src=&quot;sylvester.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
function degreesToRadians(num) {
&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;return (num) * Math.PI / 180;
}
function createIEMatrixString(M) {
	return 'M11=' + M.e(1, 1) + ', M12=' + M.e(1,2) + ', M21=' + M.e(2,1) + ', M22=' + M.e(2,2);
}
function rotateElement(e, deg) {
	deg_str = deg + &quot;&quot;;
	rotate_transform = &quot;rotate(&quot; + deg + &quot;deg)&quot;;
	matrix_str = createIEMatrixString(Matrix.Rotation(degreesToRadians(deg)));
	filter_str = &quot;progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand', &quot; + matrix_str + &quot;)&quot;;

	e.style[&quot;rotation&quot;] = deg_str + &quot;deg&quot;; // CSS3
	e.style.MozTransform = rotate_transform; // Moz
	e.style.OTransform = rotate_transform; // Opera
	e.style.WebkitTransform = rotate_transform; // Webkit/Safari/Chrome
	e.style.filter = filter_str; // IE 6/7
	e.style.MsFilter = filter_str; // IE 8
	e.style[&quot;zoom&quot;] = &quot;1&quot;; // ??? Probably IEs
}
&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;p&gt;Now, you can just do:&lt;/p&gt;
&lt;pre&gt;rotateElement(document.getElementById(&quot;whatever&quot;), 20);&lt;/pre&gt;
&lt;p&gt;And that will rotate the element. &amp;nbsp;Note that this *sets* the rotation, so if I do this several times it will only keep the rotation at what I set it to, it won't keep on adding rotations.&lt;/p&gt;
&lt;p&gt;Anyway, a little bit of work, a little bit of code for your client to download, but it works.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPDATE - &lt;/strong&gt;just found &lt;a href=&quot;http://code.google.com/p/jquery-rotate/&quot; target=&quot;_blank&quot;&gt;this jquery plugin&lt;/a&gt; that *might* do something similar, but haven't looked at it closely yet.&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Thu, 10 Jun 2010 20:49:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/292</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/292</guid>
    </item>
    <item>
      <title>An Index to My Old IBM DeveloperWorks Papers</title>
      <description>&lt;p&gt;I often have to refer people to my old IBM DeveloperWorks papers, but it always takes so long to find them. &amp;nbsp;Therefore, I am going to post links to them all here to make them easier for me (and you) to find. &amp;nbsp;The dates were pulled from the IBM site, and some of them seem incoherent. &amp;nbsp;If I find the true release dates of the papers I'll put them in later.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Series 1: Theoretical Computer Science for Practical Computer Programmers&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In this series, I introduced a lot of material that is usually only studied in theoretical computer science, and showed how it could be useful for practical programming:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-memory/&quot; target=&quot;_blank&quot;&gt;Inside Memory Management&lt;/a&gt;&amp;nbsp;(2004/11/16) - a look at a variety of ways that memory is managed in different systems. &amp;nbsp;Includes a functional memory manager (malloc/free implementation) written in C. &amp;nbsp;Covers manual memory management, reference counting systems, pooled allocation systems, and garbage collection. &amp;nbsp;Sadly, I was not aware of Apple's combination of reference counting and autorelease pools at the time I wrote this.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-listproc/&quot; target=&quot;_blank&quot;&gt;Better Programming Through Effective List Handling&lt;/a&gt;&amp;nbsp;(2005/01/05) - this is an introduction to how linked lists work, why they are so useful for a variety of tasks, and how languages such as Scheme take advantage of them in interesting ways. &amp;nbsp;Starts in C, and includes a simple introduction to Scheme.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-highfunc.html&quot; target=&quot;_blank&quot;&gt;Higher Order Functions&lt;/a&gt; (2005/03/31) - Discusses how higher-order functions (functions that take a function as a parameter and/or functions that return a new function as a result) work and how they can be used to good benefit in programming. &amp;nbsp;Also discusses the relative equivalence of closures and objects, and when to use each one. &amp;nbsp;It begins using scheme, and then shows how to use everything in C.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-recurs.html&quot; target=&quot;_blank&quot;&gt;Mastering Recursive Programming&lt;/a&gt;&amp;nbsp;(2005/6/16) - this is an introduction to all of the fun associated with recursive programming. &amp;nbsp;It starts with a simple introduction to recursion, and moves on to how&amp;nbsp;recursion can be used to write programs that are provably correct, how (and why) to convert loops to recursion, how tail-calls work, and how tail-calls are implemented in assembly language.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-advflow.html&quot; target=&quot;_blank&quot;&gt;Continuations and Advanced Flow Control&lt;/a&gt; (2006/05/24) - continuations are an amazing, generalized flow-control construct from which you can implement just about any other flow control you want (threading, throw/catch, generators, and prolog-style backtracking computations). &amp;nbsp;The paper gives an introduction to a variety of flow-control structures (with various examples in Python, Prolog, and Java), and then shows how each one can be implemented using Scheme's continuation constructs. &amp;nbsp;Probably needed more explanation on the backtrack stuff - it's pretty amazing, but quite a bit different from the way we normally think about computation.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-lazyprog.html&quot; target=&quot;_blank&quot;&gt;Lazy Programming and Lazy Evaluation&lt;/a&gt;&amp;nbsp;(2006/12/18) - this is an introduction to delayed evaluation, how it is implemented, and how it can be used practically. &amp;nbsp;Shows how to use lazy evaluation to make use of infinite lists. &amp;nbsp;Examples are in Scheme and Java.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Series 2: Metaprogramming&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Metaprogramming is one of my favorite subjects. &amp;nbsp;In this series I give an introduction to several kinds of metaprogramming and how they are done. &amp;nbsp;I wish I knew ruby when I wrote these, as Ruby's metaprogramming system is just awesome!&lt;/p&gt;
&lt;p&gt;&lt;ol&gt;
&lt;li&gt;I&lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-metaprog1.html&quot; target=&quot;_blank&quot;&gt;ntroduction to Metaprogramming&lt;/a&gt; (2005/10/20) - describes several metaprogramming systems, including CPP, M4, and Embedded SQL. &amp;nbsp;Then shows how and why you might want to build your own metaprogramming system. &amp;nbsp;Then I introduce Scheme's macro system, and how to do many of the same things that were in the other metaprogramming systems.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-metaprog2.html&quot; target=&quot;_blank&quot;&gt;Metaprogramming Using Scheme&lt;/a&gt; (2006/05/02) - goes in-depth on how to write metaprogramming systems with Scheme, and then shows how this creates a super-easy way to make domain-specific languages. &amp;nbsp;(Most DSLs are better done as metaprogramming systems for more general-purpose languages IMHO). &amp;nbsp;Compares the flexibility of a Scheme-based DSL to XML-based configuration languages.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-metaprog3/&quot; target=&quot;_blank&quot;&gt;Enterprise Metaprogramming&lt;/a&gt; (2006/02/28) - describes the computational equivalence between graphical and textual metaprogramming systems, and why each one would be useful in different circumstances. &amp;nbsp;It also shows how that even with the advance in ease of use of computer programming languages, there will always be a split between the roles of a domain expert and a programmer - no tool can bridge the gap. &amp;nbsp;It then describes the Model-Driven Architecture (MDA), and how it can be used to extend the concept of metaprogramming further. &amp;nbsp;An example MDA application is given in Scheme, which produces both a set of C++ structs and corresponding SQL data definition statements from a single diagram built by the Dia program.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Assembly Language for the Power Architecture Series&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When I got a PowerPC Mac I wanted to learn PowerPC assembly language, but didn't have time. &amp;nbsp;I thought, &quot;hey, if I can convince IBM to pay me to write about it, that would give me a good excuse to learn it&quot;. &amp;nbsp;That birthed this article series:&lt;/p&gt;
&lt;p&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/library/l-powasm1.html&quot; target=&quot;_blank&quot;&gt;Programming Concepts and Beginning PowerPC Instructions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/library/l-powasm2.html&quot; target=&quot;_blank&quot;&gt;The Art of Loading and Storing on PowerPC&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/linux/library/l-powasm3.html&quot; target=&quot;_blank&quot;&gt;Programming with the PowerPC Branch Processor&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/power/library/l-powasm4.html&quot; target=&quot;_blank&quot;&gt;Function Calls and the PowerPC 64-bit ABI&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;PlayStation 3 Programming with the Cell Broadband Engine&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;IBM's Cell processor (called the Cell Broadband Engine) was the driving force behind the PS3. &amp;nbsp;It had a main processor and eight vector processors (each vector processor was a full-blown processor, though very limited). &amp;nbsp;Given the right workload, and the processor would scream. &amp;nbsp;However, if it wasn't programmed carefully, it would actually be &lt;em&gt;slower&lt;/em&gt;&amp;nbsp;than most other processors. &amp;nbsp;This is especially difficult because the vector processors actually used a different assembly language with a different memory model than the main processor. &amp;nbsp;This series walks a programmer through everything they need to know, from installing Linux on their PS3 to writing, complling, and linking their code.&lt;/p&gt;
&lt;p&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/power/library/pa-linuxps3-1/index.html&quot; target=&quot;_blank&quot;&gt;An Introduction to Linux on the PS3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/power/library/pa-linuxps3-2/index.html&quot; target=&quot;_blank&quot;&gt;Programming the Synergistic Processing Elements of the PS3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/power/library/pa-linuxps3-3/index.html&quot; target=&quot;_blank&quot;&gt;Meet the Synergistic Processing Element&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/power/library/pa-linuxps3-4/index.html&quot; target=&quot;_blank&quot;&gt;Program the SPU for Performance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/power/library/pa-linuxps3-5/index.html&quot; target=&quot;_blank&quot;&gt;Programming the SPU in C/C++&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/library/pa-specode1/&quot; target=&quot;_blank&quot;&gt;How to Make SPE and Existing Code Work Together&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/library/pa-specode2/&quot; target=&quot;_blank&quot;&gt;Removing Obstacles to Speedy Performance&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;There was supposed to be a final paper where I applied everything to a scientific application, but I got worn out by the end and just had to stop.&lt;/p&gt;
&lt;/p&gt;
&lt;/p&gt;
&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Tue, 08 Jun 2010 03:53:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/291</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/291</guid>
    </item>
    <item>
      <title>A Simple HTML Geolocation Map with Twitter and Google Maps</title>
      <description>&lt;p&gt;New Medio just released &amp;lt;a href=&quot;http://www.newmedio.com/site/postings/17?section_id=2&quot;&amp;gt;a cool new tool to do geolocation/geotagging maps of Twitter posts&amp;lt;/a&amp;gt;. &amp;nbsp;Can be used HTML-only (no Javascript coding required!) or with a Rails plugin.&amp;nbsp;&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Wed, 26 May 2010 04:40:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/285</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/285</guid>
    </item>
    <item>
      <title>Facebook FBJS problems on FireFox</title>
      <description>&lt;p&gt;I've been banging my head against a wall for the past day trying to figure out various FBJS problems in facebook.&amp;nbsp; Turns out the problem was..... FireBug!&amp;nbsp; By simply turning Firebug off, (most of) my problems went away.&amp;nbsp; I have no idea what the issue is, but it took me forever to realize it because I always have FireBug on, and don't even realize it is there.&amp;nbsp; It's never been a problem before.&amp;nbsp; But, I noticed that one of my coworkers was using my app, &lt;em&gt;with Firefox&lt;/em&gt;, with no problem, and I quickly realized that the problem was with FireBug.&lt;/p&gt;
&lt;p&gt;There's still &lt;a href=&quot;http://bugs.developers.facebook.com/show_bug.cgi?id=9088&quot; target=&quot;_blank&quot;&gt;another issue with fb:js-string on profile widgets&lt;/a&gt; that's killing me, but hopefully that will be resolved soon.&amp;nbsp; I &lt;em&gt;_think_&lt;/em&gt; they changed how they were evaluating profile javascript, to make it more secure - but in doing so made all references to the variable created by fb:js-string out-of-scope.&amp;nbsp; Developing javascripty apps for facebook is truly painful.&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Wed, 10 Mar 2010 17:12:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/272</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/272</guid>
    </item>
    <item>
      <title>IE6 Retiring Soon!</title>
      <description>&lt;p&gt;Looking at their lifecycle page, it looks like Microsoft &lt;a href=&quot;http://support.microsoft.com/gp/lifesupsps/#Internet_Explorer&quot; target=&quot;_blank&quot;&gt;will be retiring IE 6 this year&lt;/a&gt;!&amp;nbsp; For anyone who works in IT, this is certainly a cause for celebration.&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Wed, 27 Jan 2010 23:09:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/255</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/255</guid>
    </item>
    <item>
      <title>Forcing HTTP Basic Authentication on the iPhone</title>
      <description>&lt;p&gt;Here's my setup.&amp;nbsp; I have a RESTful Rails app.&amp;nbsp; Going to http://whatever.com/contacts gives the search screen for the contacts.&amp;nbsp; Going to http://whatever.com/contacts.xml gives the full list of contacts as an XML file.&amp;nbsp; For normal users, I use cookie-based authentication.&amp;nbsp; However, I also allow, for API users, HTTP basic authentication.&amp;nbsp; There is no access difference between the two.&amp;nbsp; However, this is a problem for the iPhone, because, although NSURL supports usernames and passwords, it will not present them for authentication without being challenged!&amp;nbsp; This is somewhat understandable because it doesn't know what authentication mechanism is being used (basic or digest).&amp;nbsp; However, it is EXTREMELY annoying to program for.&lt;/p&gt;
&lt;p&gt;So, after spending about 2 hours digging through stuff, here is what I found out.&lt;/p&gt;
&lt;p&gt;First of all, Basic authentication relies upon Base64 encoding, which isn't available on the iPhone.&amp;nbsp; Thankfully, someone posted public-domain Objective-C iPhone code for this &lt;a href=&quot;http://www.cocoadev.com/index.pl?BaseSixtyFour&quot;&gt;here&lt;/a&gt; and someone else gave an almost-working-but-not-quite version of the request code &lt;a href=&quot;http://stackoverflow.com/questions/1898072/nsurl-authentication-when-server-does-not-present-a-challenge/1898221#1898221&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&amp;nbsp; The Base64 code left out some things (like the class wrapper and header file), and the request code assumed a Base64 method existed which didn't.&amp;nbsp; In any case, here is the Base64 header file, Base64.h:&lt;/p&gt;
&lt;pre&gt;#import &amp;lt;Foundation/Foundation.h&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;@interface Base64 : NSObject {&lt;br /&gt;}&lt;br /&gt;+ (void) initialize;&lt;br /&gt;+ (NSString*) encode:(const uint8_t*) input length:(NSInteger) length;&lt;br /&gt;+ (NSString*) encode:(NSData*) rawBytes;&lt;br /&gt;+ (NSData*) decode:(const char*) string length:(NSInteger) inputLength;&lt;br /&gt;+ (NSData*) decode:(NSString*) string;&lt;br /&gt;&lt;br /&gt;@end&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Here is the body of the code, Base64.m:&lt;/p&gt;
&lt;pre&gt;#import &quot;Base64.h&quot;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;@implementation Base64&lt;br /&gt;&lt;br /&gt;/* Copied from http://www.cocoadev.com/index.pl?BaseSixtyFour (cyrus.najmabadi@gmail.com) */&lt;br /&gt;&lt;br /&gt;#define ArrayLength(x) (sizeof(x)/sizeof(*(x)))&lt;br /&gt;&lt;br /&gt;static char encodingTable[] = &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/&quot;;&lt;br /&gt;static char decodingTable[128];&lt;br /&gt;&lt;br /&gt;+ (void) initialize {&lt;br /&gt;	if (self == [Base64 class]) {&lt;br /&gt;		memset(decodingTable, 0, ArrayLength(decodingTable));&lt;br /&gt;		for (NSInteger i = 0; i &amp;lt; ArrayLength(encodingTable); i++) {&lt;br /&gt;			decodingTable[encodingTable[i]] = i;&lt;br /&gt;		}&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;+ (NSString*) encode:(const uint8_t*) input length:(NSInteger) length {&lt;br /&gt;    NSMutableData* data = [NSMutableData dataWithLength:((length + 2) / 3) * 4];&lt;br /&gt;    uint8_t* output = (uint8_t*)data.mutableBytes;&lt;br /&gt;	&lt;br /&gt;    for (NSInteger i = 0; i &amp;lt; length; i += 3) {&lt;br /&gt;        NSInteger value = 0;&lt;br /&gt;        for (NSInteger j = i; j &amp;lt; (i + 3); j++) {&lt;br /&gt;            value &amp;lt;&amp;lt;= 8;&lt;br /&gt;			&lt;br /&gt;            if (j &amp;lt; length) {&lt;br /&gt;                value |= (0xFF &amp;amp; input[j]);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;		&lt;br /&gt;        NSInteger index = (i / 3) * 4;&lt;br /&gt;        output[index + 0] =                    encodingTable[(value &amp;gt;&amp;gt; 18) &amp;amp; 0x3F];&lt;br /&gt;        output[index + 1] =                    encodingTable[(value &amp;gt;&amp;gt; 12) &amp;amp; 0x3F];&lt;br /&gt;        output[index + 2] = (i + 1) &amp;lt; length ? encodingTable[(value &amp;gt;&amp;gt; 6)  &amp;amp; 0x3F] : '=';&lt;br /&gt;        output[index + 3] = (i + 2) &amp;lt; length ? encodingTable[(value &amp;gt;&amp;gt; 0)  &amp;amp; 0x3F] : '=';&lt;br /&gt;    }&lt;br /&gt;	&lt;br /&gt;    return [[[NSString alloc] initWithData:data&lt;br /&gt;                                  encoding:NSASCIIStringEncoding] autorelease];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;+ (NSString*) encode:(NSData*) rawBytes {&lt;br /&gt;    return [self encode:(const uint8_t*) rawBytes.bytes length:rawBytes.length];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;+ (NSData*) decode:(const char*) string length:(NSInteger) inputLength {&lt;br /&gt;	if ((string == NULL) || (inputLength % 4 != 0)) {&lt;br /&gt;		return nil;&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	while (inputLength &amp;gt; 0 &amp;amp;&amp;amp; string[inputLength - 1] == '=') {&lt;br /&gt;		inputLength--;&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	NSInteger outputLength = inputLength * 3 / 4;&lt;br /&gt;	NSMutableData* data = [NSMutableData dataWithLength:outputLength];&lt;br /&gt;	uint8_t* output = data.mutableBytes;&lt;br /&gt;	&lt;br /&gt;	NSInteger inputPoint = 0;&lt;br /&gt;	NSInteger outputPoint = 0;&lt;br /&gt;	while (inputPoint &amp;lt; inputLength) {&lt;br /&gt;		char i0 = string[inputPoint++];&lt;br /&gt;		char i1 = string[inputPoint++];&lt;br /&gt;		char i2 = inputPoint &amp;lt; inputLength ? string[inputPoint++] : 'A'; /* 'A' will decode to \0 */&lt;br /&gt;		char i3 = inputPoint &amp;lt; inputLength ? string[inputPoint++] : 'A';&lt;br /&gt;		&lt;br /&gt;		output[outputPoint++] = (decodingTable[i0] &amp;lt;&amp;lt; 2) | (decodingTable[i1] &amp;gt;&amp;gt; 4);&lt;br /&gt;		if (outputPoint &amp;lt; outputLength) {&lt;br /&gt;			output[outputPoint++] = ((decodingTable[i1] &amp;amp; 0xf) &amp;lt;&amp;lt; 4) | (decodingTable[i2] &amp;gt;&amp;gt; 2);&lt;br /&gt;		}&lt;br /&gt;		if (outputPoint &amp;lt; outputLength) {&lt;br /&gt;			output[outputPoint++] = ((decodingTable[i2] &amp;amp; 0x3) &amp;lt;&amp;lt; 6) | decodingTable[i3];&lt;br /&gt;		}&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	return data;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;+ (NSData*) decode:(NSString*) string {&lt;br /&gt;	return [self decode:[string cStringUsingEncoding:NSASCIIStringEncoding] length:string.length];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;@end&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Okay, so now how do we make the request?&amp;nbsp; It's pretty evil, but if you wrap it in a function it's not too bad.&amp;nbsp; Don't forget to import Base64.h!&amp;nbsp; Anyway, here is the code:&lt;/p&gt;
&lt;pre&gt;+ (NSData *) loadDataFromURLForcingBasicAuth:(NSURL *url) {&lt;br /&gt;	NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];&lt;br /&gt;	NSString *authString = [Base64 encode:[[NSString stringWithFormat:@&quot;%@:%@&quot;,[url user], [url password]] dataUsingEncoding:NSUTF8StringEncoding]]; &lt;br /&gt;	[request setValue:[NSString stringWithFormat:@&quot;Basic %@&quot;, authString] forHTTPHeaderField:@&quot;Authorization&quot;];&lt;br /&gt;	return [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Ugly, ain't it?&amp;nbsp; You can use this with asynchronous connections as well, or extend it to handle the responses/errors from sendSynchronchronousRequest, but that is an exercise for the reader.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Sat, 16 Jan 2010 18:36:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/248</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/248</guid>
    </item>
    <item>
      <title>Debugging EXC_BAD_ACCESS on the iPhone</title>
      <description>&lt;p&gt;I've been working on my first real iPhone app.&amp;nbsp; It's a very interesting way of coding.&amp;nbsp; Objective-C is an interesting language.&amp;nbsp; It seems to shoot for the middle ground between something out-of-control like C++, and something so-object-oriented-it-hurts like Java.&amp;nbsp; Personally, I like Ruby best, but that's neither here nor there.&lt;/p&gt;
&lt;p&gt;Memory management on the iPhone is a tough cookie for someone who has not done Objective-C development before.&amp;nbsp; If you are new to the iPhone, the first thing you should do is read the &lt;a href=&quot;http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html&quot; target=&quot;_blank&quot;&gt;memory management contract for Cocoa&lt;/a&gt;, as well as the links that link out from there.&lt;/p&gt;
&lt;p&gt;I was having a problem getting EXC_BAD_ACCESS.&amp;nbsp; I finally used breakpoints to find where the problem was occurring, and it was an NSArray that was causing it.&lt;/p&gt;
&lt;p&gt;I did a google search, and found &lt;a href=&quot;http://www.codza.com/how-to-debug-exc_bad_access-on-iphone&quot; target=&quot;_blank&quot;&gt;this really cool method for getting a little more information about objects which have been released before they were accessed&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Eventually, I found out that the problem came from the fact that [NSArray arrayWithObjects:], because it doesn't have &quot;init&quot; or &quot;copy&quot; or &quot;alloc&quot; in the message name for object creation, autoreleases the object when it gives it to me!&amp;nbsp; Therefore, as soon as the present event was done, it trashed the object.&amp;nbsp; If you want to keep an object that has been autoreleased, you have to send it a retain message.&lt;/p&gt;
&lt;p&gt;Doing the retain fixed my problem.&amp;nbsp; Yay!&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Wed, 11 Nov 2009 16:04:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/230</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/230</guid>
    </item>
    <item>
      <title>Laps for Little Ones</title>
      <description>&lt;p&gt;&lt;a href=&quot;http://littlelighthouse.donordepot.com/civicrm/contribute/pcp/info?reset=1&amp;amp;id=116&quot;&gt;Support the Little Light House by sponsoring us in Laps for Little Ones&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The Little Light House is one of the best ministries I've ever been involved with.&amp;nbsp; They are a Christian, private, &lt;strong&gt;&lt;span style=&quot;text-decoration: underline;&quot;&gt;tuition-free&lt;/span&gt;&lt;/strong&gt; school for special-needs kids.&amp;nbsp; That's right, the kids who go there don't have to pay anything at all.&lt;/p&gt;
&lt;p&gt;This isn't day-care - it's an intensive, customized program for each child.&amp;nbsp; The school day lets out at 1PM, and the staff spends the rest of the day planning each child's next day.&amp;nbsp; When a child gets to school, they have a card of things that they are going to work on that day.&amp;nbsp; It's both extremely fun and extremely helpful for the children -- and the parents.&lt;/p&gt;
&lt;p&gt;While our oldest son, Danny, was alive, he attended the Little Light House.&amp;nbsp; His world expanded so much while he was there.&amp;nbsp; His ability to play with others and interact and do new things hinged upon the teachers at the Little Light House and their love and their help.&amp;nbsp; Danny had to be fed through a tube, received many, many, many medications at specially-timed intervals, and, if everyone was lucky, he only threw up three times a day.&amp;nbsp; Yet the Little Light House had no problems seeing to his every need while he was there, and providing every manner of therapy.&amp;nbsp; At the Little Light House, they have physical therapy, speech therapy, occupational therapy, and probably a lot of other therapies I'm not so familiar with.&amp;nbsp; And everything is done in a specifically Christian way.&lt;/p&gt;
&lt;p&gt;Isaac had the same genetic defect that Danny had, and, had he lived long enough, would have enjoyed the services of the Little Light House as well.&amp;nbsp; As soon as we discovered his condition, we reserved him a spot there, because we knew that their help was the difference between night and day for us.&lt;/p&gt;
&lt;p&gt;Below are pictures of Danny learning at the Little Light House.&amp;nbsp; Also, for those of you who didn't get to know Danny or Isaac, I pasted their memorial videos below.&amp;nbsp; In any case, please consider &lt;a href=&quot;http://littlelighthouse.donordepot.com/civicrm/contribute/pcp/info?reset=1&amp;amp;id=116&quot;&gt;helping out the Little Light House&lt;/a&gt; - they have been a huge blessing to us, and to many, many, many other children.&lt;/p&gt;
&lt;p&gt;You can donate now by going &lt;a href=&quot;http://littlelighthouse.donordepot.com/civicrm/contribute/pcp/info?reset=1&amp;amp;id=116&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here is Danny's Memorial Video:&lt;/p&gt;
&lt;p&gt;
&lt;object classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; width=&quot;425&quot; height=&quot;344&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&quot;&gt;
&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;
&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot; /&gt;
&lt;param name=&quot;src&quot; value=&quot;http://www.youtube.com/v/2QO1zxseI2s&amp;amp;hl=en&amp;amp;fs=1&amp;amp;rel=0&quot; /&gt;&lt;embed type=&quot;application/x-shockwave-flash&quot; width=&quot;425&quot; height=&quot;344&quot; src=&quot;http://www.youtube.com/v/2QO1zxseI2s&amp;amp;hl=en&amp;amp;fs=1&amp;amp;rel=0&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot;&gt;&lt;/embed&gt;
&lt;/object&gt;
&lt;/p&gt;
&lt;p&gt;Isaac's Memorial Video:&lt;/p&gt;
&lt;p&gt;
&lt;object classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; width=&quot;425&quot; height=&quot;344&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&quot;&gt;
&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;
&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot; /&gt;
&lt;param name=&quot;src&quot; value=&quot;http://www.youtube.com/v/e4TGmFwb3dQ&amp;amp;hl=en&amp;amp;fs=1&amp;amp;rel=0&quot; /&gt;&lt;embed type=&quot;application/x-shockwave-flash&quot; width=&quot;425&quot; height=&quot;344&quot; src=&quot;http://www.youtube.com/v/e4TGmFwb3dQ&amp;amp;hl=en&amp;amp;fs=1&amp;amp;rel=0&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot;&gt;&lt;/embed&gt;
&lt;/object&gt;
&lt;/p&gt;
&lt;p&gt;A few pictures of Danny at the Little Light House if you don't have time for the video:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/site/bartpub/download/12?disposition=inline&quot; alt=&quot;&quot; width=&quot;309&quot; height=&quot;191&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/site/bartpub/download/13?disposition=inline&quot; alt=&quot;&quot; width=&quot;317&quot; height=&quot;239&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The picture below might look like playtime to you, but this was actually crucial for Danny.&amp;nbsp; He had problems touching a variety of surfaces - many different textures made him cry and gag and puke (yes, really).&amp;nbsp; The Little Light House worked with him to help him adjust his senses to be able to touch and play with a huge variety of textures.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/site/bartpub/download/14?disposition=inline&quot; alt=&quot;&quot; width=&quot;319&quot; height=&quot;193&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/site/bartpub/download/15?disposition=inline&quot; alt=&quot;&quot; width=&quot;318&quot; height=&quot;208&quot; /&gt;&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Tue, 06 Oct 2009 04:29:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/220</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/220</guid>
    </item>
    <item>
      <title>Migrating to Phusion Passenger</title>
      <description>&lt;p&gt;Spent the evening migrating one of my Ruby on Rails servers to Phusion Passenger. &amp;nbsp;It was a nice upgrade, but not the trouble-free upgrade they promise. &amp;nbsp;Here were the gotchas that I ran into:&lt;/p&gt;
&lt;p&gt;&lt;ol&gt;
&lt;li&gt;Remember to install all of the gems into your new enterprise ruby that were on your regular ruby. &amp;nbsp;This one is pretty obvious, but its easy to miss some&lt;/li&gt;
&lt;li&gt;Passenger preloads your application. &amp;nbsp;This means that if there were models that you never used (and thus never got loaded into Rails before), Passenger will load them for you, and if they are broken, your app will not start. &amp;nbsp;This also affected gem loading, as there was one gem which was loaded by a file that was unused, and therefore I didn't have it installed. &amp;nbsp;But Passenger required that I install the gem.&lt;/li&gt;
&lt;li&gt;Passenger basically works by default as a SetUID program. &amp;nbsp;It looks like whatever user owns the application is the user that Passenger will run it as. &amp;nbsp;This can cause all sorts of problems. &amp;nbsp;It can cause problems accessing log files and session files. &amp;nbsp;When I finally got my gem issues sorted out, I kept getting 500 errors and I found the following in my log file:&amp;nbsp;file /tmp/ruby_sess.97c076be86e7dd90 not readable - This was because it was running as my development user rather than as Apache. &amp;nbsp;I had to use BOTH of the directives &quot;PassengerUserSwitching off&quot; and &quot;PassengerDefaultUser apache&quot; to get it to work. &amp;nbsp;&lt;/li&gt;
&lt;li&gt;Then I had to find and fix all of the badly-created permissions that had accrued while it was running as the wrong user&lt;br /&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;If I have any additional problems, I'll post them here.&lt;/div&gt;
&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Sun, 05 Jul 2009 07:31:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/208</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/208</guid>
    </item>
    <item>
      <title>What's Taking So Long?</title>
      <description>&lt;p&gt;There are a lot of performance analysis tools for Rails logs. &amp;nbsp;However, sometimes you just need something quick and dirty. &amp;nbsp;This one helped me out. &amp;nbsp;1-line perl script to show all Rails log lines which took more that 100milliseconds to produce:&lt;/p&gt;
&lt;pre&gt;perl -n -e 'print if(m/\((\d+\.\d+)ms\)/ &amp;amp;&amp;amp; $1 &amp;gt; 100);' log/development.log&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt; - Here's another handy one:&lt;/p&gt;
&lt;pre&gt; tail -20000 log/production.log|grep 'Completed in'|cut -d&quot; &quot; -f3,11|sort -n&lt;br /&gt;&lt;/pre&gt;</description>
      <author>JB</author>
      <pubDate>Fri, 26 Jun 2009 23:41:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/207</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/207</guid>
    </item>
    <item>
      <title>Risk Management Fail</title>
      <description>&lt;p&gt;From &lt;a href=&quot;http://failblog.org/2009/05/29/risk-management-fail/&quot; target=&quot;_blank&quot;&gt;failblog&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img class=&quot;alignnone size-full wp-image-18764&quot; title=&quot;fail-owned-risk-mgmt-fail&quot; src=&quot;http://failblog.files.wordpress.com/2009/05/fail-owned-risk-mgmt-fail.jpg?w=500&amp;amp;h=318&quot; alt=&quot;fail owned pwned pictures&quot; width=&quot;500&quot; height=&quot;318&quot; /&gt;&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Mon, 01 Jun 2009 02:29:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/204</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/204</guid>
    </item>
    <item>
      <title>FTP Problems with Extended Passive Mode (EPSV)</title>
      <description>&lt;p&gt;I just went through many hours of trying to figure out wierd FTP problems. &amp;nbsp;It looks like Peer1 has a weird firewall which gets confused on EPSV FTP connections. &amp;nbsp;The way that the problem presented was that after login, when the FTP client attempted a directory listing (or any other command), after giving the EPSV command it would just hang.&lt;/p&gt;
&lt;p&gt;For those who don't know, EPSV is &quot;extended passive mode&quot;, and is a newer extension to FTP's historical passive mode (PASV), which is used to make FTP work in firewalled environments. &amp;nbsp;I really don't know much about EPSV beyond that, although I think it was developed for enhanced future compatibility with IPv6. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Anyway, the problem is that most recent FTP clients attempt EPSV first, and then only use the traditional PASV if it fails. &amp;nbsp;Also, most recent FTP servers support EPSV. &amp;nbsp;Therefore, even if the firewall is blocking EPSV, the client will think that the command is successful, because the server is trying to do it, not knowing that it is being blocked.&lt;/p&gt;
&lt;p&gt;I use vsftpd. &amp;nbsp;The only way I found to prevent EPSV mode is to use their command whitelisting feature, and whitelist everything except EPSV and EPRT (the extended version of the FTP PORT command). &amp;nbsp;So, here's what I added to my vsftpd.conf file, and it seems to work so far:&lt;/p&gt;
&lt;pre&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;c&lt;/span&gt;mds_allowed=ABOR,CWD,DELE,LIST,MDTM,MKD,NLST,PASS,PASV,PORT,PWD,QUIT,RETR,RMD,RNFR,RNTO,SITE,SIZE,STOR,TYPE,USER,CDUP,HELP,MODE,NOOP,STAT,STOU,STRU&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;So now when a client attempts an EPSV command, it will respond with &quot;550 Permission denied.&quot; and the client will usually fall back to regular PASV mode. &amp;nbsp;I wish I could have blacklisted the command rather than whitelisting all other commands, but oh well.&lt;/p&gt;
&lt;p&gt;If you have access to the client side of the connection, and don't/can't mess with the server side, you can usually turn off extended passive mode there as well. &amp;nbsp;With curl, you need to add --disable-epsv. &amp;nbsp;With regular ftp, you need to issue the command &quot;epsv4&quot; after connecting.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Mon, 18 May 2009 17:24:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/197</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/197</guid>
    </item>
    <item>
      <title>This Friday is the Geek Apocalypse</title>
      <description>&lt;p&gt;See &lt;a href=&quot;http://tech.slashdot.org/article.pl?sid=09/02/08/2043206&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&amp;nbsp; On Friday, UNIX time will reach 1234567890.&amp;nbsp; This is, like, the end of the world :)&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Tue, 10 Feb 2009 16:55:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/171</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/171</guid>
    </item>
    <item>
      <title>Historically Bad Ideas in Programming</title>
      <description>&lt;p&gt;The QCon developer's conference this year has an interesting track - &lt;a href=&quot;http://qconlondon.com/london-2009/tracks/show_track.jsp?trackOID=232&quot; target=&quot;_blank&quot;&gt;historically bad programming ideas&lt;/a&gt;.&amp;nbsp; However, I have to say that I'm actually a big fan of the null pointer, despite the issues that it gives some people.&amp;nbsp; The fact is, without null, nil, undefined, or 0 (depending on language), the actual task of programming would be much more difficulty.&amp;nbsp; And, I would argue, would cost more than the bug-savings that we would get from having non-null type systems.&amp;nbsp; In order to get around them you would have to write code that is more confusing and more time-consuming, and you might even wind up with the same set of bugs, just moved around slightly.&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Fri, 23 Jan 2009 06:38:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/162</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/162</guid>
    </item>
    <item>
      <title>I Dream of acts_as_tsearch2</title>
      <description>&lt;p&gt;Two plugins I would love to have for Ruby on Rails, and would love to build if I had the time:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;acts_as_tsearch2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This would be an ActiveRecord layer for integrating with PostgreSQL's tsearch2 full-text indexing.&amp;nbsp; Right now, I am not aware of a Rails plugin that does that.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;search_coalesce&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This would take the results of multiple paginated queries and combine them together.&amp;nbsp; For instance, right now I'm writing a program using acts_as_solr for searching.&amp;nbsp; However, I also need to refine the results using named_scopes, and some of the searches would most naturally fit into a named_scope.&amp;nbsp; Therefore, I would love to be able to take the results of each query and combine them together on the fly in a paginated way.&amp;nbsp; If this sounds impossible, I've already dreamed up a basic architecture.&amp;nbsp; Here's a hint - just make sure that all queries have the same sorting.&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Tue, 20 Jan 2009 05:52:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/160</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/160</guid>
    </item>
    <item>
      <title>Docx and Open Packaging Conventions for Ruby and Rails</title>
      <description>&lt;p&gt;I just finished the first iteration of my Ruby on Rails plugin for handling Microsoft's new Open Packaging Conventions file format, which is their new container format for XML-based file formats in Microsoft Office.&amp;nbsp; DOCX, Microsoft's new XML-based format for Word is probably the most widely used of these.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Open Packaging Conventions is basically a zipfile containing one or more components, and those components' relationship to each other is defined by other files within the zipfile.&lt;/p&gt;
&lt;p&gt;To add rubyopc to your Rails app, do:&lt;/p&gt;
&lt;pre&gt;script/plugin install http://rubyopc.googlecode.com/svn/trunk/rubyopc&lt;/pre&gt;
&lt;p&gt;Here is how you would make a DOCX file with it:&lt;/p&gt;
&lt;pre&gt;OpenPackagingConventions::Package.with_package(&quot;test.docx&quot;) do |p|&lt;br /&gt;    p.add_part(&quot;/word/document.xml&quot;, &quot;http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument&quot;, &quot;application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml&quot;, &amp;lt;&amp;lt;EOF)&lt;br /&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&amp;gt;&lt;br /&gt;&amp;lt;w:document xmlns:ve=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot; xmlns:o=&quot;urn:schemas-microsoft-com:office:office&quot; xmlns:r=&quot;http://schemas.openxmlformats.org/officeDocument/2006/relationships&quot; xmlns:m=&quot;http://schemas.openxmlformats.org/officeDocument/2006/math&quot; xmlns:v=&quot;urn:schemas-microsoft-com:vml&quot; xmlns:wp=&quot;http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing&quot; xmlns:w10=&quot;urn:schemas-microsoft-com:office:word&quot; xmlns:w=&quot;http://schemas.openxmlformats.org/wordprocessingml/2006/main&quot; xmlns:wne=&quot;http://schemas.microsoft.com/office/word/2006/wordml&quot;&amp;gt;&lt;br /&gt;    &amp;lt;w:body&amp;gt;&lt;br /&gt;      &amp;lt;w:p w:rsidR=&quot;00EA68DC&quot; w:rsidRPr=&quot;00C703AC&quot; w:rsidRDefault=&quot;00EA68DC&quot; w:rsidP=&quot;00EA68DC&quot;&amp;gt;&lt;br /&gt;        &amp;lt;w:pPr&amp;gt;&lt;br /&gt;          &amp;lt;w:rPr&amp;gt;&lt;br /&gt;            &amp;lt;w:lang w:val=&quot;es-ES_tradnl&quot;/&amp;gt;&lt;br /&gt;          &amp;lt;/w:rPr&amp;gt;&lt;br /&gt;        &amp;lt;/w:pPr&amp;gt;&lt;br /&gt;        &amp;lt;w:r&amp;gt;&lt;br /&gt;          &amp;lt;w:t&amp;gt;&lt;br /&gt;            Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc at risus vel erat tempus posuere. Aenean non ante. Suspendisse vehicula dolor sit amet odio. Sed at sem. Nunc fringilla. Etiam ut diam. Nunc diam neque, adipiscing sed, ultrices a, pulvinar vitae, mauris. Suspendisse at elit vitae quam volutpat dapibus. Phasellus consequat magna in tellus. Mauris mauris dolor, dapibus sed, commodo et, pharetra eget, diam.&lt;br /&gt;          &amp;lt;/w:t&amp;gt;&lt;br /&gt;        &amp;lt;/w:r&amp;gt;&lt;br /&gt;        &amp;lt;w:r w:rsidRPr=&quot;00C703AC&quot;&amp;gt;&lt;br /&gt;          &amp;lt;w:rPr&amp;gt;&lt;br /&gt;            &amp;lt;w:lang w:val=&quot;es-ES_tradnl&quot;/&amp;gt;&lt;br /&gt;          &amp;lt;/w:rPr&amp;gt;&lt;br /&gt;          &amp;lt;w:t&amp;gt;&lt;br /&gt;&amp;nbsp;Nullam consequat lacus vitae mi. Sed tortor risus, posuere sed, condimentum pellentesque, pharetra eu, nisl.&lt;br /&gt;        &amp;lt;/w:t&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;/w:r&amp;gt;&lt;br /&gt;    &amp;lt;/w:p&amp;gt;&lt;br /&gt;  &amp;lt;/w:body&amp;gt;&lt;br /&gt;&amp;lt;/w:document&amp;gt;&lt;br /&gt;EOF&lt;br /&gt;&lt;br /&gt;  p.add_part_to(&quot;/word/document.xml&quot;, &quot;/word/styles.xml&quot;, &quot;http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles&quot;, &quot;application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml&quot;, &amp;lt;&amp;lt;EOF)&lt;br /&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&amp;gt;&lt;br /&gt;&amp;lt;w:styles xmlns:r=&quot;http://schemas.openxmlformats.org/officeDocument/2006/relationships&quot; xmlns:w=&quot;http://schemas.openxmlformats.org/wordprocessingml/2006/main&quot;&amp;gt;&lt;br /&gt;  &amp;lt;w:style w:type=&quot;paragraph&quot; w:styleId=&quot;Normal&quot;&amp;gt;&lt;br /&gt;    &amp;lt;w:name w:val=&quot;Normal&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;w:rPr&amp;gt;&lt;br /&gt;      &amp;lt;w:b /&amp;gt;&lt;br /&gt;    &amp;lt;/w:rPr&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;/w:style&amp;gt;&lt;br /&gt;&amp;lt;/w:styles&amp;gt;&lt;br /&gt;EOF&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;This will create a small word document called &quot;test.docx&quot;.&lt;/p&gt;
&lt;p&gt;You can find the official documentation for these file formats &lt;a href=&quot;http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <author>JB</author>
      <pubDate>Thu, 18 Dec 2008 23:43:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/147</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/147</guid>
    </item>
    <item>
      <title>Separating Value from State</title>
      <description>&lt;p&gt;
Lambda-the-Ultimate had an link to an interesting language called &lt;a href=&quot;http://clojure.org/state&quot; target=&quot;_blank&quot;&gt;Clojure&lt;/a&gt;:
&lt;/p&gt;
&lt;blockquote&gt;
	&lt;p&gt;
	&amp;nbsp;By identity I mean &lt;strong&gt;&lt;em&gt;a stable logical entity associated with a series of different values over time&lt;/em&gt;&lt;/strong&gt;.
	Models need identity for the same reasons humans need identity - to
	represent the world. How could it work if identities like &amp;#39;today&amp;#39; or
	&amp;#39;America&amp;#39; had to represent a single constant value for all time? Note
	that by identities I don&amp;#39;t mean names (I call my mother Mom, but you
	wouldn&amp;#39;t).
	&lt;/p&gt;
	&lt;p&gt;
	So, for this discussion, an identity is an entity that has a state, which is its value at a point in time. And &lt;strong&gt;&lt;em&gt;a value is something that doesn&amp;#39;t change&lt;/em&gt;&lt;/strong&gt;.
	42 doesn&amp;#39;t change. June 29th 2008 doesn&amp;#39;t change. Points don&amp;#39;t move,
	dates don&amp;#39;t change, no matter what some bad class libraries may cause
	you to believe. Even aggregates are values. The set of my favorite
	foods doesn&amp;#39;t change, i.e. if I prefer different foods in the future,
	that will be a different set.&lt;br /&gt;
	...&lt;br /&gt;
	In Clojure&amp;#39;s model, value calculation is purely functional. Values
	never change. New values are functions of old, not mutations. But
	logical identity is well supported, via atomic references to values (&lt;a href=&quot;http://clojure.org/Refs&quot; class=&quot;wiki_link&quot;&gt;Refs&lt;/a&gt; and &lt;a href=&quot;http://clojure.org/Agents&quot; class=&quot;wiki_link&quot;&gt;Agents&lt;/a&gt;).
	Changes to references are controlled/coordinated by the system - i.e.
	cooperation is not optional and not manual. The world moves forward due
	to the cooperative efforts of its participants and the programming
	language/system, Clojure, is in charge of world consistency management.
	The value of a reference (state of an identity) is always observable
	without coordination, and freely shareable between threads.&lt;br /&gt;
	&lt;br /&gt;
	It is worth constructing programs this way even when there is only one
	participant (thread). Programs are easier to understand/test when
	functional value calculation is independent of identity/value
	association. And it&amp;#39;s easy to add other participants when they are
	(inevitably) needed.
	&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
Sounds incredibly interesting!
&lt;/p&gt;
</description>
      <author>JB</author>
      <pubDate>Wed, 10 Sep 2008 02:35:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/91</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/91</guid>
    </item>
    <item>
      <title>Stuff you can do with Google Earth</title>
      <description>&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.techcrunch.com/2008/08/27/how-google-earth-helped-win-a-gold-medal/&quot; target=&quot;_blank&quot;&gt;Find training area and win gold medal&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.switched.com/2008/08/26/google-earth-study-shows-cows-usually-point-north/&quot; target=&quot;_blank&quot;&gt;Make interesting observations about cows&lt;/a&gt;&lt;br /&gt;
	&lt;/li&gt;
&lt;/ul&gt;
</description>
      <author>JB</author>
      <pubDate>Wed, 27 Aug 2008 15:56:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/79</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/79</guid>
    </item>
    <item>
      <title>How to Do Well</title>
      <description>&lt;p&gt;This slashdot discussion starts out as a specific question, but then digresses into a much more general (and very interesting) conversation about how to handle problems in companies. &amp;nbsp;The summation is:&lt;/p&gt;&lt;ul&gt;	&lt;li&gt;it&amp;#39;s not a problem with someone else&amp;#39;s company that someone else needs to fix - it&amp;#39;s a problem with our company that we need to fix. &amp;nbsp;The difference in language is essential.&lt;/li&gt;	&lt;li&gt;don&amp;#39;t just point out problems, also come up with solutions&lt;/li&gt;	&lt;li&gt;make a plan for implementing the solution, and offer to lead the team yourself&lt;/li&gt;	&lt;li&gt;attach a cost to what you are doing now, and a cost for implementing the solution, so that management will know why it is important&lt;/li&gt;	&lt;li&gt;if you are given the tasks, report regularly on the status and how close you are to the budget and the schedule&lt;/li&gt;	&lt;li&gt;possibly look for other ways to use the solution to profit the company - i.e. move the solution from a cost saver to an income generator&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Another option presented - just do it yourself without getting approval. &amp;nbsp;Send someone a memo when you&amp;#39;re done.&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;This was an interesting tidbit:&lt;/div&gt;&lt;div&gt;&lt;blockquote&gt;	&lt;p&gt;	I also work for a biotech but we&amp;#39;re lucky enough to have a CEO who&amp;#39;s a computer scientist so he knew the importance of IT. As such we have a rather larger IT dept which includes a software development team.	&lt;/p&gt;	&lt;p&gt;	In order to show the bossesses that proper software maintenance/creation/validation procedures are important just explain what would the FDA or some other regulatory agency do to your collective bung holes if they were to probe deeper into your practices.	&lt;/p&gt;	&lt;p&gt;	Mission critical data being handled by non-validated/non-documented software is just like having untrained people working with samples in the lab, it&amp;#39;s a big no-no.	&lt;/p&gt;	&lt;p&gt;	You need paperwork that supports your claim, start with all the areas where un-validated software is used, then add to that a second section explaining the cost of poorly planned development iterations. We work using monthly iterations and when we told the people responsible for the software in the field that an iteration cost about 30 000$ just in labor costs they started paying attention and making the lists of demands count, i.e. removing the superflueous demands (ex: &amp;quot;it would look nicer in blue&amp;quot; was replaced with &amp;quot;The standard deviation calculation should be done with X+1, not just X.&amp;quot;)	&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;</description>
      <author>JB</author>
      <pubDate>Tue, 26 Aug 2008 20:10:00 +0000</pubDate>
      <link>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/77</link>
      <guid>http://www.bartlettpublishing.com/site/bartpub/blog/3/entry/77</guid>
    </item>
  </channel>
</rss>
