<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Programming on zacharyc</title>
    <link>https://www.zacharyc.com/categories/programming/</link>
    <description>Recent content in Programming on zacharyc</description>
    <image>
      <title>zacharyc</title>
      <url>https://www.zacharyc.com/papermod-cover.png</url>
      <link>https://www.zacharyc.com/</link>
    </image>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Mon, 30 Jan 2023 15:27:02 -0500</lastBuildDate>
    <atom:link href="https://www.zacharyc.com/categories/programming/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Documentation Formats</title>
      <link>https://www.zacharyc.com/2023/01/30/documentation-formats/</link>
      <pubDate>Mon, 30 Jan 2023 15:27:02 -0500</pubDate>
      <guid>https://www.zacharyc.com/2023/01/30/documentation-formats/</guid>
      <description>&lt;p&gt;Life is full of things to catalog, especially for someone like me. Someone who loves organization in data and looking for patterns. Someone who is convinced that the random things in my life will probably come together someday like the unification theory. But how? How does one sort, contain, and search data?&lt;/p&gt;
&lt;p&gt;The first step is recording the data. There are many ways to do this. Databases have traditionally been a great way. NoSQL databases with their loose document format are interesting. The second brain methodology uses documents or notes to contain the same thing. And while these documents can be formatted in things like Markdown and have front matter for categorization, much of the data is contained in the raw text which means a human has to parse and read it.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Life is full of things to catalog, especially for someone like me. Someone who loves organization in data and looking for patterns. Someone who is convinced that the random things in my life will probably come together someday like the unification theory. But how? How does one sort, contain, and search data?</p>
<p>The first step is recording the data. There are many ways to do this. Databases have traditionally been a great way. NoSQL databases with their loose document format are interesting. The second brain methodology uses documents or notes to contain the same thing. And while these documents can be formatted in things like Markdown and have front matter for categorization, much of the data is contained in the raw text which means a human has to parse and read it.</p>
<p>Before you expect this post to come to some epic realization, tl;dr; I still don’t have one. This post is about the methods out there I’m considering for sorting my life.</p>
<h4 id="option-1-sql">Option 1: SQL</h4>
<p>I’m not a fan of no SQL databases. From my point of view, if you are going to create data to exist in a place that is typed, loose document formats make comparing and reading things hard. So structured data is better, hence SQL.</p>
<p><strong>Pros:</strong></p>
<ul>
<li>The data is structured from the start</li>
<li>There are many different options for which SQL platform to use and many of them are interchangeable so there are options.</li>
<li>Things like normalization define best practices for working with something like this, so you don’t have to develop them yourself.</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li>You need to run a server somewhere.</li>
<li>It is not easily human decodable.</li>
<li>You need to learn to use SQL to really be successful and joins are fun (and hard).</li>
<li>Because structure is required you have to define it up front.</li>
</ul>
<h4 id="option-2-markdown">Option 2: Markdown</h4>
<p>This is honestly what I’m currently using in my second brain with Obsidian. This may be the best of all worlds. It has the notion of storing structured data in front matter, and throughout the document with special tags. Much of the document remains readable in sentences, but it is in loose format and you have to create and maintain your own formatting standards.</p>
<p><strong>Pros:</strong></p>
<ul>
<li>Format is loose so you don’t need to stress about it.</li>
<li>Much of the notes are human-readable.</li>
<li>There are many tools to convert markdown to the web for sharing.</li>
<li>Cost of starting is very low.</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li>Because the format is loose, the responsibility lies on the creator to maintain the structure desired.</li>
<li>The organization of individual documents is also important.</li>
<li>Search is only as good as you are at searching and remembering.</li>
<li>It’s easy to end up with a mess of documents.</li>
</ul>
<p><strong>Option 3: Stricter document format</strong></p>
<p>This category contains things similar to markdown but with more structure. This category fits things like JSON, YAML, and TOML. This is following the Pragramtic Programmer guideline of storing things in the text but putting some structure behind it. Some of these formats are more readable than others.</p>
<p><strong>Pros:</strong></p>
<ul>
<li>Easily computer parsable.</li>
<li>More human-readable than a SQL database</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li>No official typing.</li>
<li>Need to use a validator to confirm you have a valid document.</li>
<li>Nothing requires the structure like a SQL Table so searching could be difficult.</li>
</ul>
<h2 id="summation">Summation</h2>
<p>I don’t have a conclusion. I’m still thinking, but these are interesting options of how to start really putting the data together. Our lives are full of data, it’s a shame when it gets lost or mislabeled or put in a place where we can’t find it. Hopefully, I’ll start putting together something more useful.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Dabbling in Swift</title>
      <link>https://www.zacharyc.com/2022/12/26/dabbling-in-swift/</link>
      <pubDate>Mon, 26 Dec 2022 01:33:04 -0500</pubDate>
      <guid>https://www.zacharyc.com/2022/12/26/dabbling-in-swift/</guid>
      <description>&lt;p&gt;For many years of my life I was an iOS Programmer. I worked in Objective-C, but Swift came out while I was working transitioning out of that area. Swift has always been a bit confusing for me, but I have a new complaint today. The amount of changes in Swift has caused a lot of online code to be out of date, and hard to parse.&lt;/p&gt;
