<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>synchronous &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/synchronous/</link>
	<description>Feed of posts on WordPress.com tagged "synchronous"</description>
	<pubDate>Sat, 28 Nov 2009 09:07:18 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[ Blended Learning and the Space/Time Continuum]]></title>
<link>http://itbill.wordpress.com/2009/11/25/blended-learning-and-the-spacetime-continuum/</link>
<pubDate>Wed, 25 Nov 2009 15:12:21 +0000</pubDate>
<dc:creator>Bill Knapp</dc:creator>
<guid>http://itbill.wordpress.com/2009/11/25/blended-learning-and-the-spacetime-continuum/</guid>
<description><![CDATA[&nbsp; small_space_chart, originally uploaded by bill.knapp. Meegan Lillis and I presented on this t]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div style="text-align:left;padding:3px;"><a title="photo sharing" href="http://www.flickr.com/photos/itbill/4133763900/"><img style="border:solid 2px #000000;" src="http://farm3.static.flickr.com/2490/4133763900_bfbd509e77.jpg" alt="" /></a>
<p>&#160;</p>
<p><span style="font-size:.8em;margin-top:0;"><a href="http://www.flickr.com/photos/itbill/4133763900/">small_space_chart</a>, originally uploaded by <a href="http://www.flickr.com/people/itbill/">bill.knapp</a>.</span></p>
</div>
<p>Meegan Lillis and I presented on this topic at the Campus Technology 09 conference this past summer in Boston. The idea was to visually represent the concept of using instructional technology (in this case web 2.0) to bridge time and space. The space continuum along the left side of the poster illustrates the use of increasingly complex solutions which allow students and instructors to meet synchronously from simple chat to web-conferencing and virtual worlds. The time continuum looks at connecting asynchronously using technologies which support increasing the distance, beginning with campus infrastructure and moving to G3/G4 wireless and hand-held solutions.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Plug -n- Play]]></title>
<link>http://itbill.wordpress.com/2009/11/24/plug-n-play/</link>
<pubDate>Tue, 24 Nov 2009 20:26:42 +0000</pubDate>
<dc:creator>Bill Knapp</dc:creator>
<guid>http://itbill.wordpress.com/2009/11/24/plug-n-play/</guid>
<description><![CDATA[Yesterday, I tried helping a faculty connect his class here on campus with another class at a high s]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Yesterday, I tried helping a faculty connect his class here on campus with another class at a high school several hundred miles away. Their plan was to discuss issues of diversity using a combination of <a href="http://en.wikipedia.org/wiki/Teleconferencing">teleconferencing</a> and <a title="Adobe Acrobat Connect Pro" href="http://www.adobe.com/products/acrobatconnectpro/">web-conferencing</a> solutions. The arrangements had been made ahead of time and the faculty on my end had been trying to complete the connections since early in the day.</p>
<p>However when the time came for class to begin there were problems getting it to work as planned. The HS teacher lacked experience setting up the conference phone and was unable to connect. I then shared the URL for the web-conference with the remote instructor in hopes that they might be able at least to use the chat feature to ask and respond to questions. But they were apparently unable to log on and the class went by without any connections being made.</p>
<p>The technology we attempted to use for the project was not especially new or complicated and had been used successfully many times before, but this time it failed. Will these educators try it again, or simply dismiss it as something that does&#8217;t work?</p>
<p>I wonder how many times people decide to implement technology solutions with every expectation that all they need do is plug it in or turn it on, only to discover that it doesn&#8217;t work as expected. I would guess a fair percentage of the time. Whether our expectations are met the first time we use a technology directly influences our perception of the quality or appropriateness of a given solution. Perfectly good solutions are discarded when they don&#8217;t work as expected the very first time &#8211; even when our own lack of experience is the cause of the failure.</p>
<p>As instructional technologists I believe an important part of our work is preparing faculty and students to know what to expect. The truth is that most of the time the technology they select will require some configuration and isn&#8217;t exactly what you might call &#8220;plug-n-play&#8221;. When it comes to best practices, a practice session is always a good idea; if others are to be included from a distance testing the service ahead of time will go a long way toward a successful and satisfying experience.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Newsline - November 2009]]></title>
<link>http://virtualschooling.wordpress.com/2009/11/19/newsline-november-2009/</link>
<pubDate>Thu, 19 Nov 2009 21:21:00 +0000</pubDate>
<dc:creator>mkbnl</dc:creator>
<guid>http://virtualschooling.wordpress.com/2009/11/19/newsline-november-2009/</guid>
<description><![CDATA[Note the item about Gwinnett Public Schools below. Elluminate Newsline The ePublication created excl]]></description>
<content:encoded><![CDATA[Note the item about Gwinnett Public Schools below. Elluminate Newsline The ePublication created excl]]></content:encoded>
</item>
<item>
<title><![CDATA[Concurrent Systems]]></title>
<link>http://thesynchronousblog.wordpress.com/2009/11/19/concurrency/</link>
<pubDate>Thu, 19 Nov 2009 17:56:54 +0000</pubDate>
<dc:creator>luagravity</dc:creator>
<guid>http://thesynchronousblog.wordpress.com/2009/11/19/concurrency/</guid>
<description><![CDATA[Concurrency is one of those terms that everyone has an intuition about its definition until needs to]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Concurrency is one of those terms that everyone has an intuition about its definition until needs to write about it, realizing that the concept is too open to just use &#8220;concurrency&#8221;.</p>
<p>Follows the first phrase in Wikipedia&#8217;s entry for &#8220;Concurrency&#8221;:</p>
<blockquote><p>In computer science, concurrency is a property of systems in which several computations are executing simultaneously, and potentially interacting with each other.</p></blockquote>
<p>By using the words <em>simultaneously</em> and <em>interacting</em>, this definition captures (for me) the essence of concurrency.</p>
<p>One of the fundamental properties of concurrent systems is their <em>execution model</em>, that is, when should the concurrent computations (I&#8217;ll call them <em>concurrent entities</em>) in the system run, and what are the rules that an entity should obey while running.</p>
<ul>
<li>Asynchronous Concurrency</li>
</ul>
<p style="padding-left:30px;">In <em>asynchronous</em> execution, entities are in charge of their own control flow and execute independently of each other. Hence, each entity has its own notion of time, not shared globally. The decision to synchronize with other parts of the system is also internal to each entity, and not enforced by the surrounding environment. Depending on the concurrency model in use, these entities are known as <em>threads</em>, <em>actors</em>, <em>processes</em>, <em>tasks</em>, etc.</p>
<ul>
<li>Synchronous Concurrency</li>
</ul>
<p style="padding-left:30px;">In <em>synchronous</em> execution, the system flow is controlled by the environment, and internal entities must execute at its pace, in permanent synchrony. Time is now shared between entities and is represented as time steps or as a series of events, both triggered by the surrounding environment.</p>
<p>In my personal experience, when saying &#8220;concurrency&#8221; people assume <em>asynchronous concurrency</em>, excluding all synchronous reactive languages/systems.</p>
<p>For example, if I state that event-driven programming is a concurrency model, I&#8217;ll probably be inquired about this position.</p>
<p>However, if you agree with Wikipedia&#8217;s definition and thinks about an event-driven implemented game with hundreds of entities interacting, how can it not be considered &#8220;concurrent&#8221;?</p>
<p>In a paper from Gerard Berry [1], this &#8220;prejudice&#8221; is also commented:</p>
<p><span style="font-family:Times;font-size:small;"> </span></p>
<blockquote><p>Being somewhat unclassical compared to prevalent CSP or CCS based models, it took more time for the synchronous model to be accepted in the mainstream Computer Science community.</p></blockquote>
<p>Execution model is just one property of concurrent systems. I did not discuss here communication, synchronization, parallelism, determinism&#8230;</p>
<p>Maybe it is time to build something like a &#8220;Taxonomy for Concurrency&#8221;, enumerating all recurrent properties found in concurrency models and languages. Does anyone know about an existing work in this direction?</p>
<p>[1] Gérard Berry, The foundations of Esterel, Proof, language, and interaction: essays in honour of Robin Milner, MIT Press, Cambridge, MA, 2000</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Blended or Mixed-delivery?]]></title>
<link>http://itbill.wordpress.com/2009/11/14/blended-or-mixed-delivery/</link>
<pubDate>Sat, 14 Nov 2009 14:05:58 +0000</pubDate>
<dc:creator>Bill Knapp</dc:creator>
<guid>http://itbill.wordpress.com/2009/11/14/blended-or-mixed-delivery/</guid>
<description><![CDATA[Our institution of higher ed began using web-conferencing about a year ago. By the end of the year w]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Our institution of higher ed began using <a href="http://en.wikipedia.org/wiki/Web_conferencing" target="_blank">web-conferencing</a> about a year ago. By the end of the year we had 100 host licenses. A host is a user who can initiate a meeting/training/support session. Attendees need not have a license &#8211; just hosts.</p>
<p>I began using it to permit faculty to connect to our <a href="http://www.ferris.edu/HTMLS/academics/center/IT/ITLAs.cfm" target="_blank">weekly walk-in training opportunities</a>. While most participating still attended the face-to-face option, some connected from across the state (I had one connect from Washington DC while attending a conference) and others from their desks across campus or from home.</p>
<p>Several staff members used web-conferencing for administrative purposes such as virtual meetings. No doubt, it saved on institutional travel expenses (travel for a dozen or so people is going to be much more expensive than calling into a teleconference). Unfortunately, we don&#8217;t have a good way of measuring this. We would need to track what we did not spend from one budget line item, and compare it to what we actually spent in a different budget line item.</p>
<p>Another group included instructors who were looking for ways to connect with students at a distance. A couple of faculty used it to provide an orientation to their fully-0nline programs and courses. Others used it to connect with students while away at a conference. This semester one of our faculty decided he would offer a student the opportunity to enroll in his on-campus face-to-face class, who would otherwise not be able to take the course.</p>
<p>When I was working on my masters program in order to complete my requirements, I occasionally had to enroll in sections which were offered in other locations. Although I lived and worked on the main campus, there were not always enough students enrolling in a give course to fill a section. I traveled to locations fifty and a hundred miles away, taught by instructors who also traveled a fair distance just to teach them.</p>
<p>With this technology we can offer students the option of enrolling in a on-ground face-to-face course from their desktop. It might not be for everyone. Students should be advised there may be challenges face-to-face students would not encounter such as not be able to hear questions or comments of students in the classroom, observing nonverbal cues of the instructor, needing to post questions using the chat tool, etc. In order to succeed students need to be reatively comfortable with the technology and willing to take a back seat at times, but for those who are willing and able it may be a viable option.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Synchronous e-learning and Web 2.0]]></title>
<link>http://apriledmonds.wordpress.com/2009/11/02/synchronous/</link>
<pubDate>Tue, 03 Nov 2009 00:15:48 +0000</pubDate>
<dc:creator>apriledmonds</dc:creator>
<guid>http://apriledmonds.wordpress.com/2009/11/02/synchronous/</guid>
<description><![CDATA[Today I participated in my first International online class for using Moodle. What a neat experience]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Today I participated in my first International online class for using Moodle. What a neat experience. The teacher and facilitators of the class used a live software tool to make the course interactive.  Not only where the students from all over the world, the teachers were too.   The main teacher was broadcasting live from Israel and another from Mexico. Many participants were K-12 teachers, professors, graduate students, administrators and IT specialists. I have been monitoring the <a href="http://flatclassroomproject2008.wikispaces.com/">Flat Classroom project</a>, where high schools kids connect with kids in China, via live sessions like this; however, I have not really experienced many international sessions like this myself in a <a href="http://en.wikipedia.org/wiki/Synchronous_learning">synchronous</a> environment. Most of the classes in the past that I have taken have mainly been <a href="http://en.wikipedia.org/wiki/Asynchronous_learning">asynchronous.</a></p>
<p>Even at this day and age, the main focus for online learning is in the area of <a href="http://en.wikipedia.org/wiki/Pedagogy">pedagogy</a>, not <a href="http://en.wikipedia.org/wiki/Andragogy">andragogy</a>. The mix between the two are very important to me, as I have been teaching Senior Citizens and other adults. Teaching adults has always been at the heart of what I wanted to do in life. Over the last year I have become heavily involved in social media/networking strategies and projects with my current employer and how these tools can be used in various aspects of e-learning. I’m not by far the most acclaimed expert in e-learning; however, I do know that using different methods is essential in teaching in a synchronous/asynchronous environment.  Additionally, how adult learners can use social networking in their learning processes. How can using the social networking (or Web 2.0/3.0) be integrated into the motivation and learning strategies for adults?  How can we use these social networking tools to break down the digital divide that still exists? How can we use the social networking tools to further the informal learning processes for adults? As the use of social media/networking tools continues to be adapted world-wide, there will be many choices now and in the future for providing many ways for e-learning to occur.</p>
<p>I think back to when I was young and how I would visit my grandparents on Saturday’s. Not only did we watch the Lawrence Welk show, we listened to the Beach Boys on an <a href="http://en.wikipedia.org/wiki/8-track_tape">8-Track</a>. Not long after that came <a href="http://en.wikipedia.org/wiki/Cassette_tapes">cassette tapes</a>, then CD with CD Players, now music players the size of your thumb or less. The adaptation for listening to music to what it is now, has happened over a 40-60 year span. The last 5-10 years e-learning has become much more popular, thus, still has a long way to go.</p>
<p>“Since we live in an age of innovation, a practical education must prepare a man for work that does not yet exist and cannot yet be clearly defined.” ~Peter F. Drucker</p>
<p><em>A personal note: I have learned so much from using social networking tools from so many experts. If these software tools had never come to be, I would still be in my own little silo.</em></p>
<p><em><br />
</em></p>
<p>You are welcome to comment; however, all opinions and comments written in the post are solely my opinions.</p>
<p>&#160;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Questions About Synchronous Instruction From Germany]]></title>
<link>http://virtualschooling.wordpress.com/2009/11/02/questions-about-synchronous-instruction-from-germany/</link>
<pubDate>Mon, 02 Nov 2009 14:07:03 +0000</pubDate>
<dc:creator>mkbnl</dc:creator>
<guid>http://virtualschooling.wordpress.com/2009/11/02/questions-about-synchronous-instruction-from-germany/</guid>
<description><![CDATA[I received the following e-mail last week from a researcher in Germany. I  just found your interesti]]></description>
<content:encoded><![CDATA[I received the following e-mail last week from a researcher in Germany. I  just found your interesti]]></content:encoded>
</item>
<item>
<title><![CDATA[Trend Questions: More Synchronous Online Interaction?]]></title>
<link>http://nancywhiteoz.wordpress.com/2009/10/25/trend-questions-more-synchronous-online-interaction/</link>
<pubDate>Sun, 25 Oct 2009 22:42:24 +0000</pubDate>
<dc:creator>Nancy White</dc:creator>
<guid>http://nancywhiteoz.wordpress.com/2009/10/25/trend-questions-more-synchronous-online-interaction/</guid>
<description><![CDATA[Flickr Creative Commons image from James Cridland I love working asynchronously in text. I can read ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div class="wp-caption alignright" style="width: 290px"><img class="  " src="http://farm3.static.flickr.com/2418/2271827325_6254b0c6eb.jpg" alt="Flickr Creative Commons image from James Cridland" width="280" height="210" /><p class="wp-caption-text">Flickr Creative Commons image from James Cridland</p></div>
<p>I love working asynchronously in text. I can read and write quickly so it suits me. But it sure doesn&#8217;t suit everyone. One trend I&#8217;m noticing with my clients is a preference for synchronous online interactions, from quick Skype calls to organized web meetings using tools that allow desktop sharing, white boards and even video. <em>(I have to say, for one who has a lot of meetings at 6am in the morning, I&#8217;m NOT a fan of video at that time of day!)</em></p>
<p>Even across diverse time zones, there is more synchronous. Even Twitter &#8211; which can sit both in a synch and asynch place, keeps us in that &#8220;in the moment&#8221; mode.</p>
<p>What are you seeing in your online life? More synchronous? Less? The same? What synchronous tools are popular in your communities and networks?</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Newsline - October 2009]]></title>
<link>http://virtualschooling.wordpress.com/2009/10/20/newsline-october-2009/</link>
<pubDate>Wed, 21 Oct 2009 00:09:13 +0000</pubDate>
<dc:creator>mkbnl</dc:creator>
<guid>http://virtualschooling.wordpress.com/2009/10/20/newsline-october-2009/</guid>
<description><![CDATA[Note the K12, Inc. item. Elluminate Newsline The ePublication created exclusively for educators. Oct]]></description>
<content:encoded><![CDATA[Note the K12, Inc. item. Elluminate Newsline The ePublication created exclusively for educators. Oct]]></content:encoded>
</item>
<item>
<title><![CDATA[Multithreaded Applications]]></title>
<link>http://enggtech.wordpress.com/2009/10/12/multithreaded-applications/</link>
<pubDate>Mon, 12 Oct 2009 07:54:02 +0000</pubDate>
<dc:creator>Visitor Blogs</dc:creator>
<guid>http://enggtech.wordpress.com/2009/10/12/multithreaded-applications/</guid>
<description><![CDATA[Managed Threading Threading Objects and Features A process is a collection of virtual memory space, ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div class="MTPS_CollapsibleRegion">
<div class="CollapseRegionLink">
<div><a id="ctl00_MTCS_main_ctl37_ctl00_ctl02" href="http://msdn.microsoft.com/en-us/library/3e8s7xdd.aspx">Managed Threading</a></div>
<div><a id="ctl00_MTCS_main_ctl37_ctl00_ctl03" href="http://msdn.microsoft.com/en-us/library/9xyf641a.aspx">Threading Objects and Features</a></div>
<p>A <em>process</em> is a collection of virtual memory space, code, data, and system resources. A <em>thread</em> is code that is to be serially executed within a process. A processor executes threads, not processes, so each application has at least one process, and a process always has at least one thread of execution, known as the primary thread. A process can have multiple threads in addition to the primary thread.</p>
<p>Processes communicate with one another through messages, using Microsoft&#8217;s Remote Procedure Call (RPC) technology to pass information to one another. There is no difference to the caller between a call coming from a process on a remote machine and a call coming from another process on the same machine.</p>
<p>When a thread begins to execute, it continues until it is killed or until it is interrupted by a thread with higher priority (by a user action or the kernel&#8217;s thread scheduler). Each thread can run separate sections of code, or multiple threads can execute the same section of code. Threads executing the same block of code maintain separate stacks. Each thread in a process shares that process&#8217;s global variables and resources.</p>
</div>
<div class="CollapseRegionLink">Threads are the basic unit to which an operating system allocates processor time, and more than one thread can be executing code inside that process. Each thread maintains</div>
<div class="CollapseRegionLink">
<ul>
<li>exception handlers,</li>
<li>a scheduling priority, and</li>
<li>a set of structures the system uses to save the thread context until it is scheduled.</li>
</ul>
</div>
<div class="CollapseRegionLink"><strong>The thread context </strong>includes all the information the thread needs to seamlessly resume execution, including</div>
<div class="CollapseRegionLink">
<ul>
<li>the thread&#8217;s set of CPU registers and</li>
<li>stack, in the address space of the thread&#8217;s host process.</li>
</ul>
</div>
<div class="CollapseRegionLink">
<p>The .NET Framework further subdivides an operating system process into lightweight managed subprocesses, called <strong>application domains</strong>, represented by <a id="ctl00_MTCS_main_ctl01" href="http://msdn.microsoft.com/en-us/library/system.appdomain.aspx">System..::.AppDomain</a>. One or more managed threads (represented by <a id="ctl00_MTCS_main_ctl03" href="http://msdn.microsoft.com/en-us/library/system.threading.thread.aspx">System.Threading..::.Thread</a>) can run in one or any number of application domains within the same managed process. Although each application domain is started with a single thread, code in that application domain can create additional application domains and additional threads. The result is that a managed thread can move freely between application domains inside the <strong>same managed process; </strong>you might have only one thread moving among several application domains.</p>
</div>
<div class="CollapseRegionLink">If your application uses only one thread of execution, you can combine <a id="ctl00_MTCS_main_ctl23_ctl00_ctl00" href="http://msdn.microsoft.com/en-us/library/2e08f6yc.aspx">asynchronous programming</a> with <a id="ctl00_MTCS_main_ctl23_ctl00_ctl01" href="http://msdn.microsoft.com/en-us/library/kwdt6w2k.aspx">.NET Framework remoting</a> or <a id="ctl00_MTCS_main_ctl23_ctl00_ctl02" href="http://msdn.microsoft.com/en-us/library/7bkzywba.aspx">XML Web services</a> created using ASP.NET to use the processing time of other computers in addition to that of your own to increase responsiveness to the user and decrease the data processing time of your application.</div>
<div class="CollapseRegionLink"></div>
<div class="CollapseRegionLink">
<h3>Disadvantages of Multiple Threads</h3>
<div>
<p>It is recommended that you use as few threads as possible, thereby minimizing the use of operating-system resources and improving performance. Threading also has resource requirements and potential conflicts to be considered when designing your application. The resource requirements are as follows:</p>
<ul>
<li>The system consumes memory for the context information required by processes, <strong>AppDomain </strong>objects, and threads. Therefore, the number of processes, <strong>AppDomain </strong>objects, and threads that can be created is limited by available memory.</li>
<li>Keeping track of a large number of threads consumes significant processor time. If there are too many threads, most of them will not make significant progress. <span style="color:#ff0000;">If most of the current threads are in one process, threads in other processes are scheduled less frequently</span>.</li>
<li>Controlling code execution with many threads is complex, and can be a source of many bugs.</li>
<li>Destroying threads requires knowing what could happen and handling those issues.</li>
</ul>
</div>
</div>
<div class="CollapseRegionLink">
<p>Resources that require <span style="color:#ff0000;"><strong>synchronization </strong></span>include:</p>
<ul>
<li>System resources (such as communications ports).</li>
<li>Resources shared by multiple processes (such as file handles).</li>
<li>The resources of a single application domain (such as <strong><span style="color:#0000ff;">global, static, and instance fields</span></strong>) accessed by multiple threads.</li>
</ul>
</div>
<div class="CollapseRegionLink">
<h2>Synchronizing Data for Multithreading</h2>
<p><!--Content type: Devdiv1. Transform: orcas2mtps.xslt.--></p>
<div>
<p>When multiple threads can make calls to the properties and methods of a single object, it is critical that those calls be synchronized. Otherwise one thread might interrupt what another thread is doing, and the object could be left in an invalid state. A class whose members are protected from such interruptions is called thread-safe.</p>
<p>The Common Language Infrastructure provides several strategies to synchronize access to instance and static members:</p>
<ul>
<li>Synchronized code regions. You can use the <a id="ctl00_MTCS_main_ctl01" href="http://msdn.microsoft.com/en-us/library/system.threading.monitor.aspx">Monitor</a> class or compiler support for this class to synchronize only the code block that needs it, improving performance.</li>
<li>Manual synchronization.You can use the synchronization objects provided by the .NET Framework class library. See <a id="ctl00_MTCS_main_ctl02" href="http://msdn.microsoft.com/en-us/library/ms228964.aspx">Overview of Synchronization Primitives</a>, which includes a discussion of the <a id="ctl00_MTCS_main_ctl03" href="http://msdn.microsoft.com/en-us/library/system.threading.monitor.aspx">Monitor</a> class.</li>
<li>Synchronized contexts. You can use the <a id="ctl00_MTCS_main_ctl04" href="http://msdn.microsoft.com/en-us/library/system.runtime.remoting.contexts.synchronizationattribute.aspx">SynchronizationAttribute</a> to enable simple, automatic synchronization for <a id="ctl00_MTCS_main_ctl05" href="http://msdn.microsoft.com/en-us/library/system.contextboundobject.aspx">ContextBoundObject</a> objects.</li>
<li><a id="ctl00_MTCS_main_ctl06" href="http://msdn.microsoft.com/en-us/library/system.collections.hashtable.synchronized.aspx">Synchronized</a> property. A few classes, such as <a id="ctl00_MTCS_main_ctl07" href="http://msdn.microsoft.com/en-us/library/system.collections.hashtable.aspx">Hashtable</a> and <a id="ctl00_MTCS_main_ctl08" href="http://msdn.microsoft.com/en-us/library/system.collections.queue.aspx">Queue</a>, provide a <a id="ctl00_MTCS_main_ctl09" href="http://msdn.microsoft.com/en-us/library/system.collections.queue.synchronized.aspx">Synchronized</a> property that returns a thread-safe wrapper for an instance of the class. See <a id="ctl00_MTCS_main_ctl10" href="http://msdn.microsoft.com/en-us/library/573ths2x.aspx">Collections and Synchronization (Thread Safety)</a>.</li>
</ul>
<p>The common language runtime provides a thread model in which classes fall into a number of categories that can be synchronized in a variety of different ways depending on the requirements. The following table shows what synchronization support is provided for fields and methods with a given synchronization category.</p>
<div></div>
<div>
<table border="0">
<tbody>
<tr>
<th>Category</th>
<th>Global fields</th>
<th>Static fields</th>
<th>Static methods</th>
<th>Instance fields</th>
<th>Instance methods</th>
<th>Specific code blocks</th>
</tr>
<tr>
<td>No Synchronization</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>Synchronized Context</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>Synchronized Code Regions</td>
<td>No</td>
<td>No</td>
<td>Only if marked</td>
<td>No</td>
<td>Only if marked</td>
<td>Only if marked</td>
</tr>
<tr>
<td>Manual Synchronization</td>
<td>Manual</td>
<td>Manual</td>
<td>Manual</td>
<td>Manual</td>
<td>Manual</td>
<td>Manual</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<div><!-- ApplyClick with current id --> <img style="vertical-align:middle;border-width:0;" src="http://i.msdn.microsoft.com/Global/Images/clear.gif" alt="" /></div>
</div>
</div>
<div class="CollapseRegionLink"></div>
<div class="CollapseRegionLink">
<h3>Threading and Application Design</h3>
<div>
<p>In general, using the <a id="ctl00_MTCS_main_ctl23_ctl00_ctl03" href="http://msdn.microsoft.com/en-us/library/system.threading.threadpool.aspx">ThreadPool</a> class is the easiest way to handle multiple threads for relatively short tasks that will not block other threads and when you do not expect any particular scheduling of the tasks. However, there are a number of reasons to create <span style="color:#ff0000;">your own threads</span>:</p>
<ul>
<li>If you need a task to have a particular <strong><span style="color:#0000ff;">priority</span></strong>.</li>
<li>If you have a task that might <span style="color:#0000ff;"><strong>run a long time</strong></span> (and therefore block other tasks).</li>
<li>If you need to place threads into a single-threaded apartment (all <strong>ThreadPool </strong>threads are in the multithreaded apartment).</li>
<li>If you need a stable identity associated with the thread. For example, you should use a dedicated thread to abort that thread, suspend it, or discover it by name.</li>
<li>If you need to run background threads that interact with the user interface, the .NET Framework version 2.0 provides a <a id="ctl00_MTCS_main_ctl23_ctl00_ctl04" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx">BackgroundWorker</a> component that communicates using events, with cross-thread marshaling to the user-interface thread.</li>
</ul>
</div>
</div>
<div class="CollapseRegionLink"><span style="font-family:Verdana,Arial,Helvetica,sans-serif;"></p>
<h4>Apartment Threading (Single Threaded Apartment)</h4>
<p>Apartment threaded means there are multiple threads within the application. In single threaded apartment (STA) each thread is isolated in a separate apartment underneath the process. The process can have any number of apartments that share data through a proxy. The application defines when and for how long the thread in each apartment should execute. All requests are serialized through the Windows message queue such that only a single apartment is accessed at a time and thus only a single thread will be executing at any one time. STA is the threading model that most Visual Basic developers are familiar with because this is the threading model available to VB applications prior to VB.NET. You can think of it like an apartment building full of a row of one room apartments that are accessible one at a time through a single hallway. The advantage this provides over single threaded is that multiple commands can be issued at one time instead of just a single command, but the commands are still <span style="color:#ff0000;"><strong>sequentially executed</strong></span>.</p>
<h4>Free Threading (Multi Threaded Apartment)</h4>
<p>Free threaded applications were limited to programming languages such as C++ until the release of Microsoft .NET. The free threaded/Multi Threaded Apartment (MTA) model has a single apartment created underneath the process rather than multiple apartments. This single apartment holds multiple threads rather than just a single thread. No message queue is required because all of the threads are a part of the same apartment and <span style="color:#ff0000;"><strong>can share data without a proxy</strong></span>. You can think of it like a building with multiple rooms that are all accessible once you are inside the building. These applications typically execute faster than single threaded and STA because there is less system overhead and can be optimized to eliminate system idle time.</p>
<p>These types of applications are more complex to program. The developer must provide <span style="color:#ff0000;"><strong>thread synchronization</strong></span> as part of the code to ensure that threads do not simultaneously access the same resources. A condition known as a <span style="color:#ff0000;"><strong>race condition</strong></span> can occur when a thread accesses a shared resource and modifies the resource to an invalid state and then another thread accesses the shared resource and uses it in the invalid state before the other thread can return the resource to a valid state. Therefore it is necessary to place a lock on a resource to prevent other threads from accessing the resource until the lock has been removed. However, this can lead to a <span style="color:#ff0000;"><strong>deadlock </strong></span>situation where two threads are competing for resources and neither can proceed.</p>
<p>The only way to avoid situations like these is through good design and testing.</p>
<p></span></div>
<div class="CollapseRegionLink">
<p>Rules for <span style="color:#ff0000;"><strong>single-threaded apartments</strong></span> are simple, but it is important to follow them carefully:</p>
<ul>
<li> Every object should live on only one thread (within a single-threaded apartment).</li>
<li> Initialize the COM library for each thread.</li>
<li> Marshal all pointers to objects when passing them between apartments.</li>
<li> Each single-threaded apartment must have a message loop to handle calls from other processes and apartments within the same process. Single-threaded apartments without objects (client only) also need a message loop to dispatch the broadcast messages that some applications use.</li>
<li>DLL-based or in-process objects do not call the COM initialization functions; instead, they register their threading model with the <strong>ThreadingModel</strong> named-value under the <a id="ctl00_MTCS_main_ctl01" href="http://msdn.microsoft.com/en-us/library/ms682390%28VS.85%29.aspx">InprocServer32</a> key in the registry. Apartment-aware objects must also write DLL entry points carefully. There are special considerations that apply to threading in-process servers. For more information, see <a id="ctl00_MTCS_main_ctl02" href="http://msdn.microsoft.com/en-us/library/ms687205%28VS.85%29.aspx">In-Process Server Threading Issues</a>.</li>
</ul>
</div>
<div class="CollapseRegionLink">
<p>Following are some important considerations regarding <span style="color:#ff0000;"><strong>synchronization for multithreaded apartments</strong></span>:</p>
<ul>
<li> COM provides call synchronization for single-threaded apartments only.</li>
<li> Multithreaded apartments do not receive calls while making calls (on the same thread).</li>
<li> Multithreaded apartments cannot make input-synchronized calls.</li>
<li> Asynchronous calls are converted to synchronous calls in multithreaded apartments.</li>
<li> The message filter is not called for any thread in a multithreaded apartment.</li>
</ul>
</div>
<div class="CollapseRegionLink">
<div>
<table border="0">
<tbody>
<tr>
<th><!--src=[../icons/alert_caution.gif]--><img src="http://i.msdn.microsoft.com/z8chs7ft.alert_caution%28en-us,VS.90%29.gif" alt="Important note" /><strong>Important Note:</strong></th>
</tr>
<tr>
<td>Do not lock the type — that is, <span style="color:#0000ff;">typeof(MyType)</span> in C#, GetType(MyType) in Visual Basic, or <span style="color:#0000ff;">MyType::typeid</span> in C++ — in order to protect <span style="color:#ff0000;"><strong>static </strong></span>methods (Shared methods in Visual Basic). Use a <span style="color:#0000ff;"><strong>private static object i</strong></span>nstead. Similarly, do not use<span style="color:#0000ff;"><strong> this</strong></span> in C# (Me in Visual Basic) to lock instance methods. Use a private object instead. A class or instance<span style="color:#ff0000;"><strong> can be locked by code other than your own</strong></span>, potentially causing deadlocks or performance problems.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="CollapseRegionLink">
<h3>Synchronized Context</h3>
<div style="display:block;"><a id="sectionToggle3"></a>You can use the <strong>SynchronizationAttribute </strong>on any <strong>ContextBoundObject </strong>to synchronize all instance methods and fields. All objects in the same context domain share the same lock. Multiple threads are allowed to access the methods and fields, but only a single thread is allowed at any one time.</p>
</div>
</div>
<div class="CollapseRegionLink"></div>
<div class="CollapseRegionLink"><strong>Setting Up for a Background Operation </strong></div>
<div class="MTPS_CollapsibleSection" style="display:block;"><a id="sectionToggle1"></a>To set up for a background operation, add an event handler for the <a id="ctl00_MTCS_main_ctl59_ctl00_ctl00" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.dowork.aspx">DoWork</a> event. Call your time-consuming operation in this event handler.To start the operation, call <a id="ctl00_MTCS_main_ctl59_ctl00_ctl01" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.runworkerasync.aspx">RunWorkerAsync</a>. To receive notifications of progress updates, handle the <a id="ctl00_MTCS_main_ctl59_ctl00_ctl02" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.progresschanged.aspx">ProgressChanged</a> event. To receive a notification when the operation is completed, handle the <a id="ctl00_MTCS_main_ctl59_ctl00_ctl03" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.runworkercompleted.aspx">RunWorkerCompleted</a> event.The methods that handle the <a id="ctl00_MTCS_main_ctl59_ctl00_ctl04" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.progresschanged.aspx">ProgressChanged</a> and <a id="ctl00_MTCS_main_ctl59_ctl00_ctl05" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.runworkercompleted.aspx">RunWorkerCompleted</a> events can access the application&#8217;s user interface, because those events are raised on the thread that called the <a id="ctl00_MTCS_main_ctl59_ctl00_ctl06" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.runworkerasync.aspx">RunWorkerAsync</a> method. However, the <a id="ctl00_MTCS_main_ctl59_ctl00_ctl07" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.dowork.aspx">DoWork</a> event handler cannot work with any user-interface objects because it runs on the background thread.</p>
</div>
</div>
<div class="MTPS_CollapsibleRegion">
<div class="CollapseRegionLink"><!-- ApplyClick with current id --> <strong> Creating and Using Threads </strong></div>
<div class="MTPS_CollapsibleSection" style="display:block;"><a id="sectionToggle2"></a>If you need more control over the behavior of your application&#8217;s threads, you can manage the threads yourself. However, realize that writing correct multithreaded applications can be difficult: Your application may stop responding or experience transient errors caused by race conditions. For more information, see <a id="ctl00_MTCS_main_ctl60_ctl00_ctl00" href="http://msdn.microsoft.com/en-us/library/a8544e2s.aspx">Thread-Safe Components</a>.You create a new thread in Visual Basic by declaring a variable of type <a id="ctl00_MTCS_main_ctl60_ctl00_ctl01" href="http://msdn.microsoft.com/en-us/library/system.threading.thread.aspx">Thread</a> and calling the constructor with the <span class="input">AddressOf</span> statement and the name of the procedure or method that you want to execute on the new thread.</div>
</div>
<h3 class="subHeading">Safe Points</h3>
<div class="subsection">
<p>Most of these methods are self-explanatory, but the concept of <span class="parameter">safe points</span> may be new to you. Safe points are locations in code where it is safe for the common language runtime to perform automatic <span class="parameter">garbage collection</span>, the process of releasing unused variables and reclaiming memory. When you call the <a id="ctl00_MTCS_main_ctl60_ctl00_ctl18" href="http://msdn.microsoft.com/en-us/library/system.threading.thread.abort.aspx">Abort</a> or <a id="ctl00_MTCS_main_ctl60_ctl00_ctl19" href="http://msdn.microsoft.com/en-us/library/system.threading.thread.suspend.aspx">Suspend</a> method of a thread, the common language runtime analyzes the code and determines the location of an appropriate location for the thread to stop running.</p>
</div>
<p><a href="http://msdn.microsoft.com/en-us/library/ck8bc5c6.aspx">Multithreaded Applications</a>.</p>
<p>You can provide parameters and return values to thread-pool threads by using the optional <span class="input">ByVal</span> state-object variable of the <a id="ctl00_MTCS_main_ctl21_ctl00_ctl02" href="http://msdn.microsoft.com/en-us/library/system.threading.threadpool.queueuserworkitem.aspx">QueueUserWorkItem</a> method. Thread-timer threads also support a state object for this purpose. For information on thread pooling and thread timers, see <a id="ctl00_MTCS_main_ctl21_ctl00_ctl03" href="http://msdn.microsoft.com/en-us/library/h4732ks0.aspx">Thread Pooling</a> and <a id="ctl00_MTCS_main_ctl21_ctl00_ctl04" href="http://msdn.microsoft.com/en-us/library/swx5easy.aspx">Thread Timers</a>.</p>
<div class="CollapseRegionLink"><strong><a href="http://msdn.microsoft.com/en-us/library/0ka9477y.aspx">Thread Pooling</a> Example </strong></div>
<div class="MTPS_CollapsibleSection" style="display:block;"><a id="sectionToggle0"></a>The following example shows how you can use thread pooling to start several tasks.</p>
<div id="snippetGroup"><span id="ctl00_MTCS_main_ctl17_ctl00_ctl00"></p>
<div id="ctl00_MTCS_main_ctl17_ctl00_ctl00_VisualBasic" class="libCScode">
<div class="CodeSnippetTitleBar">
<div class="CodeDisplayLanguage">Visual Basic</div>
</div>
<div style="background-color:#dddddd;" dir="ltr">
<pre class="libCScode" style="white-space:pre-wrap;"><span style="color:blue;">Sub</span> DoWork()
    <span style="color:green;">' Queue a task</span>
    System.Threading.ThreadPool.QueueUserWorkItem( _
        <span style="color:blue;">New</span> System.Threading.WaitCallback(<span style="color:blue;">AddressOf</span> SomeLongTask))
    <span style="color:green;">' Queue another task</span>
    System.Threading.ThreadPool.QueueUserWorkItem( _
        <span style="color:blue;">New</span> System.Threading.WaitCallback(<span style="color:blue;">AddressOf</span> AnotherLongTask))
<span style="color:blue;">End</span> <span style="color:blue;">Sub</span>
<span style="color:blue;">Sub</span> SomeLongTask(<span style="color:blue;">ByVal</span> state <span style="color:blue;">As</span> <span style="color:blue;">Object</span>)
    <span style="color:green;">' Insert code to perform a long task.</span>
<span style="color:blue;">End</span> <span style="color:blue;">Sub</span>
<span style="color:blue;">Sub</span> AnotherLongTask(<span style="color:blue;">ByVal</span> state <span style="color:blue;">As</span> <span style="color:blue;">Object</span>)
    <span style="color:green;">' Insert code to perform another long task.</span>
<span style="color:blue;">End</span> <span style="color:blue;">Sub</span></pre>
</div>
</div>
<p></span></div>
<p>Thread pooling is useful when you want to start many separate tasks without individually setting the properties of each thread. Each thread starts with a default stack size and priority. By default, up to 25 thread-pool threads can run per system processor. Additional threads in excess of the limit can be queued, but they do not start until other threads finish.</p>
<p>One advantage of thread pooling is that you can pass arguments in a state object to the task procedure. If the procedure you are calling requires more than one argument, you can cast a structure or an instance of a class into an <span class="input">Object</span> data type.</p>
</div>
<h2><strong><a href="http://msdn.microsoft.com/en-us/library/a60kkx8k.aspx">Application Domains and Threads</a></strong>.</h2>
<div>
<p>An application domain forms an isolation boundary for security, versioning, reliability, and unloading of managed code. Threads are the operating system construct used by the common language runtime to execute code. At run time, all managed code is loaded into an application domain and is run by a managed thread.</p>
<p>There is not a one-to-one correlation between application domains and threads. Several threads can be executing in a single application domain at any given time and a particular thread is not confined to a single application domain. That is, threads are free to cross application domain boundaries; a new thread is not created for each application domain.</p>
<p>At any given time, every thread is executing in an application domain. Zero, one, or more than one thread might be executing in any given application domain. The run time keeps track of which threads are running in which application domains. You can locate the domain in which a thread is executing at any time by calling the <a id="ctl00_MTCS_main_ctl01" href="http://msdn.microsoft.com/en-us/library/system.threading.thread.getdomain.aspx">GetDomain</a> method.</p>
</div>
<div class="MTPS_CollapsibleRegion">
<div class="MTPS_CollapsibleSection" style="display:block;">
<h2><strong><a href="http://msdn.microsoft.com/en-us/library/awbftdfh(VS.80).aspx">Events (C#)</a>.</strong></h2>
<p>Events can be used to <strong>synchronize threads</strong>.</p>
<p><strong>Delegate </strong>is a creatable type. Programming with delegates requires creating delegate objects from delegate types.</p>
<p>Delegates seamlessly support binding a notification source to multiple handler methods through a feature known as <strong>multicasting</strong>.</p>
<p>Delegate binding, see <a id="ctl00_MTCS_main_ctl35_ctl00_ctl01" href="http://msdn.microsoft.com/en-us/library/96b1ayy4%28VS.80%29.aspx">Delegates in the Common Type System</a> and <a id="ctl00_MTCS_main_ctl35_ctl00_ctl02" href="http://msdn.microsoft.com/en-us/library/s3860fy3%28VS.80%29.aspx">CreateDelegate(Type,Object,MethodInfo,Boolean)</a>.</p>
<p>Delegates are referred to as</p>
<ul>
<li>multicast, or</li>
<li>combinable,</li>
</ul>
<p>because a delegate can invoke one or more methods and can be used in combining operations.A delegate can represent a</p>
<ul>
<li>static method or</li>
<li>an instance method.</li>
</ul>
<div class="MTPS_CollapsibleSection" style="display:block;">When the delegate represents an instance method, the delegate stores not only a reference to the method&#8217;s entry point, but also a reference to the class instance. Unlike <strong>function pointers</strong>,</div>
<ul>
<li>delegates are object oriented and</li>
<li>type safe.</li>
</ul>
<p><a id="ctl00_MTCS_main_ctl06" href="http://msdn.microsoft.com/en-us/library/ms366768%28VS.80%29.aspx">How to: Subscribe to and Unsubscribe from Events (C# Programming Guide)</a></p>
<p>The line of code that is needed to subscribe to the event is also automatically generated in the <tt>InitializeComponent</tt> method in the Form1.Designer.cs file in your project. It looks like this:</p>
<p><span id="ctl00_MTCS_main_ctl02"> </span></p>
<div id="ctl00_MTCS_main_ctl02_">
<div style="background-color:#dddddd;" dir="ltr">
<pre style="white-space:pre-wrap;">  this.Load += new System.EventHandler(this.Form1_Load);</pre>
</div>
</div>
<h3>To subscribe to events programmatically</h3>
<div>
<ol>
<li>Define an event handler method whose signature matches the delegate signature for the event. For example, if the event is based on the <a id="ctl00_MTCS_main_ctl03" href="http://msdn.microsoft.com/en-us/library/system.eventhandler%28VS.80%29.aspx">EventHandler</a> delegate type, then the following code represents the method stub:<span id="ctl00_MTCS_main_ctl04"> </span>
<div id="ctl00_MTCS_main_ctl04_">
<div style="background-color:#dddddd;" dir="ltr">
<pre style="white-space:pre-wrap;">  void HandleCustomEvent(object sender, CustomEventArgs a)
  {
     // Do something useful here.
  }</pre>
</div>
</div>
</li>
<li>Use the addition assignment operator (+=) to attach your event handler to the event. In the following example, assume that an object named <tt>publisher</tt> has an event named <tt>RaiseCustomEvent</tt>. Note that the subscriber class needs a reference to the publisher class in order to subscribe to its events.<span id="ctl00_MTCS_main_ctl05"> </span>
<div id="ctl00_MTCS_main_ctl05_">
<div style="background-color:#dddddd;" dir="ltr">
<pre style="white-space:pre-wrap;">publisher.RaiseCustomEvent += HandleCustomEvent;</pre>
</div>
</div>
</li>
</ol>
<p>Note that the above syntax is new in C# 2.0. It is exactly equivalent to the C# 1.0 syntax in which the encapsulating delegate must be explicitly created using the new keyword:</p>
<p><span id="ctl00_MTCS_main_ctl06"> </span></p>
<div id="ctl00_MTCS_main_ctl06_">
<div style="background-color:#dddddd;" dir="ltr">
<pre style="white-space:pre-wrap;">publisher.RaiseCustomEvent += new CustomEventHandler(HandleCustomEvent);</pre>
</div>
</div>
</div>
<h3>To subscribe to events by using an anonymous method</h3>
<div>
<ul>
<li>Use the addition assignment operator (+=) to attach your anonymous method to the event. In the following example, assume that an object named <tt>publisher</tt> has an event named <tt>RaiseCustomEvent </tt>and that a <tt>CustomEventArgs</tt> class has also been defined to carry some kind of specialized event information. Note that the subscriber class needs a reference to <tt>publisher</tt> in order to subscribe to its events.<span id="ctl00_MTCS_main_ctl07"> </span>
<div id="ctl00_MTCS_main_ctl07_">
<div style="background-color:#dddddd;" dir="ltr">
<pre style="white-space:pre-wrap;">  publisher.RaiseCustomEvent += delegate(object o, CustomEventArgs e)
  {
    string s = o.ToString() + " " + e.ToString();
    Console.WriteLine(s);
  };</pre>
</div>
</div>
</li>
</ul>
<p>It is important to note that you cannot easily unsubscribe from an event if you used an anonymous method to subscribe to it. To unsubscribe in this scenario, go back to the code where you subscribe to the event, store the anonymous method in a delegate variable, and then add the delegate to the event.</p>
<p>When an event has multiple subscribers, the event handlers are invoked synchronously when an event is raised. To invoke events asynchronously, see <strong><a id="ctl00_MTCS_main_ctl03" href="http://msdn.microsoft.com/en-us/library/2e08f6yc%28VS.80%29.aspx">Calling Synchronous Methods Asynchronously</a></strong>.</p>
<p>four common ways to use <strong>BeginInvoke</strong> and <strong>EndInvoke</strong> to make asynchronous calls. After calling <strong>BeginInvoke</strong> you can do the following:</p>
<ul>
<li>Do some work and then call <strong>EndInvoke</strong> to block until the call completes.</li>
<li>Obtain a <a id="ctl00_MTCS_main_ctl05" href="http://msdn.microsoft.com/en-us/library/system.threading.waithandle%28VS.80%29.aspx">WaitHandle</a> using the <a id="ctl00_MTCS_main_ctl06" href="http://msdn.microsoft.com/en-us/library/system.iasyncresult.asyncwaithandle%28VS.80%29.aspx">System.IAsyncResult.AsyncWaitHandle</a> property, use its <a id="ctl00_MTCS_main_ctl07" href="http://msdn.microsoft.com/en-us/library/system.threading.waithandle.waitone%28VS.80%29.aspx">WaitOne</a> method to block execution until the <strong>WaitHandle</strong> is signaled, and then call <strong>EndInvoke</strong>.</li>
<li>Poll the <strong>IAsyncResult</strong> returned by <strong>BeginInvoke</strong> to determine when the asynchronous call has completed, and then call <strong>EndInvoke</strong>.</li>
<li>Pass a delegate for a callback method to <strong>BeginInvoke</strong>. The method is executed on a <a id="ctl00_MTCS_main_ctl08" href="http://msdn.microsoft.com/en-us/library/system.threading.threadpool%28VS.80%29.aspx">ThreadPool</a> thread when the asynchronous call completes. The callback method calls <strong>EndInvoke</strong>.
<div>
<table border="0" width="100%">
<tbody>
<tr>
<th align="left"><img src="http://i.msdn.microsoft.com/2e08f6yc.note%28en-US,VS.80%29.gif" alt="Note" />Important</th>
</tr>
<tr>
<td>Always call <strong>EndInvoke</strong> to complete your asynchronous call.</td>
</tr>
</tbody>
</table>
</div>
</li>
</ul>
<p>you should know that events in the .NET Framework are layered on top of delegates. When you use an event-driven application framework such as Windows® Forms or ASP.NET, your knowledge of delegates will make you a much stronger developer.</p>
<blockquote><p>Delegates provide the primary means in .NET for executing a method on a secondary thread in an asynchronous fashion. Therefore, delegates open the door to <strong>multithreading</strong>.</p></blockquote>
</div>
<p>the compiler generates a class definition for each delegate type. The class that is generated for each delegate type is a creatable class that inherits from the <strong>System.Multicast </strong>delegate.</p>
<p>compiler has also added a public constructor and three public methods named</p>
<ul>
<li>Invoke,</li>
<li>BeginInvoke, and</li>
<li>EndInvoke.</li>
</ul>
<h2><strong><a id="ctl00_MTCS_main_ctl21" href="http://msdn.microsoft.com/en-us/library/ms228969%28VS.80%29.aspx">Asynchronous Programming Design Patterns</a></strong></h2>
<p>Asynchronous operations are typically used to perform tasks that might take a long time to complete, such as opening large files, connecting to remote computers, or querying a database. An asynchronous operation executes in a thread separate from the main application thread. When an application calls methods to perform an operation asynchronously, the application can continue executing while the asynchronous method performs its task.</p>
<p>Asynchronous programming is a feature supported by many areas of the <strong>.NET Framework</strong>, including:</p>
<ul>
<li>File IO, Stream IO, Socket IO.</li>
<li>Networking.</li>
<li>Remoting channels (HTTP, TCP) and proxies.</li>
<li>XML Web services created using ASP.NET.</li>
<li>ASP.NET Web Forms.</li>
<li>Message Queuing using the <a id="ctl00_MTCS_main_ctl03" href="http://msdn.microsoft.com/en-us/library/system.messaging.messagequeue%28VS.80%29.aspx">MessageQueue</a> class.</li>
</ul>
<p>The .NET Framework provides two design patterns for asynchronous operations:</p>
<ul>
<li>Asynchronous operations that use <a id="ctl00_MTCS_main_ctl01" href="http://msdn.microsoft.com/en-us/library/system.iasyncresult%28VS.80%29.aspx">IAsyncResult</a> objects.</li>
<li>Asynchronous operations that use events. <a id="ctl00_MTCS_main_ctl02" href="http://msdn.microsoft.com/en-us/library/wewwczdw%28VS.80%29.aspx">Event-based Asynchronous Pattern Overview</a>.</li>
</ul>
<p>For relatively simple multithreaded applications, the <a id="ctl00_MTCS_main_ctl02" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker%28VS.80%29.aspx">BackgroundWorker</a> component provides a straightforward solution. For more sophisticated asynchronous applications, consider implementing a class that adheres to the Event-based Asynchronous Pattern.
<dl>
<dt><strong><a id="ctl00_MTCS_main_ctl04" href="http://msdn.microsoft.com/en-us/library/ms228963%28VS.80%29.aspx">Asynchronous Programming Overview</a></strong></dt>
<dd>Discusses the <strong>IAsyncResult</strong> based asynchronous design pattern, which provides a flexible programming model to deal with asynchronous operations. </dd>
</dl>
<p>The correct choice depends on whether the application has instructions that can execute while the operation completes. If an application cannot perform any additional work until it receives the results of the asynchronous operation, the application must block until the results are available. <strong>To block until an asynchronous operation completes</strong>, you can use one of the following approaches:</p>
<ul>
<li>Call <strong>End</strong><em>OperationName</em> from the application’s main thread, blocking application execution until the operation is complete. For an example that illustrates this technique, see <a id="ctl00_MTCS_main_ctl16" href="http://msdn.microsoft.com/en-us/library/ms228967%28VS.80%29.aspx">Blocking Application Execution by Ending an Asynchronous Operation</a>.</li>
<li>Use the <strong>AsyncWaitHandle</strong> to block application execution until one or more operations are complete. For an example that illustrates this technique, see <a id="ctl00_MTCS_main_ctl17" href="http://msdn.microsoft.com/en-us/library/ms228962%28VS.80%29.aspx">Blocking Application Execution Using an AsyncWaitHandle</a>.</li>
</ul>
<p>Applications that do <strong>not </strong>need to block while the asynchronous operation completes can use one of the following approaches:</p>
<ul>
<li>Poll for operation completion status by checking the <strong>IsCompleted</strong> property periodically and calling <strong>End</strong><em>OperationName</em> when the operation is complete. For an example that illustrates this technique, see <a id="ctl00_MTCS_main_ctl18" href="http://msdn.microsoft.com/en-us/library/ms228968%28VS.80%29.aspx">Polling for the Status of an Asynchronous Operation</a>.</li>
<li>Use an <strong>AsyncCallback</strong> delegate to specify a method to be invoked when the operation is complete. For an example that illustrates this technique, see <a id="ctl00_MTCS_main_ctl19" href="http://msdn.microsoft.com/en-us/library/ms228972%28VS.80%29.aspx">Using an AsyncCallback Delegate to End an Asynchronous Operation</a>.</li>
</ul>
<p><a id="ctl00_MTCS_main_ctl18" href="http://msdn.microsoft.com/en-us/library/dacysss4%28VS.80%29.aspx">Creating Event Handlers in Windows Forms</a></p>
<ul>
<li><a id="ctl00_MTCS_main_ctl06" href="http://msdn.microsoft.com/en-us/library/ms366768%28VS.80%29.aspx">How to: Subscribe to and Unsubscribe from Events (C# Programming Guide)</a></li>
<li><a id="ctl00_MTCS_main_ctl07" href="http://msdn.microsoft.com/en-us/library/w369ty8x%28VS.80%29.aspx">How to: Publish Events that Conform to .NET Framework Guidelines (C# Programming Guide)</a></li>
<li><a id="ctl00_MTCS_main_ctl08" href="http://msdn.microsoft.com/en-us/library/hy3sefw3%28VS.80%29.aspx">How to: Raise Base Class Events in Derived Classes (C# Programming Guide)</a></li>
<li><a id="ctl00_MTCS_main_ctl09" href="http://msdn.microsoft.com/en-us/library/ak9w5846%28VS.80%29.aspx">How to: Implement Interface Events (C# Programming Guide)</a></li>
<li><a id="ctl00_MTCS_main_ctl10" href="http://msdn.microsoft.com/en-us/library/ms173179%28VS.80%29.aspx">Thread Synchronization (C# Programming Guide)</a></li>
<li><a id="ctl00_MTCS_main_ctl11" href="http://msdn.microsoft.com/en-us/library/z4ka55h8%28VS.80%29.aspx">How to: Use a Dictionary to Store Event Instances (C# Programming Guide)</a></li>
<li><a id="ctl00_MTCS_main_ctl12" href="http://msdn.microsoft.com/en-us/library/y4592h76%28VS.80%29.aspx">Events Sample</a></li>
<li><a id="ctl00_MTCS_main_ctl13" href="http://msdn.microsoft.com/en-us/library/ms229011%28VS.80%29.aspx">Event Design</a></li>
</ul>
<p><a id="ctl00_MTCS_main_ctl16" href="http://msdn.microsoft.com/en-us/library/3es4b6yy%28VS.80%29.aspx">Multithreading in Components</a></p>
<p><a id="ctl00_MTCS_main_ctl14" href="http://msdn.microsoft.com/en-us/library/1c9txz50%28VS.80%29.aspx">Managed Threading Best Practices</a></p>
<dl>
<dt><a id="ctl00_MTCS_main_ctl02" href="http://msdn.microsoft.com/en-us/library/e7a34yad%28VS.80%29.aspx">Implementing the Event-based Asynchronous Pattern</a></dt>
<dd>Describes the standardized way to package a class that has asynchronous features. </dd>
</dl>
<p>features of the <strong>Event-based Asynchronous Pattern</strong> discussed in this topic.</p>
<ul>
<li>Opportunities for Implementing the Event-based Asynchronous Pattern</li>
<li>Naming Asynchronous Methods</li>
<li>Optionally Support Cancellation</li>
<li>Optionally Support the IsBusy Property</li>
<li>Optionally Provide Support for Progress Reporting</li>
<li>Optionally Provide Support for Returning Incremental Results</li>
<li>Handling Out and Ref Parameters in Methods</li>
</ul>
<dl>
<dt><a id="ctl00_MTCS_main_ctl04" href="http://msdn.microsoft.com/en-us/library/ms228966%28VS.80%29.aspx">Deciding When to Implement the Event-based Asynchronous Pattern</a></dt>
<dd>Describes how to determine when you should choose to implement the Event-based Asynchronous Pattern instead of the <a id="ctl00_MTCS_main_ctl05" href="http://msdn.microsoft.com/en-us/library/system.iasyncresult%28VS.80%29.aspx">IAsyncResult</a> pattern. </dd>
</dl>
<dl>
<dt><a id="ctl00_MTCS_main_ctl12" href="http://msdn.microsoft.com/en-us/library/khfcee8y%28VS.80%29.aspx">Event-based Asynchronous Pattern Technology Sample</a></dt>
<dd>Shows how to use the Event-based Asynchronous Pattern to perform common asynchronous operations. </dd>
</dl>
<p><a id="ctl00_MTCS_main_ctl15" href="http://msdn.microsoft.com/en-us/library/17sde2xt%28VS.80%29.aspx">Events and Delegates</a></p>
<p><strong><a id="ctl00_MTCS_main_ctl16" href="http://msdn.microsoft.com/en-us/library/hybbz6ke%28VS.80%29.aspx">How to: Run an Operation in the Background</a></strong></p>
<p>use the <a id="ctl00_MTCS_main_ctl02" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker%28VS.80%29.aspx">BackgroundWorker</a> class to run the operation on another thread.</p>
<p><span id="ctl00_MTCS_main_ctl10"> </span></p>
<h1>Robust Programming</h1>
<div id="robustProgrammingSection">
<div>
<table border="0" width="100%">
<tbody>
<tr>
<th align="left"><img src="http://i.msdn.microsoft.com/waw3xexc.Caution%28en-US,VS.80%29.gif" alt="Caution note" />Caution</th>
</tr>
<tr>
<td>When using multithreading of any sort, you potentially expose yourself to very serious and complex bugs. Consult the <a id="ctl00_MTCS_main_ctl12" href="http://msdn.microsoft.com/en-us/library/1c9txz50%28VS.80%29.aspx">Managed Threading Best Practices</a> before implementing any solution that uses multithreading.</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3>Deadlocks</h3>
<p>A deadlock occurs when each of two threads tries to lock a resource the other has already locked. Neither thread can make any further progress.</p>
<p>Many methods of the managed threading classes provide time-outs to help you detect deadlocks. For example, the following code attempts to acquire a lock on the current instance. If the lock is not obtained in 300 milliseconds, <a id="ctl00_MTCS_main_ctl01" href="http://msdn.microsoft.com/en-us/library/system.threading.monitor.tryenter%28VS.80%29.aspx">Monitor.TryEnter</a> returns <strong>false</strong>.</p>
<h3>Race Conditions</h3>
<div>
<p>A race condition is a bug that occurs when the outcome of a program depends on which of two or more threads reaches a particular block of code first. Running the program many times produces different results, and the result of any given run cannot be predicted.</p>
<p>A simple example of a race condition is incrementing a field. Suppose a class has a private <strong>static</strong> field (<strong>Shared</strong> in Visual Basic) that is incremented every time an instance of the class is created, using code such as <tt>objCt++;</tt> (C#) or <tt>objCt += 1</tt> (Visual Basic). This operation requires loading the value from <tt>objCt</tt> into a register, incrementing the value, and storing it in <tt>objCt</tt>.</p>
<p>In a multithreaded application, a thread that has loaded and incremented the value might be preempted by another thread which performs all three steps; when the first thread resumes execution and stores its value, it overwrites <tt>objCt</tt> without taking into account the fact that the value has changed in the interim.</p>
<p>This particular race condition is easily avoided by using methods of the <a id="ctl00_MTCS_main_ctl04" href="http://msdn.microsoft.com/en-us/library/system.threading.interlocked%28VS.80%29.aspx">Interlocked</a> class, such as <a id="ctl00_MTCS_main_ctl05" href="http://msdn.microsoft.com/en-us/library/system.threading.interlocked.increment%28VS.80%29.aspx">Interlocked.Increment</a>. To read about other techniques for synchronizing data among multiple threads, see <a id="ctl00_MTCS_main_ctl06" href="http://msdn.microsoft.com/en-us/library/z8chs7ft%28VS.80%29.aspx">Synchronizing Data for Multithreading</a>.</p>
<p>Race conditions can also occur when you synchronize the activities of multiple threads. Whenever you write a line of code, you must consider what might happen if a thread were preempted before executing the line (or before any of the individual machine instructions that make up the line), and another thread overtook it.</p>
<p><a id="ctl00_MTCS_main_ctl54_ctl00_ctl01" href="http://msdn.microsoft.com/en-us/library/ms228964.aspx">Overview of Synchronization Primitives</a></p>
<p>The .NET Framework provides a range of synchronization primitives for controlling the interactions of threads and avoiding race conditions. These can be roughly divided into three categories:</p>
<ul>
<li>locking,</li>
<li>signaling, and</li>
<li>interlocked operations.</li>
</ul>
<p>The categories are not tidy and clearly defined: some synchronization mechanisms have characteristics of multiple categories; events that release a single thread at a time are functionally like locks; the release of any lock can be thought of as a signal; and interlocked operations can be used to construct locks. However, the categories are still useful.</p>
<h3>Signaling</h3>
<p><a id="sectionToggle1"></a>The simplest way to wait for a signal from another thread is to call the <a id="ctl00_MTCS_main_ctl100_ctl00_ctl00" href="http://msdn.microsoft.com/en-us/library/system.threading.thread.join.aspx">Join</a> method, which blocks until the other thread completes. <a id="ctl00_MTCS_main_ctl100_ctl00_ctl01" href="http://msdn.microsoft.com/en-us/library/system.threading.thread.join.aspx">Join</a> has two overloads that allow the blocked thread to break out of the wait after a specified interval has elapsed.</p>
<p>Wait handles provide a much richer set of waiting and signaling capabilities.</p>
<h3>Wait Handles</h3>
<div>
<p>Wait handles derive from the <a id="ctl00_MTCS_main_ctl100_ctl00_ctl02" href="http://msdn.microsoft.com/en-us/library/system.threading.waithandle.aspx">WaitHandle</a> class, which in turn derives from <a id="ctl00_MTCS_main_ctl100_ctl00_ctl03" href="http://msdn.microsoft.com/en-us/library/system.marshalbyrefobject.aspx">MarshalByRefObject</a>. Thus, wait handles can be used to synchronize the activities of threads across application domain boundaries.</p>
<p>Threads block on wait handles by calling the instance method <a id="ctl00_MTCS_main_ctl100_ctl00_ctl04" href="http://msdn.microsoft.com/en-us/library/system.threading.waithandle.waitone.aspx">WaitOne</a> or one of the static methods <a id="ctl00_MTCS_main_ctl100_ctl00_ctl05" href="http://msdn.microsoft.com/en-us/library/system.threading.waithandle.waitall.aspx">WaitAll</a>, <a id="ctl00_MTCS_main_ctl100_ctl00_ctl06" href="http://msdn.microsoft.com/en-us/library/system.threading.waithandle.waitany.aspx">WaitAny</a>, or <a id="ctl00_MTCS_main_ctl100_ctl00_ctl07" href="http://msdn.microsoft.com/en-us/library/system.threading.waithandle.signalandwait.aspx">SignalAndWait</a>. How they are released depends on which method was called, and on the kind of wait handles.</p>
<p>For a conceptual overview, see <a id="ctl00_MTCS_main_ctl100_ctl00_ctl08" href="http://msdn.microsoft.com/en-us/library/kad9xah9.aspx">Wait Handles</a>. Also <a id="ctl00_MTCS_main_ctl100_ctl00_ctl19" href="http://msdn.microsoft.com/en-us/library/ksb7zs2x.aspx">EventWaitHandle, AutoResetEvent, and ManualResetEvent</a>.</p>
<h3>Interlocked Operations</h3>
<div style="display:block;"><a id="sectionToggle2"></a>Interlocked operations are simple atomic operations performed on a memory location by static methods of the <a id="ctl00_MTCS_main_ctl101_ctl00_ctl00" href="http://msdn.microsoft.com/en-us/library/system.threading.interlocked.aspx">Interlocked</a> class. Those atomic operations include addition, increment and decrement, exchange, conditional exchange depending on a comparison, and read operations for 64-bit values on 32-bit platforms.</p>
<div>
<table border="0">
<tbody>
<tr>
<th><!--src=[../icons/alert_note.gif]--><img src="http://i.msdn.microsoft.com/ms228964.alert_note%28en-us,VS.90%29.gif" alt="Note" /><strong>Note:</strong></th>
</tr>
<tr>
<td>The guarantee of atomicity is limited to individual operations; when multiple operations must be performed as a unit, a more coarse-grained synchronization mechanism must be used.</td>
</tr>
</tbody>
</table>
</div>
<p>Although none of these operations are locks or signals, they can be used to construct locks and signals. Because they are native to the Windows operating system, interlocked operations are extremely fast.</p>
<p>Interlocked operations can be used with volatile memory guarantees to write applications which exhibit powerful non-blocking concurrency, however they require sophisticated, low level programming, and for most purposes simple locks are a better choice.</p>
<p>For a conceptual overview, see <a id="ctl00_MTCS_main_ctl101_ctl00_ctl02" href="http://msdn.microsoft.com/en-us/library/sbhbke0y.aspx">Interlocked Operations</a>.</p>
</div>
</div>
<h2><a id="ctl00_MTCS_main_ctl54_ctl00_ctl04" href="http://msdn.microsoft.com/en-us/library/system.runtime.remoting.contexts.synchronizationattribute.aspx">SynchronizationAttribute</a></h2>
<p>When this attribute is applied to an object, only one thread can be executing in all contexts that share an instance of this property. This is done by contributing sinks that intercept and serialize incoming calls for the respective contexts. If the property is marked for reentry, then callouts are intercepted too. The callout interception allows other waiting threads to enter the synchronization domain for maximal throughput.</p>
<div>
<table border="0">
<tbody>
<tr>
<th><!--src=[../icons/alert_note.gif]--><img src="http://i.msdn.microsoft.com/8bf9h00k.alert_note%28en-us,VS.90%29.gif" alt="Note" /><strong>Note:</strong></th>
</tr>
<tr>
<td>There are two classes named SynchronizationAttribute : one in the <a id="ctl00_MTCS_main_ctl56_ctl00_ctl01" href="http://msdn.microsoft.com/en-us/library/system.runtime.remoting.contexts.aspx">System.Runtime.Remoting.Contexts</a> namespace, and the other in the <a id="ctl00_MTCS_main_ctl56_ctl00_ctl02" href="http://msdn.microsoft.com/en-us/library/system.enterpriseservices.aspx">System.EnterpriseServices</a> namespace. The <a id="ctl00_MTCS_main_ctl56_ctl00_ctl03" href="http://msdn.microsoft.com/en-us/library/system.enterpriseservices.synchronizationattribute.aspx">System.EnterpriseServices..::.SynchronizationAttribute</a> class supports only synchronous calls, and can be used only with serviced components. (For more information on serviced components, see <a id="ctl00_MTCS_main_ctl56_ctl00_ctl04" href="http://msdn.microsoft.com/en-us/library/7c05y13x.aspx">[&#60;topic://cpconservicedcomponentoverview&#62;]</a>.) The System.Runtime.Remoting.Contexts..::.SynchronizationAttribute supports both synchronous and asynchronous calls, and can be used only with context bound objects. (For more information on context bound objects, see the <a id="ctl00_MTCS_main_ctl56_ctl00_ctl06" href="http://msdn.microsoft.com/en-us/library/system.contextboundobject.aspx">ContextBoundObject</a> class.)</td>
</tr>
</tbody>
</table>
</div>
<table border="0">
<tbody>
<tr>
<th><!--src=[../icons/alert_note.gif]--></th>
</tr>
</tbody>
</table>
<h1>Recommendations for Class Libraries</h1>
<div id="sectionSection4">
<p>Consider the following guidelines when designing class libraries for <strong>multithreading</strong>:</p>
<ul>
<li>Avoid the need for synchronization, if possible. This is especially true for heavily used code. For example, an algorithm might be adjusted to tolerate a race condition rather than eliminate it. Unnecessary synchronization decreases performance and creates the possibility of deadlocks and race conditions.</li>
<li>Make <strong>static </strong>data (<strong>Shared</strong> in Visual Basic) thread safe by default.</li>
<li>Do not make instance data thread safe by default. Adding locks to create thread-safe code decreases <strong>performance, </strong>increases lock contention, and creates the possibility for deadlocks to occur. In common application models, only one thread at a time executes user code, which minimizes the need for thread safety. For this reason, the .NET Framework class libraries are not thread safe by default.</li>
<li>Avoid providing static methods that alter static state. In common server scenarios, static state is shared across requests, which means multiple threads can execute that code at the same time. This opens up the possibility of threading bugs. Consider using a <strong>design pattern that encapsulates data into instances that are not shared across requests</strong>. Furthermore, if static data are synchronized, calls between static methods that alter state can result in deadlocks or redundant synchronization, adversely affecting performance.</li>
</ul>
</div>
<h1>General Recommendations</h1>
<p>Consider the following guidelines when using multiple threads:</p>
<ul>
<li>Don&#8217;t use <a id="ctl00_MTCS_main_ctl09" href="http://msdn.microsoft.com/en-us/library/system.threading.thread.abort%28VS.80%29.aspx">Thread.Abort</a> to terminate other threads. Calling <strong>Abort</strong> on another thread is akin to throwing an exception on that thread, without knowing what point that thread has reached in its processing.</li>
<li>Don&#8217;t use <a id="ctl00_MTCS_main_ctl10" href="http://msdn.microsoft.com/en-us/library/system.threading.thread.suspend%28VS.80%29.aspx">Thread.Suspend</a> and <a id="ctl00_MTCS_main_ctl11" href="http://msdn.microsoft.com/en-us/library/system.threading.thread.resume%28VS.80%29.aspx">Thread.Resume</a> to synchronize the activities of multiple threads. Do use</li>
<li>
<ul>
<li><a id="ctl00_MTCS_main_ctl12" href="http://msdn.microsoft.com/en-us/library/system.threading.mutex%28VS.80%29.aspx">Mutex</a>,</li>
<li><a id="ctl00_MTCS_main_ctl13" href="http://msdn.microsoft.com/en-us/library/system.threading.manualresetevent%28VS.80%29.aspx">ManualResetEvent</a>,</li>
<li><a id="ctl00_MTCS_main_ctl14" href="http://msdn.microsoft.com/en-us/library/system.threading.autoresetevent%28VS.80%29.aspx">AutoResetEvent</a>,</li>
<li><a id="ctl00_MTCS_main_ctl15" href="http://msdn.microsoft.com/en-us/library/system.threading.monitor%28VS.80%29.aspx">Monitor</a>.</li>
</ul>
</li>
<li><strong>Don&#8217;t control the execution of worker threads from your main program (using events, for ex</strong>ample). Instead, design your program so that worker threads are responsible for waiting until work is available, executing it, and notifying other parts of your program when finished. If your worker threads do not block, consider using <strong><a href="http://msdn.microsoft.com/en-us/library/0ka9477y.aspx">thread pool</a> threads</strong>. <a id="ctl00_MTCS_main_ctl16" href="http://msdn.microsoft.com/en-us/library/system.threading.monitor.pulseall%28VS.80%29.aspx">Monitor.PulseAll</a> is useful in situations where worker threads block.</li>
<li><a href="http://msdn.microsoft.com/en-us/magazine/cc164139.aspx#S1">The Birth of the Thread Pool</a><br />
<a href="http://msdn.microsoft.com/en-us/magazine/cc164139.aspx#S2">Capability 1: Calling a Method Asynchronously</a><br />
<a href="http://msdn.microsoft.com/en-us/magazine/cc164139.aspx#S3">Capability 2: Calling a Method at Timed Intervals</a><br />
<a href="http://msdn.microsoft.com/en-us/magazine/cc164139.aspx#S4">Capability 3: Calling a Method When a Single Kernel Object Becomes Signaled</a></li>
<li>Don&#8217;t use types as lock objects. That is, <strong>avoid code such as <tt>lock(typeof(X))</tt> in C#</strong> or <tt>SyncLock(GetType(X))</tt> in Visual Basic, or the use of <a id="ctl00_MTCS_main_ctl17" href="http://msdn.microsoft.com/en-us/library/de0542zz%28VS.80%29.aspx">System.Threading.Monitor.Enter(System.Object)</a> with <a id="ctl00_MTCS_main_ctl18" href="http://msdn.microsoft.com/en-us/library/system.type%28VS.80%29.aspx">Type</a> objects. For a given type, there is only one instance of <strong>System.Type</strong> per application domain. If the type you take a lock on is public, code other than your own can take locks on it, leading to deadlocks. For additional issues, see <a id="ctl00_MTCS_main_ctl19" href="http://msdn.microsoft.com/en-us/library/ms228970%28VS.80%29.aspx">Reliability Best Practices</a>.</li>
<li>Use caution when locking on instances, for example <tt>lock(this)</tt> in C# or <tt>SyncLock(Me)</tt> in Visual Basic. If <strong>other code in your application, external to the type, takes a lock on the object, deadlocks</strong> could occur.</li>
<li>Do ensure that a thread that has entered a monitor always leaves that monitor, even if an <strong>exception </strong>occurs while the thread is in the monitor. The C# <a id="ctl00_MTCS_main_ctl20" href="http://msdn.microsoft.com/en-us/library/c5kehkcz%28VS.80%29.aspx">lock</a> statement and the Visual Basic <a id="ctl00_MTCS_main_ctl21" href="http://msdn.microsoft.com/en-us/library/3a86s51t%28VS.80%29.aspx">SyncLock</a> statement provide this behavior automatically, employing a <strong>finally</strong> block to ensure that <a id="ctl00_MTCS_main_ctl22" href="http://msdn.microsoft.com/en-us/library/system.threading.monitor.exit%28VS.80%29.aspx">Monitor.Exit</a> is called. If you cannot ensure that <strong>Exit</strong> will be called, consider changing your design to use <strong>Mutex</strong>. A mutex is automatically released when the thread that currently owns it terminates.</li>
<li>Do use multiple threads for tasks that require different resources, and     <strong>avoid assigning multiple threads to a single resource</strong>. For example, any task involving I/O benefits from having its own thread, because that thread will block during I/O operations and thus allow other threads to execute. <strong>User input is another resource that benefits from a dedicated thread</strong>. On a single-processor computer, a task that involves intensive computation coexists with user input and with tasks that involve I/O, but <strong>multiple computation-intensive tasks contend with each other</strong>.</li>
<li>Consider using methods of the <a id="ctl00_MTCS_main_ctl23" href="http://msdn.microsoft.com/en-us/library/system.threading.interlocked%28VS.80%29.aspx">Interlocked</a> class for simple state changes, instead of using the <strong>lock</strong> statement (<strong>SyncLock</strong> in Visual Basic). The <strong>lock</strong> statement is a good general-purpose tool, but the <strong>Interlocked</strong> class provides better performance for updates that must be atomic. Internally, it executes a single lock prefix if there is no contention. In code reviews, watch for code like that shown in the following examples. In the first example, a state variable is incremented:</li>
</ul>
<p><strong>Performance Considerations with Locks, Threads, Semaphores</strong></p>
<dl>
<dt>You can improve performance by using the <a id="ctl00_MTCS_main_ctl26" href="http://msdn.microsoft.com/en-us/library/system.threading.interlocked.increment%28VS.80%29.aspx">Increment</a> method instead of the <strong>lock</strong> statement, as follows: </dt>
<dt>
</dt>
<dt><span id="ctl00_MTCS_main_ctl28"></p>
<div id="ctl00_MTCS_main_ctl28_CSharp">
<div>
<div>C#</div>
</div>
<div style="background-color:#dddddd;" dir="ltr">
<pre style="white-space:pre-wrap;">System.Threading.Interlocked.Increment(myField);</pre>
</div>
</div>
<p></span></dt>
</dl>
<p>In the second example, a <strong>reference type variable is updated only if it is a null reference</strong> (<em><strong>Nothing </strong></em>in Visual Basic).</p>
<p><span id="ctl00_MTCS_main_ctl30"> </span>C#         <span id="ctl00_MTCS_main_ctl31"> </span></p>
<div id="ctl00_MTCS_main_ctl31_CSharp">
<div style="background-color:#dddddd;" dir="ltr">
<pre style="white-space:pre-wrap;"><span style="color:blue;">if</span> (x == <span style="color:blue;">null</span>)
{
    lock (lockObject)
    {
        <span style="color:blue;">if</span> (x == <span style="color:blue;">null</span>)
        {
            x = y;
        }
    }
}</pre>
</div>
</div>
<p>Performance can be improved by using the <a id="ctl00_MTCS_main_ctl32" href="http://msdn.microsoft.com/en-us/library/system.threading.interlocked.compareexchange%28VS.80%29.aspx">CompareExchange</a> method instead, as follows:</p>
<p><span id="ctl00_MTCS_main_ctl33"> </span>C#         <span id="ctl00_MTCS_main_ctl34"> </span></p>
<div id="ctl00_MTCS_main_ctl34_CSharp">
<div style="background-color:#dddddd;" dir="ltr">
<pre style="white-space:pre-wrap;">System.Threading.Interlocked.CompareExchange(ref x, y, <span style="color:blue;">null</span>);</pre>
</div>
</div>
<p>The methods of this class help protect against errors that can occur when the scheduler switches contexts while a thread is updating a variable that can be accessed by other threads, or when two threads are executing concurrently on separate processors. The members of this class do not throw exceptions.The <a id="ctl00_MTCS_main_ctl32_ctl00_ctl00" href="http://msdn.microsoft.com/en-us/library/system.threading.interlocked.increment%28VS.80%29.aspx">Increment</a> and <a id="ctl00_MTCS_main_ctl32_ctl00_ctl01" href="http://msdn.microsoft.com/en-us/library/system.threading.interlocked.decrement%28VS.80%29.aspx">Decrement</a> methods increment or decrement a variable and store the resulting value in a single operation. On most computers, incrementing a variable is not an atomic operation, requiring the following steps:</p>
<ol>
<li>Load a value from an instance variable into a register.</li>
<li>Increment or decrement the value.</li>
<li>Store the value in the instance variable.</li>
</ol>
<p>If you do not use <strong>Increment</strong> and <strong>Decrement</strong>, a thread can be preempted after executing the first two steps. Another thread can then execute all three steps. When the first thread resumes execution, it overwrites the value in the instance variable, and the effect of the increment or decrement performed by the second thread is lost.</p>
<p>The <a id="ctl00_MTCS_main_ctl32_ctl00_ctl02" href="http://msdn.microsoft.com/en-us/library/system.threading.interlocked.exchange%28VS.80%29.aspx">Exchange</a> method atomically exchanges the values of the specified variables. The <a id="ctl00_MTCS_main_ctl32_ctl00_ctl03" href="http://msdn.microsoft.com/en-us/library/system.threading.interlocked.compareexchange%28VS.80%29.aspx">CompareExchange</a> method combines two operations: comparing two values and storing a third value in one of the variables, based on the outcome of the comparison. The compare and exchange operations are performed as an atomic operation.</p>
<p><span id="ctl00_MTCS_main_ctl33_ctl00_ctl01"> </span></p>
<pre style="white-space:pre-wrap;"><span style="color:green;">//A simple method that denies reentrancy.</span>
        <span style="color:blue;">static</span> <span style="color:blue;">bool</span> UseResource()
        {
            <span style="color:green;">//0 indicates that the method is not in use.</span>
            <span style="color:blue;">if</span>(0 == Interlocked.Exchange(ref usingResource, 1))
            {
                Console.WriteLine(<span style="color:maroon;"><span style="color:maroon;">"{0} acquired the lock"</span></span>, Thread.CurrentThread.Name);

                <span style="color:green;">//Code to access a resource that is not thread safe would go here.</span>

                <span style="color:green;">//Simulate some work</span>
                Thread.Sleep(500);

                Console.WriteLine(<span style="color:maroon;"><span style="color:maroon;">"{0} exiting lock"</span></span>, Thread.CurrentThread.Name);

                <span style="color:green;">//Release the lock</span>
                Interlocked.Exchange(ref usingResource, 0);
                <span style="color:blue;">return</span> <span style="color:blue;">true</span>;
            }
            <span style="color:blue;">else</span>
            {
                Console.WriteLine(<span style="color:maroon;"><span style="color:maroon;">"   {0} was denied the lock"</span></span>, Thread.CurrentThread.Name);
                <span style="color:blue;">return</span> <span style="color:blue;">false</span>;
            }
        }
</pre>
<h2>Source Code Examples</h2>
<dl>
<dt>
<ul>
<li><a title="Part-1 - Creating a thread in Windows Forms" href="http://bigballofmud.wordpress.com/2009/04/01/2009/03/21/thread-marshalling-part-1-creating-a-thread-in-windows-forms/">Part 1 – Creating a thread in Windows Forms</a> -  Some basic ideas about firing a background and how to synchronize it with the UI.</li>
<li><a title="Part 2 - using BackgroundWorker" href="http://bigballofmud.wordpress.com/2009/04/01/2009/03/28/thread-marshalling-part-2-using-backgroundworker/" target="_self">Part 2 – Using BackgroundWorker</a> -  the .NET 2.0 way using a BackgroundWorker component<a title="Part 2 - using BackgroundWorker" href="http://bigballofmud.wordpress.com/2009/04/01/2009/03/28/thread-marshalling-part-2-using-backgroundworker/"></a></li>
</ul>
<ul>
<li><a title="Part 3 - Automatic Marshalling" href="http://bigballofmud.wordpress.com/2009/03/21/2009/04/01/thread-marshalling-part-3-automatic-marshalling/" target="_self">Part 3 – Automatic Marshalling</a> – creating your own component with auto marshalling</li>
</ul>
</dt>
<h2>When Not to Use Thread Pool Threads</h2>
<div style="display:block;"><a id="sectionToggle0"></a>There are several scenarios in which it is appropriate to create and manage your own threads instead of using thread pool threads:</p>
<ul>
<li>You require a foreground thread.</li>
<li>You require a thread to have a particular priority.</li>
<li>You have tasks that cause the thread to block for long periods of time. The thread pool has a maximum number of threads, so a large number of blocked thread pool threads might prevent tasks from starting.</li>
<li>You need to place threads into a single-threaded apartment. All <a id="ctl00_MTCS_main_ctl64_ctl00_ctl00" href="http://msdn.microsoft.com/en-us/library/system.threading.threadpool.aspx">ThreadPool</a> threads are in the multithreaded apartment.</li>
<li>You need to have a stable identity associated with the thread, or to dedicate a thread to a task.</li>
</ul>
</div>
<dt><strong><a id="ctl00_MTCS_main_ctl01" href="http://msdn.microsoft.com/en-us/library/8xs8549b%28VS.80%29.aspx">BackgroundWorker Component Overview</a></strong></dt>
<dd>Describes the <strong>BackgroundWorker</strong> component, which gives you the ability to execute time-consuming operations asynchronously (&#8220;in the background&#8221;), on a thread different from your application&#8217;s main UI thread.
</dd>
</dl>
</div>
<p>There are many commonly performed operations that can take a long time to execute. For example:</p>
<ul>
<li>Image downloads</li>
<li>Web service invocations</li>
<li>File downloads and uploads (including for peer-to-peer applications)</li>
<li>Complex local computations</li>
<li>Database transactions</li>
<li>Local disk access, given its slow speed relative to memory access</li>
</ul>
<p><a id="ctl00_MTCS_main_ctl45_ctl00_ctl01" href="http://msdn.microsoft.com/en-us/library/system.marshalbyrefobject%28VS.80%29.aspx">System.MarshalByRefObject</a><br />
<a id="ctl00_MTCS_main_ctl45_ctl00_ctl02" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.component%28VS.80%29.aspx">System.ComponentModel.Component</a><br />
<strong>System.ComponentModel.BackgroundWorker</strong></p>
<dl>
<dt><strong><a id="ctl00_MTCS_main_ctl14" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker%28VS.80%29.aspx">BackgroundWorker</a> </strong></dt>
<dd>Describes this class and has links to all its members. </dd>
</dl>
<p>To execute a time-consuming operation in the background, create a <strong>BackgroundWorker</strong> and listen for events that report the progress of your operation and signal when your operation is finished. You can create the <strong>BackgroundWorker</strong> programmatically or you can drag it onto your form from the <strong>Components</strong> tab of the <strong>Toolbox</strong>. If you create the <strong>BackgroundWorker</strong> in the Windows Forms Designer, it will appear in the Component Tray, and its properties will be displayed in the Properties window.</p>
<p>To set up for a background operation, add an event handler for the <a id="ctl00_MTCS_main_ctl43_ctl00_ctl00" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.dowork%28VS.80%29.aspx">DoWork</a> event. Call your time-consuming operation in this event handler. To start the operation, call <a id="ctl00_MTCS_main_ctl43_ctl00_ctl01" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.runworkerasync%28VS.80%29.aspx">RunWorkerAsync</a>. To receive notifications of progress updates, handle the <a id="ctl00_MTCS_main_ctl43_ctl00_ctl02" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.progresschanged%28VS.80%29.aspx">ProgressChanged</a> event. To receive a notification when the operation is completed, handle the <a id="ctl00_MTCS_main_ctl43_ctl00_ctl03" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.runworkercompleted%28VS.80%29.aspx">RunWorkerCompleted</a> event.</p>
<div>
<table border="0" width="100%">
<tbody>
<tr>
<th align="left"><img src="http://i.msdn.microsoft.com/4852et58.note%28en-US,VS.80%29.gif" alt="Note" />Note:</th>
</tr>
<tr>
<td>You must be careful not to manipulate any user-interface objects in your <strong>DoWork</strong> event handler. Instead, communicate to the user interface through the <strong>ProgressChanged</strong> and <strong>RunWorkerCompleted</strong> events.<strong>BackgroundWorker</strong> events are not marshaled across <a id="ctl00_MTCS_main_ctl43_ctl00_ctl04" href="http://msdn.microsoft.com/en-us/library/system.appdomain%28VS.80%29.aspx">AppDomain</a> boundaries. Do not use a <strong>BackgroundWorker</strong> component to perform multithreaded operations in more than one <strong>AppDomain</strong>.</td>
</tr>
</tbody>
</table>
</div>
<p>If your background operation requires a parameter, call <strong>RunWorkerAsync</strong> with your parameter. Inside the <strong>DoWork</strong> event handler, you can extract the parameter from the <a id="ctl00_MTCS_main_ctl43_ctl00_ctl05" href="http://msdn.microsoft.com/en-us/library/system.componentmodel.doworkeventargs.argument%28VS.80%29.aspx">DoWorkEventArgs.Argument</a> property.</p>
<div>System.Threading..::.<span style="text-decoration:underline;"><strong>ThreadPool</strong></span></div>
<div>Remarks</div>
<div style="display:block;"><a id="remarksToggle"></a></p>
<div>
<table border="0">
<tbody>
<tr>
<th><!--src=[../icons/alert_note.gif]--><img src="http://i.msdn.microsoft.com/y5htx827.alert_note%28en-us,VS.90%29.gif" alt="Note" /><strong>Note:</strong></th>
</tr>
<tr>
<td>The <a id="ctl00_MTCS_main_ctl51_ctl00_ctl01" href="http://msdn.microsoft.com/en-us/library/system.security.permissions.hostprotectionattribute.aspx">HostProtectionAttribute</a> attribute applied to this type or member has the following <a id="ctl00_MTCS_main_ctl51_ctl00_ctl02" href="http://msdn.microsoft.com/en-us/library/system.security.permissions.hostprotectionattribute.resources.aspx">Resources</a> property value: <strong>Synchronization &#124; ExternalThreading</strong>. The <a id="ctl00_MTCS_main_ctl51_ctl00_ctl03" href="http://msdn.microsoft.com/en-us/library/system.security.permissions.hostprotectionattribute.aspx">HostProtectionAttribute</a> does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the <a id="ctl00_MTCS_main_ctl51_ctl00_ctl04" href="http://msdn.microsoft.com/en-us/library/system.security.permissions.hostprotectionattribute.aspx">HostProtectionAttribute</a> class or <a id="ctl00_MTCS_main_ctl51_ctl00_ctl05" href="http://msdn.microsoft.com/en-us/library/ms172338.aspx">SQL Server Programming and Host Protection Attributes</a>.</td>
</tr>
</tbody>
</table>
</div>
<p>Many applications create threads that spend a great deal of time in the sleeping state, waiting for an event to occur. Other threads might enter a sleeping state only to be awakened periodically to poll for a change or update status information. Thread pooling enables you to use threads more efficiently by providing your application with a pool of worker threads that are managed by the system. One thread monitors the status of several wait operations queued to the thread pool. When a wait operation completes, a worker thread from the thread pool executes the corresponding callback function.</p>
<div>
<table border="0">
<tbody>
<tr>
<th><!--src=[../icons/alert_note.gif]--><img src="http://i.msdn.microsoft.com/y5htx827.alert_note%28en-us,VS.90%29.gif" alt="Note" /><strong>Note:</strong></th>
</tr>
<tr>
<td>The threads in <a href="http://msdn.microsoft.com/en-us/library/0ka9477y.aspx"><strong>the managed thread pool</strong></a> are background threads. That is, their <a id="ctl00_MTCS_main_ctl51_ctl00_ctl07" href="http://msdn.microsoft.com/en-us/library/system.threading.thread.isbackground.aspx">IsBackground</a> properties are true. This means that a ThreadPool thread will not keep an application running after all foreground threads have exited.</td>
</tr>
</tbody>
</table>
</div>
<p>You can also queue work items that are not related to a wait operation to the thread pool. To request that a work item be handled by a thread in the thread pool, call the <a id="ctl00_MTCS_main_ctl51_ctl00_ctl08" href="http://msdn.microsoft.com/en-us/library/system.threading.threadpool.queueuserworkitem.aspx">QueueUserWorkItem</a> method. This method takes as a parameter a reference to the method or delegate that will be called by the thread selected from the thread pool. There is no way to cancel a work item after it has been queued.</p>
<p>Timer-queue timers and registered wait operations also use the thread pool. Their callback functions are queued to the thread pool.</p>
<blockquote><p>There is <strong>one thread pool per process</strong>. The thread pool has a default size of <strong>250 worker threads</strong> per available processor, and 1000 I/O completion threads. The number of threads in the thread pool can be changed by using the <a id="ctl00_MTCS_main_ctl51_ctl00_ctl09" href="http://msdn.microsoft.com/en-us/library/system.threading.threadpool.setmaxthreads.aspx">SetMaxThreads</a> method. Each thread uses the default stack size and runs at the default priority.</p></blockquote>
<p>The thread pool maintains a minimum number of idle threads. For worker threads, the default value of this minimum is the number of processors. The <a id="ctl00_MTCS_main_ctl51_ctl00_ctl11" href="http://msdn.microsoft.com/en-us/library/system.threading.threadpool.getminthreads.aspx">GetMinThreads</a> method obtains the minimum numbers of idle worker and I/O completion threads.</p>
<p>When all thread pool threads have been assigned to tasks, the thread pool does not immediately begin creating new idle threads. To avoid unnecessarily allocating stack space for threads, it creates new idle threads at intervals. The <strong>interval is currently half a second</strong>, although it could change in future versions of the .NET Framework.</p>
<p>If an application is subject to bursts of activity in which large numbers of thread pool tasks are queued, use the <a id="ctl00_MTCS_main_ctl51_ctl00_ctl12" href="http://msdn.microsoft.com/en-us/library/system.threading.threadpool.setminthreads.aspx">SetMinThreads</a> method to increase the minimum number of idle threads. Otherwise, the built-in delay in creating new idle threads could cause a bottleneck.</p>
<table border="0">
<tbody>
<tr>
<th><!--src=[../icons/alert_note.gif]--><img src="http://i.msdn.microsoft.com/y5htx827.alert_note%28en-us,VS.90%29.gif" alt="Note" /><strong>Note:</strong></th>
</tr>
<tr>
<td>Unnecessarily increasing the number of idle threads can also cause performance problems. Stack space must be allocated for each thread. If too many tasks start at the same time, all of them might appear to be slow. Finding the right balance is a <strong>performance-tuning issue</strong>.</td>
</tr>
</tbody>
</table>
<p>When the thread pool reuses a thread, it does not clear the data in thread local storage or in fields that are marked with the <a id="ctl00_MTCS_main_ctl51_ctl00_ctl14" href="http://msdn.microsoft.com/en-us/library/system.threadstaticattribute.aspx">ThreadStaticAttribute</a> attribute. Therefore, data that is placed in thread local storage by one method can be exposed to any other method that is executed by the same thread pool thread. A method that accesses a field that is marked with the <a id="ctl00_MTCS_main_ctl51_ctl00_ctl15" href="http://msdn.microsoft.com/en-us/library/system.threadstaticattribute.aspx">ThreadStaticAttribute</a> attribute could encounter different data depending on which thread pool thread executes it.</p>
<p>Starting with the .NET Framework version 2.0 Service Pack 1, the throughput of the thread pool is significantly improved for applications that make heavy use of small thread pool tasks. These applications will see improvements in three areas:</p>
<ul>
<li>queuing tasks,</li>
<li>dispatching thread pool threads, and</li>
<li>dispatching I/O completion threads.</li>
</ul>
<p>To use this functionality, your application should target the .NET Framework version 3.5. For more information, see <a id="ctl00_MTCS_main_ctl51_ctl00_ctl16" href="http://msdn.microsoft.com/en-us/library/bb822049.aspx">.NET Framework 3.5 Architecture</a>.</p>
<h2>More Samples, .NET Snippets</h2>
<p>use the <a href="http://msdn2.microsoft.com/en-us/library/system.componentmodel.isynchronizeinvoke.invoke.aspx" target="_blank">Invoke Method</a> of the <a href="http://msdn2.microsoft.com/en-us/library/system.componentmodel.isynchronizeinvoke.aspx" target="_blank">ISynchronizeInvoke</a> Interface:</p>
<p><!--c1--></p>
<div>CODE</div>
<div>
#region UpdateStatus<br />
private static void UpdateStatus(string msg, string status)<br />
{<br />
//create our Object Array<br />
object[] items = new object[2];<br />
//populate our array with the parameters<br />
//passed to our method<br />
items[0] = msg;<br />
items[1] = status;<br />
//call the delegate<br />
_synch.Invoke(_status, items);<br />
}<br />
#endregion</div>
<p><!--ec2--></p>
<p>Using this we can update any UI component in the main thread without worrying if the call is being made from the proper thread. So as you can see, there is a thread-safe way to share data between threads. Though we aren&#8217;t using data, we&#8217;re simply updating a component on the UI with the status of our background thread. This process can now rune while leaving the UI in a usable state.</p></div>
<p><strong><a href="http://msdn.microsoft.com/en-us/magazine/cc188792.aspx">Basic Instincts: Implementing Callbacks with a Multicast Delegate</a>.</strong></p>
<p>is a follow-up to the <a href="http://msdn.microsoft.com/msdnmag/issues/02/12/basicinstincts/default.aspx">December 2002</a> installment in which I introduced the basic concepts and programming techniques associated with delegates. I am going to assume you have already read that column and that you are familiar with the fundamentals of programming delegates. For example, you should know how to define a delegate type, how to create a delegate object that&#8217;s bound to a handler method, and how to execute the handler method by calling the delegate object&#8217;s Invoke method.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms173175(VS.80).aspx">How to: Combine Delegates (Multicast Delegates)(C#)</a>.</p>
<p>This example demonstrates how to compose multicast delegates. A useful property of <a id="ctl00_MTCS_main_ctl02" href="http://msdn.microsoft.com/en-us/library/900fyy8e%28VS.80%29.aspx">delegate</a> objects is that they can be assigned to one delegate instance to be multicast using the <strong>+</strong> operator. A composed delegate calls the two delegates it was composed from. Only delegates of the same type can be composed.</p>
<p>The <strong>-</strong> operator can be used to remove a component delegate from a composed delegate.</p>
<h1>Example</h1>
<div id="codeExampleSection"><span id="ctl00_MTCS_main_ctl03"></p>
<div id="ctl00_MTCS_main_ctl03_CSharp">
<div>
<div>C#</div>
</div>
<div style="background-color:#dddddd;" dir="ltr">
<pre style="white-space:pre-wrap;">delegate <span style="color:blue;">void</span> Del(<span style="color:blue;">string</span> s);

<span style="color:blue;">class</span> TestClass
{
    <span style="color:blue;">static</span> <span style="color:blue;">void</span> Hello(<span style="color:blue;">string</span> s)
    {
        System.Console.WriteLine(<span style="color:maroon;"><span style="color:maroon;">"  Hello, {0}!"</span></span>, s);
    }

    <span style="color:blue;">static</span> <span style="color:blue;">void</span> Goodbye(<span style="color:blue;">string</span> s)
    {
        System.Console.WriteLine(<span style="color:maroon;"><span style="color:maroon;">"  Goodbye, {0}!"</span></span>, s);
    }

    <span style="color:blue;">static</span> <span style="color:blue;">void</span> Main()
    {
        Del a, b, c, d;

        <span style="color:green;">// Create the delegate object a that references </span>
        <span style="color:green;">// the method Hello:</span>
        a = Hello;

        <span style="color:green;">// Create the delegate object b that references </span>
        <span style="color:green;">// the method Goodbye:</span>
        b = Goodbye;

        <span style="color:green;">// The two delegates, a and b, are composed to form c: </span>
        c = a + b;

        <span style="color:green;">// Remove a from the composed delegate, leaving d, </span>
        <span style="color:green;">// which calls only the method Goodbye:</span>
        d = c - a;

        System.Console.WriteLine(<span style="color:maroon;"><span style="color:maroon;">"Invoking delegate a:"</span></span>);
        a(<span style="color:maroon;"><span style="color:maroon;">"A"</span></span>);
        System.Console.WriteLine(<span style="color:maroon;"><span style="color:maroon;">"Invoking delegate b:"</span></span>);
        b(<span style="color:maroon;"><span style="color:maroon;">"B"</span></span>);
        System.Console.WriteLine(<span style="color:maroon;"><span style="color:maroon;">"Invoking delegate c:"</span></span>);
        c(<span style="color:maroon;"><span style="color:maroon;">"C"</span></span>);
        System.Console.WriteLine(<span style="color:maroon;"><span style="color:maroon;">"Invoking delegate d:"</span></span>);
        d(<span style="color:maroon;"><span style="color:maroon;">"D"</span></span>);
    }
}</pre>
</div>
</div>
<p></span></p>
<h4>Output</h4>
<pre>Invoking delegate a:
  Hello, A!
Invoking delegate b:
  Goodbye, B!
Invoking delegate c:
  Hello, C!
  Goodbye, C!
Invoking delegate d:
  Goodbye, D!</pre>
</div>
<h1><span id="seeAlsoNoToggle">See Also</span></h1>
<h4>Reference</h4>
<p><a id="ctl00_MTCS_main_ctl04" href="http://msdn.microsoft.com/en-us/library/system.multicastdelegate%28VS.80%29.aspx">MulticastDelegate</a></p>
<h4>Concepts</h4>
<p><a id="ctl00_MTCS_main_ctl05" href="http://msdn.microsoft.com/en-us/library/67ef8sbd%28VS.80%29.aspx">C# Programming Guide</a><br />
<a id="ctl00_MTCS_main_ctl06" href="http://msdn.microsoft.com/en-us/library/awbftdfh%28VS.80%29.aspx">Events (C# Programming Guide)</a></p>
<h2><a href="http://msdn.microsoft.com/en-us/magazine/cc188792.aspx"><span id="ctl00_WikiContent_ctl00_HeaderTitle">Quick factories using delegates</span></a></h2>
<p>Delegates are very useful to act as object factories. In the example below, it is used to allow the function to build another object based on it, while keeping the function unaware about types.</p>
<pre>namespace Microsoft.MSDN.Wiki.Samples
{
    class Vehicle
    {
        int Price;
    }
    class Car : Vehicle
    {
        protected Car(string model, int passengers)
        {
        }
        public static Car Create(string model, int passengers)
        {
            // Perform some check and create a new instance
            return new Car(model, passengers);
        }
        public Vehicle FakeClone(Vehicle src)
        {
            // Cars are special in our example, and will not be cloned
            // return the original object instead
            return src;
        }
    }
    class Bus : Vehicle
    {
        private string model;
        private int passengers;
        private int cargo;
        protected Bus(string model, int passengers, int cargo)
        {
            // Assign variables
            this.model = model;
            this.passengers = passengers;
            this.cargo = cargo;
        }
        public static Bus Create(string model, int passengers, int cargo)
        {
            // TODO: Perform some check and create a new instance
            return new Bus(model, passengers, cargo);
        }
        public Vehicle CloneSpecial(Vehicle src)
        {
            // TODO: Perform some check and clone the instance
            Bus bus = (Bus)src;
            return new Bus(bus.model, bus.passengers, bus.cargo);
        }
    }
    class Program
    {
        <strong>public delegate Vehicle CreateNewVehicle(Vehicle src);</strong>
        public void ProcessBus(Bus bus)
        {
            ProcessVehicle(bus, <strong>bus.CloneSpecial</strong>);
        }
        public void ProcessCar(Car car)
        {
            ProcessVehicle(car, <strong>car.FakeClone</strong>);
        }
        public void ProcessVehicle(Vehicle source, <strong>CreateNewVehicle factory</strong>)
        {
            // This function might need to clone the vehicle. Use the delegate
            // so the caller can control the creation
            bool needToCloneObject = true;
            if (needToCloneObject)
            {
                Vehicle newObj = factory(source);
                if (newObj != null)
                {
                    // Now we have a new object to work with
                }
            }
        }
        [STAThread]
        public static void Main(string[] args)
        {
        }
    }
}
</pre>
<p>As you can see we can take the knowledge about the creation logic outside the function when pure inheritance does not work (e.g. having a generic Clone() function in Vehicle) or when the logic changing depending on the context. For example, you might need to clone in a specific way on one condition and clone it differently on another condition.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/awbftdfh(VS.80).aspx"><br />
</a></p>
<h2><span id="ctl00_WikiContent_ctl01_HeaderTitle">Anonymous delegates can be used to simplify context changes</span></h2>
<p>you can also use an anonymous delegate to simplify the cloning process. But remember that this technique is not constrained to cloning. That was just the motivation for the example.</p>
<pre>namespace Microsoft.MSDN.Wiki.Samples
{
    class Vehicle
    {
        int Price;
    }
    class Car : Vehicle
    {
        protected Car(string model, int passengers)
        {
        }
        public static Car Create(string model, int passengers)
        {
            // Perform some check and create a new instance
            return new Car(model, passengers);
        }
    }
    class Bus : Vehicle
    {
        private string model;
        private int passengers;
        private int cargo;
        protected Bus(string model, int passengers, int cargo)
        {
            // Assign variables
            this.model = model;
            this.passengers = passengers;
            this.cargo = cargo;
        }
        public static Bus Create(string model, int passengers, int cargo)
        {
            // TODO: Perform some check and create a new instance
            return new Bus(model, passengers, cargo);
        }
        public Bus Clone()
        {
            return new Bus(this.model, this.passengers, this.cargo);
        }
    }
    class Program
    {
        public delegate Vehicle CreateNewVehicle(Vehicle src);
        public void ProcessBus(Bus bus)
        {
            ProcessVehicle(bus, <strong>delegate(Vehicle src)
            {
                // Perform some special logic
                return ((Bus)src).Clone();
            }</strong>);
        }
        public void ProcessCar(Car car)
        {
            ProcessVehicle(car, <strong>delegate(Vehicle src)
            {
                // Cars are not cloned in this situation
                return src;
            }</strong>);
        }
        public void ProcessVehicle(Vehicle source, CreateNewVehicle factory)
        {
            // This function might need to clone the vehicle. Use the delegate
            // so the caller can control the creation
            bool needToCloneObject = true;
            if (needToCloneObject)
            {
                Vehicle newObj = factory(source);
                if (newObj != null)
                {
                    // Now we have a new object to work with
                }
            }
        }
        [STAThread]
        public static void Main(string[] args)
        {
        }
    }
}</pre>
</div>
</div>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Elluminate Eventsline - October 2009]]></title>
<link>http://virtualschooling.wordpress.com/2009/10/10/elluminate-eventsline-october-2009/</link>
<pubDate>Sat, 10 Oct 2009 17:35:21 +0000</pubDate>
<dc:creator>mkbnl</dc:creator>
<guid>http://virtualschooling.wordpress.com/2009/10/10/elluminate-eventsline-october-2009/</guid>
<description><![CDATA[Notice the iNACOL item and the PBS item looks interesting if you are into generational differences (]]></description>
<content:encoded><![CDATA[Notice the iNACOL item and the PBS item looks interesting if you are into generational differences (]]></content:encoded>
</item>
<item>
<title><![CDATA[Media Richness Theory]]></title>
<link>http://vcoutonalim.org/2009/10/08/media-richness-theory/</link>
<pubDate>Thu, 08 Oct 2009 12:23:28 +0000</pubDate>
<dc:creator>Janine Lim</dc:creator>
<guid>http://vcoutonalim.org/2009/10/08/media-richness-theory/</guid>
<description><![CDATA[Media Richness Theory Isn&#8217;t this a cool little theory?! It shows the richness of the communica]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div class="wp-caption alignnone" style="width: 356px"><a href="http://upload.wikimedia.org/wikipedia/en/thumb/2/2d/Media_Richness_Theory_Diagram_PNG.png/800px-Media_Richness_Theory_Diagram_PNG.png"><img class="   " title="Media Richness Theory" src="http://upload.wikimedia.org/wikipedia/en/thumb/2/2d/Media_Richness_Theory_Diagram_PNG.png/800px-Media_Richness_Theory_Diagram_PNG.png" alt="Media Richness Theory" width="346" height="259" /></a><p class="wp-caption-text">Media Richness Theory</p></div>
<p>Isn&#8217;t this a cool little <a href="http://en.wikipedia.org/wiki/Media_richness_theory">theory</a>?! It shows the richness of the communication &#8211; how personal, how interactive, how effective.</p>
<p>Let&#8217;s ask ourselves though, does effective mean more synchronous? does effective mean more asynchronous?</p>
<p>Compare Media Richness Theory to this chart by <a href="http://handouts.wesfryer.com/powerfulblending">Wesley Fryer</a>:</p>
<p><a href="http://farm1.static.flickr.com/151/435697374_1dede73ff6_o.jpg"><img class="alignnone" title="Thinking About Web 2.0 Tools" src="http://farm1.static.flickr.com/151/435697374_1dede73ff6_o.jpg" alt="" width="350" height="385" /></a></p>
<p>What other comparisons can be made? What framework do you find for thinking about these tools? How do you decide which one to use for which purpose? <em>Have you seen any similar comparisons? Please share!</em></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[What Makes Online Learning Effective?]]></title>
<link>http://alearning.wordpress.com/2009/09/30/what-makes-online-learning-effective/</link>
<pubDate>Wed, 30 Sep 2009 01:43:09 +0000</pubDate>
<dc:creator>Ellen</dc:creator>
<guid>http://alearning.wordpress.com/2009/09/30/what-makes-online-learning-effective/</guid>
<description><![CDATA[Isn&#8217;t this the million-dollar question? No? A couple hundred thousand, maybe? (Okay.  Maybe th]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Isn&#8217;t this the million-dollar question? No? A couple hundred thousand, maybe? (Okay.  Maybe the answer is only worth a few hundred dollars.)</p>
<p>Whatever the value, a variation of this question has generated a terrific discussion in the ASTD LinkedIn group. The original post from Donna Gilliland, President of MOSTraining, Inc. read:</p>
<p>&#8220;Online Live Training: what challenges do you face? Have you started delivering training live online training yet? If so, which of the following tools to you use?&#8221;</p>
<p>She listed:</p>
<ul>
<li>GoToWebinar</li>
<li>WebEx</li>
<li>Telspan</li>
<li>Others? </li>
</ul>
<p>Then she asked, &#8220;What do you find to be your greatest challenge in training live online?&#8221;</p>
<p>Several people chimed in, all of whom seemed to be focused on two key areas:</p>
<ul>
<li>Presenters&#8217; skills</li>
<li>Tools/technology</li>
</ul>
<p>What&#8217;s missing here?!?</p>
<p>CONTENT!!!</p>
<p>Yes, I&#8217;ll keep preaching this. Yes, my face is blue from repeating it over and over. And no, I&#8217;m not tired of repeating myself quite yet.</p>
<p>Why is content so important?</p>
<p>Because if your content doesn&#8217;t match the delivery mode, it doesn&#8217;t matter how interesting, entertaining, adept, practiced, experienced or knowledgable your instructor/facilitator/trainer is, the online event will fail. Completely.</p>
<p>If your content doesn&#8217;t match the delivery mode, it doesn&#8217;t matter how many polls, chat and breakout rooms you use, how pretty your slides are, or whether you use phone or VOIP, the online event will fail. Utterly.</p>
<p>So I&#8217;ll say it again: your content needs to be presented in a way that enables your learners to learn. Sounds obvious, but failing to do this is the primary reason most online events fail.</p>
<p>Webinars are a great example. They&#8217;re easy to conduct and attend, relatively inexpensive, and everyone seems to be offering them. Even when they should be doing something else (see <a href="http://alearning.wordpress.com/2008/05/11/when-a-webinar-is-a-bad-idea/" target="_blank">When A Webinar Is a Bad Idea</a>).</p>
<p>Only after you&#8217;re sure you have decided on the best delivery mode for the content you&#8217;re training should you be thinking about how you&#8217;ll handle the technical side of things, and choose the instructor.</p>
<p>Period. End of discussion.</p>
<p>Now, if you&#8217;ll excuse me, I need to get some pink back into my face <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Newsline - September 2009]]></title>
<link>http://virtualschooling.wordpress.com/2009/09/24/newsline-september-2009/</link>
<pubDate>Thu, 24 Sep 2009 13:49:27 +0000</pubDate>
<dc:creator>mkbnl</dc:creator>
<guid>http://virtualschooling.wordpress.com/2009/09/24/newsline-september-2009/</guid>
<description><![CDATA[From my inbox, a couple of K-12 focused items in this month&#8217;s newletter. Elluminate Newsline T]]></description>
<content:encoded><![CDATA[From my inbox, a couple of K-12 focused items in this month&#8217;s newletter. Elluminate Newsline T]]></content:encoded>
</item>
<item>
<title><![CDATA[Camtasia is King and Live Online Learning is the thing]]></title>
<link>http://learnadoodledastic.wordpress.com/2009/09/23/camtasia-is-king-and-live-online-learning-is-the-thing/</link>
<pubDate>Wed, 23 Sep 2009 11:12:02 +0000</pubDate>
<dc:creator>learnadoodledastic</dc:creator>
<guid>http://learnadoodledastic.wordpress.com/2009/09/23/camtasia-is-king-and-live-online-learning-is-the-thing/</guid>
<description><![CDATA[Enjoying Distance Learning Yes the thing – the thing to bring some emotion and enjoyment to the busi]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><span style="font-weight:bold;">Enjoying Distance Learning</span></p>
<p>Yes the thing – the thing to bring some emotion and enjoyment to the business of distance learning. Live online learning not only connects people, but is also a powerful aid to learning.  How so! Using web conferencing software a teacher/facilitator has a vast array of tools to promote active learning and whether that be face to face or online at a distance there is a vast array of literature that extols the virtues of active learning.  What tools say thee!  Ok  we have voice and video conferencing, text chat, whiteboard text and drawing tools, feedback icons such as &#8216;yes&#8217;, &#8216;no&#8217; and raised hand (to ask a question), web browser sharing, quizzes and polls, file transfers and on the fly uploading of resources.</p>
<div style="text-align:center;">from a previous study (Mackenzie 2008)
</div>
<p><a href="http://2.bp.blogspot.com/_jJsqoUexCOY/SrlfujC4hhI/AAAAAAAAACM/2nIBmfE4Cx0/s1600-h/effectivenesssynch.jpg"><img style="display:block;text-align:center;cursor:pointer;width:320px;height:190px;margin:0 auto 10px;" src="http://2.bp.blogspot.com/_jJsqoUexCOY/SrlfujC4hhI/AAAAAAAAACM/2nIBmfE4Cx0/s320/effectivenesssynch.jpg" alt="" border="0" /></a><br />
Now with some investment in time to understand how best to use the technology for teaching and learning, you&#8217;ll soon see how you can transform the hum drum educational experience of the distance learner.</p>
<p><span style="font-weight:bold;">Some Initial Reactions</span></p>
<p>I write these notes after completing an initial round of live online inductions using <a href="http://www.wimba.com/products/wimba_classroom/">Wimba Live Classroom</a> with my colleague Mellissa Phillips on the topic of myDmu and Blackboard, the main online learning services of my university DMU. These first set of month long inductions were not without some initial logging on difficulties which was disappointing as we were desperate to avoid irritating logging on problems. However for those postgraduate students that did logon and participate it appeared to be a welcome and enjoyable experience. Some brief comments (all positive) from those that attended included:</p>
<p><span style="font-style:italic;"><br />
<blockquote><span style="font-style:italic;">“Very interesting session, i am amazed by what technology is available and i think it will be a very good way of learning and communicating during the remainder of the course.”</span></p></blockquote>
<p></span><br />
<span style="font-style:italic;"><br />
<blockquote><span style="font-style:italic;">“I thought the use of live on line tech was very good and there were no problems. Would like to see it used in discussion boards etc if poss”</span></p></blockquote>
<p></span></p>
<p><span style="font-weight:bold;">Some Broad Lesson Learnt</span></p>
<p>Some good comments appreciating the value of this form of learning, but we still have work to do to improve this particular live online learning experience.  The lessons we are learning are:</p>
<p>1. We have to keep working very hard to change the mindset of the vast majority of programme leaders and students who are unaware of the power of voice technology in distance learning.  We hope at the end of this month long series of inductions to have gathered a body of evidence to support the value of this mode of learning and try gradually to move thinking and expectations on in this area.<br />
2. Due to the struggle to get participants live online we are cramming too much into their first live online learning experience.  We end up giving them a crash course on how to work in the new environment and then proceed to give the myDMU and Blackboard induction. Currently thinking this should be split due to the need to iron out initial technology problems that some students have.<br />
3. You have to work hard to understand how each particular live online learning environment works.  By this I mean that there are a vast array of web conferencing services to use, each one is setup differently &#8211; you have to understand how you can smoothly integrate the technology into your teaching aims.  Big Big tip – to fully appreciate this whilst developing you should log in on two machines – one as admin/presenter and the other as participant. You can then see the effects of your intended interactions from the participant viewpoint (allowing you to shape and refine your approach).</p>
<p><span style="font-weight:bold;">The Technology Used</span></p>
<p>Knowing that this was for most students this was their first experience of this type of learning we restricted our use of technology to:</p>
<p>1. Voice conferencing<br />
2. Text chatting<br />
3. Web browser demonstrations<br />
4. Links to web pages that held pre-recorded Camtasia video screencasts.<br />
5. The students also completed some self study tasks during the class.</p>
<p><span style="font-weight:bold;">A Word on Participant Interaction</span></p>
<p>With regard to the level of participant interaction and use of the technology available on a scale of 1 to 5 I’d rate this just over three.  With increased student familiarity and appreciation of the live online environment we can edge this more to 5 when devising classroom activities and interactions in the future.</p>
<p><span style="font-weight:bold;">Headline Grabbing Camtasia</span></p>
<p><a href="http://1.bp.blogspot.com/_jJsqoUexCOY/Srla4iBPq2I/AAAAAAAAAB0/sBipCpoRN5o/s1600-h/logo-studio.gif"><img style="display:block;text-align:center;cursor:pointer;width:194px;height:31px;margin:0 auto 10px;" src="http://1.bp.blogspot.com/_jJsqoUexCOY/Srla4iBPq2I/AAAAAAAAAB0/sBipCpoRN5o/s320/logo-studio.gif" alt="" border="0" /></a></p>
<p>Mentioned as a headline grabber <a href="http://www.techsmith.com/">Camtasia</a> is undoubtedly King in the world of e-learning tools. This easy to use moving screen capture software, with brilliant automatic zoom focus technology is a must for any lecturer who spends hours and hours grabbing screenshots for the production of module guides.  The video quality is excellent and once saved the source material can be produced in a variety of formats for use in a variety of situations. i.e. web, iPod, DVD.  Educational versions can be picked up for £134and in my opinion should be subject to a site licence for any serious learning organization.</p>
<p>More on explanation and discussion on Camtasia and live online learning will follow soon in up and coming blog posts.  Look out for them.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[MonoTouch Sample Code: Synchronous Web Request]]></title>
<link>http://sabonrai.wordpress.com/2009/08/30/monotouch-sample-code-synchronous-web-request/</link>
<pubDate>Sun, 30 Aug 2009 21:39:44 +0000</pubDate>
<dc:creator>twestley</dc:creator>
<guid>http://sabonrai.wordpress.com/2009/08/30/monotouch-sample-code-synchronous-web-request/</guid>
<description><![CDATA[Today we have another sample MonoTouch program. This little program performs a synchronous web reque]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Today we have another sample MonoTouch program. This little program performs a synchronous web request. Though we&#8217;re using a <a href="http://developer.apple.com/iPhone/library/documentation/UIKit/Reference/UIWebView_Class/Reference/Reference.html">UIWebView</a> to display the results of the web request, the focus is on one way to perform a synchronous web request in MonoTouch. Note that <a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest%28VS.80%29.aspx">HttpWebRequst</a> and <a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebresponse%28VS.80%29.aspx">HttpWebResponse</a> are .Net classes; don&#8217;t be looking in the Apple iPhone developer pages to find their descriptions.</p>
<p>Please do yourself and your iPhone users a favor: don&#8217;t use this technique except in a separate thread. If you do this on the main UI thread, you&#8217;ll lock it up until you get the response or it times out.</p>
<p>More details on building the main application and controller are available on the <a href="http://www.mono-project.com/MonoTouch">MonoTouch site</a>, including <a href="http://www.mono-project.com/MonoTouch_Samples">sample programs</a> and <a href="http://www.mono-project.com/MonoTouch_Tutorials">tutorials</a>.</p>
<p><strong>Update 10/10/09:</strong> Fixed code display.</p>
<p>Here&#8217;s the sample code:</p>
<pre class="brush: csharp;">
/*
Copyright (c) 2009, Terry Westley

Copying and distribution of this file, with or without
modification, are permitted in any medium without royalty.
This file is offered as-is, without any warranty.
*/

using System;
using System.Drawing;
using System.IO;
using System.Net;
using System.Text;

using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace MT_SampleSyncWebRequest
{
    public class Application
    {
        static void Main (string[] args)
        {
            UIApplication.Main (args, null, &#34;AppController&#34;);
        }
    }

    [Register (&#34;AppController&#34;)]
    public class AppController : UIApplicationDelegate
    {
        UIWindow window;

        public override bool FinishedLaunching (
            UIApplication app, NSDictionary options)
        {
            // Create the main view controller
            var vc = new MainViewController ();

            // Create the main window and add main view
            // controller as a subview
            window = new UIWindow (
                UIScreen.MainScreen.Bounds);
            window.AddSubview(vc.View);

            window.MakeKeyAndVisible ();
            return true;
        }

        // This method is required in iPhoneOS 3.0
        public override void OnActivated (
            UIApplication application)
        {
        }
    }

    [Register]
    public class MainViewController : UIViewController
    {
        private UIWebView webView;

        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();

            webView = new UIWebView (new RectangleF (
                0, 0, this.View.Frame.Width,
                this.View.Frame.Height));
            this.View.AddSubview (webView);

            string url = &#34;http://www.wolframalpha.com/iphone/&#34;;
            Uri uri = new Uri (url);

            // HttpWebRequest
            StringBuilder pageContent = new StringBuilder();
            try
            {
                HttpWebRequest request =
                    (HttpWebRequest)WebRequest.Create (uri);
                request.Method = &#34;GET&#34;;

                HttpWebResponse response =
                    (HttpWebResponse)request.GetResponse();
                StreamReader sr = new StreamReader(
                    response.GetResponseStream(), Encoding.UTF8);
                string line;
                while ((line = sr.ReadLine ()) != null)
                {
                    pageContent.Append (line);
                }
                sr.Close ();
                response.Close ();
            }
            catch (Exception ex)
            {
                Console.WriteLine (ex);
            }

            webView.LoadHtmlString(
                pageContent.ToString(), new NSUrl(url));
            Console.WriteLine(&#34;Hey, switch to Simulator now&#34;);
        }
    }
}
</pre>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Google Reader... with a Perspective and Style!]]></title>
<link>http://climenole.wordpress.com/2009/08/28/google-reader-with-a-perspective-and-style/</link>
<pubDate>Fri, 28 Aug 2009 18:40:59 +0000</pubDate>
<dc:creator>Claude LaFrenière</dc:creator>
<guid>http://climenole.wordpress.com/2009/08/28/google-reader-with-a-perspective-and-style/</guid>
<description><![CDATA[. Hi Gentle Readers [{p ٧ ¬p} W {p ۸ ¬p}] ٧ significare aut crepare ٧ σημασία ἤ θόρυβος or, in other]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><span style="color:#ffffff;">.</span></p>
<p><span style="color:#993300;"><em><strong>Hi Gentle Readers</strong></em></span> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><span style="font-weight:bold;">[{p ٧ ¬p} W {p ۸ ¬p}] ٧ significare aut crepare ٧ </span><span style="font-weight:bold;">σημασία</span><span style="font-weight:bold;"> ἤ θόρυβος <strong> </strong></span><br />
or, in other words,«<em>Speak if you have any words stronger than silence</em>.» [<strong><a href="http://en.wikipedia.org/wiki/Euripides" target="_blank">Euripides</a></strong>]<br />
So I keep silence for about one month in these pages (but a lot less on <strong><a href="http://twitter.com/climenole" target="_blank">Twitter</a></strong>&#8230;)  <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><img class="alignnone size-full wp-image-5687" title="Google Reader" src="http://climenole.wordpress.com/files/2009/08/reader_large-gif.png" alt="Google Reader" width="95" height="96" /></p>
<h3><span style="color:#993300;"><strong>Google Reader new features</strong></span></h3>
<p>Announced by the official Google Reader Blog [<strong><a href="http://googlereader.blogspot.com/2009/08/flurry-of-features-for-feed-readers.html" target="_blank">Flurry of features for feed readers</a></strong> and <strong><a href="http://googlereader.blogspot.com/2009/08/looking-for-great-stuff-to-read.html" target="_blank">Looking for great stuff to read</a></strong>], repeated like parrots by almost every Bloggers and Tweeters, I would like to avoid to add my voice in this Buzz &#38; Noise to give you some Signal instead by shortly reviewing the new features of Google Readers (you can explore by yourself) and stress on the meaning of these feature from the perspective of Data Processing <em>(&#8220;Web 1.x&#8221; or &#8220;It&#8217;s about data&#8221;)</em> &#38; People Connecting via the Social Medias <em>(&#8220;Web 2.x&#8221; or &#8220;It&#8217;s about Poeple&#8221;)</em></p>
<p>No, the Rss/Atom is not dead and yes Google Reader gives you the opportunity to add new sources of information from other people and share your discoveries with the others in social medias including via your blog ( FYI: blogging is not dead &#8230;).<br />
<span style="color:#ffffff;">.</span><br />
<strong><em>Here the new look of Google reader including the People You Follow feature:</em></strong></p>
<p><img class="alignnone size-full wp-image-5657" title="GReader-01" src="http://climenole.wordpress.com/files/2009/08/greader-01-2009-08-26_100133.png" alt="GReader-01" width="700" height="413" /></p>
<p><em><strong>An example of People You (&#8220;I&#8221;) Follow</strong></em></p>
<p><a href="http://climenole.wordpress.com/files/2009/08/greader-02-pif.png"><img class="alignnone size-full wp-image-5665" title="GReader People I Follow" src="http://climenole.wordpress.com/files/2009/08/greader-02-pif.png" alt="GReader People I Follow" width="513" height="552" /></a></p>
<p><em><strong>The Sharing on Social Media feature:</strong></em></p>
<p><img class="alignnone size-full wp-image-5660" title="GReader Share to " src="http://climenole.wordpress.com/files/2009/08/greader-07-shareto-01-2009-08-26_102200.png" alt="GReader Share to " width="631" height="629" /></p>
<p><em><strong>Custom Sharing feature:</strong></em></p>
<p><img class="alignnone size-full wp-image-5661" title="GReader Share to WordPress" src="http://climenole.wordpress.com/files/2009/08/greader-07-shareto-02-2009-08-26_102200.png" alt="GReader Share to WordPress" width="608" height="374" /></p>
<p><em><strong>And finally the Bundle of feed you may create and share: (an example&#8230;)<br />
</strong></em></p>
<p><span style="color:#ffffff;">.</span><br />
<a href="https://www.google.com/reader/bundle/user%2F16987784196755000261%2Fbundle%2FClimenole" target="_blank"><img class="alignnone size-full wp-image-5662" title="Greader My Bundle as Example" src="http://climenole.wordpress.com/files/2009/08/greader-06-bundle-mybundle-2009-08-26_101417.png" alt="Greader My Bundle as Example" width="700" height="410" /></a><br />
<span style="color:#ffffff;">.</span></p>
<h3><strong><span style="color:#993300;">The Cycle of Information and the Web</span></strong></h3>
<p>These new features gives to us the complete cycle of information production/consumption.</p>
<p>All Functions in the Information Cycle are present in the GReader features:</p>
<ul>
<li>Creators (content makers)</li>
<li>Critics (comments, ratings, and reviews),</li>
<li>Collectors (gathering, tagging and sharing contents),</li>
<li>Joiners (connecting people to poeple via contents),</li>
<li>Spectators (or pure consummers)</li>
<li>Doers (because information is related to <em>&#8220;energy&#8221;</em> and lead to works on physical stuff&#8230;)</li>
<li>Actors (because information is also related to communication and people relations&#8230;)</li>
</ul>
<p>These functions are not exclusives to some peoples and not the others: each of us may, from time to time, be a creator or a pure consumer, or behave as critic or joiner&#8230; The only difference between the Internauts <em>à la</em> Web 2 is in the percentage of their time dedicated for each of these functions.</p>
<p>To keep things simple: presently, writing this article for you, I  behave as creator by making a new and valuable contents (I hope so!) but for the last month (august 2009) I was more critic, collector and joiner than creator and soon (if everything goes according to my plans) and doer and actor. Then I will return to the function of creator and, for sure, from time to time as a pure consumer. See the idea?</p>
<p>By the way, it&#8217;s not only about &#8220;Real Time&#8221; (synchronous applications) which are often chronophages but mainly about the new flexibility in the social functions of data processing and communications. People are no more maintained in a limited social function but have the opportunity to change from one function to another. This idea and it&#8217;s reality are more important, IMHO, than the so-called &#8220;Real Time&#8221; applications (a buzz word only ). Every creator know they must keep their most productive periods for themselves and their creation process&#8221;. Asynchronous applications are valuables tools as much as the &#8220;Real Time&#8221; ones.</p>
<h3><span style="color:#993300;"><strong>Using Stylish Firefox add-on for your Google Reader (and more)</strong></span></h3>
<p>I can&#8217;t leave you without some <strong><span style="color:#993300;">Goodies</span></strong> so let me talk you about a very useful Firefox Add-on: <strong><a href="https://addons.mozilla.org/fr/firefox/addon/2108" target="_blank">Stylish</a></strong>.<br />
Stylish let you fix ugly sites or customize the look of  any site or web applications such as Google Reader. There&#8217;s  an on-line repository at <strong><a href="http://userstyles.org/" target="_blank">userstyles.org</a></strong>. Just few clicks and the chosen style is applied.</p>
<p><strong><span style="color:#0000ff;"><em>« Stylish is to CSS what Greasemonkey is to JavaScript »</em></span></strong></p>
<p>Easy to use , just click on the icon in the Status bar of Firefox and check for a style sheet created for the web site you visit, select a style, apply it and check if it&#8217;s ok for you. Often you have many choices for a site so feel free to experiment. Styles are easy to apply and to disable. <em> </em></p>
<p>Some screen captures for Google Reader:</p>
<p><img class="alignnone size-full wp-image-5677" title="GReader Style-01 " src="http://climenole.wordpress.com/files/2009/08/greaderstyle-01-2009-08-28_114150.png" alt="GReader Style-01 " width="700" height="368" /><br />
<span style="color:#ffffff;">.</span></p>
<p><img class="alignnone size-full wp-image-5678" title="GReader Style-02 " src="http://climenole.wordpress.com/files/2009/08/greaderstyle-02-2009-08-28_114150.png" alt="GReader Style-02 " width="700" height="366" /></p>
<p>and many more accessible at Userstyles.org via the Stylish Firefox Add-on.<br />
Have fun!<br />
 <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://climenole.wordpress.com/category/feed/" target="_blank"><img title="Abonnez-vous au fil RSS" src="http://climenole.files.wordpress.com/2009/06/rss-web-icon.png?w=64&#038;h=64#38;h=64&#38;h=64" alt="Rss-web-icon" width="64" height="64" /></a><a href="http://feeds2.feedburner.com/ProposEtCommentairesDuClimenole" target="_blank"><img title="Abonnez-vous via Feedburner" src="http://climenole.files.wordpress.com/2009/06/feedburner-icone-web.png?w=64&#038;h=64#38;h=64&#38;h=64" alt="FeedBurner-icône-web" width="64" height="64" /></a><a href="http://friendfeed.com/climenole" target="_blank"><img title="Abonnez-vous à Climenole sur FriendFeed" src="http://climenole.files.wordpress.com/2009/06/friendfeed-web-icon.png?w=64&#038;h=64#38;h=64&#38;h=64" alt="FriendFeed-web-icon" width="64" height="64" /></a><a href="http://twitter.com/climenole" target="_blank"><img title="Suivez Climenole sur Twitter" src="http://climenole.files.wordpress.com/2009/06/twitter-web-icon.png?w=64&#038;h=64#38;h=64&#38;h=64" alt="Twitter-web-icon" width="64" height="64" /></a><a href="http://www.google.com/profiles/climenole" target="_blank"><img title="Profil &#38; Contact" src="http://climenole.files.wordpress.com/2009/06/google-icone-web-2.png?w=64&#038;h=64#38;h=64&#38;h=64" alt="Profil &#38; Contact" width="64" height="64" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Very Powerful Session]]></title>
<link>http://craigtavs.wordpress.com/2009/08/23/very-powerful-session/</link>
<pubDate>Sun, 23 Aug 2009 06:47:59 +0000</pubDate>
<dc:creator>CraigT</dc:creator>
<guid>http://craigtavs.wordpress.com/2009/08/23/very-powerful-session/</guid>
<description><![CDATA[I love discussions about how powerful a session or technique is. The great joy in discussing such th]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I love discussions about how powerful a session or technique is. The great joy in discussing such things as this lies in the absence of any objective criteria. Everybody&#8217;s right, as there&#8217;s no definition of wrong.</p>
<p>There&#8217;s a few well established principles for session design. With nothing more than a gist of what behaviours are associated with each of the five broad bands of brainwave activity, sessions with a high probability of eliciting the desired effects can be created. There are no secrets required to write an alpha, theta or delta session that has every bit as much likelihood of &#8216;working&#8217; as the most expensive downloads. Then, of course, there&#8217;s the realms of &#8216;psychoactive music&#8217; &#8211; where the only rule that applies is that it must facilitate unusual perceptions.</p>
<p>A while ago I wrote a little program called &#8216;BrainForm&#8217; that I posted on the Transparent user forum. If ability to twist the mind is taken as the highest priority, then BrainForm is capable of generating Very Powerful Sessions.</p>
<p>If you want to try a Very Very Powerful Session, find your old copy of BrainForm and set it up as shown. If you&#8217;re downloading BrainForm for the first time, make sure you read all the posts in the thread over there &#8211; BF is a bit fussy about installation and some of the other Transparent forum users were very, very helpful in ironing out bugs and finding workarounds.</p>
<p>When you&#8217;re all set up, hit &#8216;Generate&#8217; and save the file somewhere you can find it. Once generated, find your file and play it in MediaPlayer or whatever.</p>
<p style="text-align:center;"><img class="aligncenter size-full wp-image-444" title="BrainForm-Beta-1" src="http://craigtavs.wordpress.com/files/2009/08/brainform-beta-11.jpg" alt="BrainForm-Beta-1" width="450" height="310" /></p>
<p>Yup, that&#8217;s a 30 minute session. The general consensus regarding BrainForm sessions is that they aren&#8217;t pretty to listen to. Well, I challenge you to lay back with your AudioStrobe glasses on and the volume high (not silly high), and tough out the whole thirty minutes of the session generated with the settings above.</p>
<p>Used in this way, BrainForm is a very simple random music synthesizer. What I have found particularly engaging about these sessions is that my mind starts finding patterns in longer and longer segments of the sound, even though no such patterns are likely to be there. It&#8217;s quite hypnotic, much like looking for patterns in clouds. Another quirk is that sessions generated with the same settings differ only in random distribution, yet they can have quite different perceived rhythms.</p>
<p>The session is intense, insistent. Being both beta-based and demanding, it it the kind of session that could easily induce panic or anxiety in one prone to such things. Even with nothing particularly going on I find my stomach muscles tighten at times during these sessions. I believe its a very good session for thinking outside the square.</p>
<p>A BrainForm session is based on a stimulus pattern that I dreamed up while I was trying to imagine what I would really like to see and hear, what I thought I would find most stimulating. What I came up with was randomly generated pulse triplets. The three pulses within the triplet are spaced at the &#8216;target frequency&#8217; &#8211; in this case between 12 and 20Hz. The pitch and amplitude of the pulses is proportional to the setting of the BF slider for that frequency. After a delay proportional to the last rate, another triplet is formed, at a frequency determined statistically from the spread of the BF sliders.</p>
<p>Sessions formed with BrainForm can be referred to as frequency independent sessions. There is no intention of entraining the brain to any particular frequency. What will happen is that a complex sequence of evoked potentials in the sensory regions will give all parts of the brain something to think about. By way of pure conjecture, I would venture that a whole brain highly active with asynchronous activity is probably more useful than one with isolated regions of synchronous activity. I often wonder what consideration is given to absolute potentials in EEG measurement &#8211; large volumes of asynchronous activity would not be seen as ripples in the EEG, but as an increased offset.</p>
<p>I hope you&#8217;ve now tried BrainForm and hated it. I get a real kick out of it, and an unanticipated side-effect of listening to these fast rise-time clicks is that my long standing tinnitus has diminished to barely a hiss.</p>
<p>In discussion of powerful sessions, we need to consider what we&#8217;re really saying. Methinks mostly what we mean is that there was something about a particular session that made it sufficiently engaging to make us stick with it for long enough to notice effects. It might be that the marketing carried significant weight for you. It might have been recommended by someone you trust. It might have a message that speaks to you. It might have the right aesthetics to appeal to you.</p>
<p>An observation I have made is that most people don&#8217;t like entrainment tracks to sound like entrainment tracks. The more skilfully a session designer can obscure the psychoactive elements without diminishing their effects too severely, the more popular the session is likely to be.</p>
<p>A common forum question is, &#8216;How quiet can I have the beats before they don&#8217;t work?&#8221; I ask the reciprocal question, &#8220;How loud can you have them before they become hopelessly annoying to you?&#8221; The evoked response to a stimulus is substantially proportional to the magnitude of the stimulus. Louder and sharper works better. But having you on a razor&#8217;s edge, teeth gritted, is going to work counter to anything but the most agressive pump-it-up session, so we do what we have to do. We trade raw power for palatability. We do that quite a lot in life &#8211; isn&#8217;t there something about &#8220;a softer easier way&#8221;?</p>
<p>During a session, keep in mind that there&#8217;s two quite distinct things going on. There&#8217;s the direct physiological effect of pulse stimulus to the visual and/or auditory centres. Then there&#8217;s your opinion, your judgement, your critique, your acceptance, your enjoyment, your intellectualisation of the sound and light experience. In between these poles is a whole gamut of perception to which we don&#8217;t usually pay attention.</p>
<p>It&#8217;s no secret that during my magickal days I made considerable use of entheogens to access unusual perceptions. Even now I make occasional use of the several very adequate herbals legally available in this country. The arrangement I have with these teacher plants is that whatever they show me, I try to find again without their help. Over the years I tried a lot of things, but the abyss between ordinary consciousness and that opened up by psychedelics has been too much for me to traverse bare-brained. AVS has provided the bridge, and with its help I can do most of the things that were previously only possible with spirit aid. Since using AVS many of the perspectives have become accessible to me in daily life.</p>
<p>I included the last paragraph for anyone who&#8217;s just come along to this blog, and hasn&#8217;t been reading my posts over on the Transparent or Mind Place forums for the last year or so. I&#8217;ve drawn my inspiration from many sources, and many of the more peculiar sessions that I have shared have come into existence through my efforts to emulate experiences I&#8217;ve had through shamanic or ritual techniques, with or without entheogens. One of my ambitions is to make these experiences accessible to others without the necessity for potentially hazardous, often illegal, substances and without resort to arcane and long-winded rituals. The universe perceived by a shaman is one stripped of both illusion and delusion. It is much easier to be accepting of what is when truly honest about oneself. Many of the sessions I write are intended to accompany introspection. Most ritual is little more than a symbolic representation of the self in macrocosm and microcosm, laid out in relation to the perceived universe, for inspection and reorganization. The most valuable function of &#8216;teacher plants&#8217; is to nudge ego far enough into the background to allow a few self-truths to emerge.</p>
<p>AVS sessions can facilitate the deepest self-explorations. For myself, the most intense experiences arise when I&#8217;m deeply immersed in the unfamiliar. Any session that contains conventional musical elements contains objects of familiarity and interesting structures that my mind can attach to. Random sessions provide no such haven and the mind has no choice but to find it&#8217;s own way.</p>
<p>I hope these comments open the way for others to start experimenting with sessions that have little or no theoretical foundation other than a vague idea, such as, &#8220;I want to contemplate past influences, so I&#8217;ll target the theta range&#8221;. Forget about what anyone else might think, and write the session that speaks to you.</p>
<p>Have fun!!!</p>
<p>Cheers,<br />
Craig</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Web Conferencing an online communities &amp; social media ]]></title>
<link>http://cinnova.wordpress.com/2009/08/21/web-conferencing-an-online-communities-social-media/</link>
<pubDate>Fri, 21 Aug 2009 12:13:43 +0000</pubDate>
<dc:creator>cinnova</dc:creator>
<guid>http://cinnova.wordpress.com/2009/08/21/web-conferencing-an-online-communities-social-media/</guid>
<description><![CDATA[The field of Web conferencing software is growing at a breathtaking pace. In the summer of 1994 ther]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><!--Google Video Error: bad URL entered-->The field of <a href="http://www.cinnova.com/web-conferencing-collaboration/">Web conferencing software </a>is growing at a breathtaking pace. In the summer of 1994 there were exactly two products in this category, both of them rather primitive freeware packages. Today there are well over 60 commercial and freeware products, many of them quite sophisticated, that support <a href="http://www.adobe.com/products/acrobatconnect/">conferencing on the Web </a>in one form or another.</p>
<p>With so many products available, the choice can seem overwhelming. But with a <a href="http://www.imc.org/atom-syntax/mail-archive/msg06715.html">methodical approach</a>, you&#8217;ll probably find that you can quickly whittle the list down to just a few candidates.</p>
<p>First, let&#8217;s define our terms. For our present purposes, conferencing is a form of group discussion that uses text messages stored on a computer as a <a href="http://www.megaessays.com/essay_search/communication_medium.html">communication medium</a>. It does <em>not</em> include various types of real-time, or synchronous, communication, such as &#8220;chat rooms&#8221;, <a href="http://blogs.zdnet.com/Apple/?p=4551">voice-based teleconferencing</a>, or <a href="http://www.tandberg.com/video-conferencing-products.jsp">video conferencing</a>.</p>
<p>A conferencing system is Web-based if it uses Web browsers and servers to provide most of its functionality. This is not as clear a distinction as it might sound. Most developers of conferencing software are hurrying to adapt their products to the Web, and the result is a lot of hybrid products that use the Web to a greater or lesser extent. Hence, the boundary between Web and non-Web conferencing software is a bit blurry.</p>
<p><a href="http://thinkofit.com/webconf/wcchoice.htm#intro">For Info</a></p>
<p><span style='text-align:center; display: block;'><object width='425' height='350'><param name='movie' value='http://www.youtube.com/v/1KaBWDrp0Oc&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;hd=0' /><param name='allowfullscreen' value='true' /><param name='wmode' value='transparent' /><embed src='http://www.youtube.com/v/1KaBWDrp0Oc&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;hd=0' type='application/x-shockwave-flash' allowfullscreen='true' width='425' height='350' wmode='transparent'></embed></object></span></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[advancing conversation]]></title>
<link>http://ourpresentpartialknowledge.wordpress.com/2009/08/20/99/</link>
<pubDate>Fri, 21 Aug 2009 03:46:16 +0000</pubDate>
<dc:creator>jennaream</dc:creator>
<guid>http://ourpresentpartialknowledge.wordpress.com/2009/08/20/99/</guid>
<description><![CDATA[I was talking tonight with Joni Dunlap about live, synchronous discussions in online classes.  I ten]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I was talking tonight with <a title="Joni Dunlap" href="http://thoughtsonteaching-jdunlap.blogspot.com/" target="_blank">Joni Dunlap</a> about live, synchronous discussions in online classes.  I tend to go pretty structured so none of us (especially me) is second guessing whether to talk or listen.  I like to prompt  conversation with leads like- check out this video clip then talk about it, respond to this image, etc. When I think of the discussions that have been the most effective, I think the student led discussions last semester were probably the best of all. In reflecting on it I think that had <span style="display:inline;">to do mostly with the nature and the number of conversations with the leaders about what they need to think about to facilitate a good discussion&#8230; then that builds on itself as the leaders become participants in the next conversation and the quality of discussions grows exponentially throughout the semester.  I am excited to try breakout groups this semester&#8230; where teams go off and discuss or problem solve elements of an issue&#8230; then return for a new conversation to share and build on thinking from their small groups. It is a strategy that works amazingly face to face&#8230; I think synchronous conversations this way in <a title="Adobe Connect" href="http://www.adobe.com/products/acrobatconnect/">Adobe Connect</a> could be a really great way to bring multi-level conversations like this alive in the online classroom.</span></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Tips for Teaching Online]]></title>
<link>http://nauelearning.wordpress.com/2009/08/21/tipsforteachingonline/</link>
<pubDate>Thu, 20 Aug 2009 22:17:54 +0000</pubDate>
<dc:creator>NAUelearning</dc:creator>
<guid>http://nauelearning.wordpress.com/2009/08/21/tipsforteachingonline/</guid>
<description><![CDATA[by Lorraine B. Elder Dr. Judith V. Boettcher has written Teaching Online for the First Time &#8212; ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><strong>by Lorraine B. Elder</strong></p>
<p>Dr. Judith V. Boettcher has written <a title="Dr. Judith V. Boettcher's Teaching Online for the First Time -- The Quick Guide" href="http://www.designingforlearning.info/services/writing/ecoach/tenbest.html" target="_blank">Teaching Online for the First Time &#8212; The Quick Guide</a>. She lists ten best practices for designing and teaching a course, and most are spot on, with the possible exception of</p>
<blockquote><p>Best Practice 5: Use both synchronous and asynchronous activities</p></blockquote>
<p>Using both kinds of activities works only if your online students know up front that&#8217;s an expectation. Many students think online inherently means asynchronous, so be clear in your class description about whether synchronous activities are included in the course, and be sure to list the dates and times of the synchronous activities on a <a title="NAU's tutorial on class preview pages" href="http://www.nau.edu/~d-elearn/support/tutorials/course_preview_page/course_preview.php" target="_blank">class preview page</a> so students can figure out even before they register whether their school, work, and life schedules will permit them to be available at those times.</p>
<p>To Dr. Boettcher&#8217;s list, I&#8217;d add a few more implementation tips that the e-Learning Center has learned from years of working with faculty in preparing online and hybrid courses.</p>
<h3><a name="onthefly"></a>1. Don&#8217;t try to create an online course on the fly while you&#8217;re teaching it. You won&#8217;t like it and neither will your students.</h3>
<p>If your in-person teaching style entails glancing at your notes—or not—a few minutes before class starts and then winging it by speaking extemporaneously, you&#8217;ll be tempted to approach online teaching the same way. <strong>Don&#8217;t do it.</strong> You&#8217;ll fumble with the technology (or it will go down at an inopportune time); you won&#8217;t have an adequate list of resources and supplemental materials available for your students; you&#8217;ll forget to include important details in your assignment instructions, confusing your students and sparking a flood of emails or discussion posts asking for clarification; and in an asynchronous course, your students will be irritated if they&#8217;re ready to proceed but you aren&#8217;t because you haven&#8217;t yet built out the course. They&#8217;re busy people, too, who don&#8217;t want you wasting their time.</p>
<h3><a name="nopowerpoint"></a>2. Posting PowerPoint presentations online does not constitute an online course, no matter how many slides you include.</h3>
<p>A bunch of bullet points out of context and lacking a speaker to fill in the details isn&#8217;t what students need. Neither are slides packed with overstuffed paragraphs.  If you need to write paragraphs to convey your information, put them on a web page, not on a slide. Put the bullet points on web pages, too, and also write the information you would have said aloud in a face-to-face presentation. Or include an audio recording (with transcripts!) of what you would have said to accompany the slides.</p>
<p>Don&#8217;t expect students to intuit what you meant by your cryptic, one- or two-word bullets. What&#8217;s obvious to you—an expert— won&#8217;t be obvious to them—novices. Explain yourself.</p>
<p>I&#8217;ll have more to say on the evils of PowerPoint in <a title="Why You Shouldn't Use PowerPoints in (Most) Online Courses" href="http://nauelearning.wordpress.com/2009/10/21/nopptonline/">a future blog post</a>.</p>
<h3><a name="accessible"></a>3. Make your course accessible to <em>all</em> students, including those who have disabilities.</h3>
<p>It&#8217;s easy and desirable in an online course to include clips of rich instructional media, such as videos and audio. Be sure to include captioning or transcripts so that all students get the full benefit of the media without having to ask for special accommodations. Even students who don’t have disabilities often appreciate captions and transcripts. Also make sure your course can be navigated easily with a keyboard, not just a mouse, and check with your campus <a title="Disability Resources at Northern Arizona University" href="http://www4.nau.edu/dr/" target="_blank">Disability Resources</a> office to be sure that screen reader software can interpret your course material.</p>
<p><a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/us/"><img style="border-width:0;" src="http://i.creativecommons.org/l/by-nc/3.0/us/88x31.png" alt="Creative Commons License" /></a><br />
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/us/">Creative Commons Attribution-Noncommercial 3.0 United States License</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Teaching as all-encompassing activity: (a)synchronous and omnipresent]]></title>
<link>http://michaelgallagher.wordpress.com/2009/08/19/educationteaching-as-encompassing-activity-synchronous-asynchronous-spiritual-and-omnipresent/</link>
<pubDate>Wed, 19 Aug 2009 19:09:02 +0000</pubDate>
<dc:creator>Michael Gallagher</dc:creator>
<guid>http://michaelgallagher.wordpress.com/2009/08/19/educationteaching-as-encompassing-activity-synchronous-asynchronous-spiritual-and-omnipresent/</guid>
<description><![CDATA[&#8220;The next generation is responsible for its own soul; a man of genius is responsible to his pe]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><blockquote><p>&#8220;The next generation is responsible for its own soul; a man of genius is responsible to his peers, not to a studio full of uneducated and undisciplined coxcombs.&#8221;<br />
<a href="http://books.google.com/books?id=sS7dxjpZh6cC&#38;pg=PA176&#38;lpg=PA176&#38;dq=each+generation+is+responsible+for+its+own+soul+t.s.+eliot&#38;source=bl&#38;ots=B25nFagAMQ&#38;sig=bFTEPwag1CdwA59L4HOZf8Sz9qM&#38;hl=en&#38;ei=9EqMSvmRA4-AMpqVwZMO&#38;sa=X&#38;oi=book_result&#38;ct=result&#38;resnum=1#v=onepage&#38;q=&#38;f=false">T.S. Eliot</a></p></blockquote>
<blockquote><p>Coxcomb-a conceited dandy who is overly impressed by his own accomplishments (<a href="http://wordnetweb.princeton.edu/perl/webwn?s=coxcomb">Princeton</a>)</p></blockquote>
<blockquote><p>&#8220;Teachers shouldn&#8217;t be coxcombs nor should politicians try to squeeze the coxcombiness (I made it up a la Sussidio and Phil Collins) from schools with standardized tests that measure societal conceit. Also, don&#8217;t be a dandy as that is so 1920s.&#8221;<br />
<a href="http://twitter.com/gallagher_msean">Michael Sean Gallagher </a></p></blockquote>
<p>I have been doing some thinking of late on how technology has changed the face of education. Some will bemoan these changes, arguing that basic literacies and disciplined grounding in scholarship will be lost for the sake of technological acumen. Those of the opposite persuasion will argue that this very same technology allows us to push farther and faster than ever before, offering many more opportunities for genuine learning moments. The truth, as always, probably rests somewhere in between these schools of thought. This post will focus on the transformative effects of this technology on actual learning activities, those activities designed by teachers to elicit learning.</p>
<p><em>1. Education is omnipresent</em><br />
This point illustrates itself. To think that the only education of any merit occurs in classrooms is ludicrous and has been dismissed almost exclusively. Granted, the opposite end of the spectrum will argue that very little actual education takes place in classrooms and that is equally unfounded. The only real question is what type of learning actually should take place in thee physical or digital environs.</p>
<p>Regardless, we live 99% of our lives outside of classrooms so to regulate that 99% to a compartment for living and not learning seems absurd. Learning is not turned off or on when one steps in and out of a classroom. Digital learning environments have illustrated the power of asynchronous learning, that learning done at the pace of the learner as opposed to a teacher guided activity. Most learning occurs in this asynchronous realm. But what type of learning? The self-directed kind obviously. Asynchronous is all about ingestion, analysis, synthesis and reflection. It is a perfect space for absorbing and personalizing learning; it is where the learning takes on the spiritual element. It becomes omnipresent, applied in all our daily facets, and with the reflection necessary in proscribed activities such as essay or blogs, it provides a significant augmentation of classroom activities.</p>
<p>In short, teachers should recognize that the majority of learning takes place outside of classrooms. Plan accordingly.</p>
<p><em>2. Assessment of learning is a fickle beast. </em><br />
Yes, standardized testing and national metrics are necessary, but not necessarily for the sake of the learner. These are more benchmarks for the learning institutions. Basic literacies are indeed necessary; the ability to navigate society in any meaningful way is dependent on this preliminary type of education. It is skills based training at its finest and a basic building block of any sort of progress. This all applies to the synchronous learning activities.</p>
<p>But what of the asynchronous activities? What of the reflection, the synthesis, the discovery, the personalization of knowledge? How does a society, institution or individual assess the impact of education on the learner in question, especially when the learning is conducted at the pace and depth of the learner? It can have some standard elements, for sure. It can measure competence, an intelligence quotient. But IQ tests are not measures of anything other than IQ. Do you remember the last IQ class you had in secondary school? Of course not. You remember learning French, Calculas, Biology. You were never taught intelligence per se. But that is what we measure because that is the only measurable aspect of the classroom learning experience. Retention is valued over reflection. Retention, however, will not contribute in any measurable way to the betterment of society. Only reflective individuals will.</p>
<p>Assess the learning, make assessment as predictable as possible, and stay on task with assessment. All too often it veers into a measuring of some corollary activity wholey unrelated to the task at hand.</p>
<p><em>3. Learning takes place even with resistance/stubbornness/ego</em></p>
<p>The outward unwillingness to learn is not a disqualification from the learning process. The student in question is resisting for other reasons, most notably ego. By resisting do they identify themselves and that is an education in itself. Open defiance is disruptive to the learning process, but a general skepticism is critical to the reflective process. If I don&#8217;t question it, I can never make it fully my own. All religions ascribe to this line of questioning; doubt can be a perfectly valid intellectual response to a new idea. Recalcitrance is just an aberration of skepticism.</p>
<p>Also, learning is inherently an alteration of understanding and all too often our sense of self is buttressed by our view of the world (and especially our place in it.) Does Darwin refute religion? Most certainly not. Are two explanations for the same phenomena possible? Absolutely. Does an understanding of the barbarity/benevolence of my ancestors/country detract or augment my sense of worth? Well it shouldn&#8217;t, but it does. If the foundation of self is cast on such temporal stone, then it is bound to shift. Be sensitive to the student&#8217;s sense of self and the factors that play into that, but don&#8217;t let the pursuit of truth be hindered by that sense.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Introduction to AJAX...]]></title>
<link>http://learnajax.wordpress.com/2009/08/19/introduction-to-ajax/</link>
<pubDate>Wed, 19 Aug 2009 13:58:54 +0000</pubDate>
<dc:creator>Lasantha Samarakoon</dc:creator>
<guid>http://learnajax.wordpress.com/2009/08/19/introduction-to-ajax/</guid>
<description><![CDATA[AJAX is stands for Asynchronous JavaScript And XML. It&#8217;s not a language such as Javascript, VB]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>AJAX is stands for <em><strong>Asynchronous JavaScript And XML</strong></em>. It&#8217;s not a language such as Javascript, VBScript or anything, but it&#8217;s a collection of techniques that the developpers used for a long time.</p>
<p>AJAX can be used to update a web page continuesly or to update only a part of the web page. But, how this can happen? So to get an idea about this, you should consider about how the traditional model works.</p>
<p>So how the browser going to fetch data from the server? To understand this, let&#8217;s get an example of visiting Google.com. So when you want to visit google.com, you just enter google&#8217;s URL in your browsers address bar. When you hit &#8220;Enter&#8221;, the browser generate an request which is called as &#8220;<strong>HTTP Request</strong>&#8220;, and send that to the web server. When the server get this request, extract it, analyse it, and finally send back the required web page to the client&#8217;s browser. So this is happen everytime when you click a link or type a URL in the address bar.</p>
<div id="attachment_16" class="wp-caption aligncenter" style="width: 428px"><img class="size-full wp-image-16" title="traditional_model" src="http://learnajax.wordpress.com/files/2009/08/traditional_model1.png" alt="Traditional Model" width="418" height="220" /><p class="wp-caption-text">Traditional Model</p></div>
<p>In the AJAX model, it is little bit different from the traditional model. Let&#8217;s understand this by an example. Imagine that you are viewing a photo gallery in some website. Thumbnails of all the photos are there on the page. When you click on one of the thumbnails, you can view the full-size image of that. If you are using the traditional model, the image will be loaded in a new page. But if you are using the AJAX model, you can see that image on the same page at some location without refreshing or navigating away from that page.</p>
<div id="attachment_15" class="wp-caption aligncenter" style="width: 381px"><img class="size-full wp-image-15" title="ajax_model" src="http://learnajax.wordpress.com/files/2009/08/ajax_model.png" alt="AJAX Model" width="371" height="151" /><p class="wp-caption-text">AJAX Model</p></div>
<p>So this is the basic idea of AJAX. AJAX has been so popular these days, and many websites use this for increase their user experience. Here are the some real world examples of AJAX.</p>
<ol>
<li>
<h3>GMail</h3>
<ul>
<li>If you are familiar with GMail, you can remember that, when you select a mail and click &#8220;Delete&#8221;, your mail will be deleted without refreshing the whole page. It&#8217;s AJAX.</li>
</ul>
</li>
<li>
<h3>Facebook</h3>
<ul>
<li>Facebook is one of main sites which use AJAX. In Facebook, you can update your status, delete a post from the wall, or send message without reloading the page. And when you enter someone&#8217;s name in your search box, you can see drop down list of similar names. That is also AJAX. The most interesting thing is, did you ever noticed that your news feed refreshes every 60 seconds? This shows the power of AJAX.</li>
</ul>
</li>
<li>
<h3>Google Maps</h3>
<ul>
<li>Google maps also uses AJAX for refreshing their maps when you navigate through or when you zoom them.</li>
</ul>
</li>
</ol>
<p>Oh&#8230; I forgot to tell you about another thing. Do you know what is meant by &#8220;<strong>Asynchronous</strong>&#8220;? OK, again an example. Your honey is gonna prepare something for the dinner. So she&#8217;s working hard and she does everything without bothering you. That is <em>Synchronous</em>. But one day, she asked you to cut potatoes while she&#8217;s doing other stuff. When you finished cutting, you alert her that you have finished cutting. That is <em>Asynchronous</em>.</p>
<p>In the Synchronous method, there is only one stream, that only the main-stream available (like herself). In asynchronous model, along with the main-steam, there are several sub-streams available (like your help to her). So in AJAX, it is asynchronous. i.e. data transfers happen, without disturbing your view.</p>
<p>So now the time to get ready for long run with AJAX&#8230;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Distance Education]]></title>
<link>http://pacificogarcia.wordpress.com/2009/07/13/distance-education/</link>
<pubDate>Mon, 13 Jul 2009 02:47:36 +0000</pubDate>
<dc:creator>pacificogarcia</dc:creator>
<guid>http://pacificogarcia.wordpress.com/2009/07/13/distance-education/</guid>
<description><![CDATA[A new pedagogy is being demanded by the 21st century learners.  The traditional synchronous learning]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>A new pedagogy is being demanded by the 21<sup>st</sup> century learners.  The traditional synchronous learning strategies, is now being ousted by new technologies.  With respects to social software via the internet, learners are opting to a more constructivist learning approach.  The concept of instructors banking information to learners while they passively receive the information is an example of “oppressed” pedagogy (Paulo Freire).</p>
<p>If we are all different, coming from different cultures, experiences and backgrounds, then why should we all be required to learn in the same way?  I cannot agree more that we need a more learner-focused system where the learners’ needs become the center of attention.</p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
