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

<channel>
	<title>Web Plant Media</title>
	<atom:link href="http://webplantmedia.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://webplantmedia.com</link>
	<description>Lubbock Web Design and Web Development</description>
	<lastBuildDate>Wed, 26 Oct 2011 14:03:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Wireless Doesn&#8217;t Work in Ubuntu 10.10</title>
		<link>http://webplantmedia.com/ubuntu/2011/02/wireless-doesnt-work-in-ubuntu-10-10/</link>
		<comments>http://webplantmedia.com/ubuntu/2011/02/wireless-doesnt-work-in-ubuntu-10-10/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 19:41:22 +0000</pubDate>
		<dc:creator>ChrisB</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.webplantmedia.com/?p=557</guid>
		<description><![CDATA[For the longest time, I couldn&#8217;t figure out how to get my wireless to on my laptop. I could enable and disable my wireless card, but I could never scan and view available wireless channels. After searching many forums, I came across an article that suggested this. rfkill unblock all After you run this command, [...]]]></description>
			<content:encoded><![CDATA[<p>For the longest time, I couldn&#8217;t figure out how to get my wireless to on my laptop. I could enable and disable my wireless card, but I could never scan and view available wireless channels. After searching many forums, I came across an article that suggested this.</p>

<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">rfkill unblock all</pre></div></div>

<p>After you run this command, disable and enable your wireless card. If your problem was similar to mine, then you should be able to see wireless channels and connect. I&#8217;m not sure exactly why this works, but it worked for me. Feel free to explain if you know why this solution works. I am curious. </p>
<p>I hope this helps someone out. I&#8217;m very thankful I was able to come across the solution.</p>
<p><a href="http://life.firelace.com/2010/10/tips-and-tricks-upgrading-to-ubuntu-10-10-wireless-fix/">http://life.firelace.com/2010/10/tips-and-tricks-upgrading-to-ubuntu-10-10-wireless-fix/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://webplantmedia.com/ubuntu/2011/02/wireless-doesnt-work-in-ubuntu-10-10/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rename Files in Windows 7 using the Command Prompt</title>
		<link>http://webplantmedia.com/windows/2011/02/rename-files-in-windows-7-using-the-command-prompt/</link>
		<comments>http://webplantmedia.com/windows/2011/02/rename-files-in-windows-7-using-the-command-prompt/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 16:55:57 +0000</pubDate>
		<dc:creator>ChrisB</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.webplantmedia.com/?p=549</guid>
		<description><![CDATA[I came across a situation where a client of mine needed a whole batch of pictures renamed to display &#8220;underscores&#8221; instead of &#8220;dashes&#8221;. For example, I needed the following to be changed: W-Lawther-4311-1263.jpg W_Lawther_4311_1263.jpg Going through each individual file and manually changing each dash to an underscore would be painstaking. I did some research and [...]]]></description>
			<content:encoded><![CDATA[<p>I came across a situation where a client of mine needed a whole batch of pictures renamed to display &#8220;underscores&#8221; instead of &#8220;dashes&#8221;. For example, I needed the following to be changed:</p>

<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">W-Lawther-4311-1263.jpg
W_Lawther_4311_1263.jpg</pre></div></div>

<p>Going through each individual file and manually changing each dash to an underscore would be painstaking. I did some research and found a very simple solution to this problem.</p>

<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">ren ?-???????-????-????.jpg ?_???????_????_????.jpg</pre></div></div>

<p>Open up the Command Prompt (Start-&gt;Run-&gt;Type: cmd)<br />
Navigate to your directory using the &#8216;cd&#8217; command and display the contents of your directory using the &#8216;dir&#8217; command. Here is an example of the process I went through.</p>

<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
&nbsp;
C:\Users\Chris&gt;dir
 Volume in drive C has no label.
 Volume Serial Number is BC3E-4FC9
&nbsp;
 Directory of C:\Users\Chris
&nbsp;
01/24/2011  08:22 AM    &lt;DIR&gt;          .
01/24/2011  08:22 AM    &lt;DIR&gt;          ..
01/24/2011  03:03 PM    &lt;DIR&gt;          Contacts
01/31/2011  05:54 PM    &lt;DIR&gt;          Desktop
01/28/2011  02:27 PM    &lt;DIR&gt;          Documents
01/31/2011  04:02 AM    &lt;DIR&gt;          Downloads
01/24/2011  03:03 PM    &lt;DIR&gt;          Favorites
01/24/2011  03:03 PM    &lt;DIR&gt;          Links
01/24/2011  03:03 PM    &lt;DIR&gt;          Music
02/01/2011  09:56 AM    &lt;DIR&gt;          Pictures
01/24/2011  03:03 PM    &lt;DIR&gt;          Saved Games
01/24/2011  03:03 PM    &lt;DIR&gt;          Searches
01/24/2011  03:03 PM    &lt;DIR&gt;          Videos
               0 File(s)              0 bytes
              13 Dir(s)  66,118,414,336 bytes free
&nbsp;
C:\Users\Chris&gt;cd Pictures
&nbsp;
C:\Users\Chris\Pictures&gt;dir
 Volume in drive C has no label.
 Volume Serial Number is BC3E-4FC9
&nbsp;
 Directory of C:\Users\Chris\Pictures
&nbsp;
02/01/2011  09:56 AM    &lt;DIR&gt;          .
02/01/2011  09:56 AM    &lt;DIR&gt;          ..
02/01/2011  10:11 AM    &lt;DIR&gt;          4311 W Lawther 550
09/18/2010  11:13 AM           242,056 Earth.jpg
               1 File(s)        242,056 bytes
               3 Dir(s)  66,118,414,336 bytes free
&nbsp;
C:\Users\Chris\Pictures&gt;cd &quot;4311 W Lawther 550&quot;
&nbsp;
C:\Users\Chris\Pictures\4311 W Lawther 550&gt;dir
 Volume in drive C has no label.
 Volume Serial Number is BC3E-4FC9
&nbsp;
 Directory of C:\Users\Chris\Pictures\4311 W Lawther 550
&nbsp;
02/01/2011  10:11 AM    &lt;DIR&gt;          .
02/01/2011  10:11 AM    &lt;DIR&gt;          ..
02/01/2011  10:11 AM    &lt;DIR&gt;          JPEG
01/20/2011  02:29 PM           190,939 W-Lawther-4311-1003.jpg
01/20/2011  02:29 PM           229,187 W-Lawther-4311-1011.jpg
01/20/2011  02:29 PM           362,945 W-Lawther-4311-1019.jpg
01/20/2011  02:29 PM           315,891 W-Lawther-4311-1025.jpg
01/20/2011  02:29 PM           324,793 W-Lawther-4311-1037.jpg
01/20/2011  02:29 PM           298,915 W-Lawther-4311-1054.jpg
01/20/2011  02:29 PM           311,920 W-Lawther-4311-1062.jpg
01/20/2011  02:29 PM           218,105 W-Lawther-4311-1069.jpg
01/20/2011  02:30 PM           284,679 W-Lawther-4311-1092.jpg
01/24/2011  03:50 PM           179,684 W-Lawther-4311-1097.jpg
01/24/2011  03:55 PM           215,851 W-Lawther-4311-1132.jpg
01/24/2011  03:53 PM           119,409 W-Lawther-4311-1183.jpg
01/24/2011  03:53 PM           121,753 W-Lawther-4311-1192.jpg
01/24/2011  03:53 PM           130,715 W-Lawther-4311-1201.jpg
01/24/2011  03:50 PM           191,201 W-Lawther-4311-1216.jpg
01/24/2011  03:50 PM           188,831 W-Lawther-4311-1225.jpg
01/24/2011  03:53 PM           163,884 W-Lawther-4311-1242.jpg
01/24/2011  03:51 PM           215,726 W-Lawther-4311-1251A.jpg
01/24/2011  03:53 PM           174,017 W-Lawther-4311-1263.jpg
01/24/2011  03:54 PM           170,680 W-Lawther-4311-1273.jpg
01/24/2011  03:54 PM           150,399 W-Lawther-4311-1283.jpg
01/24/2011  03:51 PM           189,790 W-Lawther-4311-1289.jpg
01/24/2011  03:51 PM           169,936 W-Lawther-4311-1307.jpg
01/24/2011  03:51 PM           171,228 W-Lawther-4311-1321.jpg
01/24/2011  03:54 PM           155,343 W-Lawther-4311-1333.jpg
01/20/2011  02:29 PM           319,921 W-Lawther-4311-2048.jpg
01/20/2011  02:30 PM           227,850 W-Lawther-4311-2081.jpg
01/24/2011  03:55 PM           168,058 W-Lawther-4311-2144.jpg
              28 File(s)      5,961,650 bytes
               3 Dir(s)  66,118,414,336 bytes free
&nbsp;
C:\Users\Chris\Pictures\4311 W Lawther 550&gt;ren ?-???????-????-????.jpg ?_???????
_????_????.jpg
&nbsp;
C:\Users\Chris\Pictures\4311 W Lawther 550&gt;dir
 Volume in drive C has no label.
 Volume Serial Number is BC3E-4FC9
&nbsp;
 Directory of C:\Users\Chris\Pictures\4311 W Lawther 550
&nbsp;
02/01/2011  10:35 AM    &lt;DIR&gt;          .
02/01/2011  10:35 AM    &lt;DIR&gt;          ..
02/01/2011  10:34 AM    &lt;DIR&gt;          JPEG
01/20/2011  02:29 PM           190,939 W_Lawther_4311_1003.jpg
01/20/2011  02:29 PM           229,187 W_Lawther_4311_1011.jpg
01/20/2011  02:29 PM           362,945 W_Lawther_4311_1019.jpg
01/20/2011  02:29 PM           315,891 W_Lawther_4311_1025.jpg
01/20/2011  02:29 PM           324,793 W_Lawther_4311_1037.jpg
01/20/2011  02:29 PM           298,915 W_Lawther_4311_1054.jpg
01/20/2011  02:29 PM           311,920 W_Lawther_4311_1062.jpg
01/20/2011  02:29 PM           218,105 W_Lawther_4311_1069.jpg
01/20/2011  02:30 PM           284,679 W_Lawther_4311_1092.jpg
01/24/2011  03:50 PM           179,684 W_Lawther_4311_1097.jpg
01/24/2011  03:55 PM           215,851 W_Lawther_4311_1132.jpg
01/24/2011  03:53 PM           119,409 W_Lawther_4311_1183.jpg
01/24/2011  03:53 PM           121,753 W_Lawther_4311_1192.jpg
01/24/2011  03:53 PM           130,715 W_Lawther_4311_1201.jpg
01/24/2011  03:50 PM           191,201 W_Lawther_4311_1216.jpg
01/24/2011  03:50 PM           188,831 W_Lawther_4311_1225.jpg
01/24/2011  03:53 PM           163,884 W_Lawther_4311_1242.jpg
01/24/2011  03:51 PM           215,726 W_Lawther_4311_1251.jpg
01/24/2011  03:53 PM           174,017 W_Lawther_4311_1263.jpg
01/24/2011  03:54 PM           170,680 W_Lawther_4311_1273.jpg
01/24/2011  03:54 PM           150,399 W_Lawther_4311_1283.jpg
01/24/2011  03:51 PM           189,790 W_Lawther_4311_1289.jpg
01/24/2011  03:51 PM           169,936 W_Lawther_4311_1307.jpg
01/24/2011  03:51 PM           171,228 W_Lawther_4311_1321.jpg
01/24/2011  03:54 PM           155,343 W_Lawther_4311_1333.jpg
01/20/2011  02:29 PM           319,921 W_Lawther_4311_2048.jpg
01/20/2011  02:30 PM           227,850 W_Lawther_4311_2081.jpg
01/24/2011  03:55 PM           168,058 W_Lawther_4311_2144.jpg
              28 File(s)      5,961,650 bytes
               3 Dir(s)  66,118,410,240 bytes free
&nbsp;
C:\Users\Chris\Pictures\4311 W Lawther 550&gt;cd JPEG
&nbsp;
C:\Users\Chris\Pictures\4311 W Lawther 550\JPEG&gt;dir
 Volume in drive C has no label.
 Volume Serial Number is BC3E-4FC9
&nbsp;
 Directory of C:\Users\Chris\Pictures\4311 W Lawther 550\JPEG
&nbsp;
02/01/2011  10:34 AM    &lt;DIR&gt;          .
02/01/2011  10:34 AM    &lt;DIR&gt;          ..
02/01/2011  10:11 AM            38,673 W-Lawther-4311-1003.jpg
02/01/2011  10:11 AM            39,929 W-Lawther-4311-1011.jpg
02/01/2011  10:11 AM            41,485 W-Lawther-4311-1019.jpg
02/01/2011  10:11 AM            39,100 W-Lawther-4311-1025.jpg
02/01/2011  10:11 AM            39,778 W-Lawther-4311-1037.jpg
02/01/2011  10:11 AM            38,511 W-Lawther-4311-1054.jpg
02/01/2011  10:11 AM            38,979 W-Lawther-4311-1062.jpg
02/01/2011  10:11 AM            36,873 W-Lawther-4311-1069.jpg
02/01/2011  10:11 AM            39,101 W-Lawther-4311-1092.jpg
02/01/2011  10:11 AM            36,034 W-Lawther-4311-1097.jpg
02/01/2011  10:11 AM            39,793 W-Lawther-4311-1132.jpg
02/01/2011  10:11 AM            34,166 W-Lawther-4311-1183.jpg
02/01/2011  10:11 AM            34,872 W-Lawther-4311-1192.jpg
02/01/2011  10:11 AM            33,423 W-Lawther-4311-1201.jpg
02/01/2011  10:11 AM            38,824 W-Lawther-4311-1216.jpg
02/01/2011  10:11 AM            38,824 W-Lawther-4311-1225.jpg
02/01/2011  10:11 AM            36,862 W-Lawther-4311-1242.jpg
02/01/2011  10:11 AM            39,910 W-Lawther-4311-1251.jpg
02/01/2011  10:11 AM            36,474 W-Lawther-4311-1263.jpg
02/01/2011  10:11 AM            35,538 W-Lawther-4311-1273.jpg
02/01/2011  10:11 AM            36,691 W-Lawther-4311-1283.jpg
02/01/2011  10:11 AM            42,598 W-Lawther-4311-1289.jpg
02/01/2011  10:11 AM            35,948 W-Lawther-4311-1307.jpg
02/01/2011  10:11 AM            36,512 W-Lawther-4311-1321.jpg
02/01/2011  10:11 AM            36,163 W-Lawther-4311-1333.jpg
02/01/2011  10:11 AM            39,918 W-Lawther-4311-2048.jpg
02/01/2011  10:11 AM            36,907 W-Lawther-4311-2081.jpg
02/01/2011  10:11 AM            37,046 W-Lawther-4311-2144.jpg
              28 File(s)      1,058,932 bytes
               2 Dir(s)  66,118,410,240 bytes free
&nbsp;
C:\Users\Chris\Pictures\4311 W Lawther 550\JPEG&gt;ren ?-???????-????-????.jpg ?_??
?????_????_????.jpg
&nbsp;
C:\Users\Chris\Pictures\4311 W Lawther 550\JPEG&gt;dir
 Volume in drive C has no label.
 Volume Serial Number is BC3E-4FC9
&nbsp;
 Directory of C:\Users\Chris\Pictures\4311 W Lawther 550\JPEG
&nbsp;
02/01/2011  10:36 AM    &lt;DIR&gt;          .
02/01/2011  10:36 AM    &lt;DIR&gt;          ..
02/01/2011  10:11 AM            38,673 W_Lawther_4311_1003.jpg
02/01/2011  10:11 AM            39,929 W_Lawther_4311_1011.jpg
02/01/2011  10:11 AM            41,485 W_Lawther_4311_1019.jpg
02/01/2011  10:11 AM            39,100 W_Lawther_4311_1025.jpg
02/01/2011  10:11 AM            39,778 W_Lawther_4311_1037.jpg
02/01/2011  10:11 AM            38,511 W_Lawther_4311_1054.jpg
02/01/2011  10:11 AM            38,979 W_Lawther_4311_1062.jpg
02/01/2011  10:11 AM            36,873 W_Lawther_4311_1069.jpg
02/01/2011  10:11 AM            39,101 W_Lawther_4311_1092.jpg
02/01/2011  10:11 AM            36,034 W_Lawther_4311_1097.jpg
02/01/2011  10:11 AM            39,793 W_Lawther_4311_1132.jpg
02/01/2011  10:11 AM            34,166 W_Lawther_4311_1183.jpg
02/01/2011  10:11 AM            34,872 W_Lawther_4311_1192.jpg
02/01/2011  10:11 AM            33,423 W_Lawther_4311_1201.jpg
02/01/2011  10:11 AM            38,824 W_Lawther_4311_1216.jpg
02/01/2011  10:11 AM            38,824 W_Lawther_4311_1225.jpg
02/01/2011  10:11 AM            36,862 W_Lawther_4311_1242.jpg
02/01/2011  10:11 AM            39,910 W_Lawther_4311_1251.jpg
02/01/2011  10:11 AM            36,474 W_Lawther_4311_1263.jpg
02/01/2011  10:11 AM            35,538 W_Lawther_4311_1273.jpg
02/01/2011  10:11 AM            36,691 W_Lawther_4311_1283.jpg
02/01/2011  10:11 AM            42,598 W_Lawther_4311_1289.jpg
02/01/2011  10:11 AM            35,948 W_Lawther_4311_1307.jpg
02/01/2011  10:11 AM            36,512 W_Lawther_4311_1321.jpg
02/01/2011  10:11 AM            36,163 W_Lawther_4311_1333.jpg
02/01/2011  10:11 AM            39,918 W_Lawther_4311_2048.jpg
02/01/2011  10:11 AM            36,907 W_Lawther_4311_2081.jpg
02/01/2011  10:11 AM            37,046 W_Lawther_4311_2144.jpg
              28 File(s)      1,058,932 bytes
               2 Dir(s)  66,118,402,048 bytes free
&nbsp;
C:\Users\Chris\Pictures\4311 W Lawther 550\JPEG&gt;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://webplantmedia.com/windows/2011/02/rename-files-in-windows-7-using-the-command-prompt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Executable Prolog CLP Program for the Following Job Shop Scheduling Problem</title>
		<link>http://webplantmedia.com/prolog/2010/12/executable-prolog-clp-program-for-the-following-job-shop-scheduling-problem/</link>
		<comments>http://webplantmedia.com/prolog/2010/12/executable-prolog-clp-program-for-the-following-job-shop-scheduling-problem/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 07:01:16 +0000</pubDate>
		<dc:creator>ChrisB</dc:creator>
				<category><![CDATA[Prolog]]></category>

		<guid isPermaLink="false">http://www.webplantmedia.com/?p=530</guid>
		<description><![CDATA[The job shop scheduling problem has a wide range of applications in industry. The problem we will explore is a simple job shop scheduling for a print shop. The print shop has 6 machines: [printer, stapler, sorter, binder, packager, copier], and schedules a number of jobs over a two day (48 hour) period. Each job [...]]]></description>
			<content:encoded><![CDATA[<p>The job shop scheduling problem has a wide range of applications in industry. The problem we will explore is a simple job shop scheduling for a print shop. The print shop has 6 machines: [printer, stapler, sorter, binder, packager, copier], and schedules a number of jobs over a two day (48 hour) period. Each job is a sequence of tasks which have a name, duration (in hours) and machine that they must be performed on. A schedule assigns a start time for each task, so that no task starts before the previous task in the job has finished, and no machine is busy with two tasks at the same time. The main user defined predicate defined to solve the scheduling problem is data(TaskList, Jobs, Machines, Vars) where</p>
<ul class="blog-list">
<li>TaskList is a list of tasks. Each task is represented as a term task(Name, Duration, Machine, StartTime) where Name, Duration, StartTime are the name, start time, and duration of the task, Machine is the machine the task needs.</li>
<li>Jobs is a list of jobs which in turn by definition is a list of tasks. Each job in this list consists of the tasks that make up this job in the order that they should be completed,</li>
<li>Machines is the list of all machines in the shop, and</li>
<li>Vars is the list of all start time variables (of the tasks).</li>
</ul>
<p>As an example, data/4 below describes a pair of small advertising print jobs.</p>

<div class="wp_syntax"><div class="code"><pre class="prolog" style="font-family:monospace;">data<span style="color: #009900;">&#40;</span>
   <span style="color: #666666; font-style: italic;">%%% First argument is a list of tasks with name, duration</span>
   <span style="color: #666666; font-style: italic;">%%% and machine and start time (unconstrained)</span>
   <span style="color: #009900;">&#91;</span>
     task<span style="color: #009900;">&#40;</span>ad1_copy<span style="color: #339933;">,</span> <span style="color: #800080;">4</span><span style="color: #339933;">,</span> copier<span style="color: #339933;">,</span> AC1<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
     task<span style="color: #009900;">&#40;</span>ad1_sort<span style="color: #339933;">,</span> <span style="color: #800080;">4</span><span style="color: #339933;">,</span> sorter<span style="color: #339933;">,</span> AS1<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
     task<span style="color: #009900;">&#40;</span>ad1_pack<span style="color: #339933;">,</span> <span style="color: #800080;">3</span><span style="color: #339933;">,</span> packager<span style="color: #339933;">,</span> AD1<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
     task<span style="color: #009900;">&#40;</span>ad2_copy<span style="color: #339933;">,</span> <span style="color: #800080;">5</span><span style="color: #339933;">,</span> copier<span style="color: #339933;">,</span> AC2<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
     task<span style="color: #009900;">&#40;</span>ad2_sort<span style="color: #339933;">,</span> <span style="color: #800080;">4</span><span style="color: #339933;">,</span> sorter<span style="color: #339933;">,</span> AS2<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
     task<span style="color: #009900;">&#40;</span>ad2_pack<span style="color: #339933;">,</span> <span style="color: #800080;">4</span><span style="color: #339933;">,</span> packager<span style="color: #339933;">,</span> AD2<span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
   <span style="color: #666666; font-style: italic;">%%% second argument is a list of lists of task names to be</span>
   <span style="color: #666666; font-style: italic;">%%% performed in order</span>
   <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>ad1_copy<span style="color: #339933;">,</span>ad1_sort<span style="color: #339933;">,</span>ad1_pack<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#91;</span>ad2_copy<span style="color: #339933;">,</span>ad2_sort<span style="color: #339933;">,</span>ad2_pack<span style="color: #009900;">&#93;</span>
   <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
   <span style="color: #666666; font-style: italic;">%%% third argument is the list of different machines</span>
   <span style="color: #009900;">&#91;</span>copier<span style="color: #339933;">,</span>sorter<span style="color: #339933;">,</span>packager<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
   <span style="color: #666666; font-style: italic;">%%% fourth argument is the list of all start time variables</span>
   <span style="color: #009900;">&#91;</span>AC1<span style="color: #339933;">,</span>AS1<span style="color: #339933;">,</span>AD1<span style="color: #339933;">,</span>AC2<span style="color: #339933;">,</span>AS2<span style="color: #339933;">,</span>AD2<span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span></pre></div></div>

<p>The file ’job.pl’ above, containing the data/4, should be saved under the same directory as your program. When your program is tested, it should be able to handle more jobs and each job may have more tasks. This program uses the template schedule-template.pl, below.</p>

<div class="wp_syntax"><div class="code"><pre class="prolog" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">%% This is a program stub for the job shop scheduling problem</span>
<span style="color: #666666; font-style: italic;">%% given in the project.</span>
&nbsp;
<span style="color: #666666; font-style: italic;">% Load in finite domain module</span>
<span style="color: #339933;">:-</span> use_module<span style="color: #009900;">&#40;</span>library<span style="color: #009900;">&#40;</span>clpfd<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
<span style="color: #666666; font-style: italic;">% Other modules you may use are loaded here</span>
&nbsp;
<span style="color: #666666; font-style: italic;">% You must use the following to load in the data</span>
<span style="color: #339933;">:-</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'job.pl'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span>
&nbsp;
<span style="color: #666666; font-style: italic;">% Your definition of the userdefined constraint jobshop(L) should be here.</span>
&nbsp;
member<span style="color: #009900;">&#40;</span>X<span style="color: #339933;">,</span><span style="color: #009900;">&#91;</span>X<span style="color: #339933;">|</span>_<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
member<span style="color: #009900;">&#40;</span>X<span style="color: #339933;">,</span><span style="color: #009900;">&#91;</span>_<span style="color: #339933;">|</span>T<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:-</span>
	member<span style="color: #009900;">&#40;</span>X<span style="color: #339933;">,</span>T<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
&nbsp;
jobshop<span style="color: #009900;">&#40;</span>L<span style="color: #009900;">&#41;</span> <span style="color: #339933;">:-</span>
	data<span style="color: #009900;">&#40;</span>W<span style="color: #339933;">,</span>X<span style="color: #339933;">,</span>_<span style="color: #339933;">,</span>Z<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	init<span style="color: #009900;">&#40;</span>W<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	precLL<span style="color: #009900;">&#40;</span>X<span style="color: #339933;">,</span>W<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	capacity<span style="color: #009900;">&#40;</span>W<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	labeling<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>Z<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	L <span style="color: #339933;">=</span> Z<span style="color: #339933;">.</span>
&nbsp;
init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
init<span style="color: #009900;">&#40;</span>TASKLIST<span style="color: #009900;">&#41;</span><span style="color: #339933;">:-</span>
	TASKLIST<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>task<span style="color: #009900;">&#40;</span>_<span style="color: #339933;">,</span>D<span style="color: #339933;">,</span>_<span style="color: #339933;">,</span>ST<span style="color: #009900;">&#41;</span><span style="color: #339933;">|</span>T<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
	ST in <span style="color: #800080;">0</span><span style="color: #339933;">..</span><span style="color: #800080;">48</span><span style="color: #339933;">,</span>
	ST<span style="color: #339933;">+</span>D #<span style="color: #339933;">=&lt;</span> <span style="color: #800080;">48</span><span style="color: #339933;">,</span>
	init<span style="color: #009900;">&#40;</span>T<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
&nbsp;
precLL<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> _<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
precLL<span style="color: #009900;">&#40;</span>JOBS<span style="color: #339933;">,</span>TASKLIST<span style="color: #009900;">&#41;</span> <span style="color: #339933;">:-</span>
	JOBS <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>H<span style="color: #339933;">|</span>T<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
	precL<span style="color: #009900;">&#40;</span>H<span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #800080;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> TASKLIST<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	precLL<span style="color: #009900;">&#40;</span>T<span style="color: #339933;">,</span>TASKLIST<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
&nbsp;
precL<span style="color: #009900;">&#40;</span>_<span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> _<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
precL<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> _<span style="color: #339933;">,</span> _<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
precL<span style="color: #009900;">&#40;</span>JOBS<span style="color: #339933;">,</span> _<span style="color: #339933;">,</span> TASKLIST<span style="color: #009900;">&#41;</span> <span style="color: #339933;">:-</span>
	JOBS<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>H<span style="color: #339933;">|</span>T<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> T<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>HH<span style="color: #339933;">|</span>TT<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
	member<span style="color: #009900;">&#40;</span>task<span style="color: #009900;">&#40;</span>H<span style="color: #339933;">,</span>D1<span style="color: #339933;">,</span>_<span style="color: #339933;">,</span>T1<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> TASKLIST<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	member<span style="color: #009900;">&#40;</span>task<span style="color: #009900;">&#40;</span>HH<span style="color: #339933;">,</span>_<span style="color: #339933;">,</span>_<span style="color: #339933;">,</span>T2<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> TASKLIST<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	T1 <span style="color: #339933;">+</span> D1 #<span style="color: #339933;">&lt;</span> T2<span style="color: #339933;">,</span>
	<span style="color: #666666; font-style: italic;">%write(H), write('-'), write(HH),write('\n'),</span>
	precL<span style="color: #009900;">&#40;</span>T<span style="color: #339933;">,</span> TT<span style="color: #339933;">,</span>TASKLIST<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
&nbsp;
exlude<span style="color: #009900;">&#40;</span>T1<span style="color: #339933;">,</span> D1<span style="color: #339933;">,</span> T2<span style="color: #339933;">,</span> _<span style="color: #009900;">&#41;</span> <span style="color: #339933;">:-</span>
	T1 <span style="color: #339933;">+</span> D1 #<span style="color: #339933;">&lt;</span> T2<span style="color: #339933;">.</span>
exlude<span style="color: #009900;">&#40;</span>T1<span style="color: #339933;">,</span> _<span style="color: #339933;">,</span> T2<span style="color: #339933;">,</span> D2<span style="color: #009900;">&#41;</span> <span style="color: #339933;">:-</span>
	T2 <span style="color: #339933;">+</span> D2 #<span style="color: #339933;">&lt;</span> T1<span style="color: #339933;">.</span>
&nbsp;
capacity<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
capacity<span style="color: #009900;">&#40;</span>TASKLIST<span style="color: #009900;">&#41;</span> <span style="color: #339933;">:-</span>
	TASKLIST <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>task<span style="color: #009900;">&#40;</span>J<span style="color: #339933;">,</span>D<span style="color: #339933;">,</span>M<span style="color: #339933;">,</span>_<span style="color: #009900;">&#41;</span><span style="color: #339933;">|</span>T<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
	<span style="color: #666666; font-style: italic;">%write(J), write('-'), write(D), write('-'), write(M), write('-'), write(ST), write('\n'),</span>
	nonoverlaps<span style="color: #009900;">&#40;</span>J<span style="color: #339933;">,</span>D<span style="color: #339933;">,</span>M<span style="color: #339933;">,</span>T<span style="color: #339933;">,</span>TASKLIST<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	capacity<span style="color: #009900;">&#40;</span>T<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
&nbsp;
nonoverlaps<span style="color: #009900;">&#40;</span>_<span style="color: #339933;">,</span>_<span style="color: #339933;">,</span>_<span style="color: #339933;">,</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>_<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
nonoverlaps<span style="color: #009900;">&#40;</span>J<span style="color: #339933;">,</span>D<span style="color: #339933;">,</span>M<span style="color: #339933;">,</span>L<span style="color: #339933;">,</span>TASKLIST<span style="color: #009900;">&#41;</span> <span style="color: #339933;">:-</span>
	L <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>task<span style="color: #009900;">&#40;</span>_<span style="color: #339933;">,</span> _<span style="color: #339933;">,</span> M2<span style="color: #339933;">,</span> _<span style="color: #009900;">&#41;</span> <span style="color: #339933;">|</span> T<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
	M \<span style="color: #339933;">=</span> M2<span style="color: #339933;">,</span>
	nonoverlaps<span style="color: #009900;">&#40;</span>J<span style="color: #339933;">,</span>D<span style="color: #339933;">,</span>M<span style="color: #339933;">,</span>T<span style="color: #339933;">,</span>TASKLIST<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
nonoverlaps<span style="color: #009900;">&#40;</span>J<span style="color: #339933;">,</span>D<span style="color: #339933;">,</span>M<span style="color: #339933;">,</span>L<span style="color: #339933;">,</span>TASKLIST<span style="color: #009900;">&#41;</span> <span style="color: #339933;">:-</span>
	L<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span>task<span style="color: #009900;">&#40;</span>_<span style="color: #339933;">,</span>D2<span style="color: #339933;">,</span>M2<span style="color: #339933;">,</span>T2<span style="color: #009900;">&#41;</span><span style="color: #339933;">|</span>T<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
	M <span style="color: #339933;">=</span> M2<span style="color: #339933;">,</span>
	member<span style="color: #009900;">&#40;</span>task<span style="color: #009900;">&#40;</span>J<span style="color: #339933;">,</span>D<span style="color: #339933;">,</span>M<span style="color: #339933;">,</span>T1<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>TASKLIST<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	exlude<span style="color: #009900;">&#40;</span>T1<span style="color: #339933;">,</span>D<span style="color: #339933;">,</span>T2<span style="color: #339933;">,</span>D2<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	nonoverlaps<span style="color: #009900;">&#40;</span>J<span style="color: #339933;">,</span>D<span style="color: #339933;">,</span>M<span style="color: #339933;">,</span>T<span style="color: #339933;">,</span>TASKLIST<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
&nbsp;
<span style="color: #666666; font-style: italic;">% Your rules should not go below this line</span>
&nbsp;
<span style="color: #666666; font-style: italic;">% Don't delete or comment away the following</span>
&nbsp;
<span style="color: #666666; font-style: italic;">%% Output the solution</span>
myoutput <span style="color: #339933;">:-</span> jobshop<span style="color: #009900;">&#40;</span>L<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
 	    <span style="color: #990000;">write</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'The starting time of the tasks are: \n'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
            myprint<span style="color: #009900;">&#40;</span>L<span style="color: #339933;">,</span> <span style="color: #800080;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
&nbsp;
<span style="color: #666666; font-style: italic;">%% this is to output the sarting time</span>
myprint<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> _<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
myprint<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>X<span style="color: #339933;">|</span>L<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> I<span style="color: #009900;">&#41;</span> <span style="color: #339933;">:-</span> <span style="color: #990000;">write</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'task '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">write</span><span style="color: #009900;">&#40;</span>I<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">write</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' starts at '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                   <span style="color: #990000;">write</span><span style="color: #009900;">&#40;</span>X<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">write</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'\n'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> Y #<span style="color: #339933;">=</span> I<span style="color: #339933;">+</span><span style="color: #800080;">1</span><span style="color: #339933;">,</span> myprint<span style="color: #009900;">&#40;</span>L<span style="color: #339933;">,</span> Y<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
&nbsp;
<span style="color: #666666; font-style: italic;">%% initiat the output.</span>
<span style="color: #339933;">:-</span> myoutput<span style="color: #339933;">.</span></pre></div></div>

<p>Sample query and output under Sicstus Prolog</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">banana$ sicstus
SICStus 3.11.2 (sparc-solaris-5.7): Wed Jun  2 11:43:16 MET DST 2004
Licensed to ttu.edu
| ?- ['schedule-template.pl'].
% consulting /home/undergrad3/ebaldelo/schedule-template.pl...
%  loading /usr/local/lib/sicstus-3.11.2/library/clpfd.po...
%  module clpfd imported into user
%   loading /usr/local/lib/sicstus-3.11.2/library/atts.po...
%   module attributes imported into clpfd
%    loading /usr/local/lib/sicstus-3.11.2/library/lists.po...
%    module lists imported into attributes
%    loaded /usr/local/lib/sicstus-3.11.2/library/lists.po in module lists, 10 msec 18528 bytes
%   loaded /usr/local/lib/sicstus-3.11.2/library/atts.po in module attributes, 10 msec 46400 bytes
%   loading /usr/local/lib/sicstus-3.11.2/library/assoc.po...
%   module assoc imported into clpfd
%    module lists imported into assoc
%   loaded /usr/local/lib/sicstus-3.11.2/library/assoc.po in module assoc, 20 msec 17988 bytes
%   module lists imported into clpfd
%   loading /usr/local/lib/sicstus-3.11.2/library/ordsets.po...
%   module ordsets imported into clpfd
%   loaded /usr/local/lib/sicstus-3.11.2/library/ordsets.po in module ordsets, 0 msec 21496 bytes
%   loading /usr/local/lib/sicstus-3.11.2/library/ugraphs.po...
%   module ugraphs imported into clpfd
%    module ordsets imported into ugraphs
%    module lists imported into ugraphs
%    module assoc imported into ugraphs
%    loading /usr/local/lib/sicstus-3.11.2/library/random.po...
%    module random imported into ugraphs
%     module assoc imported into random
%     loading foreign resource /usr/local/lib/sicstus-3.11.2/library/sparc-solaris-5.7/random.so in module random
%    loaded /usr/local/lib/sicstus-3.11.2/library/random.po in module random, 20 msec 7776 bytes
%   loaded /usr/local/lib/sicstus-3.11.2/library/ugraphs.po in module ugraphs, 70 msec 84872 bytes
%   loading foreign resource /usr/local/lib/sicstus-3.11.2/library/sparc-solaris-5.7/clpfd.so in module clpfd
%  loaded /usr/local/lib/sicstus-3.11.2/library/clpfd.po in module clpfd, 170 msec 829440 bytes
%  consulting /home/undergrad3/ebaldelo/job.pl...
%  consulted /home/undergrad3/ebaldelo/job.pl in module user, 0 msec 912 bytes
The starting time of the tasks are:
task 1 starts at 0
task 2 starts at 5
task 3 starts at 10
task 4 starts at 5
task 5 starts at 11
task 6 starts at 16
% consulted /home/undergrad3/ebaldelo/schedule-template.pl in module user, 200 msec 836040 bytes
yes
| ?-</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://webplantmedia.com/prolog/2010/12/executable-prolog-clp-program-for-the-following-job-shop-scheduling-problem/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adding Color, Drawing a Tetrahedron, Cube with WebGL</title>
		<link>http://webplantmedia.com/webgl/2010/09/adding-color-drawing-a-tetrahedron-cube-with-webgl/</link>
		<comments>http://webplantmedia.com/webgl/2010/09/adding-color-drawing-a-tetrahedron-cube-with-webgl/#comments</comments>
		<pubDate>Fri, 24 Sep 2010 19:22:15 +0000</pubDate>
		<dc:creator>ChrisB</dc:creator>
				<category><![CDATA[WebGL]]></category>

		<guid isPermaLink="false">http://www.webplantmedia.com/?p=510</guid>
		<description><![CDATA[Our second assignment asked us to use color when drawing a tetrahedron and cube using WebGL. Here is a screen shot of my work. If you have a WebGl capable browser, then follow the link and you can test it yourself. Make sure you view source on the page. Here are the three files you [...]]]></description>
			<content:encoded><![CDATA[<p>Our second assignment asked us to use color when drawing a tetrahedron and cube using WebGL. Here is a screen shot of my work.</p>
<p><object width="450" height="360"><param name="movie" value="http://www.youtube.com/v/q0VRMnpNkww?fs=1&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/q0VRMnpNkww?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="450" height="360"></embed></object></p>
<p>If you have a WebGl capable browser, then follow the <a href="http://dev.chrisbaldelomar.com/ttu/lesson2.html" target="_blank">link</a> and you can test it yourself. Make sure you view source on the page.</p>
<p>Here are the three files you need to run this lesson.<br />
<a href="http://dev.chrisbaldelomar.com/ttu/lesson2.html">lesson2.html</a><br />
<a href="http://dev.chrisbaldelomar.com/ttu/sylvester.js">sylvester.js</a><br />
<a href="http://dev.chrisbaldelomar.com/ttu/glUtils.js">glUtils.js</a></p>
<div class="navigation">
<div class="alignleft"><a href="http://www.webplantmedia.com/webgl/2010/09/drawing-simple-shapes-triangle-square-in-webgl/">« Lesson 1</a></div>
<div class="alignright"><a href="">Lesson 3 »</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://webplantmedia.com/webgl/2010/09/adding-color-drawing-a-tetrahedron-cube-with-webgl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to get the Symbol Browser Plugin to work in Gedit</title>
		<link>http://webplantmedia.com/ubuntu/2010/09/how-to-get-the-symbol-browser-plugin-to-work-in-gedit/</link>
		<comments>http://webplantmedia.com/ubuntu/2010/09/how-to-get-the-symbol-browser-plugin-to-work-in-gedit/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 05:14:16 +0000</pubDate>
		<dc:creator>ChrisB</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.webplantmedia.com/?p=500</guid>
		<description><![CDATA[Ok, so twice I had to research and figure out how I got the symbol browser working in gedit. I started out trying to install the Class Browser. But the ubuntu community suggested that this plugin was no good and to instead use the symbol browser. If you quickly rush and start downloading the symbol [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so twice I had to research and figure out how I got the symbol browser working in gedit. I started out trying to install the Class Browser. But the ubuntu community suggested that this plugin was no good and to instead use the symbol browser. If you quickly rush and start downloading the symbol browser plugin, you will find that you just downloaded a whole bunch files that need to be compiled. Lucky for us though, you can instead download the binary files for the symbol browser. Go to <a href="http://sourceforge.net/projects/symbol-browser/files/">SourceForge</a> and instead of clicking on &#8220;Download Files&#8221;, look below under &#8220;Browse Files for Gedit Symbol Browser Plugin&#8221; and you should see</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">gedit-symbol-browser-plugin-bin-ubuntu-i386-0.1.tar.gz</pre></div></div>

<p>If you are using 64 bit, make sure download the 64 bit binary version.</p>
<p>Extract your files and move it over to ~/.gnome2/gedit. You should have the following files&#8230;<br />
~/.gnome2/gedit/symbols<br />
~/.gnome2/gedit/plugins/libsymbolbrowser.so<br />
~/.gnome2/gedit/plugins/symbolbrowser.gedit-plugin</p>
<p>A lot of us will now try and open Gedit and enable the plugin. As you try, it will automatically get grayed out. This is because you need the following package.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">libgnomeprintui</pre></div></div>

<p>Once you restart Gedit and enable the plugin, you might realize that it&#8217;s still not displaying any class, functions, or variables after you open a file. This is because you need to install exuberant-ctags. After you do this, you should be ready to go.</p>
<p>Let me know if you have any problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://webplantmedia.com/ubuntu/2010/09/how-to-get-the-symbol-browser-plugin-to-work-in-gedit/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Drawing Simple Shapes &#8211; Triangle, Square in WebGL</title>
		<link>http://webplantmedia.com/webgl/2010/09/drawing-simple-shapes-triangle-square-in-webgl/</link>
		<comments>http://webplantmedia.com/webgl/2010/09/drawing-simple-shapes-triangle-square-in-webgl/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 23:02:05 +0000</pubDate>
		<dc:creator>ChrisB</dc:creator>
				<category><![CDATA[WebGL]]></category>

		<guid isPermaLink="false">http://www.webplantmedia.com/?p=478</guid>
		<description><![CDATA[Our first assignment asked us to draw simple shapes using WebGL. For this particular project I drew a simple square and triangle. Here is a screen shot of my work. If you have a WebGl capable browser, then follow the link and you can test it yourself. Make sure you view source on the page. [...]]]></description>
			<content:encoded><![CDATA[<p>Our first assignment asked us to draw simple shapes using WebGL. For this particular project I drew a simple square and triangle. Here is a screen shot of my work.</p>
<p><img src="http://www.webplantmedia.com/wp-content/uploads/2010/09/triangle-square-webgl-400x398.jpg" alt="" title="triangle-square-webgl" width="450" height="448" class="alignnone size-medium wp-image-479" /></p>
<p>If you have a WebGl capable browser, then follow the <a href="http://dev.chrisbaldelomar.com/ttu/lesson1.html" target="_blank">link</a> and you can test it yourself. Make sure you view source on the page. I heavily commented the code.</p>
<p>Here are the three files you need to run this lesson.<br />
<a href="http://dev.chrisbaldelomar.com/ttu/lesson1.html">lesson1.html</a><br />
<a href="http://dev.chrisbaldelomar.com/ttu/sylvester.js">sylvester.js</a><br />
<a href="http://dev.chrisbaldelomar.com/ttu/glUtils.js">glUtils.js</a></p>
<div class="navigation">
<div class="alignleft"><a href="http://www.webplantmedia.com/webgl/2010/09/introduction-to-webgl/">« Introduction to WebGL</a></div>
<div class="alignright"><a href="http://www.webplantmedia.com/webgl/2010/09/adding-color-drawing-a-tetrahedron-cube-with-webgl/">Lesson 2 »</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://webplantmedia.com/webgl/2010/09/drawing-simple-shapes-triangle-square-in-webgl/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Introduction to WebGL</title>
		<link>http://webplantmedia.com/webgl/2010/09/introduction-to-webgl/</link>
		<comments>http://webplantmedia.com/webgl/2010/09/introduction-to-webgl/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 17:36:08 +0000</pubDate>
		<dc:creator>ChrisB</dc:creator>
				<category><![CDATA[WebGL]]></category>

		<guid isPermaLink="false">http://www.webplantmedia.com/?p=452</guid>
		<description><![CDATA[I&#8217;m currently taking a computer graphics class and I&#8217;ll be spending this semester delving into WebGL. So, I&#8217;ll be giving some tutorials as I get new projects to work on. Setting Up Your Browser To Support WebGL First do a Google search for &#8220;google chrome developer build&#8221;, and it should be the first result. Here [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently taking a computer graphics class and I&#8217;ll be spending this semester delving into WebGL. So, I&#8217;ll be giving some tutorials as I get new projects to work on.</p>
<p><strong>Setting Up Your Browser To Support WebGL</strong></p>
<p>First do a Google search for &#8220;google chrome developer build&#8221;, and it should be the first result. Here is the link it took me to. </p>
<p><a href="http://www.google.com/chrome/intl/en/eula_dev.html">http://www.google.com/chrome/intl/en/eula_dev.html</a></p>
<p>Once you have chrome&#8217;s developer build, click on [Start->All Programs->Google Chrome] and then right-click on &#8216;Google Chrome&#8217;. Select &#8216;properties&#8217; and append this to the end of the [Target] string.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">--enable-webgl</pre></div></div>

<p>Here is how my target string looked like.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">C:\Users\Chris\AppData\Local\Google\Chrome\Application\chrome.exe --enable-webgl</pre></div></div>

<p>Now open up Chrome by going through [Start->All Programs->Google Chrome] and you should be ready to view WebGL webpages. Click <a href="http://dev.chrisbaldelomar.com/ttu/webgl.html">here</a> to test for your self.</p>
<p><strong>Getting Started With WebGL</strong></p>
<p>Here are the three files you need to set up your frist WebGL script.<br />
<a href="http://dev.chrisbaldelomar.com/ttu/webgl.html">webgl.html</a><br />
<a href="http://dev.chrisbaldelomar.com/ttu/sylvester.js">sylvester.js</a><br />
<a href="http://dev.chrisbaldelomar.com/ttu/glUtils.js">glUtils.js</a></p>
<div class="navigation">
<div class="alignright"><a href="http://www.webplantmedia.com/webgl/2010/09/drawing-simple-shapes-triangle-square-in-webgl/">Lesson 1 »</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://webplantmedia.com/webgl/2010/09/introduction-to-webgl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cache Problem in CakePHP</title>
		<link>http://webplantmedia.com/cakephp/2010/09/cache-problem-in-cakephp/</link>
		<comments>http://webplantmedia.com/cakephp/2010/09/cache-problem-in-cakephp/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 15:56:13 +0000</pubDate>
		<dc:creator>ChrisB</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://www.webplantmedia.com/?p=440</guid>
		<description><![CDATA[I recently had a problem on our website with caching in our CakePHP framework. We initially had caching turned on. And then we started noticing when we submitted a form, our changes wound not be updated until we manually refreshed the page. So let&#8217;s say I have a row of users. I choose to delete [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had a problem on our website with caching in our CakePHP framework. We initially had caching turned on. And then we started noticing when we submitted a form, our changes wound not be updated until we manually refreshed the page.</p>
<p>So let&#8217;s say I have a row of users. I choose to delete one of the users. I click on delete, hit submit and cake removes that user from my table. Cake then redirects me back to same page, but the deleted user is still listed on our page. Once we manually hit the refresh button on our browser, then our deleted user disappears from our form page.</p>
<p>We scratched our heads and tried figuring out why this was happening. We turned off all caching and even added the &lt;cake:nocache&gt; tag. No matter what we did, we could not get rid of the problem.</p>
<p>After much research, we realized that the browser itself was actually caching the previous form page. So we added this snippet of code to our app controller.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">disableCache</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This is used to tell the user’s browser not to cache the results of the current request. The headers sent to this effect are:</p>

<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">Expires: Mon, 26 Jul 1997 05:00:00 GMT
Last-Modified: [current datetime] GMT
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0
Pragma: no-cache</pre></div></div>

<p>I hope this saves you some time. If you find a better way fixing this problem, please leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://webplantmedia.com/cakephp/2010/09/cache-problem-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Constraint Programming Tutorial</title>
		<link>http://webplantmedia.com/prolog/2010/04/simple-constraint-programming-tutorial/</link>
		<comments>http://webplantmedia.com/prolog/2010/04/simple-constraint-programming-tutorial/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 04:03:40 +0000</pubDate>
		<dc:creator>ChrisB</dc:creator>
				<category><![CDATA[Prolog]]></category>

		<guid isPermaLink="false">http://www.webplantmedia.com/?p=407</guid>
		<description><![CDATA[A programming language is like a tool. Every tool has a specific purpose. One tool does one job better and another tool does another job better. Programming Languages should be thought of the same way. Why Constraint Programming The N-Queens puzzle is very popular and we were able to find several working examples in C [...]]]></description>
			<content:encoded><![CDATA[<p>A programming language is like a tool. Every tool has a specific purpose. One tool does one job better and another tool does another job better. Programming Languages should be thought of the same way.</p>
<h2>Why Constraint Programming</h2>
<p>The N-Queens puzzle is very popular and we were able to find several working examples in C and in Prolog.  We analyzed, compiled and tested all these programs and weighed all the pros and cons these two types of languages.</p>
<p>Prolog, being a higher level language, is intuitively easier to understand and easier to program. You can think about the problem with more abstraction. The challenge in actually programming in prolog is that you need to be able to correctly “define” and thus “constrain” the program to do what needs to be done. You don’t have to worry about data types, pointers, data structures and other lower level issues. All the prolog solutions we came across were between 40 and 50 lines of code. On the downside, it was inconvenient when trying to test any n size greater than 12. Trying to solve the puzzle for n=13 takes about 148 seconds.</p>
<p>We found one good example of the n queens problem written in C. We compiled it under Visual Studio 2008, and ran it. The obvious upside in the C program was the speed. It could still solve the puzzle in under a second for n=13. That’s a huge difference compared with the prolog program.  The downside is trying to understand the code and trying to write the code. It’s not as obvious to see what’s happening. The level of abstraction is not as narrow as it is in prolog. On top having to worry about correctly implementing a solution, you have to worry about correctly defining a data structure, defining the correct data types, properly handling arrays and pointers, and other lower level issues not in any way related to the puzzle’s algorithm. The C program that we were testing was 400 lines of code. 236 lines if you remove the comments. That’s almost 5 times the size of the prolog program.</p>
<h2>Time Comparisons between Prolog and C</h2>
<table class="stats" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th width="213" valign="top"><strong>N</strong></th>
<th width="213" valign="top"><strong>Prolog <em>(seconds)</em></strong></th>
<th width="213" valign="top"><strong>C <em>(seconds)</em></strong></th>
</tr>
</thead>
<tbody>
<tr>
<td width="213" valign="top"><strong>1</strong></td>
<td width="213" valign="top">&lt; 1</td>
<td width="213" valign="top">&lt; 1</td>
</tr>
<tr>
<td width="213" valign="top"><strong>2</strong></td>
<td width="213" valign="top">&lt;   1</td>
<td width="213" valign="top">&lt;   1</td>
</tr>
<tr>
<td width="213" valign="top"><strong>3</strong></td>
<td width="213" valign="top">&lt; 1</td>
<td width="213" valign="top">&lt; 1</td>
</tr>
<tr>
<td width="213" valign="top"><strong>4</strong></td>
<td width="213" valign="top">&lt;   1</td>
<td width="213" valign="top">&lt;   1</td>
</tr>
<tr>
<td width="213" valign="top"><strong>5</strong></td>
<td width="213" valign="top">&lt; 1</td>
<td width="213" valign="top">&lt; 1</td>
</tr>
<tr>
<td width="213" valign="top"><strong>6</strong></td>
<td width="213" valign="top">&lt;   1</td>
<td width="213" valign="top">&lt;   1</td>
</tr>
<tr>
<td width="213" valign="top"><strong>7</strong></td>
<td width="213" valign="top">&lt; 1</td>
<td width="213" valign="top">&lt; 1</td>
</tr>
<tr>
<td width="213" valign="top"><strong>8</strong></td>
<td width="213" valign="top">&lt;   1</td>
<td width="213" valign="top">&lt;   1</td>
</tr>
<tr>
<td width="213" valign="top"><strong>9</strong></td>
<td width="213" valign="top">&lt; 1</td>
<td width="213" valign="top">&lt; 1</td>
</tr>
<tr>
<td width="213" valign="top"><strong>10</strong></td>
<td width="213" valign="top">&lt;   1</td>
<td width="213" valign="top">&lt;   1</td>
</tr>
<tr>
<td width="213" valign="top"><strong>11</strong></td>
<td width="213" valign="top">3.5</td>
<td width="213" valign="top">&lt; 1</td>
</tr>
<tr>
<td width="213" valign="top"><strong>12</strong></td>
<td width="213" valign="top">20.3</td>
<td width="213" valign="top">&lt;   1</td>
</tr>
<tr>
<td width="213" valign="top"><strong>13</strong></td>
<td width="213" valign="top">Too long</td>
<td width="213" valign="top">&lt; 1</td>
</tr>
<tr>
<td width="213" valign="top"><strong>14</strong></td>
<td width="213" valign="top">Too   long</td>
<td width="213" valign="top">1</td>
</tr>
<tr>
<td width="213" valign="top"><strong>15</strong></td>
<td width="213" valign="top">Too long</td>
<td width="213" valign="top">4</td>
</tr>
<tr>
<td width="213" valign="top"><strong>16</strong></td>
<td width="213" valign="top">Too   long</td>
<td width="213" valign="top">23</td>
</tr>
<tr>
<td width="213" valign="top"><strong>17</strong></td>
<td width="213" valign="top">Too long</td>
<td width="213" valign="top">Too long</td>
</tr>
</tbody>
</table>
<p>Next, we wanted to discuss the simplicity in solving the n-queens problem in prolog. Let’s define our solution for N=4.</p>
<p>We define our solution by stating that each of the 4 queens must occupy it’s very own row, column, downward diagonal, and upward diagonal on a 4&#215;4 board.</p>
<p><img class="alignnone size-full wp-image-408" title="n-queens" src="http://www.webplantmedia.com/wp-content/uploads/2010/04/n-queens1.jpg" alt="" width="400" height="425" /></p>
<p>And that’s our definition! Now we need to tell prolog to do this and write our constraints.</p>

<div class="wp_syntax"><div class="code"><pre class="prolog" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">%% DEFINE OUR BOARD     </span>
<span style="color: #666666; font-style: italic;">%% sq(y-coord, x-coord, downward-diag, upward-diag) </span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">1</span><span style="color: #339933;">,</span><span style="color: #800080;">1</span><span style="color: #339933;">,</span><span style="color: #800080;">4</span><span style="color: #339933;">,</span><span style="color: #800080;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">1</span><span style="color: #339933;">,</span><span style="color: #800080;">2</span><span style="color: #339933;">,</span><span style="color: #800080;">5</span><span style="color: #339933;">,</span><span style="color: #800080;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">1</span><span style="color: #339933;">,</span><span style="color: #800080;">3</span><span style="color: #339933;">,</span><span style="color: #800080;">6</span><span style="color: #339933;">,</span><span style="color: #800080;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">1</span><span style="color: #339933;">,</span><span style="color: #800080;">4</span><span style="color: #339933;">,</span><span style="color: #800080;">7</span><span style="color: #339933;">,</span><span style="color: #800080;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">2</span><span style="color: #339933;">,</span><span style="color: #800080;">1</span><span style="color: #339933;">,</span><span style="color: #800080;">3</span><span style="color: #339933;">,</span><span style="color: #800080;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">2</span><span style="color: #339933;">,</span><span style="color: #800080;">2</span><span style="color: #339933;">,</span><span style="color: #800080;">4</span><span style="color: #339933;">,</span><span style="color: #800080;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">2</span><span style="color: #339933;">,</span><span style="color: #800080;">3</span><span style="color: #339933;">,</span><span style="color: #800080;">5</span><span style="color: #339933;">,</span><span style="color: #800080;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">2</span><span style="color: #339933;">,</span><span style="color: #800080;">4</span><span style="color: #339933;">,</span><span style="color: #800080;">6</span><span style="color: #339933;">,</span><span style="color: #800080;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">3</span><span style="color: #339933;">,</span><span style="color: #800080;">1</span><span style="color: #339933;">,</span><span style="color: #800080;">2</span><span style="color: #339933;">,</span><span style="color: #800080;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">3</span><span style="color: #339933;">,</span><span style="color: #800080;">2</span><span style="color: #339933;">,</span><span style="color: #800080;">3</span><span style="color: #339933;">,</span><span style="color: #800080;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">3</span><span style="color: #339933;">,</span><span style="color: #800080;">3</span><span style="color: #339933;">,</span><span style="color: #800080;">4</span><span style="color: #339933;">,</span><span style="color: #800080;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">3</span><span style="color: #339933;">,</span><span style="color: #800080;">4</span><span style="color: #339933;">,</span><span style="color: #800080;">5</span><span style="color: #339933;">,</span><span style="color: #800080;">6</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">4</span><span style="color: #339933;">,</span><span style="color: #800080;">1</span><span style="color: #339933;">,</span><span style="color: #800080;">1</span><span style="color: #339933;">,</span><span style="color: #800080;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">4</span><span style="color: #339933;">,</span><span style="color: #800080;">2</span><span style="color: #339933;">,</span><span style="color: #800080;">2</span><span style="color: #339933;">,</span><span style="color: #800080;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">4</span><span style="color: #339933;">,</span><span style="color: #800080;">3</span><span style="color: #339933;">,</span><span style="color: #800080;">3</span><span style="color: #339933;">,</span><span style="color: #800080;">6</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 sq<span style="color: #009900;">&#40;</span><span style="color: #800080;">4</span><span style="color: #339933;">,</span><span style="color: #800080;">4</span><span style="color: #339933;">,</span><span style="color: #800080;">4</span><span style="color: #339933;">,</span><span style="color: #800080;">7</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
&nbsp;
<span style="color: #666666; font-style: italic;">%% CONSTRAINT</span>
<span style="color: #666666; font-style: italic;">%% We define our solution by stating that</span>
<span style="color: #666666; font-style: italic;">%% each of the 4 queens must occupy it’s</span>
<span style="color: #666666; font-style: italic;">%% very own row, column, downward diagonal,</span>
<span style="color: #666666; font-style: italic;">%% and upward diagonal on a 4x4 board.</span>
 chess<span style="color: #009900;">&#40;</span>A<span style="color: #339933;">,</span>B<span style="color: #339933;">,</span> E<span style="color: #339933;">,</span>F<span style="color: #339933;">,</span> I<span style="color: #339933;">,</span>J<span style="color: #339933;">,</span> M<span style="color: #339933;">,</span>N<span style="color: #009900;">&#41;</span> <span style="color: #339933;">:-</span>
 sq<span style="color: #009900;">&#40;</span>A<span style="color: #339933;">,</span>B<span style="color: #339933;">,</span>C<span style="color: #339933;">,</span>D<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> sq<span style="color: #009900;">&#40;</span>E<span style="color: #339933;">,</span>F<span style="color: #339933;">,</span>G<span style="color: #339933;">,</span>H<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> sq<span style="color: #009900;">&#40;</span>I<span style="color: #339933;">,</span>J<span style="color: #339933;">,</span>K<span style="color: #339933;">,</span>L<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> sq<span style="color: #009900;">&#40;</span>M<span style="color: #339933;">,</span>N<span style="color: #339933;">,</span>O<span style="color: #339933;">,</span>P<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
 A<span style="color: #339933;">=</span><span style="color: #800080;">1</span><span style="color: #339933;">,</span> E<span style="color: #339933;">=</span><span style="color: #800080;">2</span><span style="color: #339933;">,</span> I<span style="color: #339933;">=</span><span style="color: #800080;">3</span><span style="color: #339933;">,</span> M<span style="color: #339933;">=</span><span style="color: #800080;">4</span><span style="color: #339933;">,</span>
 A\<span style="color: #339933;">=</span>E<span style="color: #339933;">,</span> A\<span style="color: #339933;">=</span>I<span style="color: #339933;">,</span> A\<span style="color: #339933;">=</span>M<span style="color: #339933;">,</span>
 B\<span style="color: #339933;">=</span>F<span style="color: #339933;">,</span> B\<span style="color: #339933;">=</span>J<span style="color: #339933;">,</span> B\<span style="color: #339933;">=</span>N<span style="color: #339933;">,</span>
 C\<span style="color: #339933;">=</span>G<span style="color: #339933;">,</span> C\<span style="color: #339933;">=</span>K<span style="color: #339933;">,</span> C\<span style="color: #339933;">=</span>O<span style="color: #339933;">,</span>
 D\<span style="color: #339933;">=</span>H<span style="color: #339933;">,</span> D\<span style="color: #339933;">=</span>L<span style="color: #339933;">,</span> D\<span style="color: #339933;">=</span>P<span style="color: #339933;">,</span>
 E\<span style="color: #339933;">=</span>I<span style="color: #339933;">,</span> E\<span style="color: #339933;">=</span>M<span style="color: #339933;">,</span>
 F\<span style="color: #339933;">=</span>J<span style="color: #339933;">,</span> F\<span style="color: #339933;">=</span>N<span style="color: #339933;">,</span>
 G\<span style="color: #339933;">=</span>K<span style="color: #339933;">,</span> G\<span style="color: #339933;">=</span>O<span style="color: #339933;">,</span>
 H\<span style="color: #339933;">=</span>L<span style="color: #339933;">,</span> H\<span style="color: #339933;">=</span>P<span style="color: #339933;">,</span>
 I\<span style="color: #339933;">=</span>M<span style="color: #339933;">,</span>
 J\<span style="color: #339933;">=</span>N<span style="color: #339933;">,</span>
 K\<span style="color: #339933;">=</span>O<span style="color: #339933;">,</span>
 L\<span style="color: #339933;">=</span>P<span style="color: #339933;">.</span></pre></div></div>

<p>Here is our output once we run our program:</p>

<div class="wp_syntax"><div class="code"><pre class="prolog" style="font-family:monospace;"><span style="color: #339933;">?-</span> chess<span style="color: #009900;">&#40;</span>A<span style="color: #339933;">,</span>B<span style="color: #339933;">,</span>E<span style="color: #339933;">,</span>F<span style="color: #339933;">,</span>I<span style="color: #339933;">,</span>J<span style="color: #339933;">,</span>M<span style="color: #339933;">,</span>N<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
&nbsp;
A <span style="color: #339933;">=</span> <span style="color: #800080;">1</span><span style="color: #339933;">,</span>
B <span style="color: #339933;">=</span> <span style="color: #800080;">2</span><span style="color: #339933;">,</span>
E <span style="color: #339933;">=</span> <span style="color: #800080;">2</span><span style="color: #339933;">,</span>
F <span style="color: #339933;">=</span> <span style="color: #800080;">4</span><span style="color: #339933;">,</span>
I <span style="color: #339933;">=</span> <span style="color: #800080;">3</span><span style="color: #339933;">,</span>
J <span style="color: #339933;">=</span> <span style="color: #800080;">1</span><span style="color: #339933;">,</span>
M <span style="color: #339933;">=</span> <span style="color: #800080;">4</span><span style="color: #339933;">,</span>
N <span style="color: #339933;">=</span> <span style="color: #800080;">3</span> <span style="color: #339933;">;</span></pre></div></div>

<p>Which means:  { Q1(1, 2) , Q2(2, 4) , Q3(3, 1) , Q4(4, 3) }</p>
<p><img class="alignnone size-full wp-image-409" title="nqueens2" src="http://www.webplantmedia.com/wp-content/uploads/2010/04/nqueens2.jpg" alt="" width="400" height="412" /></p>
<p>Which is of course, the right solution. Here was the other solution.</p>

<div class="wp_syntax"><div class="code"><pre class="prolog" style="font-family:monospace;">A <span style="color: #339933;">=</span> <span style="color: #800080;">1</span><span style="color: #339933;">,</span>
B <span style="color: #339933;">=</span> <span style="color: #800080;">3</span><span style="color: #339933;">,</span>
E <span style="color: #339933;">=</span> <span style="color: #800080;">2</span><span style="color: #339933;">,</span>
F <span style="color: #339933;">=</span> <span style="color: #800080;">1</span><span style="color: #339933;">,</span>
I <span style="color: #339933;">=</span> <span style="color: #800080;">3</span><span style="color: #339933;">,</span>
J <span style="color: #339933;">=</span> <span style="color: #800080;">4</span><span style="color: #339933;">,</span>
M <span style="color: #339933;">=</span> <span style="color: #800080;">4</span><span style="color: #339933;">,</span>
N <span style="color: #339933;">=</span> <span style="color: #800080;">2</span> <span style="color: #339933;">;</span></pre></div></div>

<p>Which means:  { Q1(1, 3) , Q2(2, 1) , Q3(3, 4) , Q4(4, 2) }</p>
]]></content:encoded>
			<wfw:commentRss>http://webplantmedia.com/prolog/2010/04/simple-constraint-programming-tutorial/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Mapped File, Paging and Memory Protection – C Programming</title>
		<link>http://webplantmedia.com/c-programming/2010/04/mapped-file-paging-and-memory-protection-c-programming/</link>
		<comments>http://webplantmedia.com/c-programming/2010/04/mapped-file-paging-and-memory-protection-c-programming/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 16:30:21 +0000</pubDate>
		<dc:creator>ChrisB</dc:creator>
				<category><![CDATA[C-Programming]]></category>

		<guid isPermaLink="false">http://www.webplantmedia.com/?p=401</guid>
		<description><![CDATA[This program shows use of a number of system calls such as how to map a disk file in the virtual memory of a process space, divide it into pages, set access protection code such as read_only, write_only, etc to individual pages, read/write individual pages, and copy the file back to disk page by page. [...]]]></description>
			<content:encoded><![CDATA[<p>This program shows use of a number of system calls such as how to map a disk file in the virtual memory of a process space, divide it into pages, set access protection code such as read_only, write_only, etc to individual pages, read/write individual pages, and copy the file back to disk page by page.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;stdlib.h&gt;</span>
<span style="color: #339933;">#include &lt;sys/mman.h&gt;</span>
<span style="color: #339933;">#include &lt;sys/types.h&gt;</span>
<span style="color: #339933;">#include &lt;sys/stat.h&gt;</span>
<span style="color: #339933;">#include &lt;fcntl.h&gt;</span>
<span style="color: #339933;">#include &lt;errno.h&gt;</span>
<span style="color: #339933;">#include &lt;string.h&gt;</span>
<span style="color: #339933;">#include &lt;unistd.h&gt;</span>
<span style="color: #000000; font-weight: bold;">extern</span> <span style="color: #993333;">int</span> errno<span style="color: #339933;">;</span>
&nbsp;
main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #993333;">int</span> fid1<span style="color: #339933;">,</span> fid2<span style="color: #339933;">;</span>
<span style="color: #993333;">void</span> <span style="color: #339933;">*</span>address1<span style="color: #339933;">,</span> <span style="color: #339933;">*</span>address2<span style="color: #339933;">;</span>
<span style="color: #993333;">char</span> buf<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> data<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;edwin c&quot;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">char</span> <span style="color: #339933;">*</span>ptr<span style="color: #339933;">,</span> <span style="color: #339933;">*</span>base<span style="color: #339933;">,</span> data1<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">10</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;baldelomar&quot;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> i<span style="color: #339933;">,</span> n<span style="color: #339933;">,</span> pagesize<span style="color: #339933;">;</span>
<span style="color: #993333;">struct</span> stat statbuf<span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> inFileSize<span style="color: #339933;">,</span> outFileSize<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>fid1 <span style="color: #339933;">=</span> open<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;alice29.txt&quot;</span><span style="color: #339933;">,</span> O_RDWR<span style="color: #339933;">,</span>  <span style="color: #208080;">0600</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>perror<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;alice open failed&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066;">printf</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot; errno=%d <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> errno<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
 <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>fstat<span style="color: #009900;">&#40;</span>fid1<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>statbuf<span style="color: #009900;">&#41;</span><span style="color: #339933;">&lt;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> perror<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;fstat error&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
inFileSize <span style="color: #339933;">=</span> statbuf.<span style="color: #202020;">st_size</span><span style="color: #339933;">;</span>
<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Temp1 file size=%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> inFileSize<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>fid2 <span style="color: #339933;">=</span> open<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;temp2&quot;</span><span style="color: #339933;">,</span> O_RDWR <span style="color: #339933;">|</span> O_CREAT <span style="color: #339933;">|</span> O_TRUNC<span style="color: #339933;">,</span>  <span style="color: #208080;">0600</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span>
 perror<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;temp2 open failed&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #808080; font-style: italic;">/* temp2 is empty file. It has no space. Let us make it 20000 bytes
long by setting pointer to 9999 and then writeing a byte. */</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>lseek<span style="color: #009900;">&#40;</span>fid2<span style="color: #339933;">,</span> <span style="color: #0000dd;">19999</span><span style="color: #339933;">,</span> SEEK_SET<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> perror <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;lseek error&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>write<span style="color: #009900;">&#40;</span>fid2<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;X&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">//write 'X' at end</span>
  <span style="color: #009900;">&#123;</span>perror<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;write error&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> exit<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>fstat<span style="color: #009900;">&#40;</span>fid2<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>statbuf<span style="color: #009900;">&#41;</span><span style="color: #339933;">&lt;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> perror<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;fstat error&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
outFileSize <span style="color: #339933;">=</span> statbuf.<span style="color: #202020;">st_size</span><span style="color: #339933;">;</span>
<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Temp2 file size=%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> outFileSize<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #808080; font-style: italic;">/*prints size=20000*/</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*----------------------------------------------------*/</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>pagesize<span style="color: #339933;">=</span>sysconf<span style="color: #009900;">&#40;</span>_SC_PAGESIZE<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&lt;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> perror<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;sysconf failed&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;page size =%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> pagesize<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* map source file entirely in memory for reading by possibly
multiple processed, who may share all changes. */</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>address1 <span style="color: #339933;">=</span> mmap<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>caddr_t<span style="color: #009900;">&#41;</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> inFileSize<span style="color: #339933;">,</span> PROT_READ<span style="color: #339933;">,</span> MAP_SHARED<span style="color: #339933;">,</span> fid1<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span>MAP_FAILED<span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>perror<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;mmap failed&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;errno=%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> errno<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;actual mapped address1=0x%x<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> address1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
base <span style="color: #339933;">=</span> ptr <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span>address1<span style="color: #339933;">+</span><span style="color: #0000dd;">500</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span> <span style="color: #0000dd;">8</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> buf<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #339933;">*</span>ptr<span style="color: #339933;">++;</span> buf<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">8</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #ff0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #339933;">;</span>
<span style="color: #000066;">printf</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Reading Source: %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> buf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Following attempt to write to source file should cause segmentation
error, because of read_prot, although the file is onped RDWR.*/</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*
ptr = base;
for(i=0; i&lt;8; i++) *ptr++ = data[i]; 
fprintf(stderr, &quot;Writing to source: %s\n&quot;, base);
*/</span>
<span style="color: #808080; font-style: italic;">/*----------------------------------------------------*/</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>address2 <span style="color: #339933;">=</span> mmap<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>caddr_t<span style="color: #009900;">&#41;</span> address1<span style="color: #339933;">,</span> <span style="color: #0000dd;">10000</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span>PROT_READ <span style="color: #339933;">|</span> PROT_WRITE<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>  MAP_SHARED<span style="color: #339933;">,</span> fid2<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span>MAP_FAILED<span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>perror<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;mmap failed&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;errno=%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> errno<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;actual address2=0x%x<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> address2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Make first page write only */</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>mprotect<span style="color: #009900;">&#40;</span>address2<span style="color: #339933;">,</span> pagesize<span style="color: #339933;">,</span> PROT_WRITE<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&lt;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;protect write error=%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> errno<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #808080; font-style: italic;">/* make second page read only. */</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>mprotect<span style="color: #009900;">&#40;</span>address2<span style="color: #339933;">+</span>pagesize<span style="color: #339933;">,</span> pagesize<span style="color: #339933;">,</span> PROT_READ<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&lt;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;protect read  error=%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> errno<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/* Dump one page of memory space to output file */</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>msync<span style="color: #009900;">&#40;</span>address2<span style="color: #339933;">,</span> pagesize<span style="color: #339933;">,</span> MS_SYNC<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&lt;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;m-sync error=%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> errno<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
munmap<span style="color: #009900;">&#40;</span>address1<span style="color: #339933;">,</span> inFileSize<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//remove memory space</span>
munmap<span style="color: #009900;">&#40;</span>address2<span style="color: #339933;">,</span> outFileSize<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/* I/O is possible using file descriptor, but not through alloacted space now. */</span>
close<span style="color: #009900;">&#40;</span>fid1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
close<span style="color: #009900;">&#40;</span>fid2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://webplantmedia.com/c-programming/2010/04/mapped-file-paging-and-memory-protection-c-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