&lt;p&gt;The problem. I’m looking at my address book and I want to iterate through my contacts. I started by looking at &lt;code&gt;ABAddressBook&lt;/code&gt;, but it turns out that technology has been depricated. Then I started looking at &lt;code&gt;CNContactStore&lt;/code&gt; which is the new hotness. There are several fun methods on that object including &lt;code&gt;unifiedMeContactWithKeys&lt;/code&gt; which is pretty cool. It only returns my contact, not all contacts, but at least I was able to get it work. There is a similar function called&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>For many years of my life I was an iOS Programmer. I worked in Objective-C, but Swift came out while I was working transitioning out of that area. Swift has always been a bit confusing for me, but I have a new complaint today. The amount of changes in Swift has caused a lot of online code to be out of date, and hard to parse.</p>
<p>The problem. I’m looking at my address book and I want to iterate through my contacts. I started by looking at <code>ABAddressBook</code>, but it turns out that technology has been depricated. Then I started looking at <code>CNContactStore</code> which is the new hotness. There are several fun methods on that object including <code>unifiedMeContactWithKeys</code> which is pretty cool. It only returns my contact, not all contacts, but at least I was able to get it work. There is a similar function called</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-swift" data-lang="swift"><span class="line"><span class="cl"><span class="kd">func</span> <span class="nf">unifiedContacts</span><span class="p">(</span><span class="n">matching</span> <span class="n">predicate</span><span class="p">:</span> <span class="n">NSPredicate</span><span class="p">,</span> <span class="n">keysToFetch</span> <span class="n">keys</span><span class="p">:</span> <span class="p">[</span><span class="n">CNKeyDescriptor</span><span class="p">])</span> <span class="kr">throws</span> <span class="p">-&gt;</span> <span class="p">[</span><span class="n">CNContact</span><span class="p">]</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>You try to pass in the truthy predicate and it rejects it. You need to actually use the</p>
<p><code>enumerateContacts()</code> method. Some examples mix strings and other types with keys and that causes problems. Just using a list of Keys worked. Here is the final code that worked:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span><span class="lnt">20
</span><span class="lnt">21
</span><span class="lnt">22
</span><span class="lnt">23
</span><span class="lnt">24
</span><span class="lnt">25
</span><span class="lnt">26
</span><span class="lnt">27
</span><span class="lnt">28
</span><span class="lnt">29
</span><span class="lnt">30
</span><span class="lnt">31
</span><span class="lnt">32
</span><span class="lnt">33
</span><span class="lnt">34
</span><span class="lnt">35
</span><span class="lnt">36
</span><span class="lnt">37
</span><span class="lnt">38
</span><span class="lnt">39
</span><span class="lnt">40
</span><span class="lnt">41
</span><span class="lnt">42
</span><span class="lnt">43
</span><span class="lnt">44
</span><span class="lnt">45
</span><span class="lnt">46
</span><span class="lnt">47
</span><span class="lnt">48
</span><span class="lnt">49
</span><span class="lnt">50
</span><span class="lnt">51
</span><span class="lnt">52
</span><span class="lnt">53
</span><span class="lnt">54
</span><span class="lnt">55
</span><span class="lnt">56
</span><span class="lnt">57
</span><span class="lnt">58
</span><span class="lnt">59
</span><span class="lnt">60
</span><span class="lnt">61
</span><span class="lnt">62
</span><span class="lnt">63
</span><span class="lnt">64
</span><span class="lnt">65
</span><span class="lnt">66
</span><span class="lnt">67
</span><span class="lnt">68
</span><span class="lnt">69
</span><span class="lnt">70
</span><span class="lnt">71
</span><span class="lnt">72
</span><span class="lnt">73
</span><span class="lnt">74
</span><span class="lnt">75
</span><span class="lnt">76
</span><span class="lnt">77
</span><span class="lnt">78
</span><span class="lnt">79
</span><span class="lnt">80
</span><span class="lnt">81
</span><span class="lnt">82
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-swift" data-lang="swift"><span class="line"><span class="cl"><span class="c1">//</span>
</span></span><span class="line"><span class="cl"><span class="c1">//  main.swift</span>
</span></span><span class="line"><span class="cl"><span class="c1">//  contactsexport</span>
</span></span><span class="line"><span class="cl"><span class="c1">//</span>
</span></span><span class="line"><span class="cl"><span class="c1">//  Created by Zachary Cohen on 12/23/22.</span>
</span></span><span class="line"><span class="cl"><span class="c1">//</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">import</span> <span class="nc">Foundation</span>
</span></span><span class="line"><span class="cl"><span class="kd">import</span> <span class="nc">AddressBook</span>
</span></span><span class="line"><span class="cl"><span class="kd">import</span> <span class="nc">Contacts</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="bp">print</span><span class="p">(</span><span class="s">&#34;Hello, welcome to the AddressBook Scraper&#34;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">var</span> <span class="nv">store</span> <span class="p">=</span> <span class="n">CNContactStore</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">store</span><span class="p">.</span><span class="n">requestAccess</span><span class="p">(</span><span class="k">for</span><span class="p">:</span> <span class="p">.</span><span class="n">contacts</span><span class="p">,</span> <span class="n">completionHandler</span><span class="p">:</span> <span class="p">{</span> <span class="p">(</span><span class="n">access</span><span class="p">,</span> <span class="n">accessError</span><span class="p">)</span> <span class="p">-&gt;</span> <span class="nb">Void</span> <span class="k">in</span>
</span></span><span class="line"><span class="cl">    <span class="k">if</span> <span class="n">access</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">        <span class="bp">print</span><span class="p">(</span><span class="s">&#34;access granted&#34;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">        <span class="bp">print</span><span class="p">(</span><span class="n">access</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="cl">    <span class="k">else</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">        <span class="bp">print</span><span class="p">(</span><span class="s">&#34;access denied&#34;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">let</span> <span class="nv">nameKeys</span> <span class="p">=</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactNamePrefixKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactGivenNameKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactMiddleNameKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactFamilyNameKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactNameSuffixKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="p">]</span> <span class="k">as</span> <span class="p">[</span><span class="n">CNKeyDescriptor</span><span class="p">]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">let</span> <span class="nv">allContactKeys</span> <span class="p">=</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactNamePrefixKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactGivenNameKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactMiddleNameKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactFamilyNameKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactNameSuffixKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactOrganizationNameKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactDepartmentNameKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactJobTitleKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactBirthdayKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactNicknameKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactNoteKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactNonGregorianBirthdayKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactPreviousFamilyNameKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactPhoneticGivenNameKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactPhoneticMiddleNameKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactPhoneticFamilyNameKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactImageDataKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactThumbnailImageDataKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactImageDataAvailableKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactTypeKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactPhoneNumbersKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactEmailAddressesKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactPostalAddressesKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactDatesKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactUrlAddressesKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactRelationsKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactSocialProfilesKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="n">CNContactInstantMessageAddressesKey</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="p">]</span> <span class="k">as</span> <span class="p">[</span><span class="n">CNKeyDescriptor</span><span class="p">]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">do</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="kd">let</span> <span class="nv">contactStore</span> <span class="p">=</span> <span class="n">CNContactStore</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">    <span class="kd">let</span> <span class="nv">me</span> <span class="p">=</span> <span class="k">try</span> <span class="n">contactStore</span><span class="p">.</span><span class="n">unifiedMeContactWithKeys</span><span class="p">(</span><span class="n">toFetch</span><span class="p">:</span> <span class="n">nameKeys</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span> <span class="k">catch</span> <span class="kd">let</span> <span class="nv">error</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="bp">print</span><span class="p">(</span><span class="s">&#34;Failed to retreive Me contact: </span><span class="si">\(</span><span class="n">error</span><span class="si">)</span><span class="s">&#34;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">do</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="kd">let</span> <span class="nv">contactStore</span> <span class="p">=</span> <span class="n">CNContactStore</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">    <span class="kd">let</span> <span class="nv">fetchRequest</span> <span class="p">=</span> <span class="n">CNContactFetchRequest</span><span class="p">(</span><span class="n">keysToFetch</span><span class="p">:</span> <span class="n">allContactKeys</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">    <span class="k">try</span> <span class="n">contactStore</span><span class="p">.</span><span class="n">enumerateContacts</span><span class="p">(</span><span class="n">with</span><span class="p">:</span> <span class="n">fetchRequest</span><span class="p">)</span> <span class="p">{</span> <span class="n">con</span><span class="p">,</span> <span class="n">response</span> <span class="k">in</span>
</span></span><span class="line"><span class="cl">        <span class="bp">print</span><span class="p">(</span><span class="n">con</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span> <span class="k">catch</span> <span class="kd">let</span> <span class="nv">error</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="bp">print</span><span class="p">(</span><span class="s">&#34;Failed to retreive Me contact: </span><span class="si">\(</span><span class="n">error</span><span class="si">)</span><span class="s">&#34;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>I’m still working on the project and there is bunch more to do this, but this is a start and figured it was worth putting out there.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Building Apps In Airkit</title>
      <link>https://www.zacharyc.com/2022/08/04/building-apps-in-airkit/</link>
      <pubDate>Thu, 04 Aug 2022 23:47:44 -0400</pubDate>
      <guid>https://www.zacharyc.com/2022/08/04/building-apps-in-airkit/</guid>
      <description>&lt;p&gt;I work for &lt;a href=&#34;https://www.airkit.com&#34;&gt;Airkit&lt;/a&gt;. I’m technically a Solutions Engineer but have done a bunch of building and education for the product as well. While the company has a bunch of documentation about how to use each tool, I figured I’d write quickly about how I build an Airkit App, what some of my practices are, and generally how I go about things.&lt;/p&gt;
&lt;h2 id=&#34;start-with-the-ui&#34;&gt;Start with the UI&lt;/h2&gt;
&lt;p&gt;My first big tip is to start by creating the UI. One of the greatest things about Airkit is its ability to rapidly prototype interaction with your end users. Create the app quickly and show it to users. Often there are use cases that are missed when initially thinking about a project and this rapid prototyping brings them out.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I work for <a href="https://www.airkit.com">Airkit</a>. I’m technically a Solutions Engineer but have done a bunch of building and education for the product as well. While the company has a bunch of documentation about how to use each tool, I figured I’d write quickly about how I build an Airkit App, what some of my practices are, and generally how I go about things.</p>
<h2 id="start-with-the-ui">Start with the UI</h2>
<p>My first big tip is to start by creating the UI. One of the greatest things about Airkit is its ability to rapidly prototype interaction with your end users. Create the app quickly and show it to users. Often there are use cases that are missed when initially thinking about a project and this rapid prototyping brings them out.</p>
<h2 id="variables-and-types">Variables and Types</h2>
<p>Create types for your complex object. If the data is going to be stored in AirData, then I create an AirData object, but Custom Types are good to explain what you expect the data to look like. Knowing the format of your data is helpful when using it to fill in form details data ops.</p>
<p>Naming is also important. Tables are capitalized where as instance variables are lower snake case. Profile constants can be capitalized snake case. Following this convention will make things clearer to read, but is not enforced by the platform. It is useful for understanding how variables are used across the app.</p>
<p>Scoping of variables is also important. In general, the goal is to minimize the scope of variables as low as possible to allow for more reuse of your components. That means if it is possible keep your variable on a web page then do, because it will come when you copy and paste the page. If you move it up to the flow level you will need to copy the entire flow together to have access to the variable. The downside of keeping everything at the page level is that you might end up passing it in to a bunch of pages, which is also not good. That is the trade off.</p>
<p>Also of note, because of some legacy notions, variable scopes are a little confusing:</p>
<table>
  <thead>
      <tr>
          <th><strong>Web Builder</strong> <strong>Concept</strong></th>
          <th><strong>Variable Scope</strong></th>
          <th><strong>Notes</strong></th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Journey</td>
          <td>Session</td>
          <td>This is available anywhere in the runtime, but must be passed into data flows.</td>
      </tr>
      <tr>
          <td>Web Flow</td>
          <td>Activity Group</td>
          <td>An activity group is available for all the web pages and actions on the flow.</td>
      </tr>
      <tr>
          <td>Web Page</td>
          <td>Activity</td>
          <td>Available only in the context of the web page.</td>
      </tr>
  </tbody>
</table>
<h2 id="variants-and-themes">Variants and Themes</h2>
<p>While each individual element has its style properties in the web builders inspector, the best practice is to store things on variants for each type. Even if the variant is only used once. This gives clear intention to the way you are styling each component and all styles can be managed directly through Theme Builder. It allows them to be reused as well.</p>
<h2 id="getting-help">Getting Help</h2>
<p>There are plenty of ways to get help with Airkit. Start with the <a href="https://support.airkit.com">support site</a> and if you can’t find the answer there you can always post a question on the <a href="https://community.airkit.com">community board</a>. If that doesn’t work you can send an email to <a href="mailto:support@airkit.com">support@airkit.com</a>.</p>
]]></content:encoded>
    </item>
    <item>
      <title>HTML Email</title>
      <link>https://www.zacharyc.com/2021/10/03/html-email/</link>
      <pubDate>Sun, 03 Oct 2021 13:33:24 -0400</pubDate>
      <guid>https://www.zacharyc.com/2021/10/03/html-email/</guid>
      <description>&lt;p&gt;What some of you may not know is that much of the time at Salesforce was spent in the world of electronic mail (or email for short). Email is interesting and relevant today because almost everyone has it and communicates with it. It is an official form of communication.&lt;/p&gt;
&lt;p&gt;What you may not understand is that the world of email is rather confusing. Basically, the email that comes over the wire is presented to you by your email client and where email gets very confusing is that there are a million different email clients. You probably use more than one. If you look at your email on a mobile device and on a computer that is two different clients. Then when you think about 3rd party clients and even GMail which renders in a browser, you have a client which is actually a client within a browser.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>What some of you may not know is that much of the time at Salesforce was spent in the world of electronic mail (or email for short). Email is interesting and relevant today because almost everyone has it and communicates with it. It is an official form of communication.</p>
<p>What you may not understand is that the world of email is rather confusing. Basically, the email that comes over the wire is presented to you by your email client and where email gets very confusing is that there are a million different email clients. You probably use more than one. If you look at your email on a mobile device and on a computer that is two different clients. Then when you think about 3rd party clients and even GMail which renders in a browser, you have a client which is actually a client within a browser.</p>
<p>Because of the various numbers of email clients and security concerns, while the web has advanced, email was still written and styled like the early 2000s web. This means table layouts, no real stylesheets, and things like the <strong>center</strong> tag from way back in the day.</p>
<p>When I left Salesforce, I was hoping that my email wondering days were behind me. Well, for the most part, they are, but one common thing our clients need is to send emails to their clients. Bringing me back to writing stylized email HTML like the 2000s in table layouts.</p>
<p>Despite being very forward-thinking when it was first created, Gmail is usually the hardest client to style for. It’s not really their fault. They are presenting your email in a web browser and they have to be secure on their side of things. I don’t begrudge them thinking about branding and security. Still, things are starting to change and Gmail is now supporting some new things:</p>
<ul>
<li><a href="https://developers.google.com/gmail/design/css#example">CSS Support</a></li>
<li><a href="https://developers.google.com/gmail/markup/reference/schema-org-proposals">Schema.org Proposals</a></li>
</ul>
<p>Gmail isn’t the only client, though. Because of this, much of the email stuff is still being done with tables. This is pretty challenging for those of us who have spent a bunch of time learning to do things right in CSS (though, to be fair, I’m not the best at CSS).</p>
<p>The association for me feels a bit like the Cobal programmers who were needed to fix all the old code used before the year 2000. Granted, we have better tools for conversion, but this does feel a little archaic.</p>
<p>A Good resource is:</p>
<p><a href="https://www.udemy.com/course/html-email/">https://www.udemy.com/course/html-email/</a> – a good course on how to work through HTML email.</p>
<p>I’m learning more things as I go through this process. So far, I’ve learned that not all divs are respected and also that you have to use a capital M in margin for outlook. You also cannot use SVGs in email, you must use PNGs. More lessons to come as I dig through this project.</p>
]]></content:encoded>
    </item>
    <item>
      <title>TLog-007 Nitro Morning</title>
      <link>https://www.zacharyc.com/2015/11/13/tlog-007-nitro-morning/</link>
      <pubDate>Fri, 13 Nov 2015 17:53:33 -0500</pubDate>
      <guid>https://www.zacharyc.com/2015/11/13/tlog-007-nitro-morning/</guid>
      <description>&lt;p&gt;&lt;strong&gt;This post was pulled from my TLog project, but it felt relevant enough to make it to this blog as well. Some interesting stuff about reading and writing code.&lt;/strong&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;I’m trying the Nitro Cold Brew coffee from Stumptown that they just started carrying at Planet Granite. It is tasty, but I like the regular cold brew better and will be sticking to that in the future. Still, I do love coffee.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><strong>This post was pulled from my TLog project, but it felt relevant enough to make it to this blog as well. Some interesting stuff about reading and writing code.</strong></p>
