<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>From the Mind of Mark Farver</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/" />
    <link rel="self" type="application/atom+xml" href="http://mindbent.org/atom.xml" />
    <id>tag:mindbent.org,2009-03-16://1</id>
    <updated>2010-08-09T01:31:43Z</updated>
    
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.24-en</generator>

<entry>
    <title>What, me worry?</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/2010/08/what-me-worry.html" />
    <id>tag:mindbent.org,2010://1.25</id>

    <published>2010-08-09T01:29:19Z</published>
    <updated>2010-08-09T01:31:43Z</updated>

    <summary><![CDATA[This is a nice example of the advantages of thinking things through, especially when dealing with systems that have large negative&nbsp;consequences.End of shift - one of the operators is leaving with his backpack slung over a shoulder. The other strap...]]></summary>
    <author>
        <name>Mark Farver</name>
        
    </author>
    
        <category term="Systems" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en-US" xml:base="http://mindbent.org/">
        <![CDATA[This is a nice example of the advantages of thinking things through, especially when dealing with systems that have large negative&nbsp;consequences.<div><br /></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><p style="margin-top: 8px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(51, 51, 51); line-height: 16px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; ">End of shift - one of the operators is leaving with his backpack slung over a shoulder. The other strap happens to catch the Halon release button by the door.</p></div><div><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; "><p style="margin-top: 8px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(51, 51, 51); line-height: 16px; background-position: initial initial; background-repeat: initial initial; ">No problem. Pulling the button off did not cause a Halon release.</p></span></div><div><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; "><p style="margin-top: 8px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(51, 51, 51); line-height: 16px; background-position: initial initial; background-repeat: initial initial; ">Putting the button back however...</p></span></div></blockquote>]]>
        
    </content>
</entry>

