<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>Weblog</title>
	<atom:link href="http://www.zmeng.com.au/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zmeng.com.au/blog</link>
	<description>Technical weblog of Zac Mullett Engineering Services</description>
	<pubDate>Mon, 14 Sep 2009 08:15:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Source Code for Items Assigned To Me Web Part</title>
		<link>http://www.zmeng.com.au/blog/2009/09/source-code-for-items-assigned-to-me-web-part/</link>
		<comments>http://www.zmeng.com.au/blog/2009/09/source-code-for-items-assigned-to-me-web-part/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 08:13:20 +0000</pubDate>
		<dc:creator>Zac Mullett</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.zmeng.com.au/blog/?p=135</guid>
		<description><![CDATA[The Assigned To Me Web Part displays a summary list of any item currently assigned to you. This web part is useful in cases where your SharePoint site is divided into numerous sub-sites and lists. Items are grouped by list with a sum total of items assigned to you per list. 
To download this web [...]]]></description>
			<content:encoded><![CDATA[<p>The Assigned To Me Web Part displays a summary list of any item currently assigned to you. This web part is useful in cases where your SharePoint site is divided into numerous sub-sites and lists. Items are grouped by list with a sum total of items assigned to you per list. </p>
<p>To download this web part as a compiled WSP package, or for more information, click here:</p>
<div style="margin-left: 20px; margin-bottom: 40px"><a href="http://www.zmeng.com.au/software/sharepoint/assigned-to-me-web-part.php">Assigned To Me Web Part for SharePoint</a></div>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">
<span class="kwrd">public</span> <span class="kwrd">class</span> AssignedToMe : System.Web.UI.WebControls.WebParts.WebPart
{
    <span class="kwrd">protected</span> <span class="kwrd">override</span> <span class="kwrd">void</span> Render(System.Web.UI.HtmlTextWriter writer)
    {
        <span class="rem">// Controls are made in Render() rather than </span>
        <span class="rem">// CreateChildControls() because the TBODY</span>
        <span class="rem">// tag does not appear to exist in the Web.UI</span>
        <span class="rem">// namespace and it is required for the SharePoint</span>
        <span class="rem">// expander javascript to work</span>

        SPWeb spWebThis = SPControl.GetContextWeb(<span class="kwrd">this</span>.Context);

        List&lt;SPWeb&gt; webs = <span class="kwrd">new</span> List&lt;SPWeb&gt;();
        PopulateWebCollectionRecursive(webs, spWebThis);

        <span class="preproc">#region</span> Create table and header rows
        Table table = <span class="kwrd">new</span> Table();
        <span class="kwrd">this</span>.Controls.Add(table);
        table.Attributes[<span class="str">"class"</span>] = <span class="str">"ms-settingsframe"</span>;
        table.Width = Unit.Percentage(100);
        table.BorderStyle = BorderStyle.None;
        table.CellPadding = 1;
        table.CellSpacing = 0;
        table.Style.Add(<span class="str">"border-top"</span>, <span class="str">"0px solid"</span>);

        TableRow rowHeader = <span class="kwrd">new</span> TableRow();
        table.Rows.Add(rowHeader);

        TableCell cellHeaderTitle = <span class="kwrd">new</span> TableCell();
        rowHeader.Cells.Add(cellHeaderTitle);
        cellHeaderTitle.Wrap = <span class="kwrd">false</span>;
        cellHeaderTitle.Attributes[<span class="str">"class"</span>] = <span class="str">"ms-vh2-nofilter"</span>;
        cellHeaderTitle.Attributes[<span class="str">"scope"</span>] = <span class="str">"col"</span>;
        cellHeaderTitle.Text = <span class="str">"Item"</span>;

        TableCell cellHeaderModified = <span class="kwrd">new</span> TableCell();
        rowHeader.Cells.Add(cellHeaderModified);
        cellHeaderModified.Wrap = <span class="kwrd">false</span>;
        cellHeaderModified.Attributes[<span class="str">"class"</span>] = <span class="str">"ms-vh2-nofilter"</span>;
        cellHeaderModified.Attributes[<span class="str">"scope"</span>] = <span class="str">"col"</span>;
        cellHeaderModified.Text = <span class="str">"Modified"</span>;

        TableCell cellHeaderModifiedBy = <span class="kwrd">new</span> TableCell();
        rowHeader.Cells.Add(cellHeaderModifiedBy);
        cellHeaderModifiedBy.Wrap = <span class="kwrd">false</span>;
        cellHeaderModifiedBy.Attributes[<span class="str">"class"</span>] = <span class="str">"ms-vh2-nofilter"</span>;
        cellHeaderModifiedBy.Attributes[<span class="str">"scope"</span>] = <span class="str">"col"</span>;
        cellHeaderModifiedBy.Text = <span class="str">"Modified By"</span>;

        TableCell cellHeaderList = <span class="kwrd">new</span> TableCell();
        rowHeader.Cells.Add(cellHeaderList);
        cellHeaderList.Wrap = <span class="kwrd">false</span>;
        cellHeaderList.Attributes[<span class="str">"class"</span>] = <span class="str">"ms-vh2-nofilter"</span>;
        cellHeaderList.Attributes[<span class="str">"scope"</span>] = <span class="str">"col"</span>;
        cellHeaderList.Text = <span class="str">"List"</span>;

        TableCell cellHeaderSite = <span class="kwrd">new</span> TableCell();
        rowHeader.Cells.Add(cellHeaderSite);
        cellHeaderSite.Wrap = <span class="kwrd">false</span>;
        cellHeaderSite.Attributes[<span class="str">"class"</span>] = <span class="str">"ms-vh2-nofilter"</span>;
        cellHeaderSite.Attributes[<span class="str">"scope"</span>] = <span class="str">"col"</span>;
        cellHeaderSite.Text = <span class="str">"Site"</span>;

        table.RenderBeginTag(writer);
        rowHeader.RenderControl(writer);
        <span class="preproc">#endregion</span>

        <span class="kwrd">int</span> count = 0;
        <span class="kwrd">string</span> rowClass = <span class="str">""</span>;

        <span class="kwrd">int</span> listIndex = 0;
        <span class="kwrd">foreach</span> (SPWeb spWeb <span class="kwrd">in</span> webs)
        {
            <span class="kwrd">foreach</span> (SPList spList <span class="kwrd">in</span> spWeb.Lists)
            {
                <span class="kwrd">try</span>
                {
                    SPField spFieldAssignedTo = spList.Fields.GetFieldByInternalName(<span class="str">"AssignedTo"</span>);
                    <span class="kwrd">if</span> (spFieldAssignedTo == <span class="kwrd">null</span>)
                        <span class="kwrd">throw</span> <span class="kwrd">new</span> Exception();
                }
                <span class="kwrd">catch</span>
                {
                    <span class="kwrd">continue</span>;
                }

                SPQuery spQuery = <span class="kwrd">new</span> SPQuery();

                spQuery.Query = String.Format(
                    <span class="str">"&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name='{0}' LookupId='TRUE' /&gt;&lt;Value Type='User'&gt;{1}"</span>
                    + <span class="str">"&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;"</span>,
                    <span class="str">"AssignedTo"</span>,
                    spWebThis.CurrentUser.ID.ToString());

                SPListItemCollection spListItemCollection = spList.GetItems(spQuery);

                <span class="kwrd">if</span> (spListItemCollection.Count &gt; 0)
                {
                    listIndex++;

                    <span class="rem">// This is a (messy) replication of the code used</span>
                    <span class="rem">// by SharePoint's expanding/collapsing list viewer </span>
                    LiteralControl headerLiteral = <span class="kwrd">new</span> LiteralControl(String.Format(
                        <span class="str">"&lt;TBODY id=\"titl{0}_\" groupString=\"\"&gt;&lt;TR&gt;&lt;TD colspan=\"100\" class=\"ms-gb\""</span>
                        + <span class="str">" style=\"border-bottom: 0; border-top: 0;\" nowrap&gt;"</span>
                        + <span class="str">"&lt;img src=\"/_layouts/images/blank.gif\" alt=\"\" height=1 width=0&gt;"</span>
                        + <span class="str">"&lt;a href=\"javascript:\" onclick=\"javascript:ExpCollGroup('{0}_','img_{0}_');"</span>
                        + <span class="str">"return false;\"&gt;"</span>
                        + <span class="str">"&lt;img id=\"img_{0}_\" src=\"/_layouts/images/plus.gif\" alt=\"Expand/Collapse\""</span>
                        + <span class="str">" border=\"0\"&gt;&lt;/a&gt;&amp;nbsp;"</span>
                        + <span class="str">"&lt;a href=\"javascript:\" onclick=\"javascript:ExpCollGroup('{0}_','img_{0}_');"</span>
                        + <span class="str">"return false;\"&gt;"</span>
                        + <span class="str">"{1}&lt;/a&gt;&amp;nbsp;({2})&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;TBODY id=\"tbod{0}__\""</span>
                        + <span class="str">" style=\"display: none;\" isLoaded=\"true\"&gt;"</span>,
                        <span class="str">"1-"</span> + listIndex,
                        spList.Title,
                        spListItemCollection.Count));

                    headerLiteral.RenderControl(writer);

                    <span class="kwrd">int</span> item = 0;
                    <span class="kwrd">foreach</span> (SPListItem spListItem <span class="kwrd">in</span> spListItemCollection)
                    {
                        <span class="preproc">#region</span> Create controls <span class="kwrd">for</span> basic item information
                        TableRow rowItem = <span class="kwrd">new</span> TableRow();
                        rowItem.Attributes[<span class="str">"class"</span>] = rowClass;
                        table.Rows.Add(rowItem);

                        TableCell cellItemTitle = <span class="kwrd">new</span> TableCell();
                        rowItem.Cells.Add(cellItemTitle);
                        cellItemTitle.Attributes[<span class="str">"class"</span>] = <span class="str">"ms-vb2"</span>;
                        cellItemTitle.VerticalAlign = VerticalAlign.Top;

                        HyperLink anchorItemTitle = <span class="kwrd">new</span> HyperLink();
                        cellItemTitle.Controls.Add(anchorItemTitle);
                        anchorItemTitle.NavigateUrl = spList.Forms[PAGETYPE.PAGE_DISPLAYFORM]
                            .ServerRelativeUrl + <span class="str">"?ID="</span> + spListItem.ID;
                        <span class="kwrd">string</span> strItemName = <span class="str">""</span>;

                        SPField fieldTitle = spListItem.Fields.GetFieldByInternalName(<span class="str">"Title"</span>);
                        strItemName = fieldTitle.GetFieldValueAsText(spListItem[fieldTitle.Id]);

                        <span class="kwrd">if</span> (strItemName == <span class="kwrd">null</span> || strItemName.Trim().Length == 0)
                            strItemName = <span class="str">"(No title)"</span>;
                        anchorItemTitle.Text = strItemName;

                        TableCell cellItemModified = <span class="kwrd">new</span> TableCell();
                        rowItem.Cells.Add(cellItemModified);
                        cellItemModified.Attributes[<span class="str">"class"</span>] = <span class="str">"ms-vb2"</span>;
                        cellItemModified.Wrap = <span class="kwrd">false</span>;
                        cellItemModified.VerticalAlign = VerticalAlign.Top;

                        SPField fieldModified = spListItem.Fields.GetFieldByInternalName(<span class="str">"Modified"</span>);
                        cellItemModified.Text = fieldModified.GetFieldValueAsText(
                            spListItem[fieldModified.Id]);

                        TableCell cellItemModifiedBy = <span class="kwrd">new</span> TableCell();
                        rowItem.Cells.Add(cellItemModifiedBy);
                        cellItemModifiedBy.Attributes[<span class="str">"class"</span>] = <span class="str">"ms-vb2"</span>;
                        cellItemModifiedBy.Wrap = <span class="kwrd">false</span>;
                        cellItemModifiedBy.VerticalAlign = VerticalAlign.Top;

                        SPField fieldModifiedBy = spListItem.Fields.GetFieldByInternalName(<span class="str">"Editor"</span>);
                        cellItemModifiedBy.Text = fieldModifiedBy.GetFieldValueAsHtml(
                            spListItem[fieldModifiedBy.Id]);

                        TableCell cellItemList = <span class="kwrd">new</span> TableCell();
                        rowItem.Cells.Add(cellItemList);
                        cellItemList.Attributes[<span class="str">"class"</span>] = <span class="str">"ms-vb2"</span>;
                        cellItemList.Wrap = <span class="kwrd">false</span>;
                        cellItemList.VerticalAlign = VerticalAlign.Top;

                        HyperLink anchorList = <span class="kwrd">new</span> HyperLink();
                        cellItemList.Controls.Add(anchorList);
                        anchorList.NavigateUrl = spList.Forms[PAGETYPE.PAGE_DISPLAYFORM].ServerRelativeUrl;
                        anchorList.Text = spList.Title;

                        TableCell cellItemSite = <span class="kwrd">new</span> TableCell();
                        rowItem.Cells.Add(cellItemSite);
                        cellItemSite.Attributes[<span class="str">"class"</span>] = <span class="str">"ms-vb2"</span>;
                        cellItemSite.Wrap = <span class="kwrd">false</span>;
                        cellItemSite.VerticalAlign = VerticalAlign.Top;

                        HyperLink anchorWeb = <span class="kwrd">new</span> HyperLink();
                        cellItemSite.Controls.Add(anchorWeb);
                        anchorWeb.NavigateUrl = spWeb.ServerRelativeUrl;
                        anchorWeb.Text = spWeb.Title;

                        rowItem.RenderControl(writer);
                        <span class="preproc">#endregion</span>

                        rowClass = (rowClass == <span class="str">""</span>) ? <span class="str">"ms-alternating"</span> : <span class="str">""</span>;
                        count++;
                        item++;
                    }

                    TableRow rowSpacer = <span class="kwrd">new</span> TableRow();
                    table.Rows.Add(rowSpacer);

                    TableCell cellSpacer = <span class="kwrd">new</span> TableCell();
                    cellSpacer.ColumnSpan = table.Rows.Count;
                    cellSpacer.Text = <span class="str">"&lt;img src=\"/_layouts/images/blank.gif\" alt=\"\" height=10 width=0&gt;"</span>;
                    rowSpacer.Cells.Add(cellSpacer);

                    rowSpacer.RenderControl(writer);

                    LiteralControl footerLiteral = <span class="kwrd">new</span> LiteralControl(String.Format(
                        <span class="str">"&lt;/TBODY&gt;&lt;TBODY id=\"foot{0}__\"&gt;&lt;/TBODY&gt;"</span>,
                        <span class="str">"1-"</span> + listIndex));

                    footerLiteral.RenderControl(writer);
                }
            }
        }

        <span class="kwrd">if</span> (count == 0)
        {
            <span class="preproc">#region</span> Create controls <span class="kwrd">for</span> <span class="str">'no items'</span>
            TableRow rowItemNone = <span class="kwrd">new</span> TableRow();
            table.Rows.Add(rowItemNone);

            TableCell cellItemNone = <span class="kwrd">new</span> TableCell();
            rowItemNone.Cells.Add(cellItemNone);
            cellItemNone.ColumnSpan = table.Rows.Count;
            cellItemNone.Attributes[<span class="str">"class"</span>] = <span class="str">"ms-propertysheet"</span>;
            cellItemNone.VerticalAlign = VerticalAlign.Top;
            cellItemNone.Style.Add(<span class="str">"padding-left"</span>, <span class="str">"5px"</span>);
            cellItemNone.Text = <span class="str">"No items"</span>;

            rowItemNone.RenderControl(writer);
            <span class="preproc">#endregion</span>
        }

        table.RenderEndTag(writer);
    }

    <span class="kwrd">private</span> <span class="kwrd">void</span> PopulateWebCollectionRecursive(List&lt;SPWeb&gt; webs, SPWeb thisWeb)
    {
        webs.Add(thisWeb);

        <span class="rem">// Important to use .GetSubwebsForCurrentUser() as opposed</span>
        <span class="rem">// to the .Webs collection, as the user may not be privileged</span>
        <span class="rem">// to certain webs</span>
        <span class="kwrd">foreach</span> (SPWeb subWeb <span class="kwrd">in</span> thisWeb.GetSubwebsForCurrentUser())
            PopulateWebCollectionRecursive(webs, subWeb);
    }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.zmeng.com.au/blog/2009/09/source-code-for-items-assigned-to-me-web-part/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Determining web part user permissions on a Web Part Page</title>
		<link>http://www.zmeng.com.au/blog/2009/03/determining-web-part-user-permissions-on-a-web-part-page/</link>
		<comments>http://www.zmeng.com.au/blog/2009/03/determining-web-part-user-permissions-on-a-web-part-page/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 00:11:35 +0000</pubDate>
		<dc:creator>Zac Mullett</dc:creator>
		
		<category><![CDATA[SharePoint]]></category>

		<category><![CDATA[Web Part]]></category>

		<category><![CDATA[WSS 3.0]]></category>

		<guid isPermaLink="false">http://www.zmeng.com.au/blog/?p=122</guid>
		<description><![CDATA[A web part I&#8217;m creating must display an option to save settings, but only for designer (or administrator) users.
Web Part Page documents are SPListItem objects internally, even though SharePoint makes a distinction between document and list libraries in the user interface. I couldn&#8217;t find a path through the object model of finding this SPListItem that [...]]]></description>
			<content:encoded><![CDATA[<p>A web part I&#8217;m creating must display an option to save settings, but only for designer (or administrator) users.</p>
<p>Web Part Page documents are <code>SPListItem</code> objects internally, even though SharePoint makes a distinction between document and list libraries in the user interface. I couldn&#8217;t find a path through the object model of finding this <code>SPListItem</code> that my web part instance was a part of. Instead I accessed the item via the current URL and a reference to the context&#8217;s <code>SPWeb</code>.</p>
<p>A typical problem with assessing permissions (or roles) for a non-administrative user is that SharePoint savagely denies access to it. Try/catch blocks can be ineffective here, with ASP.NET deciding to redirect to the &#8216;Access denied&#8217; page. Depending on what you need to do, there are methods involving simple <a href="http://msdn.microsoft.com/en-us/library/system.security.principal.windowsidentity.impersonate(vs.71).aspx">impersonation</a> or <a href="http://www.bluedoglimited.com/SharePointThoughts/ViewPost.aspx?ID=7">more convoluted techniques</a>. </p>
<p>Thankfully I found a peace-loving property <code>.AllRolesForCurrentUser</code> that accurately returns the item-level roles for the current user, regardless of their permissions level.</p>
<p><span id="more-122"></span>The resulting function,</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">
    <span class="kwrd">bool</span> IsDesigner()
    {
        SPWeb spWeb = SPControl.GetContextWeb(<span class="kwrd">this</span>.Context);
        <span class="kwrd">string</span> pageUrl = <span class="kwrd">this</span>.Page.Request.Url.AbsolutePath;
        SPListItem spListItem = spWeb.GetListItem(pageUrl);

        <span class="kwrd">foreach</span> (SPRoleDefinition roleDefinition <span class="kwrd">in</span> spListItem.AllRolesForCurrentUser)
        {
            <span class="kwrd">if</span> (roleDefinition.Type == SPRoleType.WebDesigner
                || roleDefinition.Type == SPRoleType.Administrator)
            {
                <span class="kwrd">return</span> <span class="kwrd">true</span>;
            }
        }

        <span class="kwrd">return</span> <span class="kwrd">false</span>;
    }</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.zmeng.com.au/blog/2009/03/determining-web-part-user-permissions-on-a-web-part-page/feed/</wfw:commentRss>
		</item>
		<item>
		<title>DataFormWebPart&#8217;s sensitivity to XSLT parameter tag placement</title>
		<link>http://www.zmeng.com.au/blog/2009/02/dataformwebparts-xslt-param-tag/</link>
		<comments>http://www.zmeng.com.au/blog/2009/02/dataformwebparts-xslt-param-tag/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 06:59:33 +0000</pubDate>
		<dc:creator>Zac Mullett</dc:creator>
		
		<category><![CDATA[SharePoint]]></category>

		<category><![CDATA[DataFormWebPart]]></category>

		<category><![CDATA[SharePoint Designer]]></category>

		<category><![CDATA[WSS 3.0]]></category>

		<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://www.zmeng.com.au/blog/?p=103</guid>
		<description><![CDATA[While customising the XSLT of a DataFormWebPart I found a discrepancy between design-time and run-time interpretation of a template tag implementing param and variable tags. Placing the &#60;xsl:param&#62; tags first is important.
In design-time it doesn&#8217;t so much matter where you place the &#60;xsl:param&#62; tag - SharePoint Designer will render the web part. At run-time, if [...]]]></description>
			<content:encoded><![CDATA[<p>While customising the XSLT of a DataFormWebPart I found a discrepancy between design-time and run-time interpretation of a template tag implementing <code>param</code> and <code>variable</code> tags. Placing the <span class="csharpcode"><span class="kwrd">&lt;</span><span class="html">xsl:param</span><span class="kwrd">&gt;</span></span> tags first is important.</p>
<p><span id="more-103"></span>In design-time it doesn&#8217;t so much matter where you place the <span class="csharpcode"><span class="kwrd">&lt;</span><span class="html">xsl:param</span><span class="kwrd">&gt;</span></span> tag - SharePoint Designer will render the web part. At run-time, if <span class="csharpcode"><span class="kwrd">&lt;</span><span class="html">xsl:param</span><span class="kwrd">&gt;</span></span> tags appear beneath <span class="csharpcode"><span class="kwrd">&lt;</span><span class="html">xsl:variable</span><span class="kwrd">&gt;</span></span> tags then SharePoint delivers one of its characteristically unhelpful error messages (shown below). Of course, you try out what it suggests and everything is irritatingly fine in Designer.</p>
<div class="blockquote"><i><strong>Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator.</strong></i></div>
]]></content:encoded>
			<wfw:commentRss>http://www.zmeng.com.au/blog/2009/02/dataformwebparts-xslt-param-tag/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Improving readability of multi-line text columns in display view</title>
		<link>http://www.zmeng.com.au/blog/2009/02/improving-readability-of-multi-line-text-columns-in-display-view/</link>
		<comments>http://www.zmeng.com.au/blog/2009/02/improving-readability-of-multi-line-text-columns-in-display-view/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 03:40:22 +0000</pubDate>
		<dc:creator>Zac Mullett</dc:creator>
		
		<category><![CDATA[SharePoint]]></category>

		<category><![CDATA[WSS 3.0]]></category>

		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.zmeng.com.au/blog/?p=71</guid>
		<description><![CDATA[SharePoint users have a tendency to create All Items views containing almost every column in their lists. In cases like these, the readability is often poor, and SharePoint gives users no ability to format the cells appropriately (such as text alignment, column width, etc). One case where this is most disrupting is for multi-line text [...]]]></description>
			<content:encoded><![CDATA[<p>SharePoint users have a tendency to create All Items views containing almost every column in their lists. In cases like these, the readability is often poor, and SharePoint gives users no ability to format the cells appropriately (such as text alignment, column width, etc). One case where this is most disrupting is for multi-line text columns. Single line text columns have a CSS width setting, but multi-line columns depend on the user including a sensible amount of columns to view. The image below illustrates this circumstance.</p>
<div style="text-align: center">
<img class="size-full wp-image-96 bordered" title="Squashed multi-line text column" src="http://www.zmeng.com.au/blog/wp-content/uploads/multi-line.png" alt="Squashed multi-line text column" width="476" height="239" />
</div>
<p><span id="more-71"></span>There are a few available options to improve the readability of multi-line columns:</p>
<ol>
<li>Make the column name really really long</li>
<li>Create a Datasheet view where column size settings are preserved (this option isn&#8217;t applicable to users browsing with anything except Internet Explorer)</li>
<li>Modify the <code>FLDTYPES.XML</code> file to set a fixed width in HTML</li>
<li>Create the same effect as option #3 by employing a new custom field with modified rendering (thus avoiding unrecommended toying with <code>FLDTYPES.XML</code>)</li>
</ol>
<p> </p>
<p>Despite the modification of <code>FLDTYPES.XML</code> being <a href="http://msdn.microsoft.com/en-us/library/ms469928.aspx" target="_blank">unrecommended and unsupported</a>, I went for option #3. It&#8217;s a simple and fairly unimposing change. There are two caveats though:</p>
<ul>
<li>This change will force a minimum width on all multi-line text fields on all display modes of all webs on the server</li>
<li>The change will be lost if WSS is reinstalled, as it is not stored in the database</li>
</ul>
<p> </p>
<p>The code snippet below shows the two lines I added to <code>FLDTYPES.XML</code> to make multi-line text columns display with a minimum width of 300 pixels. Note that the CSS <code>min-width</code> attribute is not applicable in IE, so <code>width</code> is used to similar effect. Don&#8217;t forget to restart the IIS server after changes made to <code>FLDTYPES.XML</code>.</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">    <span class="kwrd">&lt;</span><span class="html">FieldType</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">="TypeName"</span><span class="kwrd">&gt;</span>Note<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">="TypeDisplayName"</span><span class="kwrd">&gt;</span>$Resources:core,fldtype_note;<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">="InternalType"</span><span class="kwrd">&gt;</span>Note<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">="SQLType"</span><span class="kwrd">&gt;</span>ntext<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">="ParentType"</span><span class="kwrd">&gt;&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">="FieldTypeClass"</span><span class="kwrd">&gt;</span>Microsoft.SharePoint.SPFieldMultiLineText<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">="Sortable"</span><span class="kwrd">&gt;</span>FALSE<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">Field</span> <span class="attr">Name</span><span class="kwrd">="Filterable"</span><span class="kwrd">&gt;</span>FALSE<span class="kwrd">&lt;/</span><span class="html">Field</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">RenderPattern</span> <span class="attr">Name</span><span class="kwrd">="HeaderPattern"</span><span class="kwrd">&gt;</span>
            <span style="background: yellow"><span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">style</span><span class="kwrd">="width: 300px"</span><span class="kwrd">&gt;</span>]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span></span>
            <span class="kwrd">&lt;</span><span class="html">FieldSwitch</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">Expr</span><span class="kwrd">&gt;&lt;</span><span class="html">GetVar</span> <span class="attr">Name</span><span class="kwrd">='Filter'</span><span class="kwrd">/&gt;&lt;/</span><span class="html">Expr</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">Case</span> <span class="attr">Value</span><span class="kwrd">="1"</span><span class="kwrd">&gt;</span>
                    <span class="kwrd">&lt;</span><span class="html">FieldSwitch</span><span class="kwrd">&gt;</span>
                        <span class="kwrd">&lt;</span><span class="html">Expr</span><span class="kwrd">&gt;&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">="aggregation"</span><span class="kwrd">/&gt;&lt;/</span><span class="html">Expr</span><span class="kwrd">&gt;</span>
                        <span class="kwrd">&lt;</span><span class="html">Case</span> <span class="attr">Value</span><span class="kwrd">="merge"</span><span class="kwrd">&gt;</span>
                            <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&lt;</span><span class="html">INPUT</span> <span class="attr">TYPE</span><span class="kwrd">="TEXT"</span> <span class="attr">MAXLENGTH</span><span class="kwrd">="256"</span> <span class="attr">CLASS</span><span class="kwrd">="ms-input"</span> <span class="attr">ID</span>="<span class="attr">diidFilter</span>]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
                            <span class="kwrd">&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">='Name'</span><span class="kwrd">/&gt;</span>
                            <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[" OnKeyPress='FilterNoteField("]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
                            <span class="kwrd">&lt;</span><span class="html">GetVar</span> <span class="attr">Name</span><span class="kwrd">="View"</span><span class="kwrd">/&gt;</span>
                            <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[",]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
                            <span class="kwrd">&lt;</span><span class="html">ScriptQuote</span><span class="kwrd">&gt;&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">='Name'</span> <span class="attr">URLEncode</span><span class="kwrd">="TRUE"</span><span class="kwrd">/&gt;&lt;/</span><span class="html">ScriptQuote</span><span class="kwrd">&gt;</span>
                            <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[,this.value, event.keyCode);' OnChange='FilterNoteField("]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
                            <span class="kwrd">&lt;</span><span class="html">GetVar</span> <span class="attr">Name</span><span class="kwrd">="View"</span><span class="kwrd">/&gt;&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[",]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
                            <span class="kwrd">&lt;</span><span class="html">ScriptQuote</span><span class="kwrd">&gt;&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">='Name'</span> <span class="attr">URLEncode</span><span class="kwrd">="TRUE"</span><span class="kwrd">/&gt;&lt;/</span><span class="html">ScriptQuote</span><span class="kwrd">&gt;</span>
                            <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[,this.value, 13);'<span class="kwrd">/&gt;</span>]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
                            <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&lt;</span><span class="html">BR</span><span class="kwrd">&gt;</span>]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
                        <span class="kwrd">&lt;/</span><span class="html">Case</span><span class="kwrd">&gt;</span>
                        <span class="kwrd">&lt;</span><span class="html">Default</span><span class="kwrd">/&gt;</span>
                    <span class="kwrd">&lt;/</span><span class="html">FieldSwitch</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;/</span><span class="html">Case</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">Default</span><span class="kwrd">/&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">FieldSwitch</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">="DisplayName"</span> <span class="attr">HTMLEncode</span><span class="kwrd">="TRUE"</span><span class="kwrd">/&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&lt;</span><span class="html">IMG</span> <span class="attr">SRC</span>="]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;</span><span class="html">FieldFilterImageURL</span><span class="kwrd">/&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[" BORDER=0 ALT=]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;</span>$Resources:core,550;<span class="kwrd">&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&gt;</span>]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
            <span style="background: yellow"><span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;&lt;!</span>[CDATA[<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>]]<span class="kwrd">&gt;&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span></span>
        <span class="kwrd">&lt;/</span><span class="html">RenderPattern</span><span class="kwrd">&gt;</span>
        ...
    <span class="kwrd">&lt;/</span><span class="html">FieldType</span><span class="kwrd">&gt;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.zmeng.com.au/blog/2009/02/improving-readability-of-multi-line-text-columns-in-display-view/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Consequences of the failure to incorporate negative externalities into energy prices</title>
		<link>http://www.zmeng.com.au/blog/2009/01/consequences-of-the-failure-to-incorporate-negative-externalities-into-energy-prices/</link>
		<comments>http://www.zmeng.com.au/blog/2009/01/consequences-of-the-failure-to-incorporate-negative-externalities-into-energy-prices/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 19:47:04 +0000</pubDate>
		<dc:creator>Zac Mullett</dc:creator>
		
		<category><![CDATA[Sustainability]]></category>

		<category><![CDATA[Economics]]></category>

		<category><![CDATA[Energy]]></category>

		<category><![CDATA[Essay]]></category>

		<category><![CDATA[Externalities]]></category>

		<guid isPermaLink="false">http://www.zmeng.com.au/blog/?p=52</guid>
		<description><![CDATA[(A topical essay I wrote for an Energy Economics unit)
Cheap energy has been abundantly available for the last century. But is it really as cheap as it seems? Conventional energy trade carries external costs that neither the producer nor the consumer pays. Society at large must foot the bill for negative social and environmental by-products [...]]]></description>
			<content:encoded><![CDATA[<p><em>(A topical essay I wrote for an Energy Economics unit)</em></p>
<p>Cheap energy has been abundantly available for the last century. But is it really as cheap as it seems? Conventional energy trade carries external costs that neither the producer nor the consumer pays. Society at large must foot the bill for negative social and environmental by-products of energy production and consumption. This paper discusses the consequences of the failure to incorporate these externalities into the price of traded energy.</p>
<p>Externalities are defined as benefits or costs generated as an unintended by-product of an economic activity that do not accrue to the parties involved in the activity and where no compensation takes place<sup>[5]</sup>. In other words, any party (be it an individual, a group, a society or world-wide) external to an economic transaction may receive positive or negative impacts to which they had no intention or input in accruing.</p>
<p><span id="more-52"></span>
<div class="mceTemp mceIEcenter">
<dl id="attachment_49" class="wp-caption aligncenter" style="width: 310px;">
<dt class="wp-caption-dt"><img class="size-medium wp-image-49" title="externalities-flow-chart" src="http://www.zmeng.com.au/blog/wp-content/uploads/externalities-flow-chart-300x187.png" alt="Externalities flow chart" width="300" height="187" /></dt>
<dd class="wp-caption-dd">
<p class="MsoCaption" align="center"><a name="_Ref194062446"></a><!--[if supportFields]><span style="mso-bookmark:_Ref194062446" mce_style="mso-bookmark:_Ref194062446"></span><span style="mso-element:field-begin" mce_style="mso-element:field-begin"></span><span style="mso-bookmark:_Ref194062446" mce_style="mso-bookmark:_Ref194062446"><span lang=EN-AU><span style="mso-spacerun:yes" mce_style="mso-spacerun:yes"> </span>SEQ Figure \* ARABIC <span style="mso-element: field-separator" mce_style="mso-element: field-separator"></span></span></span><![endif]--><span><span lang="EN-AU">Figure 1</span></span><!--[if supportFields]><span style="mso-bookmark:_Ref194062446" mce_style="mso-bookmark:_Ref194062446"></span><span style="mso-element:field-end" mce_style="mso-element:field-end"></span><![endif]--><span lang="EN-AU">: Economic exchange showing externalities<sup>[7]</sup></span></p>
</dd>
</dl>
</div>
<p>Figure 1 illustrates the transactions involved in a voluntary economic exchange where externalities are present. An external cost or benefit may be created during production of a good, and/or during the consumption of that good. An example of a positive externality is that of education given to some individuals in a society leading to a greater prosperity for all in that society. A negative externality example is that of an individual consuming a cigarette in a crowded area where everybody else must passively smoke their cigarette and inherit the health risks.</p>
<p>Externalities are a form of market failure. Market failure describes a condition where the allocation of goods in a free market economy is not optimal. In practical terms, market failure is said to occur when individuals’ pursuit of self-interest leads to a negative result for society overall. This form of market failure can be addressed by internalising the externalised costs or benefits. In other words, any economic gains or losses received by third parties are captured and passed back to the parties involved in the originating transaction. There are a variety of economic mechanisms available to internalise externalities, such as command and control action or market-based methods like taxation, subsidies or assigning property rights.</p>
<p>Externalities in energy trade occur both in the production and the consumption ends of the transaction. These externalities, upon society, are typically negative - the details of why will be examined later. Initially, we will explore the underlying economic theory of negative externalities.</p>
<p>To fully understand the following theory discussion, some terms must first be defined. <em>Marginal Private Cost</em> (or MPC) is the willingness for a supplier to accept a price for goods produced as a function of quantity. <em>Marginal Private Benefit</em> (or MPB) is the willingness for a consumer to pay a price for goods to consume as a function of quantity. <em>Pareto improvement</em> is the act of reallocating the distribution of goods within an economy such that at least one individual is made better off without making any other individuals worse off. <em>Deadweight loss</em> denotes an inefficiency in goods allocation within an economy which could be made efficient using Pareto improvement.</p>
<div class="mceTemp mceIEcenter">
<dl id="attachment_50" class="wp-caption aligncenter" style="width: 310px;">
<dt class="wp-caption-dt"><img class="size-medium wp-image-50" title="external-cost-of-production" src="http://www.zmeng.com.au/blog/wp-content/uploads/external-costs-of-production-300x219.png" alt="External cost of production" width="300" height="219" /></dt>
<dd class="wp-caption-dd">
<p class="MsoCaption" align="center"><a name="_Ref194161493"></a><!--[if supportFields]><span style="mso-bookmark:_Ref194161493" mce_style="mso-bookmark:_Ref194161493"></span><span style="mso-element:field-begin" mce_style="mso-element:field-begin"></span><span style="mso-bookmark:_Ref194161493" mce_style="mso-bookmark:_Ref194161493"><span lang=EN-AU><span style="mso-spacerun:yes" mce_style="mso-spacerun:yes"> </span>SEQ Figure \* ARABIC <span style="mso-element: field-separator" mce_style="mso-element: field-separator"></span></span></span><![endif]--><span><span lang="EN-AU">Figure 2</span></span><!--[if supportFields]><span style="mso-bookmark:_Ref194161493" mce_style="mso-bookmark:_Ref194161493"></span><span style="mso-element:field-end" mce_style="mso-element:field-end"></span><![endif]--><span lang="EN-AU">: Supply and demand chart of production showing external social costs<sup>[3]</sup></span></p>
</dd>
</dl>
</div>
<p>Figure 2 illustrates the differences in marginal cost of goods production where externalities are accounted for. The MPC curve is the private cost of production to the supplier. The <em>Marginal Social Cost</em> (or MSC) adds the price of abatement of external social costs onto the MPC. In this instance, consuming goods does not carry any external social cost, and so MPB and <em>Marginal Social Benefit</em> (or MSB) are equivalent. The socially optimal trade occurs at quantity <strong>q<sup>s</sup></strong> and price <strong>p<sup>s</sup></strong>. Without accounting for externalities, the optimal trade occurs at <strong>q</strong> and <strong>p</strong>. The oversupply in quantity produced leads to a deadweight loss to society, however free market competition does not provide incentive for Pareto improvement towards social optimality. An example of a production externality in the energy context is a coal-fired electricity generator may sell electricity without abating emissions that impress a cost onto society.</p>
<div class="mceTemp mceIEcenter">
<dl id="attachment_51" class="wp-caption aligncenter" style="width: 310px;">
<dt class="wp-caption-dt"><img class="size-medium wp-image-51" title="external-cost-of-consumption" src="http://www.zmeng.com.au/blog/wp-content/uploads/external-costs-of-consumption-sd-rev1-300x227.png" alt="External cost of consumption" width="300" height="227" /></dt>
<dd class="wp-caption-dd">
<p class="MsoCaption" align="center"><a name="_Ref194164043"></a><!--[if supportFields]><span style="mso-bookmark:_Ref194164043" mce_style="mso-bookmark:_Ref194164043"></span><span style="mso-element:field-begin" mce_style="mso-element:field-begin"></span><span style="mso-bookmark:_Ref194164043" mce_style="mso-bookmark:_Ref194164043"><span lang=EN-AU><span style="mso-spacerun:yes" mce_style="mso-spacerun:yes"> </span>SEQ Figure \* ARABIC <span style="mso-element: field-separator" mce_style="mso-element: field-separator"></span></span></span><![endif]--><span><span lang="EN-AU">Figure 3</span></span><!--[if supportFields]><span style="mso-bookmark:_Ref194164043" mce_style="mso-bookmark:_Ref194164043"></span><span style="mso-element:field-end" mce_style="mso-element:field-end"></span><![endif]--><span lang="EN-AU">: Supply and demand chart of consumption showing external social costs<sup>[3]</sup></span></p>
</dd>
</dl>
</div>
<p>Figure 3 illustrates an alternative situation where an external cost to society is present in the consumption of goods. In this instance, producing goods does not carry any external social cost, and so MPC is equivalent to MSC. Again the socially optimal trade occurs at quantity <strong>q<sup>s</sup></strong> and price <strong>p<sup>s</sup></strong>, and the optimal trade with accounting for externalities is at <strong>q</strong> and <strong>p</strong>. There is a deadweight loss to society in the oversupply of quantities traded when externalities in consumption of goods are not costed into the transaction. An example of a consumption externality in the energy context is the use of petrol in a car, providing transport to the consumer, without the consumer paying for engine emissions impressing a cost onto society.</p>
<p>The topic of negative externalities is particularly relevant to the energy market due to the nature of available energy production methods. Fossil fuels, to date, have been inexpensive to obtain, process and use. Some fossil fuels such as oil and gas are highly flexible due to their ease of transportability and high energy to mass ratio. It so happens that those which are used to produce the cheapest energy (coal and uranium) also carry the highest social costs<sup>[2]</sup>. In general, with the present level of technology and infrastructure, methods boasting lower social costs also deliver higher private costs, and vice versa.</p>
<p>There are numerous reasons why externalities in the energy market have not been internalised in the past and the present. The cheap generation, sale and delivery of energy was seen as the clear path to rapid industrialisation during the 19th century<sup>[6]</sup>. Only during these last decades has society begun to take heed of the growing external social and environmental costs being created by energy markets – degradation to health and the environment is now clear and present. Even so, today, the formation of global energy markets has forced energy suppliers to de-prioritise social and environmental considerations in order to stay competitive with a world of fierce market players. Also, while the true costs of these externalities are still being fiercely debated in global forums, the economic devices necessary to grow a socially-optimal energy market have not yet been instigated.</p>
<p>The failure to incorporate negative externalities into the price of energy has several categories of consequences. Each of these will be discussed in turn.</p>
<p>Neglecting to accommodate the social cost of energy has led to overdevelopment and overconsumption.  An artificially low price creates an incorrect market signal that results in greater production than is warranted. The global marketplace has now developed an unhealthy, increasing demand for energy that cannot be easily recessed or even slowed.</p>
<p>The most topical consequence of energy use is the degradation of social and environmental public goods. A public good is a non-excludable, non-rival good, and thus is not owned by any particular party. The lack of property rights on the environment has enabled society at large to produce and consume energy with very limited knowledge or consideration of the external costs. The use of fossil fuels for energy is largely to blame for environmental damages, which can be divided into two categories; emissions related to climate change, and emissions not related to climate change.</p>
<p>Climate change is, by far, the most threatening and most wide-reaching result of failing to internalise the negative externalities of energy trade. The production and consumption of hydrocarbon based energy has made a major contribution to the quantity of carbon dioxide gas entering the atmosphere, which is the catalyst for many knock-on effects such as atmospheric warming, rising sea levels, and destabilised and intensified weather patterns. Further effects include glacial retreat, species extinctions, disease propagation and overall decreases in agricultural yields<sup>[2]</sup>. While the heavily inertial nature of global climate change has made externalities difficult to quantify, the consequences of failing to abate these external by-products will result in profound costs for society the world over.</p>
<p>A multitude of other environmental and social costs are associated with the unabated externalities of energy trade. Emissions from fossil fuel energy suppliers affect the health and well-being of people in their vicinity, as well as the natural and built environment. Along with carbon dioxide, coal power stations emit sulphur dioxides, nitrous oxides, particulate matter and other toxic material which has a range of detrimental effects such as acid rain that decays structures and poisons crops, and invokes respiratory disease in people<sup>[2]</sup>. Large cities of motor vehicle commuters create similar effects, along with haze, smog and noise. Oil spills and effluent leaks damage ocean sea life and in turn the yield from fishing. The transmission and consumption of electricity creates strong magnetic fields, which have been linked to cancer development and other health effects. Accidental explosions from power plants cost lives, with the fallout from nuclear incidents slowly killing thousands to date<sup>[1]</sup>. Energy trade, without care, can be responsible for many non-trivial social and environmental costs.</p>
<p>Consuming finite resources without accounting for depletion creates inter-temporal consequences. To say an economic transaction is inter-temporally inefficient is to indicate that it is unsustainable in current form, and future transactions will have less value or no longer be possible. This is true to say of fossil fuel energy resources, as there is a fixed amount of coal, oil, gas and uranium worldwide. As stockpiles are exhausted, energy suppliers must spend more to access more technically or politically challenging sources. To this end, fossil fuel based energy tomorrow will ask a higher price than today. However, this scenario is not internalised in today’s transactions, and thus becomes a growing externality to tomorrow’s energy trader parties.</p>
<p>Failing to reflect the total social costs in free-market energy prices has resulted in alternative energy technologies to remain commercially underdeveloped. Alternative stationary electricity generation techniques such as solar or wind attempt to compete in the open market and are largely unsuccessful. The same can be said for transportable fuel systems such as hydrogen or electric engines. The cause of this failure is two-fold. Firstly, decades of improvement and infrastructure development have seen fossil fuel based energy systems inherit an underlying subsidy in today’s marketplace. De-centralised systems that cannot provide baseload energy are more challenging to integrate into conventional grids<sup>[6]</sup>. Similarly for transportable fuels, petrol is available anywhere yet no hydrogen or electricity stations exist to refill alternative engines. Alterative energy systems have not had the same investment historically, leaving them with room for improvement and the contracts with the conventional fossil-based energy suppliers. The playing field may be evened for these alternative energy suppliers by a subsidy that recognises the social benefits in comparison to conventional stationary energy supply.</p>
<p>The second cause of failure for competitive alternative energy supply is in the failure to internalise the social and environmental costs of fossil-based energy suppliers into their energy price. If the costs of abatement and damage control (as discussed earlier) were entirely factored into the cost of fossil fuel energy, alternative fuel sources would not only be competitive, but in fact the preferred choice<sup>[4]</sup>.</p>
<p>Increased geopolitical risk is also an outcome of the failure to promote a competitive market for alternative energy systems. As fossil fuel resources continue to diminish, and consumer demands fail to reshape without incentive, the need to capture and secure more fossil resources will become a vast and costly political and military exercise. Energy security has been a vital concern since the oil crises in the 1970s<sup>[2]</sup>. While Australia is a net energy exporter, the same cannot be said for most other developed nations, whose failure to negate their fossil fuel inter-temporal inefficiencies has resulted in growing import dependence.</p>
<p>This paper has covered the economic theory of externalities, detailed the externalities associated with energy production and discussed the consequences of failing to incorporate externalities into the cost of energy. The past and present show us that the trade of energy has many significant social and environmental externalities that must be abated or controlled to prevent greater consequences than those already on the horizon.</p>
<p><strong>References</strong></p>
<p><sup>[1]</sup> Damien, M., 1992. Nuclear Power: The ambiguous lessons of history. Energy Policy July.<br />
<sup>[2]</sup> Hohmeyer, O. 1992. Renewables and the Full Costs of Energy, Energy Policy April: 365-375.<br />
<sup>[3]</sup> McHugh, A. 2007. Energy Economics Course Notes: Externalities. Murdoch University.<br />
<sup>[4]</sup> Nicklas, M. 1993. Energy Politics: Can we achieve a sustainable energy path? Solar Energy Vol. 50, No. 4.<br />
<sup>[5]</sup> Owen, A. 2004. Environmental Externalities, Market Distortions and the Economics of Renewable Energy Technologies. The Energy Journal Vol. 25, No. 3.<br />
<sup>[6]</sup> Shlapfer, A. 2007. Energy Economics Course Notes: The Structure of Energy Supply Systems. Murdoch University.<br />
<sup>[7]</sup> Wikipedia contributors. 2008. Externality. http://en.wikipedia.org/wiki/Externality (accessed 18 March 2008).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zmeng.com.au/blog/2009/01/consequences-of-the-failure-to-incorporate-negative-externalities-into-energy-prices/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Custom rendering of a field&#8217;s value in list display mode</title>
		<link>http://www.zmeng.com.au/blog/2009/01/custom-rendering-of-a-fields-value-in-list-display-mode/</link>
		<comments>http://www.zmeng.com.au/blog/2009/01/custom-rendering-of-a-fields-value-in-list-display-mode/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 02:55:23 +0000</pubDate>
		<dc:creator>Zac Mullett</dc:creator>
		
		<category><![CDATA[SharePoint]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[Custom Field]]></category>

		<category><![CDATA[Digital Signature]]></category>

		<category><![CDATA[WSS 3.0]]></category>

		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.zmeng.com.au/blog/?p=10</guid>
		<description><![CDATA[In developing the Digital Signature Field for SharePoint I wanted to add a graphic to clearly display the current state of the signature. Is the signature old, new or invalid? A coloured tick can convey this intuitively while economising on size.
Controlling the rendering of a custom field&#8217;s value in most display modes is straight-forward through [...]]]></description>
			<content:encoded><![CDATA[<p>In developing the <a href="http://www.zmeng.com.au/software/sharepoint/digital-signature-field.php">Digital Signature Field for SharePoint</a> I wanted to add a graphic to clearly display the current state of the signature. Is the signature old, new or invalid? A coloured tick can convey this intuitively while economising on size.</p>
<p>Controlling the rendering of a custom field&#8217;s value in most display modes is straight-forward through overrides to the <code>SPField</code> method <code>GetFieldValueAsHtml(object)</code> and the <code>Render(</code>&#8230;<code>)</code> methods of <code>BaseFieldControl</code>.  When it came to rendering the value on the list display (i.e. AllItems.aspx) I found that SharePoint limited me to doing this through the <code>RenderPattern</code> element in the field type definition XML, with the caveat that any values, properties or calculations be limited to the CAML <a href="http://msdn.microsoft.com/en-us/library/ms439798.aspx">View Schema</a> elements. The MSDN documentation on <a href="http://msdn.microsoft.com/en-us/library/bb862248.aspx">Patterns of Custom Field Rendering</a> hints that a <code>DisplayTemplate</code> specification will let you gain control of the display mode, including the list display. After messing around for a while I felt quite confident that it didn&#8217;t include the list display mode.</p>
<p>Some Googling later, I found someone who had bent the rules a little to achieve complete control over display list value rendering. This <a href="http://www.codeplex.com/iconset">IconSet</a> custom calculated field project uses a custom <code>RenderPattern</code> to generate a script reference to a custom aspx page that dynamically renders some document.write(&#8230;) code that then renders HTML. Values necessary to identifying which item and field are supplied by the CAML and passed by URL parameters.</p>
<p><span id="more-10"></span>Cunning it is, although not exactly ideal. Every rendered value of your custom field must perform this additional page query to the server, thus lists with many values will take significantly longer to render. Unfortunately so far I&#8217;ve found no alternatives to gaining full control of display list rendering.</p>
<p>Note that this procedure is only required when you can&#8217;t render the correct output using the decision logic available in the CAML View Schema. In my case I chose not use the simple <code>Text</code> field type as the parent type instead of the popular <code>MultiColumn</code> field type.</p>
<p>My <code>RenderPattern</code> XML looks like this:</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">
    <span class="kwrd">&lt;</span><span class="html">RenderPattern</span> <span class="attr">Name</span><span class="kwrd">="DisplayPattern"</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">IfEqual</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Expr1</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">Column</span> <span class="kwrd">/&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">Expr1</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Expr2</span> <span class="kwrd">/&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Then</span> <span class="kwrd">/&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">Else</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
                    <span class="kwrd">&lt;!</span>[CDATA[&lt;script language="javascript" src="../../_layouts/zmeng/]]<span class="kwrd">&gt;</span>
                    <span class="kwrd">&lt;!</span>[CDATA[DigitalSignature/DigitalSignatureDisplay.aspx?ListId=]]<span class="kwrd">&gt;</span>
                    <span class="kwrd">&lt;</span><span class="html">List</span> <span class="kwrd">/&gt;</span>
                    <span class="kwrd">&lt;!</span>[CDATA[&amp;ItemId=]]<span class="kwrd">&gt;</span>
                    <span class="kwrd">&lt;</span><span class="html">ID</span> <span class="kwrd">/&gt;</span>
                    <span class="kwrd">&lt;!</span>[CDATA[&amp;FieldDisplayName=]]<span class="kwrd">&gt;</span>
                    <span class="kwrd">&lt;</span><span class="html">Property</span> <span class="attr">Select</span><span class="kwrd">="DisplayName"</span><span class="kwrd">/&gt;</span>
                    <span class="kwrd">&lt;!</span>[CDATA["&gt;&lt;/script&gt;]]<span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;/</span><span class="html">HTML</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;/</span><span class="html">Else</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">IfEqual</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">RenderPattern</span><span class="kwrd">&gt;</span></pre>
<p>The <code>&lt;IfEqual&gt;</code> tests whether the column has a value, and if not it avoids making a purposeless server request. Supplying the list GUID, item ID and list column display name, the receiving aspx page can query the value then render as necessary.</p>
<p>The receiving class is as below. Remember to set <code>AutoEventWireup="true"</code> in the connecting aspx file so the <code>Page_Load</code> method will be called.</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode">    <span class="kwrd">public</span> <span class="kwrd">partial</span> <span class="kwrd">class</span> DigitalSignatureDisplay : System.Web.UI.Page
    {
        <span class="kwrd">protected</span> <span class="kwrd">void</span> Page_Load(<span class="kwrd">object</span> sender, EventArgs e)
        {
            <span class="kwrd">string</span> listId = Request.QueryString.Get(<span class="str">"ListId"</span>).ToString();
            <span class="kwrd">string</span> itemId = Request.QueryString.Get(<span class="str">"ItemId"</span>).ToString();
            <span class="kwrd">string</span> displayName = Request.QueryString.Get(<span class="str">"FieldDisplayName"</span>).ToString();

            Guid listGuid = <span class="kwrd">new</span> Guid(listId);
            <span class="kwrd">int</span> itemIndex = Int32.Parse(itemId);

            SPList spList = SPContext.Current.Web.Lists[listGuid];
            SPListItem spListItem = spList.GetItemById(itemIndex);

            <span class="rem">// Create some useful HTML output here</span>
            <span class="rem">// using the list item's value</span>
            <span class="kwrd">string</span> output = <span class="str">"&lt;b&gt;le output&lt;/b&gt;"</span>; 

            Page.Response.Write(<span class="str">"document.write('"</span>
                + output.Replace(<span class="str">"'"</span>, <span class="str">@"\'"</span>) + <span class="str">"');"</span>);

            Page.Response.Flush();
        }
    }</pre>
<p>The resultant effect of all that shown below.</p>
<div class="blockquote"><img class="alignnone size-full bordered" title="Custom list display field value rendering" src="http://www.zmeng.com.au/software/sharepoint/images/digital-signature-list-view-2.png" alt="Custom list display field value rendering" width="473" height="73" /></div>
]]></content:encoded>
			<wfw:commentRss>http://www.zmeng.com.au/blog/2009/01/custom-rendering-of-a-fields-value-in-list-display-mode/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Best robots of 2008</title>
		<link>http://www.zmeng.com.au/blog/2009/01/best-robots-of-2008/</link>
		<comments>http://www.zmeng.com.au/blog/2009/01/best-robots-of-2008/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 22:29:19 +0000</pubDate>
		<dc:creator>Zac Mullett</dc:creator>
		
		<category><![CDATA[Mechatronics]]></category>

		<category><![CDATA[robotics]]></category>

		<guid isPermaLink="false">http://www.zmeng.com.au/blog/?p=3</guid>
		<description><![CDATA[Singularity Hub rounded up the most interesting developments in robotics through 2008. Most of them are the humanoid variety. I know replicating biped movement and stability is a challenging task and still at the forefront of robotics pursuits, but I always like to see the evolutions in alternative robotic anatomies.
In my opinion, the coolest, and [...]]]></description>
			<content:encoded><![CDATA[<p>Singularity Hub rounded up the <a title="A Review of the Best Robots of 2008" href="http://singularityhub.com/2009/01/12/a-review-of-the-best-robots-of-2008/" target="_blank">most interesting developments</a> in robotics through 2008. Most of them are the humanoid variety. I know replicating biped movement and stability is a challenging task and still at the forefront of robotics pursuits, but I always like to see the evolutions in alternative robotic anatomies.</p>
<p>In my opinion, the coolest, and by far the most creepy, is a quadruped that is capable of traversing almost any terrain while carrying 150kg on its back. It&#8217;s called <a title="BigDog - Boston Dynamics" href="http://www.bostondynamics.com/content/sec.php?section=BigDog" target="_blank">BigDog</a>, but I think it&#8217;s more of a big mountain goat that buzzes like a wasp. The video is great - BigDog stumbing around foolishly on black ice, and swaggers to reclaim balance after a guy kicks it with all his weight. Are we permitted a little schadenfreude for robotic animals?</p>
<p> </p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/cHJJQ0zNNOM&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/cHJJQ0zNNOM&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zmeng.com.au/blog/2009/01/best-robots-of-2008/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