<hr>
<p>I’m trying the Nitro Cold Brew coffee from Stumptown that they just started carrying at Planet Granite. It is tasty, but I like the regular cold brew better and will be sticking to that in the future. Still, I do love coffee.</p>
<h2 id="grateful-list">Grateful List</h2>
<p>I was listening to a podcast the other day, I believe it was <a href="http://findingmastery.net">Finding Mastery</a> with <a href="http://findingmastery.net/ariana-kukors/">Ariana Kukors: Swim</a>. And they were talking about gratitude practice. The part that really stuck with me was that practicing happiness is really hard. Being happy is a by-product of the world around and the best way to approach getting that feeling may be through practicing gratitude. I’m going to try and say three things I’m grateful for each day.</p>
<ol>
<li>I’m so grateful that we as humans discovered coffee. It has a profound effect on my life and while I only drink about 2 cups a day, I love it.</li>
<li>I’m grateful that I can afford to take as many pictures as I do now. I love photography and there was point when I was in college when I felt like it was too expensive. Thankfully I can now afford great gear and enjoy using it.</li>
<li>I’m very grateful for my climbing community. Yes, I don’t see as many of them as much as I used to, but I love having a second home at the climbing gym. It is more adult that my cheer community (not that I don’t appreciate that as well), and much closer to my house.</li>
</ol>
<h2 id="reading-code">Reading Code</h2>
<p>I spend a lot of my time reading objective-c code for work. Reading the basic syntax is pretty easy, but understanding what is going on in someone else’s code has always been relatively difficult for me. I’m not sure how everyone else does it, but the way I tend to read code is to go through a live example of the code and see how variables are manipulated. I like to track a path from a point I understand to a point I need to discover. The larger the piece of the code the harder it is for me discover the flow and the process.</p>
<p>The best analogy I have to this process outside of code is my attempt to read the Odyssey. I moved around a lot as kid and didn’t get to read greek theology in school. I have tried to pick up post school, but understanding the Odyssey or the Illiad has been very hard for me. I can read the words and understand the basics of what’s happening, but I’m not sure I can see the forest through the trees. When you are in class, you have a teacher and class to discuss the book with. The concepts in the book are discussed and you collectively discover what is going on.</p>
<p>When reading code, the teacher/class is akin to being able to talk to developer who originally wrote the code. Sometimes they are sitting right next to you. Sometimes they are downstairs or close by. Sometimes they are phone call or email away. Sometimes there are cliff notes in the form of a really good tutorial or ReadMe. Most of the time, though, you just have figure it out on your own. If the code is written using some common conventions (like a restful api, or common design pattern), it can be easier. Sometimes the code is all over the place and impossible to discover.</p>
<p>Yesterday I was working on understanding <a href="https://github.com/MortimerGoro/MGSwipeTableCell">MGSwipeTableCell</a>. It’s a pretty well built piece of code, but still rather confusing to figure out for me. I figured out what I needed to, but only after a couple hours of debugging. I wish I had done a better job reading the original piece of code from the beginning.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Custom UITableViewCell Layout</title>
      <link>https://www.zacharyc.com/2013/12/27/custom-uitableviewcell-layout/</link>
      <pubDate>Fri, 27 Dec 2013 02:45:42 -0500</pubDate>
      <guid>https://www.zacharyc.com/2013/12/27/custom-uitableviewcell-layout/</guid>
      <description>&lt;p&gt;At work we were trying to create a custom UITableViewCell. We wanted something that looked like this:&lt;br&gt;
&lt;a href=&#34;https://www.zacharyc.com/assets/img/2013/12/photo.png?ssl=1&#34;&gt;&lt;img alt=&#34;tip cell&#34; loading=&#34;lazy&#34; src=&#34;https://www.zacharyc.com/assets/img/2013/12/photo.png?resize=540%2C160&amp;ssl=1&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here are some of the factors that made this problem more difficult:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Our one custom cell was in a UITableView of regular cells&lt;/li&gt;
&lt;li&gt;The fonts for each of the items in the cell were pretty consistent with the rest of the table view&lt;/li&gt;
&lt;li&gt;Like every other cell, we wanted to it to be indented based on &lt;code&gt;cell.separatorInset&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I looked at several ways to approach this. I tried using a custom table view. I tried subclassing a UITableViewCell. I finally landed on trying to override the &lt;code&gt;tableView:willDisplayCell:forRowAtIndexPath:&lt;/code&gt; and it is worth explaining why.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>At work we were trying to create a custom UITableViewCell. We wanted something that looked like this:<br>
<a href="https://www.zacharyc.com/assets/img/2013/12/photo.png?ssl=1"><img alt="tip cell" loading="lazy" src="https://www.zacharyc.com/assets/img/2013/12/photo.png?resize=540%2C160&ssl=1"></a></p>
<p>Here are some of the factors that made this problem more difficult:</p>
<ul>
<li>Our one custom cell was in a UITableView of regular cells</li>
<li>The fonts for each of the items in the cell were pretty consistent with the rest of the table view</li>
<li>Like every other cell, we wanted to it to be indented based on <code>cell.separatorInset</code></li>
</ul>
<p>I looked at several ways to approach this. I tried using a custom table view. I tried subclassing a UITableViewCell. I finally landed on trying to override the <code>tableView:willDisplayCell:forRowAtIndexPath:</code> and it is worth explaining why.</p>
<p>First approach was getting a custom view in place. I turned this approach down because my view really wasn’t that custom. It was actually a tablevViewCell. It actually looked remarkably close to a standard table view cell. It had a text (in this case an NSAttributedLabel), and a detail text (the amount). Putting in a custom view would have required hard coding the layout to match the rest of the cells in the table and that seemed wrong. I also ran into a bit of confusion around getting my separator to be the correct size.</p>
<p>Then I tried subclassing the UITableViewCell. I know subclassing is frowned upon, but I only wanted to override <code>layoutSubviews</code>. I took the accessory view and tried and moved it to an offset of the tip label. I ran into a problem where the textLabel and detailTextLabel font color was being set to gray by the fact that I had userInteractionEnabled set to NO. If that sounds crazy, it should. Here’s a picture of what I saw:</p>
<p><a href="https://www.zacharyc.com/assets/img/2013/12/cell.png?ssl=1"><img alt="cell" loading="lazy" src="https://www.zacharyc.com/assets/img/2013/12/cell.png?resize=500%2C73&ssl=1"></a></p>
<p>After overriding UILabel and trying to see who was calling setColor on it, I came up with nothing useful. This felt like the wrong approach.</p>
<p>Lastly, I looked at <code>tableView:willDisplayCell:forRowAtIndexPath:</code>. When you first get into this method, the cell’s subviews frames have yet to be calculated. I called <code>[cell layoutSubviews];</code> which is costly, but get the dimensions I needed. Inserting the the editView after the label is then simple math. Here is what the code roughly looks like.</p>
<p><a href="https://gist.github.com/zacharyc/8141791">Gist</a></p>
<p>The downsides of this approach is the double rendering of the cell, but the benefit is that we get to keep our cell as close to factory as possible. In our case, we have one custom drawn cell on the page, so the performance doesn’t take that big of a hit.</p>
<p>There are other approaches to this problem, namely <a href="https://github.com/jordanekay/Mensa">Mensa Smart Tables</a>, but including another library seemed like overkill for what we needed.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Screening The Past</title>
      <link>https://www.zacharyc.com/2013/11/28/screening-the-past/</link>
      <pubDate>Thu, 28 Nov 2013 00:03:01 -0500</pubDate>
      <guid>https://www.zacharyc.com/2013/11/28/screening-the-past/</guid>
      <description>&lt;p&gt;It’s been over a year since I left my roll at Motorola working with a team of very talented web developers on &lt;a href=&#34;http://montagejs.org/&#34;&gt;Montage&lt;/a&gt;. During my time with that group I worked on a side project for automated testing called “Screening”. I wrote a couple of posts (or at least one post) about chromedriver which we used to power screening. Still, one of the big personal accomplishments for me during that time was being published at Ars Technica. I was one of three authors on a post about the tools we were working on. The project has since been abandoned, but you can read about it &lt;a href=&#34;http://arstechnica.com/information-technology/2012/07/ninja-power-open-source-html5-toolset-hopes-to-unleash-the-web/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>It’s been over a year since I left my roll at Motorola working with a team of very talented web developers on <a href="http://montagejs.org/">Montage</a>. During my time with that group I worked on a side project for automated testing called “Screening”. I wrote a couple of posts (or at least one post) about chromedriver which we used to power screening. Still, one of the big personal accomplishments for me during that time was being published at Ars Technica. I was one of three authors on a post about the tools we were working on. The project has since been abandoned, but you can read about it <a href="http://arstechnica.com/information-technology/2012/07/ninja-power-open-source-html5-toolset-hopes-to-unleash-the-web/">here</a>.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Properties in C#</title>
      <link>https://www.zacharyc.com/2011/03/02/properties-in-c/</link>
      <pubDate>Wed, 02 Mar 2011 20:00:29 -0500</pubDate>
      <guid>https://www.zacharyc.com/2011/03/02/properties-in-c/</guid>
      <description>&lt;p&gt;I’m a new C# programmer. I’m using it for a project at work. Doing an ASP.NET MVC project. So far I’ve been very happy with the language. It has some nice stuff built in. ASP.NET MVC is pretty nice too. It’s almost as easy to use as rails. So, all in all, I’m pretty happy, but today I ran into something stupid.&lt;/p&gt;
&lt;p&gt;I have a method that is trying to do a &lt;code&gt;TryUpdateModel(model, new[] {&amp;quot;prop1&amp;quot;, &amp;quot;prop2&amp;quot;});&lt;/code&gt; call and my model wasn’t getting updated. I checked out the associated FormCollection and sure enough my values were in it. The problem was in how I was defining my model.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I’m a new C# programmer. I’m using it for a project at work. Doing an ASP.NET MVC project. So far I’ve been very happy with the language. It has some nice stuff built in. ASP.NET MVC is pretty nice too. It’s almost as easy to use as rails. So, all in all, I’m pretty happy, but today I ran into something stupid.</p>
<p>I have a method that is trying to do a <code>TryUpdateModel(model, new[] {&quot;prop1&quot;, &quot;prop2&quot;});</code> call and my model wasn’t getting updated. I checked out the associated FormCollection and sure enough my values were in it. The problem was in how I was defining my model.</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">public class MyModel
</span></span><span class="line"><span class="cl">{
</span></span><span class="line"><span class="cl">   public int prop1;
</span></span><span class="line"><span class="cl">   public DateTime prop2;
</span></span><span class="line"><span class="cl">}
</span></span></code></pre></td></tr></table>
</div>
</div><p>Can you see the problem?</p>
<p>It took some digging, but it turns out that prop1 and prop2 as defined above are not properties. They are public members of the class MyModel. In order to be properties you need to assign them getters and setters like so:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">public class MyModel
</span></span><span class="line"><span class="cl">{
</span></span><span class="line"><span class="cl">   public int prop1 { get; set; }
</span></span><span class="line"><span class="cl">   public DateTime prop2 { get; set; }
</span></span><span class="line"><span class="cl">}
</span></span></code></pre></td></tr></table>
</div>
</div><p>My frustration is that prop1 and prop2 from my perspective as a consumer don’t really change with the new definition. It seems weird I should have to do that. I’m a new C# programmer and I totally believe that in 3 months more of working with this language I might become a purist and understand the reason to have these things behave differently, but for someone new to the language this isn’t the most intuitive approach.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Sleeping your Mac with a Microsoft Ergo 4000 Keyboard</title>
      <link>https://www.zacharyc.com/2010/10/25/sleeping-your-mac-with-a-microsoft-ergo-4000-keyboard/</link>
      <pubDate>Mon, 25 Oct 2010 21:27:04 -0400</pubDate>
      <guid>https://www.zacharyc.com/2010/10/25/sleeping-your-mac-with-a-microsoft-ergo-4000-keyboard/</guid>
      <description>&lt;p&gt;One of my friends, who will remain nameless for the purpose of this discussion, convinced me start playing around with a &lt;a href=&#34;http://www.amazon.com/gp/product/B000A6PPOK?ie=UTF8&amp;amp;tag=zacharycohen-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=B000A6PPOK&#34;&gt;Microsoft Natural Ergo Keyboard 4000&lt;/a&gt;&lt;img loading=&#34;lazy&#34; src=&#34;http://www.assoc-amazon.com/e/ir?t=zacharycohen-20&amp;l=as2&amp;o=1&amp;a=B000A6PPOK&#34;&gt;. I got one at work, then I bought one for the home and I’ve been pretty happy with it. There are just a couple of things missing from my standard mac keyboard.&lt;/p&gt;
