<?xml version="1.0" encoding="UTF-8"?><rss version="0.92">
<channel>
	<title>Program &#38; Design</title>
	<link>http://programanddesign.com</link>
	<description>Tips, tricks, tutorials, and tools on programming &#38; web design</description>
	<lastBuildDate>Wed, 07 Jul 2010 21:55:16 +0000</lastBuildDate>
	<docs>http://backend.userland.com/rss092</docs>
	<language>en</language>
	<!-- generator="WordPress/3.0" -->

	<item>
		<title>Recursive get/set/has-attr</title>
		<description><![CDATA[def _getattr&#40;obj, attr, default=None&#41;: &#160; &#160; try: left, right = attr.split&#40;'.', 1&#41; &#160; &#160; except: return getattr&#40;obj, attr, default&#41; &#160; &#160; return _getattr&#40;getattr&#40;obj, left&#41;, right, default&#41; def _setattr&#40;obj, attr, val&#41;: &#160; &#160; try: left, right = attr.split&#40;'.', 1&#41; &#160; &#160; except: return setattr&#40;obj, attr, val&#41; &#160; &#160; return _setattr&#40;getattr&#40;obj, left&#41;, right, val&#41; def _hasattr&#40;obj, attr&#41;: [...]]]></description>
		<link>http://programanddesign.com/python-2/recursive-getsethas-attr/</link>
			</item>
	<item>
		<title>Thread-Safe Observable List for WPF</title>
		<description><![CDATA[I'm probably posting this too early; I haven't had a chance to extensively test it yet but I basically just locked every function down, and made any method that actually modifies the list run on the main thread so that notifications can be sent. It ought to work class ObservableList&#60;T&#62; : IList&#60;T&#62;, INotifyCollectionChanged where T [...]]]></description>
		<link>http://programanddesign.com/cs/thread-safe-observable-list-for-wpf/</link>
			</item>
	<item>
		<title>Thread-Safe Observable Priority Queue for WPF</title>
		<description><![CDATA[Building on my last post, I realized that you couldn't push elements onto the queue from a worker thread, making it pretty much useless. However, if we dispatch the pushes back to the UI thread, it should work, right? Here's (what I believe to be) a thread-safe observable priority queue with notifications for use in [...]]]></description>
		<link>http://programanddesign.com/uncategorized/priority-queue-for-wpf/</link>
			</item>
	<item>
		<title>Observable Priority Queue</title>
		<description><![CDATA[Just started playing around with WPF in VS 2010. They have this ObservableCollection class which you can bind to your DataGrid or ListControl and then when you add or remove items from it, the control is refreshed automatically. However, I wanted to use my PriorityQueue class that I posted about earlier, so I modified it [...]]]></description>
		<link>http://programanddesign.com/cs/observable-priority-queue/</link>
			</item>
	<item>
		<title>Human-readable file size in C#</title>
		<description><![CDATA[&#160; &#160; &#160; &#160; static string ReadableFileSize&#40;double size, int unit=0&#41; &#160; &#160; &#160; &#160; &#123; &#160; &#160; &#160; &#160; &#160; &#160; string&#91;&#93; units = &#123; &#34;B&#34;, &#34;KB&#34;, &#34;MB&#34;, &#34;GB&#34;, &#34;TB&#34;, &#34;PB&#34;, &#34;EB&#34;, &#34;ZB&#34;, &#34;YB&#34; &#125;; &#160; &#160; &#160; &#160; &#160; &#160; while&#40;size &#62;= 1024&#41; &#123; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; size /= [...]]]></description>
		<link>http://programanddesign.com/cs/human-readable-file-size-in-c-2/</link>
			</item>
	<item>
		<title>A Simple Priority Queue in C#</title>
		<description><![CDATA[using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace QueueSpace &#123; &#160; &#160; public class PriorityQueue&#60;TValue&#62; : PriorityQueue&#60;TValue, int&#62; &#123; &#125; &#160; &#160; public class PriorityQueue&#60;TValue, TPriority&#62; where TPriority : IComparable &#160; &#160; &#123; &#160; &#160; &#160; &#160; private SortedDictionary&#60;TPriority, Queue&#60;TValue&#62;&#62; dict = new SortedDictionary&#60;TPriority, Queue&#60;TValue&#62;&#62;&#40;&#41;; &#160; &#160; &#160; &#160; public int Count &#123; get; [...]]]></description>
		<link>http://programanddesign.com/cs/a-simple-priority-queue-in-cs/</link>
			</item>
	<item>
		<title>Django Send HTML Emails</title>
		<description><![CDATA[You can use this little function to load emails from a template and send them in both HTML and plaintext formats. from django.core.mail import EmailMultiAlternatives from django.template import loader, Context from django.conf import settings def send_multipart_email&#40;subject, template, data_dict, recipient_list, from_email=settings.DEFAULT_FROM_EMAIL&#41;: &#160; &#160; if type&#40;recipient_list&#41; != list: recipient_list = &#91;recipient_list&#93; &#160; &#160; &#160; &#160; tt = [...]]]></description>
		<link>http://programanddesign.com/uncategorized/django-send-html-emails/</link>
			</item>
	<item>
		<title>.NET Dock Panel</title>
		<description><![CDATA[Apparently .NET does not come with any dock widget, like the ones used for the Toolbox and Properties window in Visual Studio. However, there is a freely available one on sourceforge called DockPanel Suite. Unfortunately, it seems to lack any sort of documentation! This little code snippet below should be enough to get you started [...]]]></description>
		<link>http://programanddesign.com/cs/net-dock-panel/</link>
			</item>
	<item>
		<title>C# Blocking Queue</title>
		<description><![CDATA[If you're writing a threaded application in C# and you need to wait until a resource becomes available, you can use this class. Very handy for producer/consumer scenarios. public class BlockingQueue&#60;T&#62; &#123; &#160; &#160; Queue&#60;T&#62; que = new Queue&#60;T&#62;&#40;&#41;; &#160; &#160; Semaphore sem = new Semaphore&#40;0, Int32.MaxValue&#41;; &#160; &#160; public void Enqueue&#40;T item&#41; &#160; &#160; [...]]]></description>
		<link>http://programanddesign.com/cs/c-blocking-queue/</link>
			</item>
	<item>
		<title>Django, Flatpages, Markdown, and Syntax Highlighting</title>
		<description><![CDATA[For what should have been an easy task, this turned out to be extraordinarily difficult. I assume you have Django already installed. If not, the tutorials on djangoproject.com aren't too terrible, provided you're not on a shared server (that's another story!). I'm using Flatpages, but you can use whatever you want to follow along with [...]]]></description>
		<link>http://programanddesign.com/uncategorized/django-flatpages-markdown-and-syntax-highlighting/</link>
			</item>
</channel>
</rss>