<entry>
    <title>Bigger Pipes for a Better Austin</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/2010/03/bigger-pipes-for-a-better-austin.html" />
    <id>tag:mindbent.org,2010://1.23</id>

    <published>2010-03-22T06:18:19Z</published>
    <updated>2010-02-25T06:22:03Z</updated>

    <summary><![CDATA[My nomination of Austin for Google's 1GB to the Home project: Situated in the beautiful heart of Texas, Austin is one of the greatest creative and startup environment in the US.&nbsp; We have bands uploading videos and music, digital movie...]]></summary>
    <author>
        <name>Mark Farver</name>
        
    </author>
    
        <category term="Misc" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en-US" xml:base="http://mindbent.org/">
        <![CDATA[My nomination of Austin for <a href="http://www.google.com/appserve/fiberrfi/">Google's 1GB to the Home</a> project: <br /><br /><blockquote>Situated in the beautiful heart of Texas, Austin is one of the greatest creative and startup environment in the US.&nbsp; We have bands uploading videos and music, digital movie distribution, and the Silicon Hills full of gaming companies and IT startups.&nbsp; The annual SXSW film, interactive media and music conference bring thousands of creative people into town every spring.&nbsp; <br /><br />Austin is the hub for Smart metering and Green Power initiatives.&nbsp; AustinEnergy, our municipal owned power provider, is a leader in progressive power delivery.&nbsp; Texas is the largest generator of Wind Power in the US due to AustinEnergy's GreenChoice program.&nbsp; The city and the utility have partnered to form the Pecan Street project, which funds and provides technical assistance to Green Power and Green transportation startups. <br /><br />This creates an unquenchable thirst for connectivity.&nbsp; Yet Austin is trapped in the Bermuda triangle of bandwidth.&nbsp; Surrounded by the large cities of Dallas, Houston, and San Antonio much connectivity and access bypasses Austin, going for the large datacenter havens in those cities.&nbsp; Choices for broadband providers are limited to the cable monopoly, and the phone monopoly.&nbsp; Both provide moderate download, but significantly restricted upload speeds.&nbsp; Neither provider offers a fiber to the home product, and neither is investing funds to upgrade their last mile connectivity. <br /><br />The City of Austin's own efforts to create a alternative municipal network for universal access were stalled when the providers lobbied for a state law prohibiting municipalities from competing in the broadband space.<br /><br />Austin's residents are leaders in technology and the arts.&nbsp; Our city is well positioned to develop and use, and contribute to Google's Fiber for Communities project, and we look forward to working with Google on the future of the Internet.<br /><br /></blockquote>Submit your city <a href="http://www.google.com/appserve/fiberrfi/user/launch_exhibit_b">here</a>.<br /><br /> ]]>
        
    </content>
</entry>

<entry>
    <title>PIC24 CAN, but won&apos;t</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/2010/03/pic24-can-but-wont.html" />
    <id>tag:mindbent.org,2010://1.24</id>

    <published>2010-03-08T09:49:54Z</published>
    <updated>2010-03-08T09:52:52Z</updated>

    <summary>PIC24HJGP504 CAN Example Code (not working) Trying to get basic CAN Transmission working on a PIC24HJ64GP504. There are a couple of app note examples, but all of them are complex and none seem to cover using CAN with PPS. I...</summary>
    <author>
        <name>Mark Farver</name>
        
    </author>
    
    <category term="microchipcanrevolt" label="Microchip CAN REVOLT" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-US" xml:base="http://mindbent.org/">
        <![CDATA[<p>PIC24HJGP504 CAN Example Code (not working)</p>
<p>Trying to get basic CAN Transmission working on a PIC24HJ64GP504. There are a couple of app note examples, but all of them are complex and none seem to cover using CAN with PPS. I tried them anyway, and no success. In an attempt to make the simplest example possible I cut and pasted the code examples from the Family Guide into this application. </p>
<p>Speed is 500kbit with a 16mhz crystal and no PLL. I have a CANUSB adapter and an older 18F2580 based product on the bus. I can see frames from the 18F, but frames from the 24HJ just retransmit over and over until the EC reaches 128 and cause bus errors on the CANUSB. I don't have a bus analyzer, but on the scope the good frames look similar to the bad ones, so I think the timing is in the ballpark. Is there a way to tell which of the five CAN errors it is experiencing? Did I do my speed calculations correct? </p><pre>


#include &lt;p24hxxxx.h&gt;

_FBS( RBS_NO_RAM &amp; BSS_NO_FLASH &amp; BWRP_WRPROTECT_OFF );
_FSS( RSS_NO_RAM &amp; SSS_NO_FLASH &amp; SWRP_WRPROTECT_OFF );
_FGS( GSS_OFF &amp; GCP_OFF &amp; GWRP_OFF );
_FOSCSEL( FNOSC_PRI &amp; IESO_OFF );
_FOSC( FCKSM_CSDCMD &amp; IOL1WAY_OFF &amp; OSCIOFNC_OFF &amp; POSCMD_HS );
_FWDT( FWDTEN_OFF );

unsigned int ecan1MsgBuf[32][8] __attribute__(( space(dma)) );

int main(void) {

  AD1PCFGL = 0xFFFF;
  __builtin_write_OSCCONL(OSCCON &amp; 0xbf);
  _C1RXR = 9; // RX = RP9
  _RP22R = 0b10000; // TX = RP22
  __builtin_write_OSCCONL(OSCCON | 0x40);

  /* Assign 32x8word Message Buffers for ECAN1 in DMA RAM */
  DMA0STA = __builtin_dmaoffset(ecan1MsgBuf);
  /* Data Transfer Size: Word Transfer Mode */
  DMA0CONbits.SIZE = 0x0;
  /* Data Transfer Direction: DMA RAM to Peripheral */
  DMA0CONbits.DIR = 0x1;
  /* DMA Addressing Mode: Peripheral Indirect Addressing mode */
  DMA0CONbits.AMODE = 0x2;
  /* Operating Mode: Continuous, Ping-Pong modes disabled */
  DMA0CONbits.MODE = 0x0;
  /* Assign ECAN1 Transmit event for DMA Channel 0 */
  DMA0REQ = 70;
  /* Set Number of DMA Transfer per ECAN message to 8 words */
  DMA0CNT = 7;
  /* Peripheral Address: ECAN1dmaxcnt Transmit Register */
  DMA0PAD = (volatile unsigned int)&amp;C1TXD;
  /* Start Address Offset for ECAN1 Message Buffer 0x0000 */
  DMA0STA = 0x0000;
  /* Channel Enable: Enable DMA Channel 0 */
  DMA0CONbits.CHEN = 0x1;
  /* Channel Interrupt Enable: Enable DMA Channel 0 Interrupt */
  IEC0bits.DMA0IE = 1;

  /* Set the ECAN module for Configuration Mode before writing into the Baud
    Rate Control Registers*/
  C1CTRL1bits.REQOP = 4;
  /* Wait for the ECAN module to enter into Configuration Mode */
  while(C1CTRL1bits.OPMODE != 4);
  /* Phase Segment 1 time is 8 TQ */
  C1CFG2bits.SEG1PH = 0x8; 
  /* Phase Segment 2 time is set to be programmable */
  C1CFG2bits.SEG2PHTS = 0x1;
  /* Phase Segment 2 time is 6 TQ */
  C1CFG2bits.SEG2PH = 0x6; 
  /* Propagation Segment time is 1 TQ */
  C1CFG2bits.PRSEG = 1; 
  /* Bus line is sampled three times at the sample point */
  C1CFG2bits.SAM = 0x1;
  /* Synchronization Jump Width set to 1 TQ */
  C1CFG1bits.SJW = 1; 
  /* Baud Rate Prescaler bits set to 1:1 */
  C1CFG1bits.BRP = 0x0 ;
  /* Put the ECAN Module into Normal Mode Operating Mode*/
  C1CTRL1bits.REQOP = 0;
  /* Wait for the ECAN module to enter into Normal Operating Mode */
  while(C1CTRL1bits.OPMODE != 0);
  /* Configure Message Buffer 0 for Transmission and assign priority*/
  C1TR01CONbits.TXEN0 = 0x1;
  C1TR01CONbits.TX0PRI = 0x3;
  /* WRITE TO MESSAGE BUFFER 0 */
  /* CiTRBnSID = 0bxxx1 0010 0011 1100
  	IDE = 0b0
  	SRR = 0b0
  	SID&lt;10:0&gt;= 0b100 1000 1111 */
  ecan1MsgBuf[0][0] = 0x123C;
  /* CiTRBnEID = 0bxxxx 0000 0000 0000
    EID&lt;17:6&gt; = 0b0000 0000 0000 */
  ecan1MsgBuf[0][1] = 0x0000;
  /* CiTRBnDLC = 0b0000 0000 xxx0 1111
    EID&lt;17:6&gt; = 0b000000
    RTR = 0b0
    RB1 = 0b0
    RB0 = 0b0
    DLC = 0b1000 */
  ecan1MsgBuf[0][2] = 0x8;
  /* WRITE MESSAGE DATA BYTES */
  ecan1MsgBuf[0][3] = 0xabcd;
  ecan1MsgBuf[0][4] = 0xabcd;
  ecan1MsgBuf[0][5] = 0xabcd;
  ecan1MsgBuf[0][6] = 0xabcd;
  /* REQUEST MESSAGE BUFFER 0 TRANSMISSION */
  C1TR01CONbits.TXREQ0 = 0x1;
  while (C1TR01CONbits.TXREQ0);
  while(1);
  return 0;
}

void __attribute__((interrupt, no_auto_psv)) _DMA0Interrupt(void)
{
   IFS0bits.DMA0IF = 0;          // Clear the DMA0 Interrupt Flag;
}

</pre>]]>
        
    </content>
</entry>

<entry>
    <title>Secret SQuirreL</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/2010/01/secret-squirrel.html" />
    <id>tag:mindbent.org,2010://1.22</id>

    <published>2010-01-06T23:02:33Z</published>
    <updated>2010-01-06T23:59:10Z</updated>

    <summary><![CDATA[SQL is a great language for human query writers, but that has given it a bias toward a query-&gt;generic error.&nbsp; It assumes that when you run a query and it returns an error, you are smart enough to know what...]]></summary>
    <author>
        <name>Mark Farver</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://mindbent.org/">
        <![CDATA[SQL is a great language for human query writers, but that has given it a bias toward a query-&gt;generic error.&nbsp; It assumes that when you run a query and it returns an error, you are smart enough to know what query caused the error.&nbsp; Easy if you are a human using a commandline.&nbsp; Most SQL connection libraries just log the error, not the SQL that caused the error.&nbsp; A simple production problem caused by a missing table becomes a two hour snipe hunt through the code to identify the SQL statement, and from there figure out the issue. <br /><br /><blockquote>2010-01-09 11:15:50,935 ERROR [org.mindbent.audit-test] (ajp-0.0.0.0-8009-12) error performing audit <br />javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not get next sequence value<br /><br /></blockquote>The error above is useless.<br /><br />The easiest solution is to have a DB connection layer that adds some additional exception handling and logs what was being run, or a stack trace that actually links to the portion of your code that is the problem.&nbsp; In JBoss/Java I think you could subclass the JDBC Driver (ie com.mysql.jdbc.Driver) put your own wrapper methods with better exception handling and then use the new class in your datasources.&nbsp; I haven't tried this yet, but it seems like a convenient solution.&nbsp; <br /><br />More directly its better to log too much and have to turn the log level down than too little and have no way to turn it up.&nbsp;&nbsp;&nbsp; <br /><br />As another option, why can't the SQL server have a setting to log failed queries? (I understand Oracle does via connection tracing, to some extent)&nbsp; Have to be careful about the security implications, but it could make some troubleshooting a lot easier.<br />]]>
        
    </content>
</entry>

<entry>
    <title>Flipping bits (and not burgers)</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/2010/01/flipping-bits-and-not-burgers.html" />
    <id>tag:mindbent.org,2010://1.21</id>

    <published>2010-01-05T06:39:54Z</published>
    <updated>2010-01-07T01:11:08Z</updated>

    <summary><![CDATA[I am writing code to talk to a Seiko S-35390A Real Time Clock (RTC) chip for the new Battery Management system I am designing for REVOLT Custom Electric Vehicles.&nbsp; The chip communicates with my microcontroller via I2C, a reasonably well...]]></summary>
    <author>
        <name>Mark Farver</name>
        
    </author>
    
        <category term="Electronics" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="REVOLT" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="rtccbitreverseflip" label="RTC C bit reverse flip" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-US" xml:base="http://mindbent.org/">
        <![CDATA[I am writing code to talk to a <a href="http://datasheet.sii-ic.com/en/real_time_clock/S35390A_E.pdf">Seiko S-35390A</a> Real Time Clock (RTC) chip for the new Battery Management system I am designing for <a href="http://revoltllc.com/">REVOLT Custom Electric Vehicles</a>.&nbsp; The chip communicates with my microcontroller via I2C, a reasonably well defined standard.&nbsp; I2C,conveniently defines the bit order for data transmitted over the bus.&nbsp; The RTC chip, for some reason, requires all of it's data to be sent as BCD encoded data with the bits reversed from the bus standard, (LSB becomes MSB.)&nbsp; Reversing bits should be a textbook problem, but I found only a few clean ways to do it. There is probably an simpler way using 16bit shifts but here is a solution using a lookup table. <br /><br />

<blockquote><code>//Seiko RTC chip uses an annoying packing system where the LSB <br />// of the BCD represented data is in the MSB of the value <br />// that has to be written to the register.&nbsp; This function<br />// does the bitwise flip of each nybble using a lookup, and <br />// swaps the two nybbles.&nbsp; <br />unsigned char RTC_ConvertRBCD( unsigned char value ) {<br />&nbsp;&nbsp;&nbsp; const unsigned char tobcd[] = { 0x0, 0x8, 0x4, 0xC, <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x2, 0xA, 0x6, 0xE, 0x1, 0x9, 0x5, 0xD, 0x3, 0xB, <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x7, 0xF };<br /><br />&nbsp;&nbsp;&nbsp; return (tobcd[value &amp; 0x0F] &lt;&lt; 4 ) + tobcd[value &gt;&gt; 4];<br />}<br /><br />//Input is a 8bit number, returns the BCD encoded, bit reversed<br />// value needed by the Seiko RTC chip registers<br />unsigned char RTC_ToRTCBCD( unsigned char value ) {<br />&nbsp;&nbsp;&nbsp; return RTC_ConvertRBCD( ( ( value / 10) &lt;&lt; 4) + ( value % 10 ) );<br />&nbsp;&nbsp;&nbsp; //return&nbsp; RTC_ConvertRBCD( ( ( value / 10) &lt;&lt; 4) + ( value &amp; 0x0F) );<br />}<br /><br />//Input is a bit reversed packed BCD register value from <br />// the Seiko RTC chip, return is a normal 8bit value<br />unsigned char RTC_FromRTCBCD( unsigned char bcdvalue ) {<br />&nbsp;&nbsp;&nbsp; unsigned char unpacked = RTC_ConvertRBCD( bcdvalue );<br />&nbsp;&nbsp;&nbsp; return ( ( unpacked &gt;&gt; 4 ) * 10) + ( unpacked &amp; 0x0F );<br />}<br /></code></blockquote>]]>
        
    </content>
</entry>

<entry>
    <title>I be, you be, Yubikey</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/2010/01/i-be-you-be-yubikey.html" />
    <id>tag:mindbent.org,2010://1.20</id>

    <published>2010-01-03T08:35:15Z</published>
    <updated>2010-01-03T08:41:20Z</updated>

    <summary><![CDATA[Cool, and simple.&nbsp; The Yubikey is a one-time password generator in a USB key.&nbsp; Plug in in and it emulates a USB keyboard.&nbsp; Touch the button on it and it will type out a one-time use password.&nbsp; Basically the same...]]></summary>
    <author>
        <name>Mark Farver</name>
        
    </author>
    
        <category term="Electronics" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Systems" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="authenticationonetimeyubikey" label="Authentication one-time Yubikey" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-US" xml:base="http://mindbent.org/">
        <![CDATA[Cool, and simple.&nbsp; The Yubikey is a one-time password generator in a USB key.&nbsp; Plug in in and it emulates a USB keyboard.&nbsp; Touch the button on it and it will type out a one-time use password.&nbsp; Basically the same system as "rolling code" garage door openers.<br /><br />The hardware should be pretty cheap having no battery like the RSA SecurID tokens, just a microcontroller.&nbsp;&nbsp; It claims to be somewhat resistant to phishing, though I cannot see how that works.&nbsp; <br /><br />
            
            
			<h6>The <a href="http://www.yubico.com/products/yubikey/">YubiKey</a></h6><blockquote>
It works seamlessly with any hardware and operating system combination
supporting USB keyboards such as Windows, MacOS, Linux and others. The
Key generates and sends unique time-variant authentication codes by
emulating keystrokes through the standard keyboard interface. The
computer to which the Key is attached receives this authentication code
character by character just as if it were being typed in from the
keyboard - yet it's all performed automatically. This process allows
the Key to be used with any application or Web-based service without
any need for special client computer interaction or drivers. <br /><br />
The YubiKey differs from traditional authentication tokens based on
time-variant codes in that it needs no battery and therefore does not
rely on an absolute time generated by an accurate time source. No
battery means unlimited shelf life, no synchronization and customer
support issues, and enables significant cost reduction.<br /><br /></blockquote><a href="http://www.yubico.com/products/yubikey/">Link</a><br /> ]]>
        
    </content>
</entry>

<entry>
    <title>&quot;Yes Virginia, you can do variable variables in Bash&quot;</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/2010/01/yes-virginia-you-can-do-variable-variables-in-bash.html" />
    <id>tag:mindbent.org,2010://1.19</id>

    <published>2010-01-03T08:07:08Z</published>
    <updated>2010-01-03T08:21:02Z</updated>

    <summary><![CDATA[I was writing a build script in Bash for one of the development projects and I wanted to have a list of patches that would be applied to a "clean" distribution of JBoss to create the fully configured app server.&nbsp;...]]></summary>
    <author>
        <name>Mark Farver</name>
        
    </author>
    
        <category term="Systems" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en-US" xml:base="http://mindbent.org/">
        <![CDATA[<p>I was writing a build script in Bash for one of the development projects and I wanted to have a list of patches that would be applied to a "clean" distribution of JBoss to create the fully configured app server.&nbsp; I needed something simple so the development team could continue to maintain and update the script.&nbsp; I came up with this idea while looking at RPM building.<br /><br /><br /></p><blockquote><code>#!/bin/bash<br /><br />PATCH0=$SOURCES/jboss-4.2.3.GA.base.patch<br />PATCH1=$SOURCES/log4j-setup-append.patch<br />PATCH2=$SOURCES/jboss-set-call-by-value.patch<br />PATCH3=$SOURCES/add-security-policy-login.patch<br />MAXPATCHES=100&nbsp; #The script searches for PATCH{value}= lines from zero to this number<br /><br />echo "Applying patches"<br />i=0<br />while [ $i -lt $MAXPATCHES ] ; do<br />&nbsp; PATCH=$(eval echo $<code>echo PATCH${i}</code>);<br />&nbsp; if [ ! "$PATCH" == "" ] ; then<br />&nbsp;&nbsp;&nbsp; echo "Applying patch: $PATCH"<br />&nbsp;&nbsp;&nbsp; patch -p0 &lt; $PATCH<br />&nbsp; fi<br />&nbsp; i=$[$i+1]<br />done;<br /></code></blockquote><p><br />In the end it might have been simpler to use a datafile, or a language with Array support, but this works well enough and is fairly usable.<br /></p>
]]>
        

    </content>
</entry>

<entry>
    <title>Quote of the day...</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/2010/01/quote-of-the-day.html" />
    <id>tag:mindbent.org,2010://1.18</id>

    <published>2010-01-02T14:59:34Z</published>
    <updated>2010-01-02T18:01:35Z</updated>

    <summary>Cynical There&apos;s never enough time to do it right but always time to blame the sysadmin. --Joe Thompson, in ASR...</summary>
    <author>
        <name>Mark Farver</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://mindbent.org/">
        <![CDATA[Cynical

<blockquote>There's never enough time to do it right but always time to blame the sysadmin. --Joe Thompson, in ASR</blockquote>]]>
        
    </content>
</entry>

<entry>
    <title>Opportunity knocks, but usually the door is locked</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/2009/12/opportunity-knocks-but-usually-the-door-is-locked.html" />
    <id>tag:mindbent.org,2009://1.17</id>

    <published>2009-12-21T04:33:34Z</published>
    <updated>2009-11-27T02:32:42Z</updated>

    <summary><![CDATA[Rather Interesting, it is a very nicely designed central locking system for server cabinets.&nbsp; The TZ Praetorian uses an end of row control pad and standard access control device (badge reader, biometric station etc) and ties into your existing access...]]></summary>
    <author>
        <name>Mark Farver</name>
        
    </author>
    
        <category term="Systems" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="datacenterhardwarecabinetlockingsecurity" label="Datacenter hardware cabinet locking security" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-US" xml:base="http://mindbent.org/">
        <![CDATA[Rather Interesting, it is a very nicely designed central locking system for server cabinets.&nbsp; The TZ Praetorian uses an end of row control pad and standard access control device (badge reader, biometric station etc) and ties into your existing access control system.&nbsp; All of the lock controls are low current (unlike magnetic locks) and are designed to run over standard UTP cabling.&nbsp; Door open/close indication is built in and displayed on the end of the row, so unsecured cabinets can be caught quickly.<br /><br />Watch the video...&nbsp; <br /><br /><a href="http://anixter.com/praetorian">http://anixter.com/praetorian</a><br /> ]]>
        
    </content>
</entry>

<entry>
    <title>Failover, Fail</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/2009/08/failover-fail.html" />
    <id>tag:mindbent.org,2009://1.16</id>

    <published>2009-08-14T17:43:40Z</published>
    <updated>2009-08-14T18:47:20Z</updated>

    <summary><![CDATA[Datacenter to datacenter failover for many database backed websites is hard.&nbsp; For it to work well it must be designed into the app.. Please don't expect your Operations team to fire up DB replication and have it magically work.Autoincrement fields?&nbsp;...]]></summary>
    <author>
        <name>Mark Farver</name>
        
    </author>
    
        <category term="Systems" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en-US" xml:base="http://mindbent.org/">
        <![CDATA[Datacenter to datacenter failover for many database backed websites is hard.&nbsp; For it to work well it must be designed into the app.. Please don't expect your Operations team to fire up DB replication and have it magically work.<br /><br /><ul><li>Autoincrement fields?&nbsp; DB supported, or hosted in the app, what happens if both sites are up? Can you get conflicting ids?<br /></li><li>Background jobs... how to you make sure only one copy is running or tolerate several?</li><li>Latency... Can you even replicate the data in real time?</li><li>Failover reponse... manual operation?&nbsp; Automated?</li><li>IP/DNS issues, the simplest failover is to change DNS entries, but that can take a significant amount of time to replicate.&nbsp; Will your customers wait?</li><li>How will you QA?&nbsp; Test failover in prod?&nbsp; Dual QA envs?</li><li>Failback?&nbsp; How are you going to switch back?</li></ul><br /> ]]>
        
    </content>
</entry>

<entry>
    <title>Distributed, and disturbed</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/2009/07/distributed-and-disturbed.html" />
    <id>tag:mindbent.org,2009://1.15</id>

    <published>2009-07-22T23:23:06Z</published>
    <updated>2010-01-05T07:50:14Z</updated>

    <summary><![CDATA[There's a lot of talk about scalability of applications and frameworks.&nbsp; A whole subculture has formed around distributed databases like CouchDB and Hbase.&nbsp; Great, but the truth is, most people don't need scalability (as Ted Dziuba harshly points out in...]]></summary>
    <author>
        <name>Mark Farver</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://mindbent.org/">
        <![CDATA[There's a lot of talk about scalability of applications and frameworks.&nbsp; A whole subculture has formed around distributed databases like <a href="http://couchdb.apache.org/">CouchDB</a> and <a href="http://hadoop.apache.org/hbase/">Hbase</a>.&nbsp; Great, but the truth is, most people don't need scalability (as Ted Dziuba harshly points out in his "<a href="http://teddziuba.com/2008/04/im-going-to-scale-my-foot-up-y.html">I'm Going To Scale My Foot Up Your Ass</a>" article.)&nbsp; I've seen only a handful of projects that grew fast enough that they have had to worry about scale, LiveJournal, Digg and Twitter all had growing pains.&nbsp; In most cases they fixed the problems with better programming, and only a sprinkling of neat tools.<br /><br />In the sites I've had to support, the problem has not been scaling, its redundancy.&nbsp; The web has placed tremedous pressure on even small sites for 24x7 operation.&nbsp; As I've said before, datacenters are not reliable.&nbsp; No matter what Tier the provider claims to be, you're never immune from outages at the datacenter level.&nbsp; Geographical diversity is important.. you don't want your server located in the next World Trade Center, or in Houston or New Orleans during hurricane season.&nbsp; My current provider has a datacenter "conveniently " near an airport.. as in, practically under a runway approach path, and they are only one of several datacenters in that business park.<br /><br />I want geographic diversity, and my customers want active/active or zero failover time.&nbsp; I want the "distributed" part of CouchDB, without having to teach programmers new tricks.&nbsp; SQL is not good in this area.&nbsp; You can have replication, hot spares and what haves but it never works fast, or cheap, or perfectly.&nbsp; Most SQL databases are designed to be consistent, and true consistency is hard to do over high or variable latency connections.&nbsp; Some apps can function in an "eventual consistency" model, and many more could if programmers gave it some thought during the design. &nbsp;<br /><br />The first database to give me SQL like syntax and function, good replication and reliable eventual consistency will make me very happy.&nbsp; In the meantime I'll watch the skies and wring my hands.<br /><br />Update: High scalability covered the same topic, but with different <a href="http://highscalability.com/against-all-odds">conclusions</a>. ]]>
        
    </content>
</entry>

<entry>
    <title>Roughing it 101.</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/2009/06/roughing-it-101.html" />
    <id>tag:mindbent.org,2009://1.14</id>

    <published>2009-06-13T18:59:03Z</published>
    <updated>2009-06-16T23:36:52Z</updated>

    <summary><![CDATA[Been a while since I posted.&nbsp; I was hired in late April for a position with Cybersource in their newly created Managed Hosting division.&nbsp; The work is standard Sysadmin stuff,with a lot of PCI and security compliance issues.&nbsp; Right up...]]></summary>
    <author>
        <name>Mark Farver</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://mindbent.org/">
        <![CDATA[Been a while since I posted.&nbsp; I was hired in late April for a position with Cybersource in their newly created Managed Hosting division.&nbsp; The work is standard Sysadmin stuff,with a lot of PCI and security compliance issues.&nbsp; Right up my alley, basically.&nbsp; Only two months without a job is pretty fortunate compared to a lot of other people in the current economic climate.&nbsp; We have a major go live in a few days, and I'm having to learn JBoss and Java on the fly.&nbsp; It is keeping me pretty busy.<br /><br />Sean installed a ceiling fan today, which involved a lot of struggling in the attic to replace the junction box with one rated to carry the weight of the fan.&nbsp; It got me thinking about all of the things "I would have done differently," so I wrote them down in a "<a href="http://mindbent.org/rough-in-tips-for-geeks.html">Rough in for Geeks</a>" article.&nbsp; The fan itself is a Windward III from Hampton Bay.&nbsp; We have Windward II in a few other rooms of the house and have been very pleased with them so far.&nbsp; They feature a simple white design, and a really nice integrated compact fluorescent lamp.&nbsp; The III appears to add another lamp on the top side of the fan, which should be very nice.&nbsp; The cost is higher than average at $150 from Home Depot, but the quality of the unit makes it well worth the price.<br /><br /> ]]>
        
    </content>
</entry>

<entry>
    <title>CANbus timings on Microchip 18F processors</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/2009/04/canbus-timings-on-microchip-18f-processors.html" />
    <id>tag:mindbent.org,2009://1.12</id>

    <published>2009-04-15T16:37:39Z</published>
    <updated>2009-04-15T17:13:27Z</updated>

    <summary><![CDATA[We've been using Microchip's 18F2580 and 18F4580 processors for most of our CAN projects.&nbsp; They are readily available and have the CAN protocol module already on board.&nbsp; Connect the processor to an Automotive CAN transceiver like the NXP PCA82C251 and...]]></summary>
    <author>
        <name>Mark Farver</name>
        
    </author>
    
    <category term="microchipcanrevolt" label="Microchip CAN REVOLT" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-US" xml:base="http://mindbent.org/">
        <![CDATA[We've been using <a href="http://ww1.microchip.com/downloads/en/DeviceDoc/39637c.pdf">Microchip's 18F2580 and 18F4580</a> processors for most of our CAN projects.&nbsp; They are readily available and have the CAN protocol module already on board.&nbsp; Connect the processor to an Automotive CAN transceiver like the NXP <a href="http://www.semiconductors.com/acrobat/datasheets/PCA82C251_3.pdf">PCA82C251</a> and you have a quick solution. &nbsp;&nbsp; I was forced into using CAN when we built a replacement PCM for REVOLT's Mazda 3 project and have become a convert.&nbsp; CAN is pretty easy to use, and seems to work quite well even in very noisy environments.&nbsp; <br /><br />The biggest challenge of using CAN is getting all of the timings right for the bus speed you are using.&nbsp; There are a couple registers that have to be set just right.&nbsp; In Microchip this is the BRP (Baud Rate Prescaler), SYNC, PHSEG1 and PHSEG2, and PROPSEG.&nbsp; The latter values are summed to find out how many (scaled) clock cycles makes one bit.&nbsp; For some reason Microchip likes giving all of its equations backwards.&nbsp; The equations explain how to calculate the bus speed based on the register values.&nbsp; Most designers want the other way, they know the bus speed they want, and need to solve for the register values.&nbsp; Its a pain.<br /><br />The good news is other people have suffered the same pain, and some of them wrote tools to help with the calculations.&nbsp; The best I've found for CAN so far is from <a href="http://www.intrepidcs.com/">Intrepid Control Systems</a>.&nbsp; Their <a href="http://www.intrepidsupport.com/mbtime.htm">Microchip Controller Area Network (CAN) Bit Timing Calculator</a> makes it easy. Give it the clock speed and CANbus speed and it will show you all of the possible BRP values.&nbsp; Then it will show you what values to fill in for the remaining registers for each possible BRP value.&nbsp; <br />]]>
        
    </content>
</entry>

<entry>
    <title>Another Disaster Recovery Plan Tip</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/2009/04/another-disaster-recovery-plan-tip.html" />
    <id>tag:mindbent.org,2009://1.10</id>

    <published>2009-04-04T05:26:00Z</published>
    <updated>2009-04-04T05:49:53Z</updated>

    <summary><![CDATA[Here's one that should be in everyone's Disaster Recovery Plan/Operations Manual:&nbsp; What to do and whom to call when the government shows up with a search and seizure warrant.Because of the confiscation of computers at Core IP Networks, a number...]]></summary>
    <author>
        <name>Mark Farver</name>
        
    </author>
    
        <category term="Systems" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="raiddisasterrecoveryoperationsmanuallegal" label="raid &quot;Disaster Recovery&quot; &quot;Operations Manual&quot; legal" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-US" xml:base="http://mindbent.org/">
        <![CDATA[Here's one that should be in everyone's Disaster Recovery Plan/Operations Manual:&nbsp; What to do and whom to call when the government shows up with a search and seizure warrant.<br /><br /><blockquote>Because of the confiscation of computers at Core IP
Networks, a number of legitimate businesses have been affected. <br /><br />
From the downtown office building in the 2300 block of Bryan Street,
FBI agents seized what one source described as millions of dollars in
computer equipment. <br /><br />
Matthew Simpson, the owner of Core IP Networks, said in a letter posted
online that&nbsp;FBI agents raided two floors and 'pulled the plug' on his
clients' web servers starting at 6 o'clock Thursday morning. Agents
also raided Simpson's house in Ovilla.<br /></blockquote>


 <a href="http://cbs11tv.com/local/Core.IP.Networks.2.974706.html">Link</a><br /><br />If you are a co-location or managed services customer and uptime is important to you, don't put all your eggs in one datacenter, and have a good plan on how to fail over.&nbsp; No matter how redundant or what Tier your datacenter provider offers, outages at the datacenter level <a href="http://www.theregister.co.uk/2008/06/01/the_planet_houston_data_center_fire/">still</a> <a href="http://www.datacenterknowledge.com/archives/2007/07/24/generator-failures-caused-365-main-outage/">happen</a>.<br /><br />My advice (INAL, and I know nothing about the legal issues)... If you are providing a shared resource to customers, either datacenter space, bandwidth services or shared hosting have a plan for dealing with search warrents.&nbsp; It seems most will be polite requests during business hours but some may not.&nbsp; You don't want your on-site tech trying to decide if he should allow the police in the door.&nbsp; Make sure Operations has on call access to Legal, or knows someone high enough who can reach legal services in time.&nbsp; &nbsp; <br /><br />On another note...I do hope Simpson is not the focus of the investigation solely because his name is on the IP allocation. <br />]]>
        
    </content>
</entry>

<entry>
    <title>Cookies a&apos; rising</title>
    <link rel="alternate" type="text/html" href="http://mindbent.org/2009/04/cookies-arising.html" />
    <id>tag:mindbent.org,2009://1.9</id>

    <published>2009-04-02T20:37:30Z</published>
    <updated>2009-04-02T20:47:05Z</updated>

    <summary><![CDATA[Looking back at my posts so far, it doesn't seem like I've settled on any particular topic for my blog.&nbsp; So I'll stick to telling what I learned yesterday.Try using Baking Powder instead of Baking Soda in the standard Toll...]]></summary>
    <author>
        <name>Mark Farver</name>
        
    </author>
    
        <category term="Misc" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="bakingcookies" label="baking cookies" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en-US" xml:base="http://mindbent.org/">
        <![CDATA[Looking back at my posts so far, it doesn't seem like I've settled on any particular topic for my blog.&nbsp; So I'll stick to telling what I learned yesterday.<br /><br />Try using Baking Powder instead of Baking Soda in the standard Toll House cookie recipe.&nbsp; The cookies end up puffier and don't seem to spread out as much.&nbsp; Don't try substituting white sugar for some or all of the brown sugar.&nbsp; The brown sugar helps the flavor a lot.&nbsp; <br /><br />My wife took some <a href="http://hobbit-max.livejournal.com/11578.html">pictures and video</a> of my son trying to help.<br /> ]]>
        
    </content>
</entry>

</feed>