&lt;p&gt;Firstly, on my old computer, I used to be able to hit the a keyboard combination to get my machine to sleep. I believe it was something like Cmd – Shft – Eject. Well, the Microsoft keyboard doesn’t have Eject. So I’m out of luck there. It does, however, have a set of buttons reserved for favorites. So I decided to code up a little AppleScript and bind it to one of these keys. Here’s the script, and I just saved it as an editable application. Then you can go into the preference pane for the keyboard and assign the whichever key you want to this script. Good luck.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>One of my friends, who will remain nameless for the purpose of this discussion, convinced me start playing around with a <a href="http://www.amazon.com/gp/product/B000A6PPOK?ie=UTF8&amp;tag=zacharycohen-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B000A6PPOK">Microsoft Natural Ergo Keyboard 4000</a><img loading="lazy" src="http://www.assoc-amazon.com/e/ir?t=zacharycohen-20&l=as2&o=1&a=B000A6PPOK">. I got one at work, then I bought one for the home and I’ve been pretty happy with it. There are just a couple of things missing from my standard mac keyboard.</p>
<p>Firstly, on my old computer, I used to be able to hit the a keyboard combination to get my machine to sleep. I believe it was something like Cmd – Shft – Eject. Well, the Microsoft keyboard doesn’t have Eject. So I’m out of luck there. It does, however, have a set of buttons reserved for favorites. So I decided to code up a little AppleScript and bind it to one of these keys. Here’s the script, and I just saved it as an editable application. Then you can go into the preference pane for the keyboard and assign the whichever key you want to this script. Good luck.</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">tell application &#34;finder&#34; sleep
</span></span><span class="line"><span class="cl">end tell
</span></span></code></pre></td></tr></table>
</div>
</div>]]></content:encoded>
    </item>
    <item>
      <title>Support Pastie</title>
      <link>https://www.zacharyc.com/2009/01/02/support-pastie/</link>
      <pubDate>Fri, 02 Jan 2009 16:06:58 -0500</pubDate>
      <guid>https://www.zacharyc.com/2009/01/02/support-pastie/</guid>
      <description>&lt;p&gt;One of the best web apps I’ve ever used: &lt;a href=&#34;http://pastie.org/pastes/new&#34;&gt;Pastie&lt;/a&gt; is doing a casual donation. I’m going into the new year and am trying to really conserve my spending, but if you can afford to toss a few bucks this way, it’s a great cause&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>One of the best web apps I’ve ever used: <a href="http://pastie.org/pastes/new">Pastie</a> is doing a casual donation. I’m going into the new year and am trying to really conserve my spending, but if you can afford to toss a few bucks this way, it’s a great cause</p>
]]></content:encoded>
    </item>
    <item>
      <title>MFC&#39;s Radio Button Hack</title>
      <link>https://www.zacharyc.com/2008/09/04/mfcs-radio-button-hack/</link>
      <pubDate>Thu, 04 Sep 2008 16:15:51 -0400</pubDate>
      <guid>https://www.zacharyc.com/2008/09/04/mfcs-radio-button-hack/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; I am a mac user, but a windows programmer.&lt;/p&gt;
&lt;p&gt;MFC is Microsoft’s old Window framework. Basically it is an object oriented wrapper around the traditional Win32 programming environment presented by Microsoft to help develop windows. Win32 is many years old, and so is MFC. Microsoft’s new frameworks, .NET and WPF (Windows Presentation Framework) are supposedly better than MFC, but I have yet to play with them.&lt;/p&gt;
&lt;p&gt;MFC has tools for many different types of controls, from buttons to dialogs, windows, and menus. MFC allows the user to create the button, override some basic functionality, provide message callbacks and otherwise manipulate the application. Buttons are particularly interesting because the base class for &lt;a href=&#34;http://msdn.microsoft.com/en-us/library/yf1wax6c%28VS.80%29.aspx&#34;&gt;buttons&lt;/a&gt; actually provides a ton of functionality for many different types of buttons. From this one class, you can get push buttons, check boxes, radio buttons, owner draw buttons (the programmer handles the rendering of these buttons), etc.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><strong>Disclaimer:</strong> I am a mac user, but a windows programmer.</p>
<p>MFC is Microsoft’s old Window framework. Basically it is an object oriented wrapper around the traditional Win32 programming environment presented by Microsoft to help develop windows. Win32 is many years old, and so is MFC. Microsoft’s new frameworks, .NET and WPF (Windows Presentation Framework) are supposedly better than MFC, but I have yet to play with them.</p>
<p>MFC has tools for many different types of controls, from buttons to dialogs, windows, and menus. MFC allows the user to create the button, override some basic functionality, provide message callbacks and otherwise manipulate the application. Buttons are particularly interesting because the base class for <a href="http://msdn.microsoft.com/en-us/library/yf1wax6c%28VS.80%29.aspx">buttons</a> actually provides a ton of functionality for many different types of buttons. From this one class, you can get push buttons, check boxes, radio buttons, owner draw buttons (the programmer handles the rendering of these buttons), etc.</p>
<figure aria-describedby="caption-attachment-172" class="wp-caption alignright" id="attachment_172" style="width: 240px">[![A Group of Radio Buttons](/assets/img/2008/09/radiobuttons.png?resize=240%2C105&ssl=1 "Radio Buttons")](/assets/img/2008/09/radiobuttons.png?ssl=1)<figcaption class="wp-caption-text" id="caption-attachment-172">A Group of Radio Buttons</figcaption></figure>
<p>I have several problems with this class design, but today I just want to talk about my gripe with Radio Buttons. The term <a href="http://en.wikipedia.org/wiki/Radio_button">radio button</a> comes from the buttons on old car radios, where only one button could be pushed at any one time. Radio buttons on a computer form, are by definition grouped with other radio buttons so that only one in the group can be selected at any one time. Any time a user selects another button in the group, the previously selected button should become unselected.</p>
<p>Taking this even further, logically, you should only use a radio button in certain situations. You have several options, usually less than 10, and you want the user to select from one of them. You should be able to have a default option set, and this choice should somewhat make sense. This functionality is very similar to a drop down box. In a drop down, you have a bunch of options (please put them in some order), where the user should select only one item. The difference in use between radio and drop downs depends on your application, but in general, you can put more items into a drop down. Drop downs will take up less screen real estate, but not all the choices may be obvious to the user, and sometimes the user may select the first option that seems relevant rather than looking through the whole list. In a radio group, all the options are present at the start.</p>
<p>This brings me to my gripe. MFC radio buttons are just the same as any other CButton. The way you define that a radio button is a radio button is by passing a style flag that is either <code>BS_RADIOBUTTON</code> or <code>BS_AUTORADIOBUTTON</code>. The difference is that auto radio buttons will look to be part of a group. This group is defined by ORing the <code>BS_AUTORADIOBUTTON</code> style with <code>WS_GROUP</code> for the first element of a group. All subsequent radio buttons will be part of that group until you create another <code>WS_GROUP</code>.</p>
<p>This upsets me because radio buttons in a group are associated with the other buttons in that group. They shouldn’t just be loosely coupled like this. It puts a lot more responsibility on the programmer to understand how the grouping is done. If you look at the picture above, you will notice it is from my Mac. In Interface Builder, Apple does not provide you with individual radio buttons, it instead provides an object called a “Radio Group”. This group is a collection of radio buttons that handles all the magic I wish existed in MFC. To be fair, Apple’s implementation is pretty new, they have redefined the way to create code on the Mac no less than 8 years ago with release of OS X. Microsoft’s MFC is much older than that and they have new technologies out there which probably better handle this problem. My issue is simply that I am working with legacy code here, and am incredibly frustrated by the lack of UI thought that went into designing this library in the beginning.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Wanting To Find A Bug</title>
      <link>https://www.zacharyc.com/2008/09/02/wanting-to-find-a-bug/</link>
      <pubDate>Tue, 02 Sep 2008 15:15:30 -0400</pubDate>
      <guid>https://www.zacharyc.com/2008/09/02/wanting-to-find-a-bug/</guid>
      <description>&lt;p&gt;This happened to me last week. Yet another lesson learned. I was working on debugging some code at work. Someone was complaining about some functionality in an element we draw on screen. In order to better diagnose the problem, I wanted to create an example and see if I couldn’t get the problem to reproduce. Not a bad first step.&lt;/p&gt;
&lt;p&gt;The problem was that as I wrote out the code I made a typo on the code I was writing. I wrote something like the following snippet:&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>This happened to me last week. Yet another lesson learned. I was working on debugging some code at work. Someone was complaining about some functionality in an element we draw on screen. In order to better diagnose the problem, I wanted to create an example and see if I couldn’t get the problem to reproduce. Not a bad first step.</p>
<p>The problem was that as I wrote out the code I made a typo on the code I was writing. I wrote something like the following snippet:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span><span class="lnt">6
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">     // ... 
</span></span><span class="line"><span class="cl">     int x = pixels2OtherUnitsX(20);
</span></span><span class="line"><span class="cl">     int y = pixels2OtherUnitsX(23);
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">     // ...
</span></span></code></pre></td></tr></table>
</div>
</div><p>If you look closely you will see that I’m using <code>pixels2OtherUnitsX()</code> in both cases, where I should probably be using <code>pixesl2OtherUnitsY()</code> in the second case. Oops.</p>
<p>What do you know, my image didn’t render correctly on screen. I had recreated the bug that someone said was out there. Now all I had to do was figure out where in our production code the bug was. I spent way too long looking around for the problem.</p>
<p><strong>Lesson</strong> don’t be so blinded by your desire to find a bug you miss one that is right in front of your face.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Why 2 can sometimes equal 1</title>
      <link>https://www.zacharyc.com/2008/08/02/why-2-can-sometimes-equal-1/</link>
      <pubDate>Sat, 02 Aug 2008 15:53:44 -0400</pubDate>
      <guid>https://www.zacharyc.com/2008/08/02/why-2-can-sometimes-equal-1/</guid>
      <description>&lt;p&gt;Ran into a fun situation today where I was writing some code, and I came across an interesting situation in C++. Now, before I get to the end of this post, I’ll give you the punch-line, Developer stupidity.&lt;/p&gt;
&lt;p&gt;So I was working on a exercise where I needed to write some sort of state machine.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;14
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;15
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;16
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;17
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;18
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;19
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;20
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;21
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;22
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;23
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;24
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-gdscript3&#34; data-lang=&#34;gdscript3&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;enum&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;STATES&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;n&#34;&gt;STATE_1&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;n&#34;&gt;STATE_2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;n&#34;&gt;STATE_3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;o&#34;&gt;...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;/*&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;...&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;some&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;other&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;code&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;...&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;switch&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;state&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;case&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;STATE_1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;o&#34;&gt;//&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Do&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;something&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;state&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;STATE_2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;break&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;case&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;STATE_2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;o&#34;&gt;//&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Do&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;some&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;other&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;stuff&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;state&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;STATE_3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;break&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;case&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;STATE_3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;o&#34;&gt;//&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Do&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;the&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;last&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;state&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;of&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;stuff&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;o&#34;&gt;//&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;This&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;code&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;never&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;gets&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;called&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;break&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;In this code STATE_3 is never reached. The code for the enum was working fine, but the state wasn’t being reached. I went over this for a while, until I found out the problem.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Ran into a fun situation today where I was writing some code, and I came across an interesting situation in C++. Now, before I get to the end of this post, I’ll give you the punch-line, Developer stupidity.</p>
<p>So I was working on a exercise where I needed to write some sort of state machine.</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span><span class="lnt">20
</span><span class="lnt">21
</span><span class="lnt">22
</span><span class="lnt">23
</span><span class="lnt">24
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-gdscript3" data-lang="gdscript3"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">enum</span> <span class="n">STATES</span><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="n">STATE_1</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="n">STATE_2</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="n">STATE_3</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="o">...</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="o">/*</span> <span class="o">...</span> <span class="n">some</span> <span class="n">other</span> <span class="n">code</span> <span class="o">...</span> <span class="o">*/</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">switch</span><span class="p">(</span><span class="n">state</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"><span class="k">case</span> <span class="n">STATE_1</span><span class="p">:</span>
</span></span><span class="line"><span class="cl">    <span class="o">//</span> <span class="n">Do</span> <span class="n">something</span>
</span></span><span class="line"><span class="cl">    <span class="n">state</span> <span class="o">=</span> <span class="n">STATE_2</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">    <span class="k">break</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">case</span> <span class="n">STATE_2</span><span class="p">:</span>
</span></span><span class="line"><span class="cl">    <span class="o">//</span> <span class="n">Do</span> <span class="n">some</span> <span class="n">other</span> <span class="n">stuff</span>
</span></span><span class="line"><span class="cl">    <span class="n">state</span> <span class="o">=</span> <span class="n">STATE_3</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">    <span class="k">break</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">case</span> <span class="n">STATE_3</span><span class="p">:</span>
</span></span><span class="line"><span class="cl">    <span class="o">//</span> <span class="n">Do</span> <span class="n">the</span> <span class="n">last</span> <span class="n">state</span> <span class="n">of</span> <span class="n">stuff</span>
</span></span><span class="line"><span class="cl">    <span class="o">//</span> <span class="n">This</span> <span class="n">code</span> <span class="n">never</span> <span class="n">gets</span> <span class="n">called</span><span class="o">.</span>
</span></span><span class="line"><span class="cl">    <span class="k">break</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>In this code STATE_3 is never reached. The code for the enum was working fine, but the state wasn’t being reached. I went over this for a while, until I found out the problem.</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">bool state = STATE_1;
</span></span></code></pre></td></tr></table>
</div>
</div><p>The assignment for the state variable had been left over from a previous implementation of the code, and when you set the Boolean value for state = 2;, you get 1, which is true.</p>
<p>Now I don’t expect anyone to be as silly as me and make this mistake, but just in case, learn from my lesson.</p>
]]></content:encoded>
    </item>
    <item>
      <title>TOC on all Books Please</title>
      <link>https://www.zacharyc.com/2008/06/15/toc-on-all-books-please/</link>
      <pubDate>Sun, 15 Jun 2008 01:09:56 -0400</pubDate>
      <guid>https://www.zacharyc.com/2008/06/15/toc-on-all-books-please/</guid>
      <description>&lt;p&gt;I shop for mostly non-fiction books. Most of these books tend to be on new and emerging technologies. When I’m purchasing a book on a technology, I really want to know the content of the book before I purchase it. What I really want is a table of contents. Just a list of the chapter lists and maybe even a more detailed list of the topics covered in each chapter, but at least some form of the table of contents would be very helpful in my purchasing decision.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I shop for mostly non-fiction books. Most of these books tend to be on new and emerging technologies. When I’m purchasing a book on a technology, I really want to know the content of the book before I purchase it. What I really want is a table of contents. Just a list of the chapter lists and maybe even a more detailed list of the topics covered in each chapter, but at least some form of the table of contents would be very helpful in my purchasing decision.</p>
<p>The sad thing is, not many of these books actually publish a table of contents online. At the time when I was first searching for books, one of the notable series that didn’t publish this was <a href="http://headfirstlabs.com/">Head First Labs</a>. They have since changed their ways and publish a PDF version of each books TOC on the individual book page. Another good example is the new <a href="http://bignerdranch.com/products.shtml">Hillegass book</a>. While this is a great book, and I was going to buy it, with, or without a look at the TOC it would still be great to see the TOC, so I knew what I was purchasing.</p>
<p>There is another one that really drove me up the edge. I purchased the first edition of <a href="http://simplebits.com/publications/bulletproof/">Bullet Proof Web Design</a>, and thought it was a GREAT book. While Dan’s site now has an updated TOC, it didn’t when the book first came out, and the <a href="http://www.peachpit.com/store/product.aspx?isbn=0321509021">publishers book page</a> does not list the table of contents, even though they will give you chapter 1 for review. The other problem with this book, is that even at the time of this post, there is no real mention about what has been updated in the second edition of this book. Now, I definitely see the cause for someone new web design to buy this book, but why should “I”, a reader of the previous edition shell out another $25 for this one?</p>
<p>This is just another instance of not giving the customers what they need. How hard is it to publish your TOC? It is a simple list element on your webpage. You aren’t giving out anything that special, just giving your customers an idea of what they will be purchasing. That is rule number 1 in sales: <em><strong>give the customers what they want.</strong></em></p>
]]></content:encoded>
    </item>
    <item>
      <title>Cheer Resource Intro</title>
      <link>https://www.zacharyc.com/2008/04/14/cheer-resource-intro/</link>
      <pubDate>Mon, 14 Apr 2008 17:16:10 -0400</pubDate>
      <guid>https://www.zacharyc.com/2008/04/14/cheer-resource-intro/</guid>
      <description>&lt;p&gt;Cheer Resource is the name of my current web project. The whole goal of this project is to contribute to the cheerleading community by providing a centralized resource for cheerleaders, parents, and coaches alike to share knowledge about their programs and experiences. There is much work to be done on this project, including refining our goals and design, but most of that will be posted on the project page:&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://zacharyc.com/projects/cheer-resource/&#34;&gt;https://zacharyc.com/projects/cheer-resource/&lt;/a&gt;&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Cheer Resource is the name of my current web project. The whole goal of this project is to contribute to the cheerleading community by providing a centralized resource for cheerleaders, parents, and coaches alike to share knowledge about their programs and experiences. There is much work to be done on this project, including refining our goals and design, but most of that will be posted on the project page:</p>
<p><a href="https://zacharyc.com/projects/cheer-resource/">https://zacharyc.com/projects/cheer-resource/</a></p>
<p>Keep in mind that this is still a rough sketch, and this not what I do for full time employment. This is a “project”, or something I work on for fun. More details to come in the future. For now, I’m just excited to have set up a basic code base and database structure.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Nuances in C: Struct Assignment in C</title>
      <link>https://www.zacharyc.com/2008/03/13/nuances-in-c-struct-assignment-in-c/</link>
      <pubDate>Thu, 13 Mar 2008 16:09:00 -0400</pubDate>
      <guid>https://www.zacharyc.com/2008/03/13/nuances-in-c-struct-assignment-in-c/</guid>
      <description>&lt;p&gt;When I started this post, it was going to be a revolutionary post, talking about something that was really bothering me. As I have spent more time thinking about this, the answer seems so simple and obvious, still there was a time where I did not get this concept, so I here is a brief post on the topic,&lt;/p&gt;
&lt;p&gt;The question is, in straight C, will this work:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;14
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;15
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;16
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;17
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;18
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;19
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;#include&lt;/span&gt; &lt;span class=&#34;cpf&#34;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class=&#34;cp&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;#include&lt;/span&gt; &lt;span class=&#34;cpf&#34;&gt;&amp;lt;stdlib.h&amp;gt;&lt;/span&gt;&lt;span class=&#34;cp&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;#include&lt;/span&gt; &lt;span class=&#34;cpf&#34;&gt;&amp;lt;string.h&amp;gt;&lt;/span&gt;&lt;span class=&#34;cp&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;typedef&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;struct&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;point_t&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kt&#34;&gt;int&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;x&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;y&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Point&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kt&#34;&gt;int&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;main&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;int&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;argc&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;char&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;**&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;argv&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;n&#34;&gt;Point&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;a&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;b&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kt&#34;&gt;int&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;4&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;4&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;n&#34;&gt;b&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nf&#34;&gt;printf&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;b(%p) is now b[x] = %d, b[y] = %dn&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;b&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;b&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;x&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;b&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;y&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;In C++ this works no problem. Structs are teated like classes where all members have public scope. Assigning one struct to another simple implements the copy constructor that is created by the C++ language, but what about straight C?&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>When I started this post, it was going to be a revolutionary post, talking about something that was really bothering me. As I have spent more time thinking about this, the answer seems so simple and obvious, still there was a time where I did not get this concept, so I here is a brief post on the topic,</p>
<p>The question is, in straight C, will this work:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="cl"><span class="cp">#include</span> <span class="cpf">&lt;stdio.h&gt;</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#include</span> <span class="cpf">&lt;stdlib.h&gt;</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp">#include</span> <span class="cpf">&lt;string.h&gt;</span><span class="cp">
</span></span></span><span class="line"><span class="cl"><span class="cp"></span>
</span></span><span class="line"><span class="cl"><span class="k">typedef</span> <span class="k">struct</span> <span class="kt">point_t</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="kt">int</span> <span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span> <span class="n">Point</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">**</span><span class="n">argv</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="n">Point</span> <span class="n">a</span><span class="p">,</span><span class="n">b</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">  <span class="kt">int</span> <span class="n">c</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  <span class="n">b</span> <span class="o">=</span> <span class="n">c</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  <span class="nf">printf</span><span class="p">(</span><span class="s">&#34;b(%p) is now b[x] = %d, b[y] = %dn&#34;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">b</span><span class="p">,</span> <span class="n">b</span><span class="p">.</span><span class="n">x</span><span class="p">,</span> <span class="n">b</span><span class="p">.</span><span class="n">y</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>In C++ this works no problem. Structs are teated like classes where all members have public scope. Assigning one struct to another simple implements the copy constructor that is created by the C++ language, but what about straight C?</p>
<p>Well, like I said the answer is the obvious one, IT WORKS! The reason this originally confused me was because you <strong>CAN’T</strong> do this:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="cl">   <span class="kt">int</span> <span class="n">a</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">};</span>
</span></span><span class="line"><span class="cl">   <span class="kt">int</span> <span class="n">b</span><span class="p">[</span><span class="mi">4</span><span class="p">];</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">   <span class="n">b</span> <span class="o">=</span> <span class="n">a</span><span class="p">;</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>Why not? The compiler knows how big each of these integer arrays are. If you run <code>sizeof(a);</code> and it will give you the same thing as <code>sizeof(b);</code>. Copying an array is as simple as copying over the bytes (bit for bit), using <code>memset()</code> or something similar.</p>
<p>The reason structs work and arrays don’t is simple. Basically we are doing a type check on the object. If the object is a struct of defined type, we know how to do an assignment because we have the size. If the item is an array of integers, we would have to do a size comparison and the compiler doesn’t do that.</p>
<p>Okay, so I hope that explains the obvious, good luck.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Software Quality, its about attention to detail</title>
      <link>https://www.zacharyc.com/2008/02/25/software-quality-its-about-attention-to-detail/</link>
      <pubDate>Mon, 25 Feb 2008 07:56:49 -0500</pubDate>
      <guid>https://www.zacharyc.com/2008/02/25/software-quality-its-about-attention-to-detail/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://zacharyc.com/2008/02/25/software-quality-its-about-attention-to-detail/competion-staff-shirts/&#34; title=&#34;Competion Staff Shirts&#34;&gt;&lt;img alt=&#34;Competion Staff Shirts&#34; loading=&#34;lazy&#34; src=&#34;https://www.zacharyc.com/assets/img/2008/02/competion.jpg?w=1100&amp;ssl=1&#34;&gt;&lt;/a&gt;Software quality can be measured in many ways. Complexity, efficiency, executable size, these are just a few of the potential metrics. The bad news is that these aren’t normally mutually exclusive. Normally if you maximize one, you might reduce the others. The hardest part of being a developer is deciding where to sacrifice and potentially how to marry the important metrics for each component we write.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><a href="https://zacharyc.com/2008/02/25/software-quality-its-about-attention-to-detail/competion-staff-shirts/" title="Competion Staff Shirts"><img alt="Competion Staff Shirts" loading="lazy" src="https://www.zacharyc.com/assets/img/2008/02/competion.jpg?w=1100&ssl=1"></a>Software quality can be measured in many ways. Complexity, efficiency, executable size, these are just a few of the potential metrics. The bad news is that these aren’t normally mutually exclusive. Normally if you maximize one, you might reduce the others. The hardest part of being a developer is deciding where to sacrifice and potentially how to marry the important metrics for each component we write.</p>
<p>Sometimes, however, we make a bad decision and write what we would call <strong><em>bad</em></strong> code. Finding the right balance of good is hard, but seeing bad code is easier.</p>
<p>I was talking to a friend the other day about an assignment at work. The story told was enough to terrify me into writing this blog post. Basically, the developer was working on some code in python. They were making a method call and getting back an exception which printed out</p>
<p>rc = someMethodCall()<br>
…<br>
# returned:<br>
“error: no error”</p>
<p>Code like this really frustrates me. The programmer who wrote the call is returning an exception with “error: no error”, basically the error was that it executed successfully. I don’t like this approach for several reasons:</p>
<ol>
<li>If you want an exit status, use a return code.</li>
<li>“No Error” is not a type of error, so there shouldn’t be a thrown exception for it.</li>
</ol>
<p>Okay, so I only have two reasons why you shouldn’t do this, but I feel these reasons are compelling.</p>
<p>Now, I’m not saying anything about the developer, perhaps the “No Error” call might be due to some legacy code, but still, if you have this, write a wrapper. Just as if you were the person printing the shirt above. If you are a printer, you should check the quality of what you are printing. Say they did send you the text incorrectly, with the words “Competion”, shouldn’t you look at the message before you blindly attach it to a t-shirt?</p>
]]></content:encoded>
    </item>
    <item>
      <title>Review of Head Rush AJAX</title>
      <link>https://www.zacharyc.com/2008/01/18/review-of-head-rush-ajax/</link>
      <pubDate>Fri, 18 Jan 2008 16:03:56 -0500</pubDate>
      <guid>https://www.zacharyc.com/2008/01/18/review-of-head-rush-ajax/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://zacharyc.com/?attachment_id=45&#34; title=&#34;Head Rush AJAX&#34;&gt;&lt;img alt=&#34;Head Rush AJAX&#34; loading=&#34;lazy&#34; src=&#34;https://www.zacharyc.com/assets/img/2008/01/head_rush.thumbnail.jpg?w=1100&amp;ssl=1&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I recently finished reading &lt;a href=&#34;http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;amp;location=http%3A%2F%2Fwww.amazon.com%2FHead-Rush-Ajax-First%2Fdp%2F0596102259%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1200668319%26sr%3D8-1&amp;amp;tag=zacharycohen-20&amp;amp;linkCode=ur2&amp;amp;camp=1789&amp;amp;creative=9325&#34;&gt;Head Rush AJAX&lt;/a&gt;&lt;img loading=&#34;lazy&#34; src=&#34;http://www.assoc-amazon.com/e/ir?t=zacharycohen-20&amp;l=ur2&amp;o=1&#34;&gt; and would like to share my comments on the book.&lt;/p&gt;
&lt;p&gt;This book is written by &lt;a href=&#34;http://www.headfirstlabs.com/&#34;&gt;Head First Labs&lt;/a&gt; and is the first of the series I have read. I picked it up because of a recommendation from a friend. I remember looking with disdain at the books in the series when I had seen them on the shelf. I remember thinking, “They look so elementary, we don’t need another ‘For Dummies’ series”. I, like most computer people, have picked up and read a “For Dummies” book, but after you get through your second, they really loose their allure. My first three technology books were from that series, and I have never committed to reading another one.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><a href="https://zacharyc.com/?attachment_id=45" title="Head Rush AJAX"><img alt="Head Rush AJAX" loading="lazy" src="https://www.zacharyc.com/assets/img/2008/01/head_rush.thumbnail.jpg?w=1100&ssl=1"></a></p>
<p>I recently finished reading <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FHead-Rush-Ajax-First%2Fdp%2F0596102259%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1200668319%26sr%3D8-1&amp;tag=zacharycohen-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">Head Rush AJAX</a><img loading="lazy" src="http://www.assoc-amazon.com/e/ir?t=zacharycohen-20&l=ur2&o=1"> and would like to share my comments on the book.</p>
<p>This book is written by <a href="http://www.headfirstlabs.com/">Head First Labs</a> and is the first of the series I have read. I picked it up because of a recommendation from a friend. I remember looking with disdain at the books in the series when I had seen them on the shelf. I remember thinking, “They look so elementary, we don’t need another ‘For Dummies’ series”. I, like most computer people, have picked up and read a “For Dummies” book, but after you get through your second, they really loose their allure. My first three technology books were from that series, and I have never committed to reading another one.</p>
<p>When it comes to Head First AJAX the phrase “Never Judge a book by its Cover” has never been more true. If you look at the cover and see the guy doing an one handed handstand you might not want to take the book seriously, but this is a serious book with a serious introduction to a very new and very powerful technology.</p>
<h4 id="about-the-reader">About the Reader</h4>
<p>It is important to understand the perspective of this review. When I picked up this book I head been reading the <a href="http://www.amazon.com/JavaScript-Definitive-Guide-David-Flanagan/dp/0596101996/ref=pd_bbs_2?ie=UTF8&amp;s=books&amp;qid=1200670177&amp;sr=8-2">Javascript: The Definitive Guide</a>. This is the canonical book on Javascript, and while it is very informative it is not a very practical straight read. I wanted to give up after about 100 pages, this book offered a quick alternative so I picked it up.</p>
<p>I’m a strong HTML and CSS programmer, I have worked with various web technologies like Rails and PHP. I wouldn’t qualify myself as an expert, but I’m no stranger to web programming. However, up until recently, I have had one GAPING flaw in my resume when it comes to web work, I have had little to no knowledge of javascript. I used a snippet of javascript back on a website I had written many years ago that responded to an onHover event to replace an image, but that was the extent of my real JavaScript experience. Realizing this hole and having some time on my hands I set about fixing it.</p>
<h4 id="book-content">Book Content</h4>
<p>This book covers the following topics:</p>
<ul>
<li>Intro to JavaScript</li>
<li>Discussion of why there is a need for AJAX</li>
<li>Basic PHP on the web server side</li>
<li>Introduction to Web Security (defending against SQL injection)</li>
<li>The Document Object Model (DOM)</li>
<li>Introduction to JSON</li>
</ul>
<p>Each of the topics in the list above is described using both pictures and instructions. There are several cornerstones to the Head First approach, but two of these really stuck with me. Firstly, everything that is important is repeated. Secondly, information is presented in both a textual and graphical format. Text is placed next to pictures to get your mind to remember it. This is EXACTLY how I learn, so this book worked great for me.</p>
<h4 id="criticisms">Criticisms</h4>
<p>I really liked the book, but there are a few areas where I felt like the speed of the book was too fast and some areas where I felt they could have used improvement. The last chapter is when they first introduce JSON. The introduction is a bit rushed, and they use the blanket “eval()” statement in javascript to execute the JSON code. Being a traditional programmer, I’m always apprehensive of using an eval function, especially in the case where are receiving the code to eval from a response object. There is no talk about the security risks of using this function until the Appendix.</p>
<p>My second issue is the discussion of frameworks doesn’t occur until the Appendix. While understanding the fundamentals of AJAX is very important, in practice frameworks are more practical then rewriting code that already exists out there. There is a discussion of frameworks and how to use them, but that isn’t until Appendix I.</p>
<p><strong>In short, Appendix I is not an optional read</strong>. The contents of this Appendix I feel are completely necessary in order to actually start using AJAX, and the fact that it is listed as an Appendix is misleading.</p>
<h4 id="conclusion">Conclusion</h4>
<p>I would strongly recommend this book to someone in my position. It gave a great introduction to AJAX for someone already familiar with web programming. I could see how users without any experience in web programming might get lost by this book, but it was PERFECT for me. I have since purchased my second book from Head First Labs, and will hopefully write a review of that title shortly.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Battle of The GTD Apps</title>
      <link>https://www.zacharyc.com/2008/01/09/battle-of-the-gtd-apps/</link>
      <pubDate>Wed, 09 Jan 2008 14:26:28 -0500</pubDate>
      <guid>https://www.zacharyc.com/2008/01/09/battle-of-the-gtd-apps/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;http://en.wikipedia.org/wiki/Getting_Things_Done&#34;&gt;Getting Things Done (GTD)&lt;/a&gt; has become increasingly popular in past few years. There have been many attempts to build an application that integrates with the whole framework. As a mac user I have been aware of a few, but the big one of the past was &lt;a href=&#34;http://kinkless.com/kgtd&#34;&gt;Kinkless GTD&lt;/a&gt;. This application consists of a bunch of applescripts meant to work with &lt;a href=&#34;http://www.omnigroup.com/omnioutliner&#34;&gt;OmniOutliner&lt;/a&gt;. There was a lot of hype surrounding the application, and for good reason, it was one of the best options out there. The problem was, it wasn’t good enough for me to get really committed. You had to hit this “sync” button ever couple of seconds to make sure everything was up to date, contexts were confusing, and sometimes the kinkless page would go down for days at a time. Others shared my concerns and now there are several different applications that aim to fill the same gap that KGTD left open. In this article I will be comparing &lt;a href=&#34;http://www.omnigroup.com/omnifocus&#34;&gt;OmniFocus&lt;/a&gt; and &lt;a href=&#34;http://culturedcode.com/things/&#34;&gt;Things&lt;/a&gt;.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Getting_Things_Done">Getting Things Done (GTD)</a> has become increasingly popular in past few years. There have been many attempts to build an application that integrates with the whole framework. As a mac user I have been aware of a few, but the big one of the past was <a href="http://kinkless.com/kgtd">Kinkless GTD</a>. This application consists of a bunch of applescripts meant to work with <a href="http://www.omnigroup.com/omnioutliner">OmniOutliner</a>. There was a lot of hype surrounding the application, and for good reason, it was one of the best options out there. The problem was, it wasn’t good enough for me to get really committed. You had to hit this “sync” button ever couple of seconds to make sure everything was up to date, contexts were confusing, and sometimes the kinkless page would go down for days at a time. Others shared my concerns and now there are several different applications that aim to fill the same gap that KGTD left open. In this article I will be comparing <a href="http://www.omnigroup.com/omnifocus">OmniFocus</a> and <a href="http://culturedcode.com/things/">Things</a>.</p>
<p>People at Omni recognized a good nitch for a better product and so began to create a new product <a href="http://www.omnigroup.com/omnifocus">OmniFocus</a>. This product would be directly geared towards the kinkless users and perhaps pick up more users in the wake of the new GTD craze. As of this post, I’m aware that omni has sold over 11,000 licenses for its application, which just hit version 1.0 yesterday (no, they didn’t make 11,000 in a day, they have been selling the product in beta for a couple of months).</p>
<p>Now, I’m a big fan of Omni products. I swear by <a href="http://www.omnigroup.com/omnigraffle">Omnigraffle</a>, and there are some interesting uses for <a href="http://www.omnigroup.com/omnioutliner">OmniOutliner</a> that sometimes make it more useful than excel or numbers (it is much FASTER than numbers). However, I have been using OmniFocus for a little while and am a little disappointed that they have released version 1.0 in the condition it is in. This app feels like it is so far from done, that I can’t understand how it can be at revision 1.0. Also, they up until announcing version 1.0, they were calling the builds alpha builds, which leads me to believe that this might be a premature release.</p>
<p>Here is a list of some of things that are frustrating me with the app:</p>
<ul>
<li>There is a “Clean Up” button on menu bar that you have to hit in order for your tasks to disappear. I agree that making them disappear as soon as you enter them is bad UI design, but the fact that I have to click on this button to move everything is also bad. I wonder if there couldn’t be a clean up every time you switch contexts or projects or if you stop using the application for several minutes if the clean up could happen automatically.</li>
<li>The views are still a little confusing. This could be because I have never been a big subscriber to the GTD methodologies, I just want an application that organizes all my tasks, I don’t care about the FORMAL practice elements.</li>
<li>The autoupdate feature continues to crash every time I install an update. Well, it claims to have crashed, if I look at the version of OmniFocus, it will say that is running the newest version.</li>
<li>The App doesn’t <strong>feel</strong> like a finished Leopard App. There is zebra striping in some of the windows. I’m not a big fan of high contrast zebra striping, I feel like it takes away from the users focus.</li>
</ul>
<p>Despite my misgivings, the app has a strong community and a good development core. There are a couple of really great things about the app that make me wonder how it will progress in the future. Here are a couple of the features that I like about OmniFocus</p>
<ul>
<li>Integration with iCal To Dos. This means that it will appear on your iPhone (or other syncable phone) currently. Also the way in which they do this is very smart. They allow you to select certain contexts to be synced with your iCal, which means if you are only interested in your Errands while you are mobile, you can set it to only sync those tasks and leave the rest off.</li>
<li>Potential integration with <a href="http://www.omnigroup.com/omniplan">OmniPlan</a>. This is a great app for project management. It is the most Mac-like project management app I’ve seen and if you could hook OmniFocus to a specific project it would be easy for people to see what they have to complete, without having to look at OmniPlan and then copy it tasks to OmniFocus (this is not very <a href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself">DRY</a>).</li>
<li>Better integration that KGTD. This applications is specifically designed to do many of the things that KGTD did, but it does it natively, whereas KGTD was a bunch of add on Applescripts. KGTD also made all of your toolbars in OmniOutliner look like a KGTD app (they might have fixed this in later versions of OmniOutliner, but I can’t remember and don’t feel like installing this all over again).</li>
</ul>
<p>This leads me to my next app, <a href="http://culturedcode.com/things/">Things</a>. This app is made by a much smaller company in Germany, so it might not have the same market penetration as the OmniGroup, but in my opinion this is what I really expect in terms of a GTD application. Keep in mind that I have only been using Things for about a day and I have been following OmniFocus for quite some time now, so my feedback on this app might not be as complete. Before I jump into feature analysis, here is a screenshot of things:</p>
<p><a href="https://zacharyc.com/2008/01/09/battle-of-the-gtd-apps/screenshot-of-things/" title="Screenshot of Things"><span class="Apple-style-span" style="color:#000000;text-decoration:none;"><img alt="Screenshot of Things" loading="lazy" src="https://www.zacharyc.com/assets/img/2008/01/things_window.png?w=1100&ssl=1"></span><span class="Apple-tab-span" style="white-space:pre;"></span></a></p>
<p>Now, Things is still in a beta stage, and the author claims that they will be releasing the code later in the spring. The price of this app will be $49 when released, compared to the OmniFocus $79. The overall look and feel of the app, though is still significantly more “finished” than OmniFocus, but some of the main features of OmniFocus are missing.</p>
<p>Here’s a rundown of what I like about Things:</p>
<ul>
    <li>Very professional looking application. Okay, yes I'll admit it, looks are only skin deep, but when it comes to working with an app, if it is pretty look at, you will look at it more, therefore I feel that aesthetics can count for something here.</li>
    <li>The cost is lower than OmniFocus. Saving money is always a good thing.</li>
    <li>The layout is more structured than OmniFocus. By this, I mean that the menu on the let has specific sections: Collect, Focus, Organize; and then brakes down the tasks within this section. If I don't know the full GTD rules or I don't want to reread David Allen before I start using the application, this makes it more clear where I should put all my tasks.</li>
    <li>It allows you tag your items. This is both a positive and a negative for me. It allows me to put tags with an item that I think belong in different projects and then find them together, but the downside is, Tags replace the notion of context in OmniFocus. I think these are two different items, tags relate to the type of app, but I feel like context relates to where/how the task should be completed. By handling both of these with items with tags its not always clear how to differentiate which tags belong to which.</li>
    <li>The Focus section allows you to clearly see what you have to do and what you can do. The whole goal of GTD is to make it easy to see what you should be doing next. This focus section does exactly that.</li>
</ul>
<p>Despite all these good features (and the one issue with tags that I have already mentioned), there are several other issues that I have with the application:</p>
<ul>
<li>No direct support for integration with iCal or mobile devices. This feature is on the roadmap, but it is unclear when it will be implemented, and I think it is very important to have it.</li>
<li>No ties to any specific project management suite. This could cause issues with having to enter your information twice.</li>
<li>Currently no way to recur items. If you want to repeat an item every day, right now, that just isn’t possible. This whole notion of recurring calendar events is probably pretty tricky to get right, but it is still an important feature that is missing. Again, this is in the future features, but no indication is provided on when it will be available.</li>
</ul>
<p>There are a bunch of additional features intended for Things, which you can see <a href="http://culturedcode.com/things/wiki/index.php?title=Future_Features">here</a>.</p>
<p>As for me, I have made up my decision, I’m going to try to stick with things for a little while and see how that works out. If OmniFocus has some major changes perhaps I will give it another look, but right now, I’m just enthused by the application. Also, if anyone else has any other task management applications they are using, please add a comment or contact me.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Computer Book Reading list</title>
      <link>https://www.zacharyc.com/2008/01/03/computer-book-reading-list/</link>
      <pubDate>Thu, 03 Jan 2008 03:32:00 -0500</pubDate>
      <guid>https://www.zacharyc.com/2008/01/03/computer-book-reading-list/</guid>
      <description>&lt;p&gt;I have a friend who asked me for a reading list of books. This friend is in a computer related field, but does not have extensive programming background. This could potentially be an issue when applying for jobs, or actually in the job world. In order to help this friend out, I spent some time coming up with a list of books I think should be read by a person in this position. For the purposes of this post I will call my friend Peter.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I have a friend who asked me for a reading list of books. This friend is in a computer related field, but does not have extensive programming background. This could potentially be an issue when applying for jobs, or actually in the job world. In order to help this friend out, I spent some time coming up with a list of books I think should be read by a person in this position. For the purposes of this post I will call my friend Peter.</p>
<p>Peter is a senior in college pursuing a degree in Systems Engineering and Finance. Both of these factors came in to play when I started looking at the books I would recommend. Peter is very smart, but is not overly interested in programming. Not a passion, but maybe a necessity of the work world in which Peter is about to enter. The list below is designed to give Peter the necessary skills to be more effective on the job without forcing all the craziness of computer programming. <strong>This is <em>NOT</em> a list of the books I would recommend for a computer engineer or programmer.</strong> Peter knows some Java, but that is about it for actual programming.</p>
<p>To get it out of the way this is the list, in order, of topics I think Peter should cover, I will explain my reasoning below:</p>
<ol>
<li>HTML and CSS</li>
<li>Python</li>
<li>Object Oriented Design (Design Patters)</li>
<li>Javascript/AJAX</li>
</ol>
<h4 id="html-and-css">HTML and CSS</h4>
<p>I like HTML and CSS as a first choice for several reasons:</p>
<ul>
<li><strong>Its simple and easy to use</strong>– Its a markup language not a full out programming language. That being said, there are still aspects of programming that can be applied to HTML and CSS.</li>
<li><strong>The Web is Everywhere</strong>– As the web matures it reach expands. More and more people are using the web every year. Even if you are not writing a product that directly uses the web, there is a good chance that your company will have a web presence. Also, most help documentation is written in HTML, yet another place that HTML and CSS can be useful</li>
<li><strong>Tools for development exist on almost every computer</strong>– All you need to learn HTML and CSS is a web browser and a text editor (and some disk space). You can find these tools on any computer for free. If you want to get serious about web design, you can end up buying better tools, but the basic tools are free.</li>
<li><strong>You See Results Fast</strong>– I feel a big problem with computer science education is the concern with getting everything <em><strong>“right”</strong></em>. This often prevents people from writing a lot of code. I know I have gone through this problem. HTML allows you to write code and get it out there quickly. Also, most browsers are VERY forgiving and will even display the right thing if you put in the wrong code. This is both a positive in a negative in terms of learning, but at least you will see results.</li>
</ul>
<p>Given these reasons I chose HTML and CSS as the first topic. I could recommend a ton of books for this topic, but in order to keep Peter from giving up on this topic, I would recommend starting with one, getting through the rest of the topics listed above and then going back and looking at some other HTML books if that is a topic that really catches his interest. So here is my list:</p>
<ol>
<li><strong><a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FHead-First-HTML-CSS-XHTML%2Fdp%2F059610197X%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1199314792%26sr%3D8-1&amp;tag=zacharycohen-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">Head First HTML with CSS</a><img loading="lazy" src="http://www.assoc-amazon.com/e/ir?t=zacharycohen-20&l=ur2&o=1"></strong>– I have actually never read this book, but I have looked at several other books in the series. I think that the publisher does a good job of putting together a book that will teach topics easily and rapidly. Also the reviews are very positive.</li>
<li><a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FDesigning-Web-Standards-Jeffrey-Zeldman%2Fdp%2F0321385551%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1199315249%26sr%3D1-1&amp;tag=zacharycohen-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">Designing With Web Standards</a><img loading="lazy" src="http://www.assoc-amazon.com/e/ir?t=zacharycohen-20&l=ur2&o=1">– This is a good second read. This book covers the basics of HTML and CSS and mostly explains why you would want to use them to build a website. I read the first revision of this book, and it was GREAT.</li>
<li><a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FBulletproof-Web-Design-flexibility-protecting%2Fdp%2F0321509021%2F&amp;tag=zacharycohen-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">Bulletproof Web Design</a><img loading="lazy" src="http://www.assoc-amazon.com/e/ir?t=zacharycohen-20&l=ur2&o=1">– this book is a collection tricks for designing websites. It is a quick read, and a reliable resource. This is not a complete reference, but it get you thinking correctly about designing sites.</li>
</ol>
<h4 id="python">Python</h4>
<p>Python is a really great language. One of the language’s design goals was to create a easily readable, and therefore maintainable programming language, that was easy to learn. Despite the easy of use of <a href="http://www.python.org">Python</a> it is still a very powerful and flexible language to learn. To elaborate here are the reasons I recommend Python for Peter:</p>
<ul>
<li><strong>Clean Syntax</strong>– while there are some oddities in Python for the most part the syntax is incredibly clean. When looking at the code, you can most normally see what it is doing. This makes it great for a beginner language.</li>
<li><strong>Dynamic Data Typing</strong>– In some languages you have to be very careful to fully declare your variables with the correct types. Python uses on the fly declarations, and uses coercion to try and change variables to the correct type when being used in an expression. What does this mean? Less confusion of the programmer or reader of code.</li>
<li><strong>High Availability</strong>– Python is approaching version 3.0. It is available for many operating systems. It is also freely distributed source so you can probably compile it for many environments even if it is not natively supported.</li>
<li><strong>Good Documentation</strong>– There are online resources for learning the language. One of the books that I recommend below is available for free online. There is also a strong developer community.</li>
<li><strong>Its Extensible</strong>– You can use Python to do almost anything. It has libraries and extension for databases, web programming, robotics and more. Once you learn the language, you can apply it in many different areas. This could make it great for quick prototyping, which might be closest to what Peter would be doing with his programming.</li>
<li><strong>MIT is using it</strong>– Okay, so this is a lame excuse, but <a href="http://www-tech.mit.edu/V125/N65/coursevi.html">MIT has switched their intro CS course from Scheme(Lisp language) to python</a>. While it is not good practice to take the lemming effect and just jump off the cliff because everyone else is, the professors at MIT know what their doing, so following them isn’t as bad as jumping blindly off a cliff.</li>
</ul>
<p>I’m sure I’ve left out some really good reasons, but I believe I’ve covered the basics. Here is my list of reading for Python. Again, I would pick either of the first two to start with and then move on the next section. If you really want to get a firmer grip you can come back and read more later.</p>
<ol>
<li><a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FDive-Into-Python-Mark-Pilgrim%2Fdp%2F1590593561%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1199317778%26sr%3D1-1&amp;tag=zacharycohen-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">Dive Into Python</a><img loading="lazy" src="http://www.assoc-amazon.com/e/ir?t=zacharycohen-20&l=ur2&o=1">– This is a great book that shows you how to program Python by example. It is quick to get you up and running and if you already know one programming language, its a GREAT place to start. Also, big kicker, its available for free at the <a href="http://www.divintopython.org">Dive Into Python Website</a>.</li>
<li><a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FCore-Python-Programming-2nd%2Fdp%2F0132269937%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1199317901%26sr%3D1-1&amp;tag=zacharycohen-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">Core Python Programming</a><img loading="lazy" src="http://www.assoc-amazon.com/e/ir?t=zacharycohen-20&l=ur2&o=1">– This is another great python book that was recommended to me by a friend. It is actually a very thick reference, but I made it pretty deep into the book starting from the first page.</li>
</ol>
<h4 id="object-oriented-design-patterns">Object Oriented Design Patterns</h4>
<p>Regardless of whether it is the right path to take (which I believe it is), object oriented programming is dominating the world. Inheritance can reduce the amount of code written, which in turn can boost maintainability of larger projects. Not all languages allow you to use objects directly. C, for example, does not directly support objects, but the design principles learned from Object Oriented Design(OOD) can still be applied to C programs. If you need more convincing on OOD or information about it, I suggest reading the <a href="http://en.wikipedia.org/wiki/Object-oriented_programming">Wikipedia Article on OOD</a>.</p>
<p>As for learning OOD, I can really not put my finger on a singular book that i have read that has taught me a significant amount about OOD, most of what I have learned I have picked up from reading and writing code. Still there is one canonical book and one book that I’m looking forward to reading as soon as I get a chance, and I’ve listed them below.</p>
<ol>
<li><a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FHead-First-Design-Patterns%2Fdp%2F0596007124%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1199318660%26sr%3D1-2&amp;tag=zacharycohen-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">Head First Design Patterns</a><img loading="lazy" src="http://www.assoc-amazon.com/e/ir?t=zacharycohen-20&l=ur2&o=1">– I have not read this book, but it looks promising and am hoping to pick it when I find the time to read it. It looks like it will give a good introduction to design patterns, and if it is like their other books in the series, it should be very readable.</li>
<li><a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FDesign-Patterns-Object-Oriented-Addison-Wesley-Professional%2Fdp%2F0201633612%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1199318493%26sr%3D1-1&amp;tag=zacharycohen-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">Design Patterns</a><img loading="lazy" src="http://www.assoc-amazon.com/e/ir?t=zacharycohen-20&l=ur2&o=1">– this is the canonical book on design patterns. I would recommend it as a reference. Many programmers will use the terms defined in this book, and if you have it as reference to look up their concerns it is worth. That being said, I don’t think that it is a good straight read, and would recommend the Head First book as a better starting place if you haven’t heard of design patterns before.</li>
</ol>
<h4 id="javascriptajax">Javascript/AJAX</h4>
<p>Now that Peter has knowledge of HTML and CSS, some basic programming and design, I’m pushing him towards Javascript and AJAX. Everyone is becoming aware of the concept of “Web 2.0”, and javascript and AJAX are at the heart of the new web. Javascript, however, is not your run of the mill programming language. There are some quirks to it, but AJAX itself is not overly complicated. I’d recommend learning Javascript after python because Javascript uses Prototypical inheritance. This is different than most programming languages, and can be rather confusing. Also, Python is more extensible. Javascript only traditionally runs within a web browser, there are a few other implementations like <a href="http://www.mozilla.org/rhino/">Rhino</a>, but for the most part it only works with a web browser.</p>
<p>There are a ton of online resources for javascript. I don’t know all of them yet as I am still in the process of learning this language, but here are a few books that I have started on the subject:</p>
<ul>
<li><a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FHead-Rush-Ajax-First%2Fdp%2F0596102259%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1199329679%26sr%3D1-1&amp;tag=zacharycohen-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">Head Rush AJAX</a><img loading="lazy" src="http://www.assoc-amazon.com/e/ir?t=zacharycohen-20&l=ur2&o=1">– Great introduction to Javascript. It is a fast read and covers all the basics of AJAX and even goes into some basic DOM scripting as well.</li>
<li><a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FJavaScript-Definitive-Guide-David-Flanagan%2Fdp%2F0596101996%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1199329847%26sr%3D1-2&amp;tag=zacharycohen-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">Javascript</a><img loading="lazy" src="http://www.assoc-amazon.com/e/ir?t=zacharycohen-20&l=ur2&o=1">– is the definitive source on the Javascript language. Its a very tough read, but it does have a ton of interesting tidbits about the nuances in the language.</li>
<li><a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FAjax-Action-Dave-Crane%2Fdp%2F1932394613%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1199330098%26sr%3D1-1&amp;tag=zacharycohen-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">AJAX in Action</a><img loading="lazy" src="http://www.assoc-amazon.com/e/ir?t=zacharycohen-20&l=ur2&o=1">– I have yet to read this book, though it is sitting on my bookcase. I have a close friend though who highly recommends it, so I’ll include it here.</li>
</ul>
<h4 id="recap">Recap</h4>
<p>This list is far from complete. Computer technology is constantly changing. Anyone serious about the field needs to apply constant effort to read and keep up to date on important technologies. This list is a good starting place. Please post any additional suggestions to the comments.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Nuances in C: Array of Function pointers</title>
      <link>https://www.zacharyc.com/2007/12/13/nuances-in-c-array-of-function-pointers/</link>
      <pubDate>Thu, 13 Dec 2007 17:31:06 -0500</pubDate>
      <guid>https://www.zacharyc.com/2007/12/13/nuances-in-c-array-of-function-pointers/</guid>
      <description>&lt;p&gt;I was in a job interview the other day and someone asked me the following question, which I got wrong. Its not hard to remember, but I figure if I pass it on, and anyone out there who reads this blog for technical content might get a little refresher.The question was something like: write the declaration for an array of function pointers that take an integer and return a double in C.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I was in a job interview the other day and someone asked me the following question, which I got wrong. Its not hard to remember, but I figure if I pass it on, and anyone out there who reads this blog for technical content might get a little refresher.The question was something like: write the declaration for an array of function pointers that take an integer and return a double in C.</p>
<p>This problem isn’t overly complicated, but C can be a tricky language. I used the language for a year of solid development, and never had to use anything this complicated.</p>
<p>My attempt at this problem without any resource ended up looking like:<br>
<code>double function_array(int foo)[];</code></p>
<p>Okay, before you laugh, remember I haven’t had to ever actually defined a complicated structure like this. What this translates to in C is: a function named “function_array” is takes an int “foo” and returns an array of doubles. This is not possible in C as you can’t return arrays. You can return pointers, which can be indexed as an array, but you cannot return an array.</p>
<p>The solution is actually:<code>double (*function_array[])(int foo);</code>which solves the problem as stated.</p>
<p>The resource that I used to find the answer is a book called <a href="http://www.amazon.com/Expert-Programming-Peter-van-Linden/dp/0131774298/ref=pd_bbs_sr_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1197566443&amp;amp;sr=8-1">Expert C Programming: Deep C Secrets</a>. This book is <em>AMAZING</em> and you should definitely invest in it if you do any serious work with C. It does have a bit of a Sun systems bias, as the author was a compiler writer for Sun Microsystems, but the book has useful information for anyone using the language. There is a whole chapter on unscrambling declarations in C.</p>
<p>So there it is, another friendly reminder about declarations in C.</p>
<h3 id="update">Update:</h3>
<p>After rereading the post I realized that I was not content with my understanding of how to use arrays of functions. I came up with a mock project to work on. Lets say you have an input string, and would like to process it to remove some special characters (in my case I used “:”, ” “, and “t”). I wrote a function for each special character and iterated through all the functions on each string. This might not be the most expedient way of solving this problem, but it allowed to me to test the use of arrays of functions.</p>
<p>You can see the source: <a href="https://zacharyc.com/wp-content/uploads/2007/12/function_arrays.c">here</a>. It has some brief inline documentation, but I’m not doing anything else too crazy. One additional note, I rediscovered that if you initialize a string like <code>char *foo = &quot;some string&quot;;</code> it stores it read only memory. Note that is different than <code>char foo[] = &quot;some string&quot;</code> which is stored in read/write memory.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Comments on Hash Tables</title>
      <link>https://www.zacharyc.com/2007/12/10/comments-on-hash-tables/</link>
      <pubDate>Mon, 10 Dec 2007 20:06:02 -0500</pubDate>
      <guid>https://www.zacharyc.com/2007/12/10/comments-on-hash-tables/</guid>
      <description>&lt;p&gt;In a recent article at &lt;a href=&#34;http://www.codinghorror.com/blog/&#34;&gt;Coding Horror&lt;/a&gt;, the author discusses &lt;a href=&#34;http://www.codinghorror.com/blog/archives/001014.html&#34;&gt;Hash Tables&lt;/a&gt;. This is a very strong post on hash tables and their hashing function. It is definitely worth the read, but there is one thing I want to comment on.&lt;/p&gt;
&lt;p&gt;In the post Jeff Atwood discusses hash tables and states the following:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Key-value pairs are quite common in real world data, and hashtables are both reasonably efficient in storage and quite fast at lookups, offering O(1) performance in most cases. That’s why hashtables are the go-to data structure for many programmers. It may not be the optimal choice, but unlike so many things in computer science, it’s rarely a bad choice.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>In a recent article at <a href="http://www.codinghorror.com/blog/">Coding Horror</a>, the author discusses <a href="http://www.codinghorror.com/blog/archives/001014.html">Hash Tables</a>. This is a very strong post on hash tables and their hashing function. It is definitely worth the read, but there is one thing I want to comment on.</p>
<p>In the post Jeff Atwood discusses hash tables and states the following:</p>
<blockquote>
<p>Key-value pairs are quite common in real world data, and hashtables are both reasonably efficient in storage and quite fast at lookups, offering O(1) performance in most cases. That’s why hashtables are the go-to data structure for many programmers. It may not be the optimal choice, but unlike so many things in computer science, it’s rarely a bad choice.</p></blockquote>
<p>and while I don’t disagree with this comment, I’m afraid that some programmers might misunderstand what is being said here. This post mostly covers the concept of hashing functions. This page is <strong>NOT</strong> saying that hash tables ARE the solution to <strong>EVERY</strong> problem.</p>
<p>One of the biggest problems I see in code that I look at is that people are not fully thinking out their data structures before writing code. Linked lists are great if you are going to be adding elements constantly and searching through your items rarely, but if search is of high demand, that maybe you would want to consider something that has less of a search time. I’m not going to go into <a href="http://en.wikipedia.org/wiki/Big_O_notation">Big O Notation</a> here, but that is another worthwhile concept for any computer programmer to understand.</p>
<p>Hash tables are great for searching one-to-one mapped pairs. If you are keeping track of person to phone number, than a hash table would be an accurate representation, and a good tool to solve the problem. If the problem were to get more complicated, lets say we start holding the phone number in an object designed to store more than just phone information. If we are writing an App that only looks up by person, then hash table might still be the best choice. If we change our search parameters, perhaps we start looking for people in a certain town, or we have a phone number and want to see if it is associated with anyone in our records, this becomes a costly search.</p>
<p>We end up having to look through all records, because the hash is keyed off of data that is irrelevant to our search. This problem can be solved in many different ways, and the solutions are beyond the scope of this article. My one point is that while hashing is very unique and powerful, it is the the universal tool that solves any and all problems. A very important precursor to Jeff’s article is to decide whether a hash table is indeed the solution you seek, otherwise, space and hashing functions may be the least of your problems.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
