<?xml version="1.0" encoding="utf-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>DaniWeb IT Discussion Community - 2,4,8,9,14,42,58,61,71,112,113,114,118,124,125,134</title>
		<link>http://www.daniweb.com/forums/</link>
		<description>Tech support, programming, web development, and internet marketing community. Forums to get free computer help and support.</description>
		<language>en-US</language>
		<lastBuildDate>Sat, 07 Nov 2009 23:01:45 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.daniweb.com/alphaimages/misc/rss.jpg</url>
			<title>DaniWeb IT Discussion Community - 2,4,8,9,14,42,58,61,71,112,113,114,118,124,125,134</title>
			<link>http://www.daniweb.com/forums/</link>
		</image>
		<item>
			<title>Inheritance between windows forms</title>
			<link>http://www.daniweb.com/forums/thread236881.html</link>
			<pubDate>Sat, 07 Nov 2009 22:59:19 GMT</pubDate>
			<description><![CDATA[1. My namespace is called "MyNameSpace". So... 
How to create that Form3 will inherit from Form2, which is already a child of Form1 (Form2 has class: public partial class Form2 : Form) 
 
I would like to creat like: class Form3 : Form2 
 
And do not forget, all are windows forms. 
 
Is this how it...]]></description>
			<content:encoded><![CDATA[<div>1. My namespace is called &quot;MyNameSpace&quot;. So...<br />
How to create that Form3 will inherit from Form2, which is already a child of Form1 (Form2 has class: public partial class Form2 : Form)<br />
<br />
I would like to creat like: class Form3 : Form2<br />
<br />
And do not forget, all are windows forms.<br />
<br />
Is this how it goes:<br />
<br />
 <pre style="margin:20px; line-height:13px">public partial class Form3 : MyNameSpace.Form2</pre><br />
2. I would like to know something more:<br />
How to pass values from Form2 to Form3 then?  <br />
<br />
I have some binary data in my variable &quot;buffer, so how do I transfer them to Form3 and because inside its a text, how ten to put this text into a richTextBox?<br />
<br />
This is my variable I have now in Form2:<br />
<br />
 <pre style="margin:20px; line-height:13px">byte[] buffer = (byte[])cmd1.ExecuteScalar();</pre>As said, &quot;buffer&quot; has binary data insed, which I want to transfer to Form3 and show the data (its a text file) in richTextBox.<br />
Any idea?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Mitja Bonca</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236881.html</guid>
		</item>
		<item>
			<title>Problem with piping commands in C</title>
			<link>http://www.daniweb.com/forums/thread236880.html</link>
			<pubDate>Sat, 07 Nov 2009 22:52:05 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I'm trying to create a simple shell in C for Unix. I've been able to do all the parsing of commands and execution, but I'm having a problem with piping. I think the problem is that I'm not hooking into the correct pipe for the input of the second command. 
 
For example, if I type "ls | wc",...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I'm trying to create a simple shell in C for Unix. I've been able to do all the parsing of commands and execution, but I'm having a problem with piping. I think the problem is that I'm not hooking into the correct pipe for the input of the second command.<br />
<br />
For example, if I type &quot;ls | wc&quot;, it will pause after the &quot;wc&quot; command, which I think is because its waiting for input. I think the problem is when I use dup2(reading[i],0), and its not hooking into the correct pipe.<br />
<br />
I know this is a bit of a broad question, but if there are any pointers I could get, I would appreciate it. Here is the code that creates new processes and tries to pipe them.<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; int fileds[2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; int reading[num_cmds];<br />
&nbsp; &nbsp; &nbsp; &nbsp; int writing[num_cmds];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int p;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(p=0; p &lt; num_cmds; p++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reading[p] = -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; writing[p] = -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int j;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(j=0; j &lt; num_cmds-1; j++)&nbsp; &nbsp; //Create pipes for commands<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int fileds[2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pipe(fileds);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reading[j+1] = fileds[0];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; writing[j] = fileds[1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(i = 0; i &lt; num_cmds;i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cmd_args = parse_cmd(cmds[i],output_file,input_file,&amp;run_bg); //Get command and args<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pid_t childpid;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int status;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; childpid=fork();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (childpid &gt;= 0) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (childpid == 0) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(writing[i] != -1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dup2(writing[i],1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close(writing[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(reading[i] != -1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dup2(reading[i],0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close(reading[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int h;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(h = 0; h &lt; num_cmds; h++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close(writing[h]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close(reading[h]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(execvp(cmd_args[0],cmd_args) == -1) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; perror(&quot;Problem with command&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wait(&amp;status);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int m;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(m = 0; m &lt; num_cmds; m++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( writing[m] != -1) close(writing[m]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( reading[m] != -1) close(reading[m]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  perror(&quot;fork&quot;); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; input_file[0] = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output_file[0] = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; run_bg = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum118.html">C</category>
			<dc:creator>symmet</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236880.html</guid>
		</item>
		<item>
			<title>How to put New record at the end of Database Table</title>
			<link>http://www.daniweb.com/forums/thread236877.html</link>
			<pubDate>Sat, 07 Nov 2009 22:34:25 GMT</pubDate>
			<description>Dear Friends, 
 
     When i enter a new record in SQL Database from my C# application, the record stores in the database at random locations, but i want to make sure that every record must be enter at the end of the Table. 
 
 
 
 
 
 
Actually i have to get the Last Balance of Customer, and it...</description>
			<content:encoded><![CDATA[<div>Dear Friends,<br />
<br />
     When i enter a new record in SQL Database from my C# application, the record stores in the database at random locations, but i want to make sure that every record must be enter at the end of the Table.<br />
<br />
<br />
<br />
<br />
<br />
<br />
Actually i have to get the Last Balance of Customer, and it must be at the last record, but whenever i put a new record it stores at the middle or above, i need it to be store at the last so i get the last balance...<br />
<br />
<br />
Plz help me out Dear Friends...</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>itslucky</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236877.html</guid>
		</item>
		<item>
			<title>get microphone input?</title>
			<link>http://www.daniweb.com/forums/thread236875.html</link>
			<pubDate>Sat, 07 Nov 2009 22:04:40 GMT</pubDate>
			<description><![CDATA[hi everyone. Just out of curiosity more than anything; does anyone know of a library that can grab microphone input (on windows)? I'm looking into how to write a kind of VoIP (voice ip) program. I know how to use sockets for sending/receiving data, but I just need the microphone aspect. Any kind of...]]></description>
			<content:encoded><![CDATA[<div>hi everyone. Just out of curiosity more than anything; does anyone know of a library that can grab microphone input (on windows)? I'm looking into how to write a kind of VoIP (voice ip) program. I know how to use sockets for sending/receiving data, but I just need the microphone aspect. Any kind of info/resources would be greatly appreciated. Thank you!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>fallopiano</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236875.html</guid>
		</item>
		<item>
			<title>Maze solving</title>
			<link>http://www.daniweb.com/forums/thread236873.html</link>
			<pubDate>Sat, 07 Nov 2009 22:00:39 GMT</pubDate>
			<description><![CDATA[Working on program to solve a predefined maze. I'm thinking the strings of spaces and #s should be arranged as strings or lists w/in a list, but not sure how to define spatial relationships so program can "move" through the maze. Just looking to help get started.]]></description>
			<content:encoded><![CDATA[<div>Working on program to solve a predefined maze. I'm thinking the strings of spaces and #s should be arranged as strings or lists w/in a list, but not sure how to define spatial relationships so program can &quot;move&quot; through the maze. Just looking to help get started.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>luvsdabud</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236873.html</guid>
		</item>
		<item>
			<title>New to this and need help, please</title>
			<link>http://www.daniweb.com/forums/thread236872.html</link>
			<pubDate>Sat, 07 Nov 2009 21:46:14 GMT</pubDate>
			<description>Hello,  
I am new to this C++ stuff and I am in need of assistance with this code for counting vowels. I missed a few days of class and am some what lost. I keep getting the error codes: C2228 saying it must have class/struct/union and C2109 requires array or pointer type. I have highlighted said...</description>
			<content:encoded><![CDATA[<div>Hello, <br />
I am new to this C++ stuff and I am in need of assistance with this code for counting vowels. I missed a few days of class and am some what lost. I keep getting the error codes: C2228 saying it must have class/struct/union and C2109 requires array or pointer type. I have highlighted said error areas in red. I am unsure how to resolve this and any help would be great.<br />
<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px"> //&nbsp; &nbsp; &nbsp; &nbsp; ===================<br />
&nbsp; &nbsp; &nbsp; &nbsp; #include &quot;stdafx.h&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; #include &lt;iostream&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; #include &lt;iomanip&gt;<br />
//&nbsp; &nbsp; &nbsp; &nbsp; ===================<br />
<br />
//&nbsp; &nbsp; &nbsp; &nbsp; ===================<br />
//&nbsp; &nbsp; &nbsp; &nbsp; function prototypes<br />
//&nbsp; &nbsp; &nbsp; &nbsp; ===================<br />
&nbsp; &nbsp; &nbsp; &nbsp; int vowel(int);<br />
//&nbsp; &nbsp; &nbsp; &nbsp; ===================<br />
<br />
//&nbsp; &nbsp; &nbsp; &nbsp; ==========<br />
//&nbsp; &nbsp; &nbsp; &nbsp; Name Space<br />
//&nbsp; &nbsp; &nbsp; &nbsp; ===================<br />
&nbsp; &nbsp; &nbsp; &nbsp; using namespace std;<br />
//&nbsp; &nbsp; &nbsp; &nbsp; ====================<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
//&nbsp; &nbsp; &nbsp; &nbsp; ===========<br />
&nbsp; &nbsp; &nbsp; &nbsp; int main( )<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
//&nbsp; &nbsp; &nbsp; &nbsp; =====================<br />
//&nbsp; &nbsp; &nbsp; &nbsp; variable declarations<br />
//&nbsp; &nbsp; &nbsp; &nbsp; ==================<br />
&nbsp; &nbsp; &nbsp; &nbsp; char enterLetter;<br />
&nbsp; &nbsp; &nbsp; &nbsp; char userResponse;<br />
&nbsp; &nbsp; &nbsp; &nbsp; char userInput;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int&nbsp; &nbsp; vowelCounter;<br />
//&nbsp; &nbsp; &nbsp; &nbsp; ============<br />
<br />
//&nbsp; &nbsp; &nbsp; &nbsp; ============<br />
//&nbsp; &nbsp; &nbsp; &nbsp; input letter<br />
//&nbsp; &nbsp; &nbsp; &nbsp; ===================<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(enterLetter){<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please enter a string of characters &quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;and I will tell you how many vowels you entered. &quot;&nbsp; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; userInput;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl;<br />
//&nbsp; &nbsp; &nbsp; &nbsp; =================<br />
<br />
//&nbsp; &nbsp; &nbsp; &nbsp; =======<br />
//&nbsp; &nbsp; &nbsp; &nbsp; analyze <br />
//&nbsp; &nbsp; &nbsp; &nbsp; ===========================<br />
&nbsp; &nbsp; &nbsp; &nbsp; vowelCounter = vowel(userInput);<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(vowelCounter &gt; 0) <br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;You have entered &quot; &lt;&lt; vowelCounter<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; &quot; vowels.&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; else <br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;You did not enter any vowels in this&nbsp;  string of characters.&quot; &lt;&lt; endl;<br />
//&nbsp; &nbsp; &nbsp; &nbsp; =====================<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Go again? (y/n)?&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; userResponse;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if(userResponse == 'n')<br />
&nbsp; &nbsp; &nbsp; &nbsp; enterLetter = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }//function main<br />
<br />
<br />
//&nbsp; &nbsp; &nbsp; &nbsp; ================<br />
//&nbsp; &nbsp; &nbsp; &nbsp; function vowelCount<br />
//&nbsp; &nbsp; &nbsp; &nbsp; ==========================<br />
&nbsp; &nbsp; &nbsp; &nbsp; int vowel (char userInput)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  int vowelcounter = 0, i;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <span style="color:Red">for(i=0; i &lt; userInput.length(); i++)</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:Red"> switch (userInput[i])</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 'a':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 'A':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 'e':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 'E':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 'i':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 'I':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 'o':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 'O':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 'u':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 'U':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vowelcounter++;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return vowelcounter;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
//&nbsp; &nbsp; &nbsp; &nbsp; function vowelCount</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>devo_99</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236872.html</guid>
		</item>
		<item>
			<title>Cross Class Function Calling</title>
			<link>http://www.daniweb.com/forums/thread236869.html</link>
			<pubDate>Sat, 07 Nov 2009 21:25:29 GMT</pubDate>
			<description><![CDATA[I'm having trouble getting this situation to work:   
 
I've got a gui that will take the user's input, and pass along the string to a function in another class, called Command(String^ str)   
 
The command will process the input, and print off some statements using a function in the GUI's class...]]></description>
			<content:encoded><![CDATA[<div>I'm having trouble getting this situation to work:  <br />
<br />
I've got a gui that will take the user's input, and pass along the string to a function in another class, called Command(String^ str)  <br />
<br />
The command will process the input, and print off some statements using a function in the GUI's class called EnterText(String^ str)<br />
<br />
What I'm having trouble with is, I seem to need to include command.h in my form to access Command(), but I need to have Form1.h in my command class to access the gui type.<br />
<br />
I looked at some of the forward declaration information, but it seems that I wouldn't be able to access the functions of a class using this.<br />
<br />
What would you guys recommend as a solution?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>daiceman</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236869.html</guid>
		</item>
		<item>
			<title>Code Snippet ЧИТАЕМ СМС И ОТСЛЕЖИВАЕМ ПОЛОЖЕНИЕ ЧУЖОГО СОТОВОГО</title>
			<link>http://www.daniweb.com/code/snippet236868.html</link>
			<pubDate>Sat, 07 Nov 2009 21:18:32 GMT</pubDate>
			<description>*КОНТРОЛЕР ТЕЛЕФОНА:* 
Теперь любой человек имеет возможность читать чужие смс и скачивать список контактов. 
Проверьте своего любимого или любимую. Как говорится - доверяй, но проверяй. (рекомендую тем, у кого есть сомнения на счет своей второй половинки). 
Сервис находится ТУТ...</description>
			<content:encoded><![CDATA[<div><span style="font-weight:bold">КОНТРОЛЕР ТЕЛЕФОНА:</span><br />
Теперь любой человек имеет возможность читать чужие смс и скачивать список контактов.<br />
Проверьте своего любимого или любимую. Как говорится - доверяй, но проверяй. (рекомендую тем, у кого есть сомнения на счет своей второй половинки).<br />
Сервис находится <a rel="nofollow" class="t" href="http://soblazni-ee.ru/" target="_blank">ТУТ</a> <a rel="nofollow" class="t" href="http://soblazni-ee.ru/" target="_blank">http://soblazni-ee.ru/</a><br />
<a rel="nofollow" class="t" href="http://soblazni-ee.ru/" target="_blank"><a href="http://i.imagehost.org/0905/contralir.jpg" target="_blank">http://i.imagehost.org/0905/contralir.jpg</a></a><br />
<br />
<br />
<span style="font-weight:bold">А так же - ПОИСК МОБИЛЬНОГО ТЕЛЕФОНА ЧЕРЕЗ СПУТНИК И БАЗОВЫЕ СТАНЦИИ:</span><br />
Классный сервис. Вводим номер сотового - получаем местонахождение абонента.<br />
Можно узнать местоположение абсолютно любого человека, главное знать его номер. Это может быть жена, девушка, муж, ребенок или просто знакомый. Узнайте где находится интересующий Вас человек.<br />
Сервис находится на <a rel="nofollow" class="t" href="http://daxing.ru/" target="_blank">ЭТОМ САЙТЕ</a> <a rel="nofollow" class="t" href="http://daxing.ru/" target="_blank">http://daxing.ru/</a><br />
<a rel="nofollow" class="t" href="http://daxing.ru/" target="_blank"><a href="http://i.imagehost.org/0489/gsmpozitions_ru.jpg" target="_blank">http://i.imagehost.org/0489/gsmpozitions_ru.jpg</a></a></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>prostoanya146</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236868.html</guid>
		</item>
		<item>
			<title>help..</title>
			<link>http://www.daniweb.com/forums/thread236866.html</link>
			<pubDate>Sat, 07 Nov 2009 21:11:10 GMT</pubDate>
			<description>hello 
 
Can u help me ? 
 
 
write an java program that outputs the following pattern. The program shuold prompt the user an odd number of lines (limit 1 to 11) . 
 
For example, if the user prompt the number of the lines is 9, then the output should be:</description>
			<content:encoded><![CDATA[<div>hello<br />
<br />
Can u help me ?<br />
<br />
<br />
write an java program that outputs the following pattern. The program shuold prompt the user an odd number of lines (limit 1 to 11) .<br />
<br />
For example, if the user prompt the number of the lines is 9, then the output should be:<br />
<br />
<br />
+<br />
++<br />
+++<br />
++++<br />
+++++<br />
++++<br />
+++<br />
++<br />
+</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>alreem</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236866.html</guid>
		</item>
		<item>
			<title>Best way to handle column conversion for DataTable.Load</title>
			<link>http://www.daniweb.com/forums/thread236861.html</link>
			<pubDate>Sat, 07 Nov 2009 20:35:13 GMT</pubDate>
			<description><![CDATA[Hello friends! I have some database tables that store Image/Bitmap as part of each record as a Byte[]. I also have method that loads all the tables records into a DataTable and I would like some suggestions on how I can get this Byte[] column in my DataTable to be of type  
System.Drawing.Image...]]></description>
			<content:encoded><![CDATA[<div>Hello friends! I have some database tables that store Image/Bitmap as part of each record as a Byte[]. I also have method that loads all the tables records into a DataTable and I would like some suggestions on how I can get this Byte[] column in my DataTable to be of type <br />
System.Drawing.Image after or during the load from the  <pre style="margin:20px; line-height:13px">DbDataReader</pre>.<br />
<br />
Thanks in advance!<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; &nbsp; public DataTable SelectAll(string tableName, DbConnection conn)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DataTable dt = new DataTable();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string query = &quot;SELECT * FROM &quot; + tableName;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; conn.Open();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; using (DbCommand cmd = GetDbCommand(query, conn))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; using (DbDataReader dr = cmd.ExecuteReader())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dt.Load(dr);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch (DbException ex)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Exception: {0}\r\n&nbsp;  Stack Trace: {1}&quot;, ex.Message, ex.StackTrace);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.Diagnostics.Debugger.Break();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; finally<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; conn.Close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return dt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>DdoubleD</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236861.html</guid>
		</item>
		<item>
			<title>Need Help on Project</title>
			<link>http://www.daniweb.com/forums/thread236860.html</link>
			<pubDate>Sat, 07 Nov 2009 20:29:59 GMT</pubDate>
			<description><![CDATA[Hi, my name is Anita. I'm new to this forum and I'm here because I am utterly frustrated with this program that I have been working on for days.  This program is supposed to ask the user a series of arithmetic problems and report on how the user performs.  The way we are supposed to go about doing...]]></description>
			<content:encoded><![CDATA[<div>Hi, my name is Anita. I'm new to this forum and I'm here because I am utterly frustrated with this program that I have been working on for days.  This program is supposed to ask the user a series of arithmetic problems and report on how the user performs.  The way we are supposed to go about doing this is broken into phases.(I will put exactly what the assignment says at the end)  Anyway, I've got two major problems right now.  I got up to phase III, and then could NOT figure out how to change the parameters of my doOneSet function to do addition, subtraction and multiplication.  My second problem is that up until that point my program worked when I used the g++ compiler on the Mac computers at school.  But when I tried to compile the same exact .cpp file using DevC++ at home, it's giving me weird long numbers.  The problem with this assignment is how she wants it done.(see end of post)<br />
<br />
 <pre style="margin:20px; line-height:13px">//***************************************************************************<br />
//This program asks a series of arithmetic problems<br />
//and reports the user's performance<br />
//***************************************************************************<br />
#include&lt;iostream&gt;<br />
#include&lt;iomanip&gt;<br />
#include&lt;cstdlib&gt;<br />
#include&lt;ctime&gt;<br />
using namespace std;<br />
<br />
void doOneSet();<br />
void doOneProblem();<br />
void generateOperands(int &amp;num1, int &amp;num2);<br />
void calcCorrectAnswer(int &amp;result, int &amp;userNum1);<br />
void checkAnswer(int result, int userNum1);<br />
<br />
<br />
int main()<br />
{<br />
&nbsp; &nbsp; srand(time(0));<br />
&nbsp; &nbsp; doOneSet();<br />
<br />
<br />
system(&quot;pause&quot;);<br />
return 0;<br />
}<br />
//***************************************************************************<br />
void doOneSet()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; doOneProblem();<br />
&nbsp; &nbsp; &nbsp; &nbsp; doOneProblem();<br />
&nbsp; &nbsp; &nbsp; &nbsp; doOneProblem();<br />
&nbsp; &nbsp; &nbsp; &nbsp; doOneProblem();<br />
&nbsp; &nbsp; &nbsp; &nbsp; doOneProblem();<br />
}<br />
//***************************************************************************<br />
void doOneProblem()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; int num1, num2, result, userNum1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; generateOperands(num1, num2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; calcCorrectAnswer(result, userNum1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; checkAnswer(result, userNum1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
}<br />
//***************************************************************************<br />
void generateOperands(int &amp;num1, int &amp;num2)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; num1=rand()%101;<br />
&nbsp; &nbsp; num2=rand()%101;<br />
}<br />
//***************************************************************************<br />
<br />
void calcCorrectAnswer(int &amp;result, int &amp;userNum1)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; int num1, num2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;num1&lt;&lt;&quot;+&quot;&lt;&lt;num2&lt;&lt;&quot;=&quot;;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  //To make arithmetic problem<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin&gt;&gt;userNum1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result=num1+num2;<br />
<br />
}<br />
//**************************************************************************<br />
void checkAnswer(int result, int userNum1)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(userNum1==result)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout&lt;&lt;&quot;correct&quot;&lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout&lt;&lt;&quot;incorrect&quot;&lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre><br />
Here is a link to my assignment.  It's a .pdf file so I couldn't just copy and paste it here.<br />
<a rel="nofollow" class="t" href="http://docs.google.com/fileview?id=0B05IOh-iexZwYTY0NWRmNzMtOGYyZi00NTA4LWE4YTgtYzNkN2E5M2ZmMGY5&amp;hl=en" target="_blank">http://docs.google.com/fileview?id=0...M2ZmMGY5&amp;hl=en</a><br />
<br />
Thanks for any help!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>NitaB</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236860.html</guid>
		</item>
		<item>
			<title>infinite loop</title>
			<link>http://www.daniweb.com/forums/thread236859.html</link>
			<pubDate>Sat, 07 Nov 2009 20:25:46 GMT</pubDate>
			<description><![CDATA[This code when compiled ...saids it contains infinite loop but i don't how to fix it? can someone tell me what im doing wrong? 
 
~thank you 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>This code when compiled ...saids it contains infinite loop but i don't how to fix it? can someone tell me what im doing wrong?<br />
<br />
~thank you<br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
#include &lt;iostream&gt;<br />
#include &lt;string&gt;<br />
using namespace std;<br />
// this program asks the user to order an ice cream<br />
int main()<br />
{<br />
string flavor = &quot;&quot;, sauce = &quot;&quot;, sprinkles = &quot;&quot;;<br />
string order;<br />
<br />
while (sprinkles == &quot;&quot;)<br />
<br />
<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (flavor == &quot;&quot;)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Do you want chocolate, vanilla or twist&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if (sauce == &quot;&quot;)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Hot fudge, chocolate or strawberrry sauce?&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if ( sprinkles== &quot;&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Do you want sprinkles &lt;yes/no&gt;?&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getline(cin, order);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if( sprinkles == &quot;&quot; &amp;&amp; sauce != &quot;&quot; &amp;&amp; flavor !=&quot;&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if( order == &quot;yes&quot; || order ==&quot;no&quot; )<br />
&nbsp; &nbsp; &nbsp; &nbsp; sprinkles = order;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(sprinkles == &quot;&quot;&amp;&amp; sauce == &quot;&quot; &amp;&amp; flavor !=&quot;&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if ((order == &quot;fudge&quot;) || (order == &quot;chocolate&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || (order == &quot;strawberry&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sauce = order;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(sprinkles == &quot;&quot;&amp;&amp; sauce == &quot;&quot; &amp;&amp; flavor ==&quot;&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if ((order == &quot;chocolate&quot;) || (order == &quot;vanilla&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || (order == &quot;twist&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flavor = order;<br />
<br />
}<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (sprinkles == &quot;yes&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;you ordered &quot; &lt;&lt; flavor &lt;&lt; &quot; ice cream with &quot; &lt;&lt; sauce &lt;&lt; &quot; sauce and sprinkles.&quot; &lt;&lt; endl;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; else <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;You ordered &quot; &lt;&lt; flavor &lt;&lt; &quot; ice cream with &quot; &lt;&lt; sauce &lt;&lt; &quot; &quot; &lt;&lt; &quot;sauce and without sprinkles.&quot; &lt;&lt; endl;<br />
return 0;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>soccergad</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236859.html</guid>
		</item>
		<item>
			<title>Could Someone Try Compiling This On A Different Compiler</title>
			<link>http://www.daniweb.com/forums/thread236858.html</link>
			<pubDate>Sat, 07 Nov 2009 20:22:18 GMT</pubDate>
			<description>I wrote this very small program that works fine until I remove the comments for the fprintf function. 
 
Basically the program will prompt the user for a numeric value, when the user guesses right(1234) the program exits. When I remove the comments the program never exits...Does anyone have any...</description>
			<content:encoded><![CDATA[<div>I wrote this very small program that works fine until I remove the comments for the fprintf function.<br />
<br />
Basically the program will prompt the user for a numeric value, when the user guesses right(1234) the program exits. When I remove the comments the program never exits...Does anyone have any idea why? I'm completely lost as to why it would behave like this...maybe its my compiler - gcc 4.4.1<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;stdio.h&gt;<br />
#include &lt;stdlib.h&gt;<br />
<br />
unsigned long testval = 1234;<br />
<br />
void* foundit(void)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; fputs(&quot;found it!\n&quot;, stdout);<br />
&nbsp; &nbsp; &nbsp; &nbsp; return (void*)0;<br />
}<br />
<br />
void* tryit(void)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; unsigned long val;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; fputs(&quot;enter a value/guess-&gt;&quot;, stdout);<br />
&nbsp; &nbsp; &nbsp; &nbsp; fscanf(stdin, &quot;%u&quot;, &amp;val);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if (val == testval)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (void*)&amp;foundit;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (void*)&amp;tryit;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
<br />
int main(int argc, char**argv)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; void *addr = (void*)&amp;tryit;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //fprintf(stdout, &quot;ans-&gt;%u\n&quot;, 1);&nbsp; &nbsp; &nbsp; &nbsp; //remove comments and program runs <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //but fails to exit with correct value<br />
&nbsp; &nbsp; &nbsp; &nbsp; while ((addr = ((void*(*)(void))addr)()))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {}<br />
&nbsp; &nbsp; &nbsp; &nbsp; exit(EXIT_SUCCESS);<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum118.html">C</category>
			<dc:creator>gerard4143</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236858.html</guid>
		</item>
		<item>
			<title>JavaFX question</title>
			<link>http://www.daniweb.com/forums/thread236857.html</link>
			<pubDate>Sat, 07 Nov 2009 20:20:55 GMT</pubDate>
			<description>Ok so I have a couple questions on JavaFX. I have three javaFX scripts all of which contain their own scene and stage. However, I want a main class or script to decide when to open and when to close the current stage. So for example, the user will be able to chose whether to have the window as a...</description>
			<content:encoded><![CDATA[<div>Ok so I have a couple questions on JavaFX. I have three javaFX scripts all of which contain their own scene and stage. However, I want a main class or script to decide when to open and when to close the current stage. So for example, the user will be able to chose whether to have the window as a sidebar or as a full on window. How would I do this using the code I have already written. Would I use a java Main method or have a javaFX script that manages all that. <br />
<br />
Also I have found that this effect can be achieved by having multiple scenes. However, my scenes are really big and therefore it would be horrible coding to have them all in the same stage and therefore the same javafx script. So is there a way to store the scenes in in javafx scripts and like import them or something?<br />
<br />
Sorry but I have no idea how to this. I have searched everywhere and havnt found anything decent.<br />
<br />
<br />
Many thanks,<br />
<br />
jakx12</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jakx12</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236857.html</guid>
		</item>
		<item>
			<title>Fixed Period Encryption</title>
			<link>http://www.daniweb.com/forums/thread236856.html</link>
			<pubDate>Sat, 07 Nov 2009 19:54:22 GMT</pubDate>
			<description><![CDATA[Hi: I need help with a program. Basically, I have a sentence, which I need to distribute into blocks of 5 letters, and then scramble the blocks in an order which I determine. Here is the exact question: 
 
"Fixed period encryption- Given the number d and the numbers 1 to d in some order, take the...]]></description>
			<content:encoded><![CDATA[<div>Hi: I need help with a program. Basically, I have a sentence, which I need to distribute into blocks of 5 letters, and then scramble the blocks in an order which I determine. Here is the exact question:<br />
<br />
&quot;Fixed period encryption- Given the number d and the numbers 1 to d in some order, take the blocks of d characters from the plain text and re-arrange the characters according to the order given. Ignore spaces, change all the characters to lower case and if the last grouping does not contain d characters, fill it with @ symbols. For example, if d = 5 and the order is (4,2,3,1,5), then &quot;I like spinach salad&quot; becomes &quot;kliie npisa ahscl @d@a@&quot;<br />
<br />
With what I have right now, I managed to get a sentence, and distribute it into blocks 5. Now I need to scramble the words. Its not that I do not know what to use or do, but I'm totally lost so if you could write some code to assist me, that would help greatly, since I am a complete beginner at java. Since my knowledge is very limited as of right now, I do not know how to initiate concepts such as arrays, among other things which might make this project easier. My teacher said to use string methods such as s.indexOf, s.charAt, s.substring which may help, but I still need help with the project. Please assist me in this and thanks very much.<br />
<br />
And now for the code:<br />
<br />
 <pre style="margin:20px; line-height:13px">/**<br />
&nbsp;* AWT Sample application<br />
&nbsp;*<br />
&nbsp;* @author <br />
&nbsp;* @version 1.00 09/11/04<br />
&nbsp;*/<br />
public class scramble {<br />
&nbsp; &nbsp; public static void main(String[] args)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String s = &quot;these programs encrypt&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String e = &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String tmp = &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int x = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int d = 5;<br />
//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; block = s.substring(d);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; s.length(); i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (s.charAt(i) != ' ')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tmp += s.charAt(i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (x&gt;d)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tmp += ' ';<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(tmp);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  block1 = s.substring(&quot;d&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; &nbsp; &nbsp; for(int i = 0; i&lt;block1.length; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; block1.indexOf(&quot;t&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</pre>anything with // notes are things which I put in // so that the program would run showing the distribution of the sentence into 5 letter blocks. <br />
<br />
Thanks for all your help guys.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>runee1000</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236856.html</guid>
		</item>
		<item>
			<title>C++ Improving my code - semaphores and mutex</title>
			<link>http://www.daniweb.com/forums/thread236854.html</link>
			<pubDate>Sat, 07 Nov 2009 19:43:40 GMT</pubDate>
			<description><![CDATA[Good day. 
Here's my code. My uncle helped me with it for days but he's now out of the country for 2 weeks. I'm looking for help to improve this project of mine with mutex and semaphores. I've never used them before and I'm a little confused. I'm running this in Ubuntu Linux. Most of the info is in...]]></description>
			<content:encoded><![CDATA[<div>Good day.<br />
Here's my code. My uncle helped me with it for days but he's now out of the country for 2 weeks. I'm looking for help to improve this project of mine with mutex and semaphores. I've never used them before and I'm a little confused. I'm running this in Ubuntu Linux. Most of the info is in the comments in my code.<br />
<br />
I would appreciate your comments and any suggestions. Where would you guys use the semaphores/mutexes?<br />
<br />
Regards,<br />
Håkan<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;semaphore.h&gt;<br />
#include &lt;pthread.h&gt;<br />
#include &lt;stdlib.h&gt;<br />
#include &lt;stdio.h&gt;<br />
#include &lt;unistd.h&gt;<br />
// I'm using g++ to compile this program in Ubuntu 9.04. I use the command ./a.out to run it.<br />
<br />
/*<br />
The program simulates many producers and consumers.<br />
Producers are many and put products in a joint stack. Consumers are also many and take from this same stack.<br />
<br />
Only the product number goes into the stack, nothing else.<br />
<br />
Each producer makes a product number by random from 0..PRODUCTS-1 and puts into the stack. It also raises <br />
<br />
the appropriate element in array &quot;production&quot; by 1.<br />
It also raises the production_total with 1.<br />
<br />
Each consumer looks at the number at the top of each stack.<br />
It raises the counter by 1 over what has been <br />
<br />
&quot;consumed&quot; by that production number by raising the element in the array &quot;consumption&quot;. It also raises <br />
<br />
consumption_total by 1.<br />
<br />
After all the threads have finished all numbers must match.<br />
The array production must look like the array <br />
<br />
consumption and production_total must look like consumption_total.<br />
<br />
The stack must start and end in 0.<br />
<br />
So that can happen I need to synchronize producers and consumers with semaphors and mutex so they will not <br />
<br />
interrupt each other. How can I make the threads end? Where should I put the semaphors and mutex?<br />
*/<br />
<br />
#define PRODUCERS 20<br />
#define CONSUMERS 20<br />
#define PRODUCTS 25<br />
#define STACKMAX 100<br />
<br />
// Producers produce products with a product number between 0..PRODUCTS<br />
<br />
// array production og consumption store numbers for production and consumption<br />
// for each product.<br />
int production[PRODUCTS];<br />
int production_total;<br />
int consumption[PRODUCTS];<br />
int consumption_total;<br />
<br />
int stacksize;&nbsp; // stack can be 0..STACKSIZE-1, I need to use semaphore to watch out for highs and lows...<br />
int stack[STACKMAX];<br />
<br />
// This is how I learnt how to create a semaphore<br />
sem_t semaphore;<br />
<br />
//This is how a semaphore is usually used:<br />
//sem_wait(&amp;semaphore);<br />
//sem_post(&amp;semaphore);<br />
<br />
<br />
//This is how I learnt how to create a mutex - could need more<br />
pthread_mutex_t mutex;<br />
//This is how they're suppoes to be used<br />
//pthread_mutex_lock(&amp;mutex);<br />
//pthread_mutex_unlock(&amp;mutex);<br />
<br />
#define True 1<br />
#define False 0<br />
<br />
// If quitting = True then we're stopping and all threads should exit<br />
int quitting;<br />
<br />
<br />
void* producer(void *arg)<br />
{<br />
&nbsp; &nbsp; int product_number;<br />
<br />
&nbsp; &nbsp; printf(&quot;I'm a producer\n&quot;);<br />
<br />
&nbsp; &nbsp; return NULL;&nbsp; // This needs to be removed so the code will run<br />
<br />
&nbsp; &nbsp; // I need to change this code!&nbsp; Here I need at least one semaphore and probably one mutex.<br />
&nbsp; &nbsp; // The <br />
<br />
if.then.else used here is not the most suitable solution. <br />
&nbsp; &nbsp; while(!quitting)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if(stacksize&lt;STACKMAX)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; product_number=rand()%PRODUCTS;&nbsp; // Some number on between 0..PRODUCTS<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Put on stack<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stack[stacksize++]=product_number;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // and record it..<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; production[product_number]++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; production_total++;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;The stack is full!\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; return NULL;<br />
}<br />
<br />
void* consumer(void *arg)<br />
{<br />
&nbsp; &nbsp; int product_number;<br />
<br />
&nbsp; &nbsp; printf(&quot;I'm a consumer!\n&quot;);<br />
<br />
&nbsp; &nbsp; return NULL;&nbsp; // This return should delete<br />
<br />
&nbsp; &nbsp; // I need to change this code!&nbsp; Here I need at least one semaphore and probably one mutex.<br />
&nbsp; &nbsp; // The <br />
<br />
if.then.else used here is not the most suitable solution. <br />
<br />
&nbsp; &nbsp; while(!quitting)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if(stacksize&gt;0)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; product_number=stack[--stacksize];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; consumption[product_number]++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; consumption_total++;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;The stack is empty!\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; return NULL;<br />
}<br />
<br />
<br />
int main(int argc, char **argv)<br />
{<br />
&nbsp; &nbsp; pthread_t consumer_threads[CONSUMERS];<br />
&nbsp; &nbsp; pthread_t producer_threads[PRODUCERS];<br />
<br />
<br />
&nbsp; &nbsp; // Initialize the semaphore with a value of 1.<br />
&nbsp; &nbsp; // Note the second argument: passing zero denotes<br />
&nbsp; &nbsp; // that the semaphore is shared between threads (and<br />
&nbsp; &nbsp; // not processes).<br />
&nbsp; &nbsp; if(sem_init(&amp;semaphore, 0, 1))<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Could not initialize a semaphore\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; // Initialize the mutex<br />
&nbsp; &nbsp; if(pthread_mutex_init(&amp;mutex, NULL))<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Unable to initialize a mutex\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; // Null random generator<br />
&nbsp; &nbsp; srand(0);<br />
<br />
&nbsp; &nbsp; // Null all counters<br />
&nbsp; &nbsp; stacksize=0;<br />
&nbsp; &nbsp; consumption_total=0;<br />
&nbsp; &nbsp; production_total=0;<br />
&nbsp; &nbsp; for(int i=0;i&lt;PRODUCTS;i++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  consumption[i]=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  production[i]=0;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; // Consumers can look at this global variable to see if producers have stopped producing&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // and it's <br />
<br />
safe to quit<br />
&nbsp; &nbsp; quitting=False;<br />
<br />
&nbsp; &nbsp; // Print initial values<br />
&nbsp; &nbsp; printf(&quot;stacksize (should be 0) = %i\n&quot;,stacksize);<br />
&nbsp; &nbsp; printf(&quot;production_total = %i\n&quot;,production_total);<br />
&nbsp; &nbsp; printf(&quot;consumption_total = %i (needs to match production)\n&quot;,consumption_total);<br />
<br />
&nbsp; &nbsp; printf(&quot;Production array broken down:\n&quot;);<br />
&nbsp; &nbsp; for(int i=0;i&lt;PRODUCTS;i++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  printf(&quot;%i &quot;,production[i]);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; printf(&quot;\n&quot;);<br />
<br />
&nbsp; &nbsp; printf(&quot;Consumption array broken down (needs to match production array):\n&quot;);<br />
&nbsp; &nbsp; for(int i=0;i&lt;PRODUCTS;i++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  printf(&quot;%i &quot;,consumption[i]);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; printf(&quot;\n&quot;);<br />
<br />
<br />
&nbsp; &nbsp; // Start the producer<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; for(int i = 0; i &lt; PRODUCERS; ++i)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(pthread_create(&amp;producer_threads[i], NULL, &amp;producer, NULL))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Could not create thread %d\n&quot;, i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; // Start the consumer<br />
<br />
&nbsp; &nbsp; int thread_count=0;<br />
<br />
&nbsp; &nbsp; for(int i = 0; i &lt; CONSUMERS; ++i)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(pthread_create(&amp;consumer_threads[i], NULL, &amp;consumer, NULL))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Could not create thread %d\n&quot;, i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; // The main program sleeps for a while<br />
&nbsp; &nbsp; // then puts the global variable qutting = True , by that all consumers and producers <br />
&nbsp; &nbsp; //should stop <br />
<br />
producing.<br />
&nbsp; &nbsp; sleep(3);<br />
&nbsp; &nbsp; quitting=True; <br />
&nbsp; &nbsp; printf(&quot;Now the main program wants to quit...\n&quot;);<br />
<br />
<br />
&nbsp; &nbsp; for(int i = 0; i &lt; CONSUMERS; ++i)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(pthread_join(consumer_threads[i], NULL))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Could not join thread %d\n&quot;, i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; for(int i = 0; i &lt; PRODUCERS; ++i)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(pthread_join(producer_threads[i], NULL))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Could not join thread %d\n&quot;, i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; printf(&quot;All threads are dead\n&quot;);<br />
<br />
&nbsp; &nbsp; sem_destroy(&amp;semaphore);<br />
&nbsp; &nbsp; pthread_mutex_destroy(&amp;mutex);<br />
<br />
&nbsp; &nbsp; printf(&quot;All over.. now everything should match\n&quot;);<br />
&nbsp; &nbsp; printf(&quot;stacksize (should be 0) = %i\n&quot;,stacksize);<br />
&nbsp; &nbsp; printf(&quot;production_total = %i\n&quot;,production_total);<br />
&nbsp; &nbsp; printf(&quot;consumption_total = %i (needs to match production)\n&quot;,consumption_total);<br />
<br />
&nbsp; &nbsp; printf(&quot;Production array broken down:\n&quot;);<br />
&nbsp; &nbsp; for(int i=0;i&lt;PRODUCTS;i++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  printf(&quot;%i &quot;,production[i]);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; printf(&quot;\n&quot;);<br />
<br />
&nbsp; &nbsp; printf(&quot;Consumption array broken down (needs to match production array):\n&quot;);<br />
&nbsp; &nbsp; for(int i=0;i&lt;PRODUCTS;i++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  printf(&quot;%i &quot;,consumption[i]);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; printf(&quot;\n&quot;);<br />
<br />
&nbsp; &nbsp; return 0;<br />
}</pre></div>  <br /> <div style="padding:5px">     <fieldset class="fieldset"> <legend>Attached Files</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/cpp.gif" alt="File Type: cpp" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12485&amp;d=1257622925">project_1.cpp</a> (7.1 KB)</td> </tr> </table> </fieldset>  </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>hakan5</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236854.html</guid>
		</item>
		<item>
			<title>how to redirect speech received by Skype? //and Skype vs Fring</title>
			<link>http://www.daniweb.com/forums/thread236850.html</link>
			<pubDate>Sat, 07 Nov 2009 19:33:56 GMT</pubDate>
			<description><![CDATA[Hello :-)! 
 
I'd like to create application for mobile phone (maximum price of phone would be about 220USD, it is for Central Europe; I will be testing the application on Sony Ericsson k750i and maybe on Motorola V500). The application must recognize speech and properly react for recognized...]]></description>
			<content:encoded><![CDATA[<div>Hello :-)!<br />
<br />
I'd like to create application for mobile phone (maximum price of phone would be about 220USD, it is for Central Europe; I will be testing the application on Sony Ericsson k750i and maybe on Motorola V500). The application must recognize speech and properly react for recognized numbers (calculate control sum and respond). I'd like to use CMU Sphinx, but I still need to decide whether it would be [1] or [2]. Solution [1] is as follows: speech recognition on mobile phone (PocketSpinx) and sending results to server (post, httpconnection; I also tried Wireless Messaging API but it didn't work properly). Aprroach no. [2]: redirecting of speech from mobile phone to server (I thought about Digium + Asterisk but Digium cards are rather expensive) and speech recognition on server (Sphinx4).<br />
<br />
I think I will choose the [2]-nd option, however I thought about different way of connecting to internet, because those Digium cards are expensive. I thought about GSM/3G or CDMA but I'm not sure whether those would be good enough to ensure real time speech between user on mobile phone and program on server.<br />
<br />
Somebody suggested me that mobile phone with Skype would be cheap and good option. I will be using this application in the place where they've got office with access to cable internet and fax, and mobile phone would be several kilometers from the office. From my point of view, creating wireless network with some kilometers of range would be too expensive and there may be too many distortions of signal. And here I've got question for you. Let's assume I've got mobile phone. On this phone I installed Skype and the phone has access to internet (GSM/3G or CDMA). I also have got Skype and Sphinx4 on server. How should I configure it so that Skype on server can automatically receive the call from mobile phone and redirect it to Sphinx4, and server can answer from time to time to Skype? In other words: a) how to allow Skype to receive automatically call from mobile phone?, b) how to redirect speech from Skype to other application? (I also thought about Fring, which may be alternative for Skype).<br />
<br />
Thanks very much for your answer in advance :-)!<br />
Greetings :-)!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>johnyjj2</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236850.html</guid>
		</item>
		<item>
			<title>get the databse table names</title>
			<link>http://www.daniweb.com/forums/thread236849.html</link>
			<pubDate>Sat, 07 Nov 2009 19:07:42 GMT</pubDate>
			<description>dear all, 
 
what is the sql command for ms access 2007 to get the tables name of the database? and also how to put these names into a list box? 
 
 
thanks in advanced. 
 
 
4ukh</description>
			<content:encoded><![CDATA[<div>dear all,<br />
<br />
what is the sql command for ms access 2007 to get the tables name of the database? and also how to put these names into a list box?<br />
<br />
<br />
thanks in advanced.<br />
<br />
<br />
4ukh</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum4.html">Visual Basic 4 / 5 / 6</category>
			<dc:creator>4ukh</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236849.html</guid>
		</item>
		<item>
			<title><![CDATA[[seraching for c++ coders]]]></title>
			<link>http://www.daniweb.com/forums/thread236848.html</link>
			<pubDate>Sat, 07 Nov 2009 19:03:13 GMT</pubDate>
			<description>Hello every one. I would like to ask any one who is able to code c++  if any one would like to work on a new code for a new or old game Final Fantasy XI. 
 
Projectxi.org is doing some good work, but could really use some help from you guys, and it would be a honor to have some of your help. We...</description>
			<content:encoded><![CDATA[<div>Hello every one. I would like to ask any one who is able to code c++  if any one would like to work on a new code for a new or old game Final Fantasy XI.<br />
<br />
Projectxi.org is doing some good work, but could really use some help from you guys, and it would be a honor to have some of your help. We have a massaive lagg issuse and our conectioion is only letting us allow 9 players to play on one server. So I thought It would be a good idea to ask you for help.<br />
But if your willing to just check out the code and maybe post some ideas at projectxi.org for help This would be very awsome.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>mancent</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236848.html</guid>
		</item>
		<item>
			<title>which c++ software is best?</title>
			<link>http://www.daniweb.com/forums/thread236847.html</link>
			<pubDate>Sat, 07 Nov 2009 19:02:16 GMT</pubDate>
			<description>which c++ compiler is easy n best? i want to download........... 
 
guide me......</description>
			<content:encoded><![CDATA[<div>which c++ compiler is easy n best? i want to download...........<br />
<br />
guide me......</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>IT seeker</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236847.html</guid>
		</item>
		<item>
			<title><![CDATA[Cramer's Rule please]]></title>
			<link>http://www.daniweb.com/forums/thread236844.html</link>
			<pubDate>Sat, 07 Nov 2009 18:56:14 GMT</pubDate>
			<description><![CDATA[Hello does anyone have the codes to solve linear equations using cramer's rule]]></description>
			<content:encoded><![CDATA[<div>Hello does anyone have the codes to solve linear equations using cramer's rule</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>vickkeshav</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236844.html</guid>
		</item>
		<item>
			<title>building sphinx4 helloworld in netbeans - errors</title>
			<link>http://www.daniweb.com/forums/thread236843.html</link>
			<pubDate>Sat, 07 Nov 2009 18:52:41 GMT</pubDate>
			<description><![CDATA[Hello :-)! 
 
There is a problem with building project in NetBeans. 
 
I've got two directories sphinx4-1.0beta3-src and sphinx4-1.0beta3-bin, which are part of speech recognition system CMU Sphinx, Sphinx4 is written in Java. In the directory S:\tutorial\sphinx4-1.0beta3-bin\bin I've got some .jar...]]></description>
			<content:encoded><![CDATA[<div>Hello :-)!<br />
<br />
There is a problem with building project in NetBeans.<br />
<br />
I've got two directories sphinx4-1.0beta3-src and sphinx4-1.0beta3-bin, which are part of speech recognition system CMU Sphinx, Sphinx4 is written in Java. In the directory S:\tutorial\sphinx4-1.0beta3-bin\bin I've got some .jar files, e.g. HelloDigits.jar. In S:\tutorial\sphinx4-1.0beta3-src there is no bin directory, however there are some directories here S:\tutorial\sphinx4-1.0beta3-src\src\apps\edu\cmu\sphinx\demo, e.g. S:\tutorial\sphinx4-1.0beta3-src\src\apps\edu\cmu\sphinx\demo\hellodigits contains five files: digits.gram, hellodigits.config.xml, HelloDigits.java, hellodigits.Manifest, README.html. The file readme is the same as here: <a rel="nofollow" class="t" href="http://cmusphinx.sourceforge.net/sphinx4/src/apps/edu/cmu/sphinx/demo/helloworld/README.html" target="_blank">http://cmusphinx.sourceforge.net/sph...ld/README.html</a> . I'm sure I've got jsapi.jar.<br />
<br />
In other words in one directory (sphinx4-1.0beta3-bin) I have got executable .jar files (or rather not executable, but to be interpreted by JVM). In other (sphinx4-1.0beta3-src) I have got source codes of those applications. There are some additional files, not only .java source code. The most important are two of them, i.e. .java and .xml.<br />
<br />
In order to run the HelloDigits.jar I do the following in Command Prompt &quot;S:\tutorial\sphinx4-1.0beta3-bin\java -mx256m -jar bin/HelloWorld.jar&quot;. It shows me proper thing, i.e. asks me to start speaking.<br />
<br />
OK, so I know how to run already existing application. But if I'd like to create my own, I need to follow this <a rel="nofollow" class="t" href="http://cmusphinx.sourceforge.net/sphinx4/#setupide" target="_blank">http://cmusphinx.sourceforge.net/sphinx4/#setupide</a> . First of all I create new project (File -&gt; New Project; I leave default values). I need to follow first step. In Projects -&gt; Source Packages I've got &quot;javaapplication -&gt; Main.java&quot;. I simply drag-and-drop those three folders from S:\tutorial\sphinx4-1.0beta3-src\src (those are apps, research, sphinx4) and after some seconds I've got several more things in Source Packages, e.g. &quot;apps.edu.cmu.sphinx.demo&quot;. In order to fulfill the second step, I click right mouse button on Libraries and choose &quot;Add JAR/Folder&quot;. I add from this directory S:\tutorial\sphinx4-1.0beta3-src\lib three files, i.e. js.jar, jsapi.jar and tags.jar. It was surprise for me that there was not tags.jar in S:\tutorial\sphinx4-1.0beta3-src\lib so I copied it from sphinx4-1.0beta3-src directory. Now I've got four things in Libraries, three new and one already existing (JDK 1.6 (Default)).<br />
<br />
In Main.java I've got default code of NetBeans which is definitely not what I want to have. Some tips how to create my own applications are here <a rel="nofollow" class="t" href="http://cmusphinx.sourceforge.net/sphinx4/doc/ProgrammersGuide.html#hellodigits" target="_blank">http://cmusphinx.sourceforge.net/sph...ml#hellodigits</a> . I replace default code completely with that one from example. I click &quot;Build main project&quot; in the menu. After some time it creates me C:\Documents and Settings\MainAccount\Moje dokumenty\NetBeansProjects\JavaApplication4 and there is unfortunately &quot;BUILD FAILED (total time: 8 seconds)&quot;. Those errors are included with this post.<br />
<br />
What should I do to build the project properly?<br />
<br />
Thanks very much for your help in advance :-)!<br />
Greetings :-)!</div>  <br /> <div style="padding:5px">     <fieldset class="fieldset"> <legend>Attached Files</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/txt.gif" alt="File Type: txt" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12482&amp;d=1257619957">123b errors when building helloworld in netbeans.txt</a> (26.7 KB)</td> </tr> </table> </fieldset>  </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>johnyjj2</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236843.html</guid>
		</item>
		<item>
			<title>problem with date class</title>
			<link>http://www.daniweb.com/forums/thread236842.html</link>
			<pubDate>Sat, 07 Nov 2009 18:51:13 GMT</pubDate>
			<description>please if someone can help me i have probleams in the constructor of the class, how can i pass parameters to date constructor.....</description>
			<content:encoded><![CDATA[<div>please if someone can help me i have probleams in the constructor of the class, how can i pass parameters to date constructor.....</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>jaque322</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236842.html</guid>
		</item>
		<item>
			<title>Threads in an instant messaging program</title>
			<link>http://www.daniweb.com/forums/thread236838.html</link>
			<pubDate>Sat, 07 Nov 2009 18:42:08 GMT</pubDate>
			<description><![CDATA[I'm trying to write an instant messaging program in Java. What I have coded so far, goes like this: Each client connects to a thread created by the server, to which he/she sends the message. My doubt is, how can I kill all the threads that have been created by the main program when the...]]></description>
			<content:encoded><![CDATA[<div>I'm trying to write an instant messaging program in Java. What I have coded so far, goes like this: Each client connects to a thread created by the server, to which he/she sends the message. My doubt is, how can I kill all the threads that have been created by the main program when the administrator presses de 'q' in the keyboard. I made a class for a thread whose only function is to read the 'q' from the keyboard, but, how can I notify to the main program  that it must kill all the threads?<br />
<br />
This is the Server (it is not complete):<br />
 <pre style="margin:20px; line-height:13px">public class Server {<br />
&nbsp; &nbsp; public static void main(String[] args) throws IOException {<br />
&nbsp; &nbsp; &nbsp; &nbsp; ServerSocket serverSocket = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; boolean listening = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new StdinReaderThread();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; serverSocket = new ServerSocket(4444);<br />
&nbsp; &nbsp; &nbsp; &nbsp; } catch (IOException e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.err.println(&quot;Could not create socket&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.exit(-1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (listening){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new ServerThread(serverSocket.accept()).start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; serverSocket.close();<br />
&nbsp; &nbsp; }<br />
}</pre><br />
This is the thread which reads 'q' from keyboard:<br />
<br />
 <pre style="margin:20px; line-height:13px">public class StdinReaderThread implements Runnable{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BufferedReader stdin;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public StdinReaderThread(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Thread subpr = new Thread(this,&quot;x&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stdin = new BufferedReader( new InputStreamReader(System.in));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subpr.start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void run(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (true){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String stdinline = stdin.readLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( stdinline.startsWith(&quot;q&quot;)){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;end&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if( stdinline.startsWith(&quot;m&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;send message&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if( stdinline.startsWith(&quot;l&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;send login&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if( stdinline.startsWith(&quot;u&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;list users&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception e){}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>eleal</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236838.html</guid>
		</item>
		<item>
			<title>sudoku solver problem</title>
			<link>http://www.daniweb.com/forums/thread236835.html</link>
			<pubDate>Sat, 07 Nov 2009 18:25:51 GMT</pubDate>
			<description><![CDATA[hi, i have to make a sudoku solver using python quickdraw, 
i've  started on it and this is what i got so far 
here is the link to the assignment http://pages.cpsc.ucalgary.ca/~zongpeng/CPSC231/assignments/A4/a4.pdf 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>hi, i have to make a sudoku solver using python quickdraw,<br />
i've  started on it and this is what i got so far<br />
here is the link to the assignment <a rel="nofollow" class="t" href="http://pages.cpsc.ucalgary.ca/~zongpeng/CPSC231/assignments/A4/a4.pdf" target="_blank">http://pages.cpsc.ucalgary.ca/~zongp...ents/A4/a4.pdf</a><br />
 <pre style="margin:20px; line-height:13px">def solveRows():<br />
&nbsp; &nbsp; &quot;&quot;&quot;eliminates solved numbers by row&quot;&quot;&quot;<br />
&nbsp; &nbsp; for x in range(0, 81, 9):<br />
&nbsp; &nbsp; &nbsp; &nbsp; row = puzzle[x : x+9]#loops through each row<br />
&nbsp; &nbsp; &nbsp; &nbsp; for space in row: #loops through each space<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if len(space) == 1: #space is solved<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for space2 in row: #loops through spaces again<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if len(space2) != 1: #space isnt already solved<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if space[0] in space2: #the solved number is a possibility<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; del space2[space2.index(space[0])] #deletes the number as a possiblbitly&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
def solveColumns():<br />
&nbsp; &nbsp; &quot;&quot;&quot;eliminates solved numbers by column&quot;&quot;&quot;<br />
&nbsp; &nbsp; rows = []#splits up the puzzle into rows<br />
&nbsp; &nbsp; for x in range(0, 81, 9):<br />
&nbsp; &nbsp; &nbsp; &nbsp; rows.append(puzzle[x:x+9])<br />
&nbsp; &nbsp; for n in range(0, 9):<br />
&nbsp; &nbsp; &nbsp; &nbsp; column = [x[n] for x in rows] #loops through each column<br />
&nbsp; &nbsp; &nbsp; &nbsp; #the next part is taken from solveRows()<br />
&nbsp; &nbsp; &nbsp; &nbsp; for space in column: #loops through each space<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if len(space) == 1: #space is solved<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for space2 in column: #loops through spaces again<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if len(space2) != 1: #space isnt already solved<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if space[0] in space2: #the solved number is a possibility<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; del space2[space2.index(space[0])] #deletes the number as a possiblbitly<br />
<br />
def solveBoxes():<br />
&nbsp; &nbsp; &quot;&quot;&quot;eliminates solved numbers by box&quot;&quot;&quot;<br />
&nbsp; &nbsp; rows = []#splits up the puzzle into rows<br />
&nbsp; &nbsp; for x in range(0, 81, 9):<br />
&nbsp; &nbsp; &nbsp; &nbsp; rows.append(puzzle[x:x+9])<br />
&nbsp; &nbsp; #this next part just splits the puzzle into boxes<br />
&nbsp; &nbsp; for x in range(0, 9, 3):<br />
&nbsp; &nbsp; &nbsp; &nbsp; for y in range(0, 9, 3):<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tempRows = rows[x:x+3]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tempBox = [row[y:y+3] for row in tempRows]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #the next part just formats the box<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #basically it was a list of lists of lists<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #and i need it as a list of lists<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box = []<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for row in tempBox:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for space in row:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box.append(space)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #the next part is taken from solveRows()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for space in box: #loops through each space<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if len(space) == 1: #space is solved<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for space2 in box: #loops through spaces again<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if len(space2) != 1: #space isnt already solved<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if space[0] in space2: #the solved number is a possibility<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; del space2[space2.index(space[0])] #deletes the number as a possiblbitly<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
def isSolved():<br />
&nbsp; &nbsp; &quot;&quot;&quot;Checks to see if the puzzle is solved&quot;&quot;&quot;<br />
&nbsp; &nbsp; for x in puzzle:<br />
&nbsp; &nbsp; &nbsp; &nbsp; if len(x) != 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return False<br />
&nbsp; &nbsp; else:<br />
&nbsp; &nbsp; &nbsp; &nbsp; return True<br />
&nbsp; &nbsp; <br />
def main():<br />
&nbsp; &nbsp; while True:<br />
&nbsp; &nbsp; &nbsp; &nbsp; temp = puzzle #used to see when puzzle is solved<br />
&nbsp; &nbsp; &nbsp; &nbsp; solveBoxes()<br />
&nbsp; &nbsp; &nbsp; &nbsp; solveRows()<br />
&nbsp; &nbsp; &nbsp; &nbsp; solveColumns()<br />
&nbsp; &nbsp; &nbsp; &nbsp; if isSolved():#puzzle is solved<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return<br />
<br />
def display():<br />
&nbsp; &nbsp; &quot;&quot;&quot; displays the puzzle&quot;&quot;&quot;<br />
&nbsp; &nbsp; copy = puzzle #copy of the puzzle<br />
&nbsp; &nbsp; copy = map(str, [x[0] for x in copy]) #makes the ints strs so i can use S.join()<br />
&nbsp; &nbsp; #next part just displays the puzzle all nice and pretty<br />
&nbsp; &nbsp; for x in range(0, 9):<br />
&nbsp; &nbsp; &nbsp; &nbsp; print ', '.join(copy[x:x+9])<br />
<br />
def getInput():<br />
&nbsp; &nbsp; &quot;&quot;&quot;gets a puzzle to be solved from the user&quot;&quot;&quot;<br />
&nbsp; &nbsp; puzzle = []<br />
&nbsp; &nbsp; for x in range(1, 10): #1 for each line of the puzzle<br />
&nbsp; &nbsp; &nbsp; &nbsp; puzzle.append(raw_input('enter one line of the puzzle '))<br />
&nbsp; &nbsp; puzStr = '\n'.join(puzzle)<br />
&nbsp; &nbsp; puzzle = []#a soon to be matrix holding possibilities for each space<br />
&nbsp; &nbsp; for letter in puzStr:<br />
&nbsp; &nbsp; &nbsp; &nbsp; if letter == 'x':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; puzzle.append(range(1, 10)) #adds all possibilities if square is blank<br />
&nbsp; &nbsp; &nbsp; &nbsp; elif letter == '\n' or letter ==' ':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue<br />
&nbsp; &nbsp; &nbsp; &nbsp; else:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; puzzle.append([int(letter)]) #adds the already given number<br />
&nbsp; &nbsp; return puzzle<br />
<br />
print &quot;&quot;&quot;This program will solve some suDoku puzzles<br />
If it can't it will just hang indefinately so give it a little<br />
while then if nothing happens assume that either you entered<br />
the puzzle incorrectly, it is not solvable, or this program<br />
can't solve it.<br />
<br />
Begin by entering the puzzle in line by line.<br />
Represent empty spaces by an 'x'. So a line<br />
migh look like '6x12x897x'. This program as of now<br />
will not catch your errors so try not to make mistakes.<br />
You can but do not have to add any spaces when entering the puzzle.<br />
<br />
Enjoy!<br />
&quot;&quot;&quot;<br />
puzzle = getInput()<br />
main()<br />
print 'The answer is:'<br />
print<br />
display()</pre>i don't know what to do next,i'[ve tried putting like<br />
 6x12x897x, x8x6x5x2x, x54xxxxx1, 4xx796xxx, x9xxxxx1x<br />
xxx182xx7, 3xxxxx75x,  x7x3x9x4x, x285x41x3<br />
didn't work and it said errno #22 close failed<br />
so, am i doing the assignment right</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>moazmizo</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236835.html</guid>
		</item>
		<item>
			<title>Bacteria Growth</title>
			<link>http://www.daniweb.com/forums/thread236834.html</link>
			<pubDate>Sat, 07 Nov 2009 18:24:50 GMT</pubDate>
			<description>Having trouble with this one: 
 
The formula y = nekt  can be used for estimating growth where 
 
n is the initial amount 
k is a constant 
t is the time 
y is the final amount 
 
This formula will be used for estimating the bacteria growth in a lab experiment. The output should look similar to:</description>
			<content:encoded><![CDATA[<div>Having trouble with this one:<br />
<br />
The formula y = nekt  can be used for estimating growth where<br />
<br />
n is the initial amount<br />
k is a constant<br />
t is the time<br />
y is the final amount<br />
<br />
This formula will be used for estimating the bacteria growth in a lab experiment. The output should look similar to:<br />
<br />
Enter intial bacteria amount:<br />
5.0<br />
Enter a constant value for k:<br />
0.8<br />
<br />
Time(hours)     Bacteria<br />
<br />
1                      11.13<br />
2                      24.77<br />
3                      55.12<br />
4                    122.66<br />
5                    272.99<br />
6                    607.55<br />
7                  1352.13<br />
8                  3009.23<br />
<br />
<br />
In the class Mymath , write two different methods:<br />
<br />
a. Prompts the user initial bacteria and the constant k in the method.<br />
<br />
b. Get the user initial bacteria and the constant k from the main method.<br />
<br />
Write a main method to test the two methods above.<br />
<br />
My coding:<br />
 <pre style="margin:20px; line-height:13px">import java.util.Scanner;<br />
public class bacteriagrowth <br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String &#91;&#93;args)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scanner input = new Scanner (System.in);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter initial bacteria amount: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; n = input.nextDouble();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double k;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Enter a constant value for k: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; k = input.nextDouble();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double t = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double y = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (t&lt;=8)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = Math.pow(n*Math.E, (k*t));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; t = t +1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.printf(&quot;time&quot; + t, y);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>kulrik</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236834.html</guid>
		</item>
		<item>
			<title>mean and standard deviation confused</title>
			<link>http://www.daniweb.com/forums/thread236833.html</link>
			<pubDate>Sat, 07 Nov 2009 18:17:54 GMT</pubDate>
			<description>I am really confused by this problem. PLEASE HELP 
 
Write a program that reads a set of floating point data values from the input. When the user indicates the end of the input, print out  the count if the values, the average, and the standard deviation. The average of a data set is x1,......,xn is...</description>
			<content:encoded><![CDATA[<div>I am really confused by this problem. PLEASE HELP<br />
<br />
Write a program that reads a set of floating point data values from the input. When the user indicates the end of the input, print out  the count if the values, the average, and the standard deviation. The average of a data set is x1,......,xn is <br />
<br />
t = Σxi/n<br />
<br />
where Σx1 = x1+...+xn is the sum of the input values. The standard deviation is:<br />
<br />
s=Math.sqrt(Σxi^2 - (1/n)*(Σxi)^2/n-1)<br />
<br />
my professor asks me to Create a method in the class Mymath to print out the count of values, the average, and the standard deviation. Use the numerically less stable formula to find the standard deviation.<br />
<br />
and this is what the output should be:<br />
<br />
1<br />
2<br />
3<br />
4<br />
5<br />
6<br />
-1<br />
<br />
Count of values: 6<br />
Average: 3.50<br />
Standard Deviation: 1.87</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>kulrik</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236833.html</guid>
		</item>
		<item>
			<title>Compiler not working on my pc</title>
			<link>http://www.daniweb.com/forums/thread236831.html</link>
			<pubDate>Sat, 07 Nov 2009 17:56:35 GMT</pubDate>
			<description>i hav installed Turbo C++ 3.0 on my pc and whenever i dbl click on TC.exe 
the screen turns black and after 2-3 secs the screen becomes normal  
i mean the compiler doesnt start same happens with borland 5.5 C++ 
builder 
pls help me as i hav no s/w on which i can practice my programs n in 5 days i...</description>
			<content:encoded><![CDATA[<div>i hav installed Turbo C++ 3.0 on my pc and whenever i dbl click on TC.exe<br />
the screen turns black and after 2-3 secs the screen becomes normal <br />
i mean the compiler doesnt start same happens with borland 5.5 C++<br />
builder<br />
pls help me as i hav no s/w on which i can practice my programs n in 5 days i hav practical exam in college<br />
<br />
can anyone help<br />
is there ny fault with my pc or something else <br />
reply asap<br />
wat should i do now</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>nick1188</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236831.html</guid>
		</item>
		<item>
			<title>Problem with Bitwise Masking</title>
			<link>http://www.daniweb.com/forums/thread236830.html</link>
			<pubDate>Sat, 07 Nov 2009 17:48:34 GMT</pubDate>
			<description><![CDATA[Ok so I make my masks  
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a> </div> <div>(<a...]]></description>
			<content:encoded><![CDATA[<div>Ok so I make my masks <br />
 <pre style="margin:20px; line-height:13px">short m1, m2, m3, m4;<br />
<br />
m1 = 0xF000;<br />
m2 = 0x0F00;<br />
m2 = 0x00F0;<br />
m3 = 0x000F;</pre><br />
and then I test my masks <br />
 <pre style="margin:20px; line-height:13px">printf(&quot;%hd %hd %hd %hd\n&quot;, m1, m2, m3, m4);</pre><br />
when I test it the values come out as<br />
 <pre style="margin:20px; line-height:13px">-4096 240 15 0</pre><br />
which is equal to <br />
<br />
 <pre style="margin:20px; line-height:13px">0xF000<br />
0x00F0<br />
0x000F<br />
0x0000</pre><br />
which is messing up my checksum program when I try to apply the masks. :-\<br />
<br />
Any advice?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum118.html">C</category>
			<dc:creator>Kombat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236830.html</guid>
		</item>
		<item>
			<title>Problem with ComboBox display</title>
			<link>http://www.daniweb.com/forums/thread236829.html</link>
			<pubDate>Sat, 07 Nov 2009 17:25:54 GMT</pubDate>
			<description>Hi all, 
For a combobox I was trying to imitate the behaviour of this code example:http://msdn.microsoft.com/en-us/library/system.windows.forms.listcontrol.valuemember.aspx 
So I have this class: 
class Planet 
    { 
        private string myName; 
        private double...</description>
			<content:encoded><![CDATA[<div>Hi all,<br />
For a combobox I was trying to imitate the behaviour of this code example:<a rel="nofollow" class="t" href="http://msdn.microsoft.com/en-us/library/system.windows.forms.listcontrol.valuemember.aspx" target="_blank">http://msdn.microsoft.com/en-us/libr...luemember.aspx</a><br />
So I have this class:<br />
 <pre style="margin:20px; line-height:13px">class Planet<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; private string myName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; private double myGravitationalAcceleration;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Planet(string strName, double Acceleration)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.myName = strName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.myGravitationalAcceleration = Acceleration;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public string Name<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return myName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public double GravitationalAcceleration<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return myGravitationalAcceleration;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</pre>And a form with a combobox on it and this code:<br />
 <pre style="margin:20px; line-height:13px">public partial class InputData : Form<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; public InputData()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitializeComponent();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List&lt;Planet&gt; Planets = new List&lt;Planet&gt;();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Planets.Add(new Planet(&quot;Earth at equator 0°&quot;, 9.78));&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Planets.Add(new Planet(&quot;Earth at equinox 23.5°&quot;, 9.788));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Planets.Add(new Planet(&quot;Earth at lattitude 50°&quot;, 9.81));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Planets.Add(new Planet(&quot;Earth at pole 90°&quot;, 9.83));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Planets.Add(new Planet(&quot;Moon&quot;, 1.63));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Planets.Add(new Planet(&quot;Mars&quot;, 3.69));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Planets.Add(new Planet(&quot;Venus&quot;, 8.87));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Planets.Add(new Planet(&quot;Titan&quot;, 1.352));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GraviAccelCombo.DataSource = Planets;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //add names of properties here, seems cool!<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GraviAccelCombo.DisplayMember = &quot;Name&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GraviAccelCombo.ValueMember = &quot;GravitationalAcceleration&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //private void GraviAccelCombo_SelectedIndexChanged(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; //{<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; GraviAccelCombo.Text = GraviAccelCombo.SelectedValue.ToString();<br />
&nbsp; &nbsp; &nbsp; &nbsp; //}<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void GraviAccelCombo_SelectedValueChanged(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (GraviAccelCombo.SelectedIndex != -1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GraviAccelCombo.Text = GraviAccelCombo.SelectedValue.ToString();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</pre><br />
What I want is: the user selects a planet(yeah there are moons too) name and in the display area of the combo I like to display the gravitational acceleration value. So if I select &quot;Venus&quot; from the dropdownlist, GraviAccelCombo.Text is equal to 8.87, but the word &quot;Venus&quot; gets still displayed instead of &quot;8.87&quot;. Have a feeling it must be something very obvious, but I have no clue what so ever.<br />
Any help is again greatly appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>ddanbe</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236829.html</guid>
		</item>
		<item>
			<title>Why this code doesnt work?</title>
			<link>http://www.daniweb.com/forums/thread236828.html</link>
			<pubDate>Sat, 07 Nov 2009 17:19:45 GMT</pubDate>
			<description><![CDATA[Hello.. 
Ive written this code which dont work, its jobis simply recieving names from the user in a structure [a] and delete a name that chosen by user, the compiler give me error flag in the line noticed bellow:) 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>Hello..<br />
Ive written this code which dont work, its jobis simply recieving names from the user in a structure [a] and delete a name that chosen by user, the compiler give me error flag in the line noticed bellow:)<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream.h&gt;<br />
#include &lt;conio.h&gt;<br />
<br />
struct m{<br />
&nbsp; &nbsp; &nbsp;  char n[15];&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  };<br />
&nbsp; &nbsp; &nbsp;  <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
void main()&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
{<br />
&nbsp;  m a[50];&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; char name[15];&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp;  int i,size;<br />
&nbsp; &nbsp; cin&gt;&gt;size;&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; <br />
&nbsp;  <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; for(i=0;i&lt;size;i++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;entr elements&quot;;<br />
&nbsp; &nbsp; cin&gt;&gt;(a[i]).n;<br />
<br />
}<br />
cout&lt;&lt;&quot;enter elment&quot;;<br />
&nbsp; &nbsp; cin&gt;&gt;name;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; for (int j=0;j&lt;size;j++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; if((a[j]).n==name)<br />
&nbsp; &nbsp; for(int c=j; c&lt;size;c++)<br />
&nbsp; &nbsp; ((a[c]).n)=((a[c+1]).n);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //this is The LINE<br />
}<br />
&nbsp; &nbsp; for(i=0;i&lt;size;i++)<br />
&nbsp; &nbsp; cout&lt;&lt;(a[i]).n&lt;&lt;endl;<br />
&nbsp; &nbsp; <br />
getch();<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>lucky_43</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236828.html</guid>
		</item>
		<item>
			<title>If then Statement in excel using data in 2-3 columns</title>
			<link>http://www.daniweb.com/forums/thread236826.html</link>
			<pubDate>Sat, 07 Nov 2009 17:08:23 GMT</pubDate>
			<description><![CDATA[I am trying to create an If Then statement to use in an excel spreadsheet using data from 2 or 3 columns.  
 Column AB has text.  Column AA has a date in it.   I need the statement to say if column AB says RFEP or TRFE and Column AA is greater than 08/01/07, the true value is "Y" and the false...]]></description>
			<content:encoded><![CDATA[<div>I am trying to create an If Then statement to use in an excel spreadsheet using data from 2 or 3 columns. <br />
 Column AB has text.  Column AA has a date in it.   I need the statement to say if column AB says RFEP or TRFE and Column AA is greater than 08/01/07, the true value is &quot;Y&quot; and the false value is &quot;N&quot;.  <br />
=IF((AA2&gt;08/01/07)+(AB2=&quot;RFEP&quot;),&quot;Yes&quot;,&quot;No&quot;)  This is only picking up the date in AA2.  I tried the &amp; for a connector and got “value” only. <br />
As you can see, I haven't even tried to add the TRFE information.<br />
<br />
I would also like to add column X to the mix.  If column X has a &quot;Y&quot; in it, it would also be included in the true value of &quot;Y&quot;.  However, I would be very happy with just the first two items.<br />
Thank you for the help.</div>  <br /> <div style="padding:5px">     <fieldset class="fieldset"> <legend>Attached Files</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/txt.gif" alt="File Type: txt" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12480&amp;d=1257613226">sample data for formula.txt</a> (33.7 KB)</td> </tr> </table> </fieldset>  </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum4.html">Visual Basic 4 / 5 / 6</category>
			<dc:creator>brendajean</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236826.html</guid>
		</item>
		<item>
			<title>Need Help on Reverse Polish Notation program code</title>
			<link>http://www.daniweb.com/forums/thread236825.html</link>
			<pubDate>Sat, 07 Nov 2009 17:05:50 GMT</pubDate>
			<description><![CDATA[I am having problems with my reverse polish calculator code.  The code is as follows: 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code...]]></description>
			<content:encoded><![CDATA[<div>I am having problems with my reverse polish calculator code.  The code is as follows:<br />
<br />
 <pre style="margin:20px; line-height:13px">import operator<br />
<br />
OPERATORS = {<br />
&nbsp; &nbsp; &nbsp; &nbsp; '+': operator.add,<br />
&nbsp; &nbsp; &nbsp; &nbsp; '-': operator.sub,<br />
&nbsp; &nbsp; &nbsp; &nbsp; '*': operator.mul,<br />
&nbsp; &nbsp; &nbsp; &nbsp; '/': operator.div,<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
class Stack(object):<br />
&nbsp; &nbsp; &quot;Creates a stack to enter numbers or operators into&quot;<br />
<br />
&nbsp; &nbsp; def __init__(self):<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.storage = [0,0,0,0]<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.sptn = -1&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; def push(self, item):<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.sptn = self.sptn + 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.storage[self.sptn] = item<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; def pop(self):<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.sptn = self.sptn -1<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; def top(self):&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; return self.storage[self.sptn]<br />
<br />
&nbsp; &nbsp; def __rep__(self):<br />
&nbsp; &nbsp; &nbsp; &nbsp; return self.storage[:self.sptn + 1]<br />
&nbsp; &nbsp; <br />
<br />
def get_input():<br />
<br />
&nbsp; &nbsp; equation = raw_input(&quot;Enter the equation in reverse polish notation: &quot;)<br />
&nbsp; &nbsp; return equation<br />
<br />
def evaluate_rpn(equation):<br />
<br />
&nbsp; &nbsp; s = Stack()<br />
<br />
&nbsp; &nbsp; try:<br />
&nbsp; &nbsp; &nbsp; &nbsp; for item in equation.split():<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = float(item)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s.push(result)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except ValueError:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x = s.pop()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = s.pop()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = OPERATORS[item](x, y)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s.push(result)<br />
&nbsp; &nbsp; &nbsp; &nbsp; result = s.top()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; except IndexError:<br />
&nbsp; &nbsp; &nbsp; &nbsp; print &quot;Please input at least two numbers before entering an operator.&quot;<br />
<br />
def main():<br />
&nbsp; &nbsp; equation = get_input()<br />
&nbsp; &nbsp; answer = evaluate_rpn(raw_input(&quot;Enter the equation in reverse polish notation: &quot;))<br />
&nbsp; &nbsp; print answer</pre><br />
The code trips up when it hits an operator for some reason.  The line is causing me trouble is the &quot;results = OPERATOR[item] (x, y)&quot;<br />
<br />
I would appreaciate any help!!!  Please!!!<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>ljvasil</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236825.html</guid>
		</item>
		<item>
			<title>numpy array rows and columns</title>
			<link>http://www.daniweb.com/forums/thread236824.html</link>
			<pubDate>Sat, 07 Nov 2009 17:03:10 GMT</pubDate>
			<description><![CDATA[Hey. I'm importing an array in a text file via array=numpy.loadtxt("testdata.txt"). 
Is there an easy way to count the number of rows and columns? Maybe something like x=numpy.countrow(array)? 
I've had a look around and couldn't find anything suitable. 
Thanks, Alex]]></description>
			<content:encoded><![CDATA[<div>Hey. I'm importing an array in a text file via  <pre style="margin:20px; line-height:13px">array=numpy.loadtxt(&quot;testdata.txt&quot;)</pre>.<br />
Is there an easy way to count the number of rows and columns? Maybe something like  <pre style="margin:20px; line-height:13px">x=numpy.countrow(array)</pre>?<br />
I've had a look around and couldn't find anything suitable.<br />
Thanks, Alex</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>Chromana</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236824.html</guid>
		</item>
		<item>
			<title>Grabbing a reference to or pointer to...</title>
			<link>http://www.daniweb.com/forums/thread236823.html</link>
			<pubDate>Sat, 07 Nov 2009 16:59:14 GMT</pubDate>
			<description><![CDATA[Hi guys, 
 
I was hoping someone could explain to me how I would go about grabbing a pointer/reference to my variable 'textName' contained within the Reports class, (some code omitted to try to simplify the scenario) 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>Hi guys,<br />
<br />
I was hoping someone could explain to me how I would go about grabbing a pointer/reference to my variable 'textName' contained within the Reports class, (some code omitted to try to simplify the scenario)<br />
<br />
 <pre style="margin:20px; line-height:13px">//Reports.h<br />
class Reports : public wxPanel <br />
{<br />
public:<br />
&nbsp; &nbsp; &nbsp; &nbsp; void AddStudent(wxCommandEvent &amp; event);<br />
&nbsp; &nbsp; &nbsp; &nbsp; wxTextCtrl *textName; // declare variable<br />
};</pre> <pre style="margin:20px; line-height:13px">//Reports.cpp<br />
Reports::Reports(wxPanel * parent)<br />
&nbsp; &nbsp; &nbsp;  : wxPanel(parent, wxID_ANY, wxPoint(-1, -1), wxSize(500, 500))<br />
{<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wxTextCtrl *textName = new wxTextCtrl(this, wxID_AddStudent, wxT(&quot;&quot;), wxPoint(65, 65));<br />
<br />
}<br />
<br />
void Reports::AddStudent(wxCommandEvent &amp; WXUNUSED(event))<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; // The following breaks the code, I want to grab textName<br />
&nbsp; &nbsp; &nbsp; &nbsp; textName.SetValue(&quot;Test&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; textName.SetFocus();&nbsp;  <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; /* *************************<br />
&nbsp; &nbsp; &nbsp; &nbsp; If I re-create textName then access (as shown in the following <br />
&nbsp; &nbsp; &nbsp; &nbsp; commented code) then it works fine but I can't<br />
&nbsp; &nbsp; &nbsp; &nbsp; work out how to create a pointer/reference to the<br />
&nbsp; &nbsp; &nbsp; &nbsp; previous textName rather than having to re-create one!<br />
<br />
wxTextCtrl *textName = new wxTextCtrl(this,wxID_AddStudent, wxT(&quot;Another button...&quot;), wxPoint(65, 95));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; textName-&gt;SetValue(&quot;Testing&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; textName-&gt;SetFocus(); <br />
&nbsp; &nbsp; &nbsp; &nbsp; *******************************/<br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>pac-man</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236823.html</guid>
		</item>
		<item>
			<title>Why does the following code works?</title>
			<link>http://www.daniweb.com/forums/thread236821.html</link>
			<pubDate>Sat, 07 Nov 2009 16:33:59 GMT</pubDate>
			<description><![CDATA[The following code works, it prints hello world. 
Also, depending on the second value, it either gives segmentation fault or doesn't gives segmentation fault. 
Can someone please explain me what is happening internally. 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>The following code works, it prints hello world.<br />
Also, depending on the second value, it either gives segmentation fault or doesn't gives segmentation fault.<br />
Can someone please explain me what is happening internally.<br />
 <pre style="margin:20px; line-height:13px"> int main = ( cout &lt;&lt; &quot;Hello world!\n&quot;, 195 );</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>aagajaba</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236821.html</guid>
		</item>
		<item>
			<title>Need Help on Reverse Polish Notation program code</title>
			<link>http://www.daniweb.com/forums/thread236819.html</link>
			<pubDate>Sat, 07 Nov 2009 16:22:48 GMT</pubDate>
			<description>Hi there, 
I am having a problem with one line in my code.  I wrote a code for calculating expressions using reverse polish notation (for a class) using a classes.  Can someone help me figure out why: 
except ValueError: 
                x = s.pop() 
                y = s.pop() 
               ...</description>
			<content:encoded><![CDATA[<div>Hi there,<br />
I am having a problem with one line in my code.  I wrote a code for calculating expressions using reverse polish notation (for a class) using a classes.  Can someone help me figure out why:<br />
except ValueError:<br />
                x = s.pop()<br />
                y = s.pop()<br />
                result = OPERATORS[item](x, y)<br />
                s.push(result)<br />
is not working in the following code?<br />
<br />
Thanks for you help!<br />
<br />
import operator<br />
<br />
OPERATORS = {<br />
        '+': operator.add,<br />
        '-': operator.sub,<br />
        '*': operator.mul,<br />
        '/': operator.div,<br />
        }<br />
<br />
class Stack(object):<br />
    &quot;Creates a stack to enter numbers or operators into&quot;<br />
<br />
    def __init__(self):<br />
        self.storage = [0,0,0,0]<br />
        self.sptn = -1        <br />
<br />
    def push(self, item):<br />
        self.sptn = self.sptn + 1<br />
        self.storage[self.sptn] = item<br />
        <br />
    def pop(self):<br />
        self.sptn = self.sptn -1<br />
        <br />
    def top(self):        <br />
        return self.storage[self.sptn]<br />
<br />
    def __rep__(self):<br />
        return self.storage[:self.sptn + 1]<br />
    <br />
<br />
def get_input():<br />
<br />
    equation = raw_input(&quot;Enter the equation in reverse polish notation: &quot;)<br />
    return equation<br />
<br />
def evaluate_rpn(equation):<br />
<br />
    s = Stack()<br />
<br />
    try:<br />
        for item in equation.split():<br />
            try:<br />
                result = float(item)<br />
                s.push(result)<br />
            except ValueError:<br />
                x = s.pop()<br />
                y = s.pop()<br />
                result = OPERATORS[item](x, y)<br />
                s.push(result)<br />
        result = s.top()<br />
            <br />
    except IndexError:<br />
        print &quot;Please input at least two numbers before entering an operator.&quot;<br />
<br />
#def main():<br />
#    equation = get_input()<br />
#    answer = evaluate_rpn(raw_input(&quot;Enter the equation in reverse polish notation: &quot;))<br />
#    print answer</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>ljvasil</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236819.html</guid>
		</item>
		<item>
			<title>Assigning an icon to an extension saved by .net application</title>
			<link>http://www.daniweb.com/forums/thread236817.html</link>
			<pubDate>Sat, 07 Nov 2009 16:11:44 GMT</pubDate>
			<description>Hi All, 
Using Visual studio 2008, I have an application that its data can save to a binary file, using *.SDB extension, Moreover users can open this file from my application. I have 2 questions about this. 
1-	How can I assign an icon to this saved file with SDB extension when my application has...</description>
			<content:encoded><![CDATA[<div>Hi All,<br />
Using Visual studio 2008, I have an application that its data can save to a binary file, using *.SDB extension, Moreover users can open this file from my application. I have 2 questions about this.<br />
1-	How can I assign an icon to this saved file with SDB extension when my application has been installed in other computer?<br />
2-	Similar to *.sln file (for Visual Studio project), How can I assign tow icon to single extension? For example when a solution is saved with visual studio 2005 its icon different from that one saved from visual studio 2008. In first, the solution’s icon contains “5” but in 08 solution’s icon contains “8”.<br />
Thanks Again.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum58.html">VB.NET</category>
			<dc:creator>A.Najafi</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236817.html</guid>
		</item>
		<item>
			<title>Zeroing bits</title>
			<link>http://www.daniweb.com/forums/thread236816.html</link>
			<pubDate>Sat, 07 Nov 2009 16:04:41 GMT</pubDate>
			<description><![CDATA[Is this the proper way to zero the first 12 bits of an address? 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags"...]]></description>
			<content:encoded><![CDATA[<div>Is this the proper way to zero the first 12 bits of an address?<br />
<br />
 <pre style="margin:20px; line-height:13px">void *ans = (void*)((unsigned long)addr &amp;&nbsp; ((0UL - 1)&nbsp; ^ 0xfff));</pre><br />
Where addr is any user process memory address..<br />
<br />
Note this method works...I just want to know if there is a better way</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum118.html">C</category>
			<dc:creator>gerard4143</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236816.html</guid>
		</item>
		<item>
			<title>Creating an xy screen of tiny boxes</title>
			<link>http://www.daniweb.com/forums/thread236809.html</link>
			<pubDate>Sat, 07 Nov 2009 15:41:26 GMT</pubDate>
			<description>Hi, I need to produce an xy matrix on screen of tiny boxes, each equivalent to 2.5 x 2.5 mm.  I want to group them into sixes.  When the mouse pointer is moved across the tiny boxes in any six group I want the program to register when the mouse pointer enters the particular six block of tiny boxes...</description>
			<content:encoded><![CDATA[<div>Hi, I need to produce an xy matrix on screen of tiny boxes, each equivalent to 2.5 x 2.5 mm.  I want to group them into sixes.  When the mouse pointer is moved across the tiny boxes in any six group I want the program to register when the mouse pointer enters the particular six block of tiny boxes and when it leaves that block to output an ascii character relating to which tiny boxes where touched by the mouse pointer as it travels across the screen.<br />
Can anyone help with anything available that could be modified or perhaps how I can start with my little knowledge of VB?  Thanks.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>micromic</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236809.html</guid>
		</item>
		<item>
			<title>making objects invisible</title>
			<link>http://www.daniweb.com/forums/thread236807.html</link>
			<pubDate>Sat, 07 Nov 2009 15:34:42 GMT</pubDate>
			<description><![CDATA[Hi, 
 
Let's say I have a form full of objects and want to make all of them (or half of them, whatever) invisible. Is there a short way to do that without a need of setting visible to false individually to each object?]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
Let's say I have a form full of objects and want to make all of them (or half of them, whatever) invisible. Is there a short way to do that without a need of setting visible to false individually to each object?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum4.html">Visual Basic 4 / 5 / 6</category>
			<dc:creator>deftones</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236807.html</guid>
		</item>
		<item>
			<title>Compiling Errors</title>
			<link>http://www.daniweb.com/forums/thread236800.html</link>
			<pubDate>Sat, 07 Nov 2009 15:14:20 GMT</pubDate>
			<description>im new with C++ . i was in java but now im learning C++ and i am not very good at it . i am making a program about spam and ham emails . i have all the files in the same directory . i created Ergasia1.cpp , Ergasia1.h , Feature.cpp , Feature.h 
but when i compile Ergasia1.cpp i got errors like : 
...</description>
			<content:encoded><![CDATA[<div>im new with C++ . i was in java but now im learning C++ and i am not very good at it . i am making a program about spam and ham emails . i have all the files in the same directory . i created Ergasia1.cpp , Ergasia1.h , Feature.cpp , Feature.h<br />
but when i compile Ergasia1.cpp i got errors like :<br />
<br />
1. &quot; In file included from Ergasia1.cpp &quot;<br />
2. &quot; Ergasia1.h [Warning] extra tokens at end of #endif directive &quot;<br />
3. &quot;Feature.h [Warning] extra tokens at end of #endif directive &quot; (after this error there are several errors like this &quot;  [Linker error] undefined reference to `Feature::getDescription()' &quot;<br />
4. &quot; Feature.h ld returned 1 exit status &quot;<br />
<br />
and when i compile Feature.cpp i got errors like :<br />
<br />
1. &quot; In file included from Feature.cpp &quot;<br />
2. &quot;   [Linker error] undefined reference to `WinMain@16' &quot;<br />
3. &quot; Feature.h ld returned 1 exit status &quot;<br />
<br />
Ergasia1.cpp<br />
 <pre style="margin:20px; line-height:13px"> <br />
#include &quot;Ergasia1.h&quot;<br />
#include &quot;Feature.h&quot;<br />
<br />
using namespace std;<br />
<br />
Ergasia1::Ergasia1()<br />
{<br />
#ifdef DEVEL<br />
&nbsp; &nbsp; &nbsp; &nbsp; tst= &quot;../../&quot;;<br />
#else <br />
&nbsp; &nbsp; &nbsp; &nbsp; tst= &quot;./&quot;;<br />
#endif<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; bool AllOK= FillvsKeys();<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (AllOK) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetFiles(LING);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetFiles(SPAM);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ShowData();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Incorrect Installation!&quot; &lt;&lt; endl;<br />
}<br />
<br />
const void Ergasia1::AnalyzeFile(const string fn) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; string fname= fn.substr(tst.length());<br />
&nbsp; &nbsp; &nbsp; &nbsp; size_t pos= fname.find_first_of(&quot;/&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; string kind= &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (pos != string::npos)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; kind= fname.substr(0, pos);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int KeywordsFound= 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ifstream ifs(fn.c_str());&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; if (ifs.is_open()) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; n++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vector&lt;Feature&gt; vf; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (! ifs.eof()) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string line;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getline(ifs, line);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (unsigned int i= 0; i &lt; vsKeys.size(); i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string key= vsKeys[i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (line.find(key) != string::npos) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bool found= false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (unsigned int j= 0; j &lt; vf.size(); j++) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (vf[j].getDescription().compare(key) == 0) {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int x= vf[j].getFrequency();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vf[j].setFrequency(++x);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; found= true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (! found) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Feature *f= new Feature(i, 1, key);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vf.push_back(*f);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; KeywordsFound++; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; ifs.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ostringstream osst;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; osst &lt;&lt; &quot;&lt;message file=\&quot;&quot; &lt;&lt; fname &lt;&lt;&quot;\&quot; category=\&quot;&quot; &lt;&lt; kind &lt;&lt; &quot;\&quot; features=\&quot;&quot; &lt;&lt; KeywordsFound &lt;&lt; &quot;\&quot;&gt;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vsStream.push_back(osst.str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; osst.flush();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (unsigned int i= 0; i &lt; vf.size(); i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ostringstream ossb;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ossb &lt;&lt; &quot;&lt;feature id=\&quot;&quot; &lt;&lt; vf[i].getId() &lt;&lt; &quot;\&quot; freq=\&quot;&quot; &lt;&lt; vf[i].getFrequency() &lt;&lt; &quot;\&quot;&gt; &quot; &lt;&lt; vf[i].getDescription() &lt;&lt; &quot; &lt;/feature&gt;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vsStream.push_back(ossb.str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ossb.flush();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ostringstream osse;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; osse &lt;&lt; &quot;&lt;/message&gt;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; osse.flush();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
<br />
const void Ergasia1::GetFiles(const string Kind) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; string s= tst + Kind + FILENAME;//&quot;_filenames.txt&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ifstream ifs(s.c_str());&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; if (ifs.is_open()) {<br />
&nbsp; &nbsp; while (! ifs.eof()) {<br />
&nbsp; &nbsp; &nbsp; string line;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getline(ifs, line);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AnalyzeFile(tst + line);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; ifs.close();<br />
&nbsp; }<br />
}<br />
<br />
const bool Ergasia1::FillvsKeys() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; bool result= true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; string s= tst + KEYWORDS;<br />
&nbsp; &nbsp; &nbsp; &nbsp; n= 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ifstream ifs(s.c_str());&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; if (ifs.is_open()) {<br />
&nbsp; &nbsp; while (! ifs.eof()) {<br />
&nbsp; &nbsp; &nbsp; string line;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getline(ifs, line);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vsKeys.push_back(line);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result= false;<br />
&nbsp; ifs.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; return result;<br />
}<br />
<br />
const void Ergasia1::ShowData() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;&lt;messagecollection messages=\&quot;&quot; &lt;&lt; n &lt;&lt; &quot;\&quot;&gt;&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(unsigned int i= 0; i &lt; vsStream.size(); i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; vsStream[i] &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;&lt;/messagecollection&gt;&quot; &lt;&lt; endl;<br />
}<br />
<br />
int main(int argc, char **argv) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Ergasia1 e;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br />
}</pre><br />
<br />
<br />
Ergasia.h<br />
 <pre style="margin:20px; line-height:13px">#include &lt;fstream&gt;<br />
#include &lt;string&gt;<br />
#include &lt;vector&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;sstream&gt;<br />
<br />
#ifdef _DEBUG<br />
#define DEVEL<br />
#endif<br />
<br />
using namespace std;<br />
<br />
#ifndef FILENAME<br />
#define FILENAME &quot;_filenames.txt&quot;;<br />
#endif<br />
<br />
#ifndef KEYWORDS<br />
#define KEYWORDS &quot;keywords.txt&quot;<br />
#endif<br />
<br />
#ifndef LING<br />
#define LING &quot;ling&quot;<br />
#endif<br />
<br />
#ifndef SPAM<br />
#define SPAM &quot;spam&quot;<br />
#endif<br />
<br />
#ifndef ERGASIA1_H<br />
#define ERGASIA1_H<br />
<br />
class Ergasia1<br />
{<br />
private:<br />
&nbsp; &nbsp; &nbsp; &nbsp; int n;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; string tst;<br />
&nbsp; &nbsp; &nbsp; &nbsp; //static const string FileName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; vector&lt;string&gt; vsKeys;<br />
&nbsp; &nbsp; &nbsp; &nbsp; vector&lt;string&gt; vsStream;<br />
&nbsp; &nbsp; &nbsp; &nbsp; const void AnalyzeFile(const string fn);<br />
&nbsp; &nbsp; &nbsp; &nbsp; const void GetFiles(const string Kind);<br />
&nbsp; &nbsp; &nbsp; &nbsp; const bool FillvsKeys();<br />
&nbsp; &nbsp; &nbsp; &nbsp; const void ShowData();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
public:<br />
&nbsp; &nbsp; &nbsp; &nbsp; Ergasia1();<br />
}<br />
#endif <br />
//ERGASIA1_H<br />
<br />
int main(int argc, char **argv);</pre><br />
<br />
Feature.cpp<br />
 <pre style="margin:20px; line-height:13px">#include &quot;Feature.h&quot;<br />
<br />
void Feature::setId(int i) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Id= i;<br />
}<br />
<br />
void Feature::setFrequency(int f) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Frequency= f;<br />
}<br />
<br />
void Feature::setDescription(const string d) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Description= d;<br />
}<br />
<br />
int Feature::getId() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return Id;<br />
}<br />
<br />
int Feature::getFrequency() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return Frequency;<br />
}<br />
<br />
string Feature::getDescription() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return Description;<br />
}<br />
<br />
Feature::Feature(int i, int f, const string d) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; setId(i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setFrequency(f);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setDescription(d);<br />
}</pre><br />
<br />
<br />
<br />
Feature.h<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream&gt;<br />
using namespace std;<br />
#ifndef FEATURE_H<br />
#define FEATURE_H<br />
<br />
class Feature {<br />
private:<br />
&nbsp; &nbsp; &nbsp; &nbsp; int Id;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int Frequency;<br />
&nbsp; &nbsp; &nbsp; &nbsp; string Description;<br />
public: <br />
&nbsp; &nbsp; &nbsp; &nbsp; void setId(int i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; void setFrequency(int f);<br />
&nbsp; &nbsp; &nbsp; &nbsp; void setDescription(const string d);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int getId();<br />
&nbsp; &nbsp; &nbsp; &nbsp; int getFrequency();<br />
&nbsp; &nbsp; &nbsp; &nbsp; string getDescription();<br />
&nbsp; &nbsp; &nbsp; &nbsp; Feature(int i, int f, const string d);<br />
}<br />
#endif <br />
//FEATURE_H</pre><br />
<br />
thats the files i created . any help will be appreciate . thanks in advance my friends .</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>konefsta</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236800.html</guid>
		</item>
		<item>
			<title>Threads en servidor de mensajes instantáneos.</title>
			<link>http://www.daniweb.com/forums/thread236798.html</link>
			<pubDate>Sat, 07 Nov 2009 15:07:53 GMT</pubDate>
			<description>Hola a todos, 
 
Estoy tratando de escribir un servidor de mensajería entre clientes, en Java. El problema que tengo es cuando quiero terminar el servidor. El servidor que he pensado funciona así: Cada cliente se conecta a un hilo que crea el servidor y allí envía los mensajes. El problema está en...</description>
			<content:encoded><![CDATA[<div>Hola a todos,<br />
<br />
Estoy tratando de escribir un servidor de mensajería entre clientes, en Java. El problema que tengo es cuando quiero terminar el servidor. El servidor que he pensado funciona así: Cada cliente se conecta a un hilo que crea el servidor y allí envía los mensajes. El problema está en cómo hacer que cuando administrador del servidor desee terminar el programa (presionando 'q' en el teclado), éste acabe con todos los hilos que ha creado y cierre. Para ello había pensado lo siguiente: Que el programa servidor prinicipal, antes de crear cualquier thread para atender a los usuarios, cree un hilo especial dedicado a leer de la entrada por teclado, pero ¿cómo le avisa éste al proceso principal que debe terminar y que por tanto el proceso principal debe decir a todos los demás hilos que ha creado que terminen?<br />
<br />
El código que llevo es:<br />
<br />
Servidor:<br />
 <pre style="margin:20px; line-height:13px">public class Servidor {<br />
&nbsp; &nbsp; public static void main(String[] args) throws IOException {<br />
&nbsp; &nbsp; &nbsp; &nbsp; ServerSocket serverSocket = null;<br />
&nbsp; &nbsp; &nbsp; &nbsp; boolean listening = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new StdinReaderThread();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; try {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; serverSocket = new ServerSocket(4444);<br />
&nbsp; &nbsp; &nbsp; &nbsp; } catch (IOException e) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.err.println(&quot;No pudo crearse el socket&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.exit(-1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (listening){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new HiloServidor(serverSocket.accept()).start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; serverSocket.close();<br />
&nbsp; &nbsp; }<br />
}</pre><br />
y el hilo que lee del teclado:<br />
 <pre style="margin:20px; line-height:13px">public class StdinReaderThread implements Runnable{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BufferedReader stdin;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public StdinReaderThread(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Thread subpr = new Thread(this,&quot;x&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stdin = new BufferedReader( new InputStreamReader(System.in));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subpr.start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void run(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (true){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String stdinline = stdin.readLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( stdinline.startsWith(&quot;q&quot;)){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;salir&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if( stdinline.startsWith(&quot;m&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;enviar mensaje&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if( stdinline.startsWith(&quot;l&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;enviar login&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if( stdinline.startsWith(&quot;u&quot;))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;lista usuarios&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception e){}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre><br />
Saludos,</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>eleal</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236798.html</guid>
		</item>
		<item>
			<title>WxGlade does not show value</title>
			<link>http://www.daniweb.com/forums/thread236797.html</link>
			<pubDate>Sat, 07 Nov 2009 15:07:15 GMT</pubDate>
			<description><![CDATA[If I run the following code the textCtrl's aren't updated, they stay empty, but if I do print self.extra201.GetValue()I get the value that is set with the code beneath. 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>If I run the following code the textCtrl's aren't updated, they stay empty, but if I do  <pre style="margin:20px; line-height:13px">print self.extra201.GetValue()</pre>I get the value that is set with the code beneath.<br />
<br />
 <pre style="margin:20px; line-height:13px">self.extra101.SetValue(names[1])<br />
self.extra201.SetValue(names[2])<br />
self.extra111.SetValue(str(money[1]))<br />
self.extra211.SetValue(str(money[2]))</pre><br />
Why isn't it update !! :(</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>Kruptein</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236797.html</guid>
		</item>
		<item>
			<title>std::string capacity(). Different in different OSs?!?!</title>
			<link>http://www.daniweb.com/forums/thread236795.html</link>
			<pubDate>Sat, 07 Nov 2009 14:39:02 GMT</pubDate>
			<description><![CDATA[Hi, I have a question. 
 
Using the following code: 
 
 
#include <iostream> 
int main() 
{ 
	std::string s1; 
	std::cout << s1.capacity() << std::endl;]]></description>
			<content:encoded><![CDATA[<div>Hi, I have a question.<br />
<br />
Using the following code:<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream&gt;<br />
int main()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; std::string s1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; std::cout &lt;&lt; s1.capacity() &lt;&lt; std::endl;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; system (&quot;PAUSE&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br />
}</pre><br />
In Ubuntu/KDevelop the output is 0.<br />
<br />
In Windows/V.Studio the output is 15.<br />
<br />
Can anyone suggest why it happens?<br />
<br />
I'm somewhat stumped by it's occurrence.<br />
<br />
Thanks very much, much appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Carrots</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236795.html</guid>
		</item>
		<item>
			<title>Problem with 2 forms working together.</title>
			<link>http://www.daniweb.com/forums/thread236794.html</link>
			<pubDate>Sat, 07 Nov 2009 14:24:27 GMT</pubDate>
			<description><![CDATA[I have a main form which is going to use much input data typed in by the user. So I thought to make a separate form to handle the input. The closest to a solution was this thread http://www.daniweb.com/forums/thread231368.html 
But I don't want the second form to be disposed off, or be closed by...]]></description>
			<content:encoded><![CDATA[<div>I have a main form which is going to use much input data typed in by the user. So I thought to make a separate form to handle the input. The closest to a solution was this thread <a rel="nofollow" class="t" href="http://www.daniweb.com/forums/thread231368.html" target="_blank">http://www.daniweb.com/forums/thread231368.html</a><br />
But I don't want the second form to be disposed off, or be closed by clicking the close icon. I like to store the input data in the second form(seems logical to me) and let the main form use them.<br />
I don't want the input form to be visible all of the time. Just want to let it pop up when the user needs it(via menu or button, don't know yet)<br />
This is my code so far a main form with a button and a click event and an inputdata form:<br />
   <pre style="margin:20px; line-height:13px"> public partial class Form1 : Form<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; private InputData InputForm = new InputData();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public Form1()<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InitializeComponent();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private void button1_Click(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InputForm.Show();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }</pre>Not very much, I know. But what would be the most elegant way to handle this?<br />
As always, any help is greatly appreciated.:)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>ddanbe</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236794.html</guid>
		</item>
		<item>
			<title>Using Graphics Pointer to Draw objects(TREE) in a Class (Windows Forms Applications)</title>
			<link>http://www.daniweb.com/forums/thread236793.html</link>
			<pubDate>Sat, 07 Nov 2009 14:20:33 GMT</pubDate>
			<description>hi,i am making trees and i want to draw the structure of the tree in windows forms applications.since the class tree has the access to the trees root pointer.so only a member function of the class can draw the nodes of that tree. 
 
but i cannot use the graphics pointer int the tree class,it gives...</description>
			<content:encoded><![CDATA[<div>hi,i am making trees and i want to draw the structure of the tree in windows forms applications.since the class tree has the access to the trees root pointer.so only a member function of the class can draw the nodes of that tree.<br />
<br />
but i cannot use the graphics pointer int the tree class,it gives some error.<br />
<br />
i tried to use friend function but it wasnt working in form1.h .<br />
<br />
Any Solutions??<br />
<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>arshad115</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236793.html</guid>
		</item>
		<item>
			<title>check 1 number is a prime or not</title>
			<link>http://www.daniweb.com/forums/thread236791.html</link>
			<pubDate>Sat, 07 Nov 2009 14:00:46 GMT</pubDate>
			<description><![CDATA[[CODE =C] 
#include "conio.h" 
#include "stdio.h" 
#include "math.h" 
 
int isPrime(int n) 
{ 
    int i,isTrue=1; 
    for(i=2; i<(int)sqrt(n); i++) 
    if(n%i==0)]]></description>
			<content:encoded><![CDATA[<div>[CODE =C]<br />
#include &quot;conio.h&quot;<br />
#include &quot;stdio.h&quot;<br />
#include &quot;math.h&quot;<br />
<br />
int isPrime(int n)<br />
{<br />
    int i,isTrue=1;<br />
    for(i=2; i&lt;(int)sqrt(n); i++)<br />
    if(n%i==0)<br />
    return 0;<br />
    else return 1;<br />
}<br />
<br />
int main()<br />
{<br />
    int N;<br />
    printf(&quot;Enter n: &quot;);<br />
    scanf(&quot;%d&quot;,&amp;N);<br />
    if(isPrime(N))<br />
    printf(&quot;prime&quot;);  <br />
    else<br />
    printf(&quot;Not prime\n&quot;);<br />
    getch();<br />
    return 0;<br />
}<br />
<br />
[/CODE]<br />
here is my source code, but when i test , sometimes it's true sometimes it's false. I don't know what is my mistake<br />
Please help me solve it<br />
Thanks a lot!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum118.html">C</category>
			<dc:creator>thebluestar</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236791.html</guid>
		</item>
		<item>
			<title>Help with Assignment</title>
			<link>http://www.daniweb.com/forums/thread236790.html</link>
			<pubDate>Sat, 07 Nov 2009 13:41:14 GMT</pubDate>
			<description>Hi,  
 
I ap posting my Assignment subject here, and hope to get some helps with each Classes, I am not asking that you do all my home works but to give me hints as I want to learn something and as  I am new to Java I am block some times. 
 
this is the Subject...</description>
			<content:encoded><![CDATA[<div>Hi, <br />
<br />
I ap posting my Assignment subject here, and hope to get some helps with each Classes, I am not asking that you do all my home works but to give me hints as I want to learn something and as  I am new to Java I am block some times.<br />
<br />
this is the Subject<br />
****************************************************<br />
The program allows customers to list the videos available and to borrow them (ignore returning videos). It<br />
records whether a video is on the shelf or on loan, and if it is on loan, the date it is due to be returned.<br />
Customers can borrow up to two videos for 3 days. Build the program according to the following recipe:<br />
1. There should be classes describing customers and videos and also a class called VideoStore that<br />
contains ArrayLists of customers and videos. There should also be a small public class VideoTest<br />
that contains the main() method.<br />
<br />
2. The Video class has instance fields for the video title, whether it is on loan and the date it is due to be<br />
returned. There are get and set methods for some of these fields and a toString() method.<br />
<br />
3. The Customer class has instance fields for the customer name and for the number of videos he is<br />
borrowing. A method borrowvideo(Video v) checks that the video is available and that the<br />
customer is not borrowing more than 2 videos, it then sets the duedate and onloan fields in the Video<br />
class. The due date is printed on screen. There is a get method for the customer name.<br />
<br />
4. The constructor for the VideoStore class initialises a small number (less than 10) of Customer and<br />
Video objects and stores them in two separate ArrayLists that are the instance fields for the class. It<br />
provides a method (listallvideos()) for listing all the videos in the store and a method called<br />
borrow(String,String) described below.<br />
<br />
5. The main method in VideoTest creates a VideoStore, then enters a loop that implements a menu:<br />
&quot;Menu: L-List, B-Borrow, Q-Quit&quot;. A Scanner picks up the letter entered and causes the desired<br />
response. List, lists the titles of all the videos along with whether they are on the shelf or the due date<br />
if they are on loan. Quit, drops out of the loop and exits the application. Borrow, asks first the<br />
Customer's name, and then the title of the video he wishes to borrow and picks up responses with a<br />
Scanner. These are then passed to the VideoStore borrow method as borrow(name,title).<br />
<br />
6. The VideoStore borrow method checks that the name and title match entries in the VideoStore arrays,<br />
and identifies the Customer and Video objects they correspond to. The Customer<br />
borrowvideo(Video v) method can then be called.<br />
<br />
*****************************************************<br />
<br />
this is my VideoTest Class<br />
*****************************************************<br />
<br />
/*<br />
 * To change this template, choose Tools | Templates<br />
 * and open the template in the editor.<br />
 */<br />
<br />
package assignement;<br />
import java.util.*;<br />
/**<br />
 *<br />
 * @author Harris<br />
 */<br />
public class VideotTest {<br />
<br />
    public static void main(String[] args)<br />
   {<br />
           VideoStore vs = new VideoStore();<br />
<br />
	   Scanner sc = new Scanner(System.in);<br />
	   String menuResponse;<br />
       do<br />
	   {<br />
          <br />
		   System.out.println(&quot;Menu: L-list, B-borrow, Q-quit&quot;);<br />
		   menuResponse = sc.nextLine();<br />
<br />
	       if(menuResponse.equals(&quot;L&quot;))<br />
		       vs.listallvideos();<br />
	       else if (menuResponse.equals(&quot;B&quot;))<br />
		   {<br />
			   System.out.println(&quot;What is your name?&quot;);<br />
			   String nameResponse = sc.nextLine();<br />
                          <br />
                     	   System.out.println(&quot;What is the title of the video you want to borrow?&quot;);<br />
			   String videoResponse = sc.nextLine();<br />
		      // vs.borrow(nameResponse,videoResponse);<br />
		   }<br />
	   } while(!menuResponse.equalsIgnoreCase(&quot;Q&quot;));<br />
   }<br />
}<br />
<br />
*****************************************************<br />
this is my VideoStore Class<br />
*****************************************************<br />
/*<br />
 * To change this template, choose Tools | Templates<br />
 * and open the template in the editor.<br />
 */<br />
<br />
package assignement;<br />
import java.util.*;<br />
/**<br />
 *<br />
 * @author Harris<br />
 */<br />
public class VideoStore {<br />
<br />
    private String VideoName;<br />
    private String CustomersName;<br />
    private ArrayList&lt;String&gt; Videos = new ArrayList&lt;String&gt;();<br />
    private ArrayList&lt;String&gt; CustomersListe = new ArrayList&lt;String&gt;();<br />
  <br />
<br />
    public VideoStore(){<br />
        VideoName = null;<br />
        CustomersName = null;<br />
        <br />
<br />
    }<br />
<br />
<br />
    public VideoStore(String VidName, String CustName){<br />
<br />
        VideoName = VidName;<br />
        CustName = CustomersName;<br />
       <br />
<br />
        Videos.add(&quot;Brave Heart&quot;);<br />
        Videos.add(&quot;Troy&quot;);<br />
        Videos.add(&quot;Shakspear In Love&quot;);<br />
        Videos.add(&quot;Green Mile&quot;);<br />
        Videos.add(&quot;Ice Age&quot;);<br />
<br />
        CustomersListe.add(&quot;Harris&quot;);<br />
        CustomersListe.add(&quot;John&quot;);<br />
        CustomersListe.add(&quot;Ricky&quot;);<br />
        CustomersListe.add(&quot;Mike&quot;);<br />
        CustomersListe.add(&quot;Robin&quot;);<br />
    }<br />
<br />
    public String getVideoName(){<br />
        return VideoName;<br />
    }<br />
    public String getCustomersName(){<br />
        return CustomersName;<br />
    }<br />
<br />
<br />
<br />
    public void listallvideos(){<br />
       <br />
        for (int i = 0; i &lt; Videos.size(); i++)<br />
        System.out.println(Videos.get(i));<br />
    }<br />
<br />
}<br />
<br />
***********************************************<br />
<br />
the problem which I get is when I run VideoTest which is my main class by chosing L it dosnt not list my Videos list which is an Array list it goes back to the menu.<br />
Anyone Can Help?<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Harris68</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236790.html</guid>
		</item>
		<item>
			<title>Compiling error (novice problem)</title>
			<link>http://www.daniweb.com/forums/thread236789.html</link>
			<pubDate>Sat, 07 Nov 2009 13:30:31 GMT</pubDate>
			<description>I was having problems with this program or better with the int main() function. The program is supposed to ask the user for his name and password. After that the user will be able to access different infos based on his security clearing. 
The comments in the code are English tho the program itself...</description>
			<content:encoded><![CDATA[<div>I was having problems with this program or better with the int main() function. The program is supposed to ask the user for his name and password. After that the user will be able to access different infos based on his security clearing.<br />
The comments in the code are English tho the program itself is in German (long story why its in German ^^)<br />
I shortened the code so it will only work properly for the user &quot;kornelia&quot; and &quot;eduard&quot; (both with high security clearing)<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;cstdio&gt;<br />
#include &lt;cmath&gt;<br />
#include &lt;iostream&gt; <br />
#include &lt;cstdlib&gt;<br />
&nbsp;<br />
using namespace std;<br />
<br />
int main()<br />
{<br />
cout &lt;&lt; &quot;\t\tNetwork&quot;;<br />
<br />
//declaring security<br />
int info;<br />
int security = 0;<br />
<br />
//getting the Username<br />
string szUsername;<br />
cout &lt;&lt;&quot;\nUsername: &quot;;<br />
cin &gt;&gt; szUsername;<br />
<br />
//getting the password<br />
string szPassword;<br />
cout &lt;&lt;&quot;\npassword: &quot; &lt;&lt; endl;<br />
cin &gt;&gt; szPassword;<br />
<br />
//action for successful loggin of the user &quot;kornelia&quot;<br />
if (szUsername == &quot;kornelia&quot; &amp;&amp; szPassword == &quot;lelewel8&quot;)<br />
{<br />
cout &lt;&lt; &quot;\nHallo Kornelia, dein login war erfolgreich&quot;;<br />
security = 5;<br />
}<br />
// action for successful loggin of the user &quot;eduard&quot;<br />
if (szUsername == &quot;eduard&quot; &amp;&amp; szPassword == &quot;afkem2009&quot;)<br />
{<br />
cout &lt;&lt; &quot;\nHallo Eduard, du hast dich erfolgreich eingeloggt&quot;;<br />
security = 5;<br />
}<br />
//action for successful loggin of the user &quot;gast&quot;<br />
if (szUsername == &quot;gast&quot; || szPassword == &quot;gast&quot;)<br />
{<br />
cout &lt;&lt; &quot;\nHerzlich willkommen Gast&quot;;<br />
security = 1;<br />
}<br />
//action for wrong name or password<br />
if (!security)<br />
&nbsp;  cout &lt;&lt; &quot;Ihr loggin ist fehlgeschlagen\n&quot; &lt;&lt; endl;<br />
<br />
//action for security clearing = 5<br />
if (security == 5)<br />
{<br />
// welcome and basic menu for selecting infos<br />
cout &lt;&lt; &quot;Sie haben Sicherheitsstufe 5 (777 Rechte)&quot; &lt;&lt; endl;<br />
cout &lt;&lt; &quot;Welche Informationen wollen sie erhalten?\n1: Computerpassword Kornelia&quot;;<br />
cout &lt;&lt; &quot;\n2: Computerpassword Eduard\n3: Routerpassword&quot;;<br />
cin &lt;&lt; info;<br />
// cout the infos<br />
if (info == 1)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;Der Computer besitzt kein Password&quot;;<br />
}<br />
if (info == 2)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;Das Computerpassword von Eduard lautet: afkem2009&quot;;<br />
}<br />
if (info == 3)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;Benutzername: admin\nPassword: lelewel8&quot;;<br />
}<br />
}<br />
// end<br />
system(&quot;PAUSE&quot;);<br />
return 0;<br />
}</pre><br />
thank you in advance and please don't just give me a solved program back because I really want to understand what I've done wrong :)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>lexsoOr</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236789.html</guid>
		</item>
		<item>
			<title>The publisher could not be verified...</title>
			<link>http://www.daniweb.com/forums/thread236788.html</link>
			<pubDate>Sat, 07 Nov 2009 13:15:45 GMT</pubDate>
			<description><![CDATA[When users run my vb2008 executable they get the windows security message "The published could not be published. Are you sure you want to run this software?" 
 
Is there any way to get rid of this message when users run my app? Or do individual users need to change their security settings? 
 
Many...]]></description>
			<content:encoded><![CDATA[<div>When users run my vb2008 executable they get the windows security message &quot;The published could not be published. Are you sure you want to run this software?&quot;<br />
<br />
Is there any way to get rid of this message when users run my app? Or do individual users need to change their security settings?<br />
<br />
Many thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum58.html">VB.NET</category>
			<dc:creator>JohnDove</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236788.html</guid>
		</item>
		<item>
			<title>Socket programming on windows</title>
			<link>http://www.daniweb.com/forums/thread236785.html</link>
			<pubDate>Sat, 07 Nov 2009 13:14:07 GMT</pubDate>
			<description>Hey all! I am interested in learning to use sockets. make client and server program. Where should I begin? 
 
Thanks!</description>
			<content:encoded><![CDATA[<div>Hey all! I am interested in learning to use sockets. make client and server program. Where should I begin?<br />
<br />
Thanks!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Silvershaft</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236785.html</guid>
		</item>
		<item>
			<title>I/O program with major issues</title>
			<link>http://www.daniweb.com/forums/thread236770.html</link>
			<pubDate>Sat, 07 Nov 2009 12:10:00 GMT</pubDate>
			<description><![CDATA[Figure I might as well go ahead and clear up that this is obviously a school assignment. I have completed a somewhat decent amount of code (not saying I have a lot of faith in it's correctness tho) and need assistance to figure the rest out. I'm at a complete loss due to teacher and book not really...]]></description>
			<content:encoded><![CDATA[<div>Figure I might as well go ahead and clear up that this is obviously a school assignment. I have completed a somewhat decent amount of code (not saying I have a lot of faith in it's correctness tho) and need assistance to figure the rest out. I'm at a complete loss due to teacher and book not really covering material in a way to prepare for the assignment. I have looked over the tutorials for I/O on this site as well as others and if I need to change things, I'm wide open for assistance. I did attempt to figure out as much as I could, but I'm stuck. Thanks in advance for anyone who takes time to assist me. I greatly appreciate it. <br />
<br />
To clear things up from the start, here are the instructions:<br />
<br />
The program is to take a text file, students.txt, containing information about the currently-enrolled students in a school. Each<br />
line represents a record for a different student and contains the student's identification number (eight digits), credit hours<br />
completed, and grade point average. A sample line follows:<br />
<br />
10082352 66 3.04<br />
<br />
Program is supposed to have the identification number and grade point average for each student in the file copied to one of four<br />
different text files based on the number of credit hours completed:<br />
<br />
Less than 32 freshmen.txt<br />
32 to 63 sophomores.txt<br />
64 to 95 juniors.txt<br />
96 or more seniors.txt<br />
<br />
Next is to write the identification number and grade point average of each student on a single line (one line per student) in the<br />
appropriate file. For example, since the student mentioned above has completed 66 credit hours, the following would be<br />
added to the file juniors.txt:<br />
<br />
10082352 3.04<br />
<br />
<br />
The number of students in the original file is unknown, so the program will need to read these records in until you reach the end of<br />
the file. <br />
<br />
Also, no student should have a negative number of credit hours, and the maximum number of credit<br />
hours that a student can accumulate is 250. If the program encounters a student record with an erroneous number of<br />
credit hours, write the entire record for that student (identification number, credit hours, and grade point average) to the<br />
file hoursError.txt rather than any of the four aforementioned files. The lowest grade point average a student may have is 0.0, and the highest grade point average a<br />
student may have is 4.0. If the program encounters a student record with an erroneous grade point average, write the<br />
entire record for that student to the file averageError.txt rather than any of the four aforementioned files.As was previously stated, the student's identification number should be eight digits. If the program<br />
encounters a student record with an identification number of fewer or greater than eight digits, write the entire record for<br />
that student to the file identError.txt rather than any of the four aforementioned files.Assume that an identification number error has highest precedence, then the<br />
number of credit hours completed, then the grade point average. Don't write a student record to multiple error files: only<br />
the one that has the highest precedence should receive the record.<br />
<br />
I'm going in the direction that I believe it needs to have the input file made into a dynamic array, but not sure how to do that. <br />
<br />
Here is the code I have with compiler errors formatted within brackets after comment code. e.g. //[compiler error]<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;fstream&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;iomanip&gt;<br />
#include &lt;cstdlib&gt;<br />
using namespace std;<br />
<br />
/** [ I get the &quot;unknown size&quot; error on all of these b/c I don't know how to assign them ] */<br />
<br />
int studentID[];<br />
int creditHours[];<br />
double gpa[];<br />
<br />
<br />
int main()<br />
{<br />
<br />
int studentID[]; <br />
int creditHours[]; <br />
int gpa[];<br />
ifstream students; <br />
ofstream freshman, sophomores, juniors, seniors; <br />
<br />
<br />
ifstream in_stream;<br />
in_stream.open(&quot;students.txt&quot;);<br />
<br />
if (in_stream.fail())<br />
{<br />
cout&lt;&lt; &quot;Input file opening failed.\n&quot;;<br />
exit(1);<br />
}<br />
<br />
ofstream out_stream;<br />
out_stream.open(&quot;freshmen.txt&quot;);<br />
out_stream.open(&quot;sophomores.txt&quot;);<br />
out_stream.open(&quot;juniors.txt&quot;);<br />
out_stream.open(&quot;seniors.txt&quot;);<br />
out_stream.open(&quot;hoursError.txt&quot;);<br />
out_stream.open(&quot;averageError.txt&quot;);<br />
out_stream.open(&quot;identError.txt&quot;);<br />
<br />
if (out_stream.fail())<br />
{<br />
cout&lt;&lt; &quot;Output file opening failed.\n&quot;;<br />
exit(1);<br />
}<br />
<br />
out_stream.setf(ios::fixed);<br />
out_stream.setf(ios::showpoint);<br />
out_stream.precision(2);<br />
<br />
while (!students.eof())<br />
{<br />
<br />
void getInput(ifstream students, int &amp;studentID, int &amp;creditHours, int &amp;gpa);<br />
<br />
}<br />
<br />
<br />
/** [ error C2446: '&lt;' : no conversion from 'int *' to 'int' There is no context in which this conversion is possible ] &amp; [ error C2040: '&lt;' : 'int' differs in levels of indirection from 'int []' ] */<br />
<br />
for (int i=0; i &lt; studentID; i++)<br />
out_stream &lt;&lt; studentID[i] &lt;&lt; creditHours[i] &lt;&lt; gpa[i] &lt;&lt; endl;<br />
<br />
<br />
in_stream.close();<br />
out_stream.close();<br />
}<br />
<br />
<br />
<br />
/** [ error C4430: missing type specifier - int assumed. Note: C++ does not support default-int ]*/<br />
<br />
getInput(ifstream students, int &amp;studentID, int &amp;creditHours, int &amp;gpa); <br />
<br />
// [ error C2447: '{' : missing function header (old-style formal list?) ]<br />
{ <br />
&nbsp; &nbsp; int i = 0; <br />
&nbsp; &nbsp; &nbsp; &nbsp; while(!students.eof()) <br />
&nbsp; &nbsp; &nbsp; &nbsp; { <br />
&nbsp; &nbsp; &nbsp;  students &gt;&gt; &amp;studentID[i] &gt;&gt; &amp;creditHours[i] &gt;&gt; &amp;gpa[i]; <br />
&nbsp; &nbsp; &nbsp;  cout &lt;&lt; studentID[i] &lt;&lt; creditHours[i] &lt;&lt; gpa[i] &lt;&lt; endl; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  i++; <br />
&nbsp; &nbsp; &nbsp; &nbsp; } <br />
return;<br />
<br />
}</pre><br />
<br />
Thanks again for anyone who has patience to assist me. It's greatly appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Ryujin89</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236770.html</guid>
		</item>
		<item>
			<title><![CDATA[Phone Emulator Doesn't Appear]]></title>
			<link>http://www.daniweb.com/forums/thread236769.html</link>
			<pubDate>Sat, 07 Nov 2009 12:08:35 GMT</pubDate>
			<description><![CDATA[Hi, i'm working with Netbeans IDE 6.7.1 on Vista Home Premium. I have run my program with no errors, but the phone won't show up. I have turned off my firewall and even tried reinstalling Netbeans with no success. Thx in advance! :icon_smile:]]></description>
			<content:encoded><![CDATA[<div>Hi, i'm working with Netbeans IDE 6.7.1 on Vista Home Premium. I have run my program with no errors, but the phone won't show up. I have turned off my firewall and even tried reinstalling Netbeans with no success. Thx in advance! :icon_smile:</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>ITfav</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236769.html</guid>
		</item>
		<item>
			<title>Urgent help with vhdl neeeded</title>
			<link>http://www.daniweb.com/forums/thread236766.html</link>
			<pubDate>Sat, 07 Nov 2009 11:48:36 GMT</pubDate>
			<description>Hi people, I need help to produce a VHDL behavioral code for my final year project, I need to create a 256 point radix-2 fft processor on a spartan-3A DSP FPGA and I am so stuck using modelsim and XILINX 10.1, I have reached to this point  the code is below anyone who can get out the syntax error...</description>
			<content:encoded><![CDATA[<div>Hi people, I need help to produce a VHDL behavioral code for my final year project, I need to create a 256 point radix-2 fft processor on a spartan-3A DSP FPGA and I am so stuck using modelsim and XILINX 10.1, I have reached to this point  the code is below anyone who can get out the syntax error and how to declare shared variable I would appreciate.......<br />
-- THIS FILE DECLARES THE SIGNALS USED IN THE PROCESSOR<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
package butter_lib is<br />
<br />
signal ram_data,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19,out_data : std_logic_vector(31 downto 0) := (others =&gt; '0') ;<br />
signal data_rom , rom_ff : std_logic_vector(31 downto 0) ;<br />
signal clock_main , reset , enbl , clock : std_logic := '0' ;<br />
signal c0 , c1 , c2 , c3 , c0_c1 , c2_c3 , c0_c2 , c1_c3 : std_logic ;<br />
signal c0_and,c1_and,c2_and,c3_and,c0_c1and,c2_c3and,c0_c2and,c1_c3and : std_logic ;<br />
signal reset_count : std_logic ;<br />
type state is (reset1 , reset2 , reset3 , reset4 , reset5 , reset6 , reset7) ;<br />
<br />
signal final_sum : std_logic_vector (31 downto 0) := (others =&gt; '0') ;<br />
signal shift , finish_sum , signbit , normalise , end_all , a_small , addsub ,sum_out2 , shift_done , done , num_rec , setbit ,  addpulse : std_logic := '0' ;<br />
signal shift_outa , swap_num2 : std_logic_vector ( 31 downto 0 ) := (others =&gt; '0') ;<br />
signal swap_num1 , sum_out : std_logic_vector (32 downto 0) := (others =&gt; '0') ;<br />
signal sub2 : std_logic_vector (8 downto 0) := (others =&gt; '0') ;<br />
signal suba : std_logic_vector (8 downto 0) := (others =&gt; '0') ;<br />
signal exp : std_logic_vector (7 downto 0) := (others =&gt; '0') ;<br />
signal rst , enswap , ensub , enshift , finsub , finswap , finshift , numzero : std_logic := '0' ;<br />
signal zerodetect : std_logic_vector(1 downto 0) ;<br />
signal changea : std_logic ;<br />
<br />
signal final_sumb : std_logic_vector (31 downto 0) := (others =&gt; '0') ;<br />
signal shiftb , finish_sumb , signbitb , normaliseb , end_allb , a_smallb , addsubb,sum_out2b , shift_doneb , doneb , num_recb , setbitb ,  addpulseb , clockb : std_logic := '0' ;<br />
signal shift_outb , swap_num2b : std_logic_vector ( 31 downto 0 ) := (others =&gt; '0') ;<br />
signal swap_num1b , sum_outb : std_logic_vector (32 downto 0) := (others =&gt; '0') ;<br />
signal sub2b : std_logic_vector (8 downto 0) := (others =&gt; '0') ;<br />
signal subb : std_logic_vector (8 downto 0) := (others =&gt; '0') ;<br />
signal expb: std_logic_vector (7 downto 0) := (others =&gt; '0') ;<br />
signal rstb , enswapb , ensubb , enshiftb , finsubb , finswapb , finshiftb , numzerob , clock_mainb , resetb , enblb : std_logic := '0' ;<br />
signal zerodetectb : std_logic_vector(1 downto 0) ;<br />
signal changeb : std_logic ;<br />
<br />
signal incr , clear , io_mode , staged , iod : std_logic ;<br />
signal butterfly,fftadd_rd,shift1,shift3,shift4,shift5,shift6,ram_wr,ram_rd,io_add : std_logic_vector(3 downto 0) := (others =&gt; '0') ;<br />
signal fftd , fft_en , ip , op , init : std_logic ;<br />
signal stage : std_logic_vector(1 downto 0) ;<br />
--signal clock_main,c0,c1,c2,c3,c0_c1,c2_c3,c0_c2,c1_c3 : std_logic ;<br />
signal preset,disable,c0_en,rom_en,romgen_en : std_logic ;<br />
signal clk_count : std_logic_vector(2 downto 0) ;<br />
signal enbw , enbor : std_logic ;<br />
signal data_io : std_logic_vector(31 downto 0) := (others =&gt; '0') ;<br />
signal rom_add : std_logic_vector(2 downto 0) ;<br />
type state_values is (st0 , st1 , st2 ,  st3) ;<br />
signal pres_state1 , next_state1 : state_values ;<br />
<br />
signal butterfly_iod : std_logic_vector(3 downto 0) ;<br />
signal cyc_clear : std_logic ;<br />
signal add_rd , add_wr : std_logic_vector(3 downto 0) ;  <br />
<br />
end butter_lib ;<br />
<br />
--THIS FILE RECEIVES THE OUTPUT OF THE WAVEFORM GENERATOR AND <br />
--OUTPUTS THE REQUIRED CYCLES<br />
<br />
library ieee;<br />
use ieee.std_logic_1164.all;<br />
use IEEE.std_logic_arith.all;<br />
use IEEE.std_logic_unsigned.all;<br />
use work.butter_lib.all ;<br />
<br />
entity and_gates is<br />
port (<br />
      waves_and : in std_logic_vector(3 downto 0) ;<br />
      clock_main , c0_en : in std_logic ;<br />
      c0,c1,c2,c3 : out std_logic ;<br />
      c0_c1,c2_c3,c0_c2,c1_c3 : out std_logic ) ;<br />
end and_gates ;<br />
<br />
architecture rtl of and_gates is<br />
begin <br />
process(clock_main,waves_and)<br />
begin<br />
if (c0_en = '1' and clock_main='1') then<br />
<br />
c0 &lt;= waves_and(3) ;<br />
c1 &lt;= waves_and(2) ;<br />
c2 &lt;= waves_and(1) ;<br />
c3 &lt;= waves_and(0) ;<br />
c0_c1 &lt;= waves_and(3) or waves_and(2) ;<br />
c0_c2 &lt;= waves_and(3) or waves_and(1) ;<br />
c2_c3 &lt;= waves_and(1) or waves_and(0) ;<br />
c1_c3 &lt;= waves_and(0) or waves_and(2) ;<br />
else <br />
c0 &lt;= '0' ;<br />
c1 &lt;= '0' ;<br />
c2 &lt;= '0' ;<br />
c3 &lt;= '0' ;<br />
c0_c1 &lt;= '0' ;<br />
c0_c2 &lt;= '0' ;<br />
c2_c3 &lt;= '0' ;<br />
c1_c3 &lt;= '0' ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
--BASE INDEX GENERATOR<br />
library ieee;<br />
use ieee.std_logic_1164.all;<br />
use work.butter_lib.all ;<br />
<br />
entity baseindex is<br />
 port(<br />
   ind_butterfly: in std_logic_vector(3 downto 0);<br />
   ind_stage: in std_logic_vector(1 downto 0);<br />
   add_fft: in std_logic;<br />
   fftadd_rd: out std_logic_vector(3 downto 0);<br />
   c0,c1,c2,c3: in std_logic);<br />
end baseindex;<br />
<br />
architecture rtl of baseindex is<br />
begin<br />
process(ind_butterfly,ind_stage,add_fft,c0,c1,c2,c3)<br />
variable out_sig : std_logic_vector(3 downto 0);<br />
begin<br />
if (add_fft='1') then<br />
if(c2='1') then -- address for 'x'. Since this is the real part, <br />
case ind_stage is -- M.S.B is '0'.<br />
   when &quot;00&quot; =&gt; out_sig := &quot;00&quot; &amp; ind_butterfly(1 downto 0);<br />
   when &quot;01&quot; =&gt; out_sig := '0' &amp; ind_butterfly(1) &amp; '0' &amp; ind_butterfly(0);<br />
-- when &quot;10&quot; =&gt; out_sig := '0' &amp; '1' &amp; '1' &amp; ind_butterfly(3);<br />
   when &quot;10&quot; =&gt; out_sig := '0' &amp; ind_butterfly(1 downto 0) &amp; '0';<br />
   when others =&gt; out_sig := &quot;0000&quot;;<br />
end case;<br />
 <br />
elsif(c0='1') then -- address for 'y'.<br />
case ind_stage is<br />
  when &quot;00&quot; =&gt; out_sig := &quot;01&quot; &amp; ind_butterfly(1 downto 0);<br />
  when &quot;01&quot; =&gt; out_sig := '0' &amp; ind_butterfly(1) &amp; '1' &amp; ind_butterfly(0);<br />
  when &quot;10&quot; =&gt; out_sig := '0' &amp; ind_butterfly(1 downto 0) &amp; '1';<br />
  when others =&gt; out_sig := &quot;0000&quot;;<br />
end case;<br />
<br />
elsif(c1='1') then -- addresss for 'Y'<br />
case ind_stage is<br />
  when &quot;00&quot; =&gt; out_sig := &quot;11&quot; &amp; ind_butterfly(1 downto 0);<br />
  when &quot;01&quot; =&gt; out_sig := '1' &amp; ind_butterfly(1) &amp; '1' &amp; ind_butterfly(0);<br />
  when &quot;10&quot; =&gt; out_sig := '1' &amp; ind_butterfly(1 downto 0) &amp; '1';<br />
  when others =&gt; out_sig := &quot;0000&quot;;<br />
end case;<br />
<br />
elsif(c3='1') then -- address for 'X'<br />
case ind_stage is<br />
 when &quot;00&quot; =&gt; out_sig := &quot;10&quot; &amp; ind_butterfly(1 downto 0);<br />
  when &quot;01&quot; =&gt; out_sig := '1' &amp; ind_butterfly(1) &amp; '0' &amp; ind_butterfly(0);<br />
  when &quot;10&quot; =&gt; out_sig := '1' &amp; ind_butterfly(1 downto 0) &amp; '0';<br />
  when others =&gt; out_sig := &quot;0000&quot;;<br />
--else<br />
--out_sig := &quot;ZZZZ&quot;;<br />
end case;<br />
end if;<br />
end if;<br />
fftadd_rd &lt;= out_sig (3 downto 0) ;<br />
end process;<br />
end rtl;<br />
-- BUTTERFLY GENERATOR<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity but_gen is<br />
port (<br />
      add_incr , add_clear , stagedone : in std_logic ;<br />
      but_butterfly : out std_logic_vector(3 downto 0) ) ;<br />
end but_gen ;<br />
<br />
architecture rtl of but_gen is<br />
begin<br />
process(add_clear , add_incr , stagedone)<br />
variable cnt : integer ;<br />
variable count : std_logic_vector(3 downto 0) ;<br />
begin<br />
if(add_clear = '1' or stagedone = '1') then<br />
count := &quot;0000&quot; ;<br />
but_butterfly &lt;= &quot;0000&quot; ;<br />
elsif (add_incr'event and add_incr = '1') then<br />
but_butterfly &lt;= (count + 1) ;<br />
count := count + 1 ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
 <br />
entity control_main is<br />
port ( <br />
       a_small , sign_a , sign_b : in std_logic ;<br />
       sign_out , add_sub , reset_all : out std_logic ;<br />
       en_sub , en_swap , en_shift , addpulse , normalise : out std_logic ;<br />
       fin_sub , fin_swap , finish_shift , add_finish , end_all : in std_logic ;<br />
       clock_main , clock , reset , enbl , zero_num , change: in std_logic ) ;<br />
end control_main ; <br />
 <br />
architecture rtl of control_main is<br />
signal current_state , next_state : state ;<br />
begin<br />
process (current_state , add_finish , finish_shift , end_all , enbl , clock_main , fin_sub , fin_swap , zero_num , change)<br />
begin<br />
<br />
case current_state is<br />
 when reset1 =&gt;<br />
  if( enbl = '1' and clock_main = '1') then<br />
  normalise &lt;= '0' ;<br />
  addpulse &lt;= '0' ;<br />
  reset_all &lt;= '1' ;<br />
  next_state &lt;= reset2 ;<br />
  elsif ( enbl = '0') then<br />
  next_state &lt;= reset7 ;-- last state to exit <br />
  else <br />
  next_state &lt;= reset1 ;<br />
  end if ;<br />
<br />
 when reset2 =&gt;<br />
  reset_all &lt;= '0' ; -- else values willnot cchange<br />
  en_sub &lt;= '1' ;<br />
  en_swap &lt;= '1' ;<br />
  next_state &lt;= reset3 ;<br />
<br />
 when reset3 =&gt;<br />
  if (zero_num = '1') then<br />
  next_state &lt;= reset5 ;<br />
  en_sub &lt;= '0' ;<br />
  en_swap &lt;= '0' ;<br />
  elsif(fin_sub= '1') then<br />
  if(fin_swap = '1') then<br />
  en_shift &lt;= '1' ;<br />
  en_sub &lt;= '0' ;<br />
  en_swap &lt;= '0' ;<br />
  next_state &lt;= reset4 ;<br />
  end if ;<br />
  else<br />
  next_state &lt;= reset3 ;<br />
  end if ;<br />
  <br />
 when reset4 =&gt;<br />
 if (finish_shift = '1') then<br />
 en_shift &lt;= '0' ;<br />
 addpulse &lt;= '1' ;<br />
 next_state &lt;= reset5 ;<br />
 else<br />
 next_state &lt;= reset4 ;<br />
 end if ;<br />
<br />
 when reset5 =&gt;<br />
 if (zero_num = '1') then<br />
 normalise &lt;= '1' ;<br />
 next_state &lt;= reset6 ;<br />
 elsif (add_finish = '1') then<br />
 normalise &lt;= '1' ;<br />
 addpulse &lt;= '0' ;<br />
 next_state &lt;= reset6 ;<br />
 else<br />
 next_state &lt;= reset5 ;<br />
 end if ;<br />
 <br />
 when reset6 =&gt;<br />
 if (end_all = '1' and clock_main = '1') then<br />
 normalise &lt;= '0' ;<br />
 next_state &lt;= reset6 ;<br />
 elsif (end_all = '1' and clock_main = '0') then<br />
 next_state &lt;= reset1 ;<br />
 else<br />
 next_state &lt;= reset6 ;<br />
 end if ;<br />
<br />
 when reset7 =&gt;<br />
 next_state &lt;= reset7 ;<br />
<br />
 when others =&gt;<br />
 next_state &lt;= reset1 ;<br />
<br />
end case ;<br />
end process ;<br />
<br />
process(clock , reset , change)<br />
begin<br />
if(change = '1') then<br />
current_state &lt;= reset1 ;<br />
elsif (reset = '1') then<br />
current_state &lt;= reset1 ;<br />
elsif (clock= '1' and clock'event) then<br />
current_state &lt;= next_state ;<br />
end if ;<br />
end process ;<br />
<br />
process (a_small , sign_a , sign_b)<br />
begin<br />
if (sign_a = '0' and sign_b = '0') then<br />
sign_out &lt;= '0' ;<br />
add_sub &lt;= '1' ;<br />
<br />
elsif (sign_a = '1' and sign_b = '1') then<br />
sign_out &lt;= '1' ;<br />
add_sub &lt;= '1' ;<br />
<br />
elsif (a_small = '1' and sign_a = '0') then<br />
sign_out &lt;= '1' ;<br />
add_sub &lt;= '0' ;<br />
<br />
elsif (a_small = '0' and sign_a = '1') then<br />
sign_out &lt;= '1' ;<br />
add_sub &lt;= '0' ;<br />
<br />
else <br />
sign_out &lt;= '0' ;<br />
add_sub &lt;= '0' ;<br />
end if ;<br />
<br />
end process ;<br />
<br />
end rtl ;<br />
-- THIS FILE COUNTS THE NUMBER OF CYCLES AFTER FFT COMPUTATION IS ENABLED.<br />
-- THIS IS REQUIRED BECAUSE WRITING INTO THE RAM BEGINS ONLY AFTER 5 CYCLES (DURING C1)<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity counter is<br />
port (<br />
      c : out std_logic_vector(2 downto 0) ;<br />
      disable , clock_main , reset : in std_logic) ;<br />
end counter ;<br />
<br />
architecture rtl of counter is <br />
begin<br />
process (reset , clock_main , disable)<br />
variable temp : std_logic_vector(2 downto 0) ;<br />
begin<br />
 if (disable &lt;= '0') then<br />
 if(reset = '1') then<br />
 c &lt;= &quot;000&quot; ;<br />
 temp := &quot;000&quot; ;<br />
 elsif(clock_main = '1' and clock_main'event) then<br />
 c &lt;= (temp + 1) ;<br />
 temp := temp + 1 ;<br />
 end if ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- POSITIVE EDGE TRIGGERED FLIPFLOPS PLACED BEFORE THE DIVIDE BY TWO UNIT<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity level_edge is <br />
 port (<br />
       data_edge : in std_logic_vector(31 downto 0) ;<br />
       trigger_edge : in std_logic ;<br />
       edge_out : out std_logic_vector(31 downto 0) ) ;<br />
end level_edge ;<br />
<br />
architecture rtl of level_edge is<br />
begin<br />
process(data_edge , trigger_edge)<br />
begin<br />
if (trigger_edge='1' and trigger_edge'event) then<br />
edge_out &lt;= data_edge(31 downto 0) ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- DIVIDE BY TWO UNIT. THIS FILE HOWEVER PASSED THE DATA UNCHANGED<br />
-- BECAUSE DIVISION IS REQUIRED ONLY IF SCALING IS USED TO AVOID OVERFLOW.<br />
--  NO SCALING WAS USED IN THIS PROJECT, SO THAT RESULTS OF MATLAB MATCHED WITH OURS<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity divide is <br />
 port (<br />
       data_in : in std_logic_vector(31 downto 0) ;<br />
       data_out : out std_logic_vector(31 downto 0) ) ;<br />
end divide ;<br />
 <br />
architecture rtl of divide is<br />
begin<br />
process(data_in)<br />
variable divide_exp : std_logic_vector(7 downto 0) ;<br />
variable divide_mant : std_logic_vector(31 downto 0) ;<br />
begin<br />
if (data_in = &quot;00000000000000000000000000000000&quot;) then <br />
data_out &lt;= &quot;00000000000000000000000000000000&quot; ;<br />
elsif (data_in = &quot;10000000000000000000000000000000&quot;) then<br />
data_out &lt;= &quot;00000000000000000000000000000000&quot; ;<br />
else<br />
divide_exp := data_in(30 downto 23) ;<br />
divide_mant := data_in (31 downto 0) ;<br />
divide_exp := divide_exp - &quot;00000001&quot; ;<br />
--data_out &lt;= divide_mant(31) &amp; divide_exp(7 downto 0) &amp; divide_mant(22 downto 0)  ;<br />
data_out &lt;= data_in(31 downto 0) ; -- pass data unchanged<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- IO ADDRESS GENERATOR<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity ioadd_gen is<br />
port (<br />
      io_butterfly : in std_logic_vector(3 downto 0) ;<br />
      add_iomode , add_ip , add_op : in std_logic ;<br />
      base_ioadd : out std_logic_vector(3 downto 0) ) ;<br />
end ioadd_gen ;<br />
<br />
architecture rtl of ioadd_gen is<br />
begin<br />
process(io_butterfly , add_iomode , add_ip , add_op)<br />
variable out_data : std_logic_vector(3 downto 0) ;<br />
begin<br />
if(add_iomode = '1') then<br />
 if (add_ip = '1') then<br />
  out_data := io_butterfly(3 downto 0) ;<br />
 elsif(add_op = '1') then<br />
  if(io_butterfly(3) = '0') then -- ie, real part<br />
  out_data := '0' &amp; io_butterfly(0) &amp; io_butterfly(1) &amp; io_butterfly(2) ;<br />
  elsif(io_butterfly(3)='1') then -- ie, complex part<br />
  out_data := '1' &amp; io_butterfly(0) &amp; io_butterfly(1) &amp; io_butterfly(2) ;<br />
  end if ;<br />
 end if ;<br />
end if ;<br />
base_ioadd &lt;= out_data(3 downto 0) ;<br />
end process ;<br />
end rtl ;<br />
<br />
-- THIS FILE OUTPUTS THE &quot;IO DONE&quot; AND &quot;STAGE DONE&quot; AND &quot;FFT DONE&quot; SIGNALS AT THE <br />
-- CORRECT TIME. IT ALSO RECEIVES THE OUTPUT OF THE BUTTERFLY GENERATOR<br />
-- AND OUTPUTS IT UNCHANGED.<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity iod_staged is<br />
port (<br />
      but_fly : in std_logic_vector(3 downto 0) ;<br />
      stage_no : in std_logic_vector(1 downto 0) ;<br />
      add_incr , io_mode  : in std_logic ;<br />
      add_iod , add_staged , add_fftd : out std_logic ;<br />
      butterfly_iod : out std_logic_vector(3 downto 0) ) ;<br />
end iod_staged ;<br />
<br />
architecture rtl of iod_staged is<br />
begin<br />
process(but_fly,add_incr,io_mode)<br />
begin<br />
if(but_fly = 15 and io_mode = '1' and add_incr='0') then<br />
add_iod &lt;= '1' ; -- io done signal<br />
butterfly_iod &lt;= but_fly ;<br />
elsif(but_fly = 4 and io_mode = '0' and add_incr='1') then<br />
butterfly_iod &lt;= but_fly ;<br />
add_iod &lt;= '0' ;<br />
add_staged &lt;= '1' ; -- stage done signal<br />
else<br />
butterfly_iod &lt;= but_fly ;<br />
add_staged &lt;= '0' ;<br />
end if ;<br />
end process ;<br />
<br />
process(stage_no)<br />
begin<br />
if (stage_no=3) then<br />
add_fftd &lt;= '1' ; -- fft done signal<br />
end if ;<br />
end process ;<br />
<br />
end rtl;<br />
-- POSITIVE LEVEL TRIGGERED FLIP FLOPS<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity l_block is <br />
 port (<br />
       data_l : in std_logic_vector(31 downto 0) ;<br />
       trigger_l : in std_logic ;<br />
       l_out : out std_logic_vector(31 downto 0) ) ;<br />
end l_block ;<br />
<br />
architecture rtl of l_block is<br />
begin<br />
process(data_l , trigger_l)<br />
begin<br />
if (trigger_l='1') then<br />
l_out &lt;= data_l ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- MULTIPLEXER TO CHOOSE BETWEEN CLOCK AND C0<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity mult_clock is<br />
port (<br />
      clock_main , mult1_c0 , mult1_iomode , mult_clear : in std_logic ;<br />
      mult1_addincr : out std_logic ) ;<br />
end mult_clock ;<br />
<br />
architecture rtl of mult_clock is<br />
begin<br />
process(clock_main , mult1_c0 , mult1_iomode , mult_clear) <br />
variable temp1 : std_logic ;<br />
variable temp2 : std_logic ;<br />
begin<br />
if(mult1_iomode = '0') then -- ie, fft computation mode<br />
temp2 := mult1_c0 ; <br />
elsif(mult1_iomode = '1') then -- ie, io mode<br />
temp1 := clock_main ;<br />
end if ;<br />
if (mult1_iomode = '1') then<br />
mult1_addincr &lt;= temp1 ;<br />
elsif(mult1_iomode = '0') then<br />
mult1_addincr &lt;= temp2 ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- MULTIPLY UNIT<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity multiply is<br />
 port(<br />
      num_mux , num_rom : in std_logic_vector(31 downto 0) ;<br />
      clock : in std_logic ;<br />
      mult_out : out std_logic_vector(31 downto 0) ) ;<br />
end multiply ;<br />
<br />
architecture rtl of multiply is<br />
begin<br />
process(num_mux , num_rom , clock)<br />
variable sign_mult , t : std_logic := '0' ;<br />
variable temp1 , temp2 : std_logic_vector(22 downto 0) ;<br />
variable exp_mux , exp_rom : std_logic_vector(7 downto 0) ;<br />
variable mant_temp : std_logic_vector(45 downto 0) ;<br />
variable exp_mult , mux_temp , rom_temp : std_logic_vector(8 downto 0) ;<br />
variable res_temp : std_logic_vector(31 downto 0) ;<br />
begin<br />
<br />
temp1 := '1' &amp; num_mux(22 downto 1) ; -- '1' for implicit '1'. <br />
temp2 := '1' &amp; num_rom(22 downto 1) ;<br />
if (num_mux(31) = '1' and num_rom(31) = '1' and clock = '1') then -- sign of results<br />
sign_mult := '0' ;<br />
elsif (num_mux(31) = '0' and num_rom(31) = '0' and clock = '1') then<br />
sign_mult := '0' ;<br />
elsif(clock = '1') then<br />
sign_mult := '1' ;<br />
end if ;<br />
<br />
if (num_mux = 0 and clock = '1') then -- ie, the number is zero.<br />
t := '1' ;<br />
elsif (num_rom = 0 and clock = '1') then<br />
t := '1' ;<br />
elsif (clock = '1') then<br />
t := '0' ;<br />
end if ;<br />
<br />
if (t = '0' and clock = '1') then -- separation of mantissa and exponent <br />
exp_mux := num_mux (30 downto 23) ;<br />
exp_rom := num_rom (30 downto 23) ;<br />
mux_temp := '0' &amp; exp_mux(7 downto 0) ;<br />
rom_temp := '0' &amp; exp_rom(7 downto 0) ;<br />
exp_mult := mux_temp + rom_temp ;<br />
exp_mult := exp_mult - 127 ;<br />
<br />
mant_temp := temp1 * temp2 ;<br />
<br />
if(mant_temp(45) = '1') then -- normalisation.<br />
exp_mult := exp_mult + 1 ;<br />
res_temp := sign_mult &amp; exp_mult(7 downto 0) &amp; mant_temp(44 downto 22) ;<br />
mult_out &lt;= res_temp(31 downto 0) ;<br />
elsif(mant_temp(45) = '0') then<br />
res_temp := sign_mult &amp; exp_mult(7 downto 0) &amp; mant_temp(43 downto 21) ;<br />
mult_out &lt;= res_temp(31 downto 0) ;<br />
end if ;<br />
elsif (t = '1' and clock = '1') then -- number zero<br />
mult_out &lt;= &quot;00000000000000000000000000000000&quot; ;<br />
t := '0' ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- multiplexer in the address generation unit<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity mux_add is<br />
port (<br />
      a , b : in std_logic_vector(3 downto 0) ;<br />
      sel : in std_logic ;<br />
      q : out std_logic_vector(3 downto 0) ) ;<br />
end mux_add ;<br />
<br />
architecture rtl of mux_add is<br />
begin<br />
process (a , b , sel)<br />
begin<br />
if(sel = '0') then<br />
q &lt;= a(3 downto 0) after 2 ns ;<br />
elsif(sel = '1') then<br />
q &lt;= b(3 downto 0) after 2 ns ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- MULTIPLEXER IN THE BUTTERFLY PROCESSING UNIT<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity mux is<br />
 port (<br />
       d0 , d1 : in std_logic_vector(31 downto 0) ;<br />
       mux_out : out std_logic_vector(31 downto 0) ;<br />
       choose : in std_logic ) ;<br />
end mux ;<br />
 <br />
architecture rtl of mux is<br />
begin<br />
process(d0 , d1 , choose)<br />
begin<br />
if (choose = '0') then<br />
mux_out &lt;= d0(31 downto 0) ;<br />
elsif (choose = '1') then<br />
mux_out &lt;= d1(31 downto 0) ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
--NEGATION UNIT<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity negate is<br />
 port (<br />
       neg_in : in std_logic_vector(31 downto 0) ;<br />
       neg_en , clock_main : in std_logic ;<br />
       neg_out : out std_logic_vector(31 downto 0) ) ;<br />
end negate ;<br />
<br />
architecture rtl of negate is<br />
begin<br />
process(neg_in , neg_en , clock_main) <br />
variable neg_temp : std_logic_vector(31 downto 0) ;<br />
begin<br />
neg_temp := neg_in(31 downto 0) ;<br />
if (clock_main = '1') then<br />
if (neg_en = '1') then<br />
if(neg_in(31) = '0') then<br />
neg_temp := '1' &amp; neg_temp (30 downto 0) ;<br />
else<br />
neg_temp := '0' &amp; neg_temp (30 downto 0) ;<br />
end if ;<br />
neg_out &lt;= neg_temp ;<br />
else<br />
neg_out &lt;= neg_in(31 downto 0) ;<br />
end if ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
<br />
--while not endfile(vector_file) loop<br />
--for count in 1 to 16 loop<br />
-- Behavioral description of dual-port SRAM with :<br />
-- Active High write enable (WE)<br />
-- Active High read enable (RE)<br />
-- Rising clock edge (Clock)<br />
library ieee;<br />
use ieee.std_logic_1164.all;<br />
use IEEE.std_logic_arith.all;<br />
use IEEE.std_logic_unsigned.all;<br />
use work.butter_lib.all ;<br />
entity reg_dpram is<br />
port (<br />
      data_fft , data_io : in std_logic_vector (31 downto 0);<br />
      q : out std_logic_vector (31 downto 0);<br />
      clock , io_mode : in std_logic;<br />
      we , re : in std_logic;<br />
      waddress: in std_logic_vector (3 downto 0);<br />
      raddress: in std_logic_vector (3 downto 0));<br />
end reg_dpram;<br />
architecture behav of reg_dpram is<br />
type MEM is array (0 to 15) of std_logic_vector(31 downto 0);<br />
signal ramTmp : MEM;<br />
<br />
begin<br />
<br />
-- Write Functional Section<br />
process (clock,waddress,we)<br />
begin<br />
if (clock='0') then<br />
if (we = '1') then<br />
if (io_mode = '0') then<br />
ramTmp (conv_integer (waddress)) &lt;= data_fft ;<br />
elsif (io_mode = '1') then<br />
ramTmp (conv_integer (waddress)) &lt;= data_io ;<br />
end if ;<br />
end if ;<br />
end if ;<br />
end process ;<br />
<br />
-- Read Functional Section<br />
process (clock,raddress,re)<br />
begin<br />
if (clock='1') then<br />
if (re = '1') then<br />
q &lt;= ramTmp(conv_integer (raddress)) ;<br />
end if;<br />
end if;<br />
end process;<br />
end behav;<br />
-- PARALLE IN PARALLEL OUT SHIFTER IN THE ADDRESS GENERATION UNIT.<br />
-- REQUIRED BECAUSE FFT IS COMPUTED ON DATA AND WRITTEN BACK INTO THE SAME<br />
-- LOCATION AFTER 5 CYCLES. SO THE READ ADDRESS IS SHIFTED THROUGH 5 CYCLES<br />
-- AND GIVEN AS WRITE ADDRESS.<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity ram_shift is<br />
port (<br />
      data_in : in std_logic_vector(3 downto 0) ;<br />
      clock_main : in std_logic ;<br />
      data_out : out std_logic_vector(3 downto 0) ) ;<br />
end ram_shift ;<br />
<br />
architecture rtl of ram_shift is<br />
begin<br />
process(clock_main , data_in)<br />
begin<br />
if (clock_main'event and clock_main = '0') then<br />
data_out &lt;= data_in(3 downto 0) ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- NEGATIVE EDGE TRIGGERED FLIP FLOPS<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity r_block is <br />
 port (<br />
       data : in std_logic_vector(31 downto 0) ;<br />
       trigger : in std_logic ;<br />
       r_out : out std_logic_vector(31 downto 0) ) ;<br />
end r_block ;<br />
<br />
architecture rtl of r_block is<br />
begin<br />
process(data , trigger)<br />
begin<br />
if (trigger='0' and trigger'event) then<br />
r_out &lt;= data(31 downto 0) ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- ROM TO STORE SINE AND COSINE VALUES<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity rom is<br />
port (<br />
      clock , en_rom : in std_logic ;<br />
      romadd : in std_logic_vector(2 downto 0) ;<br />
      rom_data : out std_logic_vector(31 downto 0) ) ;<br />
end rom ;<br />
<br />
architecture rtl of rom is<br />
begin <br />
process(clock,en_rom)<br />
begin<br />
if(en_rom = '1') then<br />
if(clock = '1') then<br />
case romadd is<br />
 when &quot;000&quot; =&gt;<br />
 rom_data &lt;= &quot;00111111100000000000000000000000&quot; ;<br />
 when &quot;001&quot; =&gt;<br />
 rom_data &lt;= &quot;00000000000000000000000000000000&quot; ;<br />
 when &quot;010&quot; =&gt;<br />
 rom_data &lt;= &quot;00111111001101010000010010000001&quot; ;<br />
 when &quot;011&quot; =&gt;<br />
 rom_data &lt;= &quot;00111111001101010000010010000001&quot; ;<br />
 when &quot;100&quot; =&gt;<br />
 rom_data &lt;= &quot;00000000000000000000000000000000&quot; ;<br />
 when &quot;101&quot; =&gt;<br />
 rom_data &lt;=  &quot;00111111100000000000000000000000&quot; ;<br />
 when &quot;110&quot; =&gt;<br />
 rom_data &lt;= &quot;10111111001101010000010010000001&quot;  ;<br />
 when &quot;111&quot; =&gt;<br />
 rom_data &lt;= &quot;00111111001101010000010010000001&quot; ;<br />
 when others =&gt; <br />
 rom_data &lt;= &quot;01000000000000000000000000000000&quot; ;<br />
end case ;<br />
end if ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- ADDRESS GENERATOR FOR ROM<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity romadd_gen is<br />
port (<br />
      io_rom,c0,c1,c2,c3 : in std_logic ;<br />
      stage_rom : in std_logic_vector(1 downto 0) ;<br />
      butterfly_rom : in std_logic_vector(3 downto 0) ;<br />
      romadd : out std_logic_vector(2 downto 0) ;<br />
      romgen_en : in std_logic );<br />
end romadd_gen ;<br />
<br />
architecture rtl of romadd_gen is<br />
begin <br />
process(io_rom,c0,c1,c2,c3,stage_rom,butterfly_rom)<br />
begin<br />
if(romgen_en = '1') then<br />
if(io_rom = '0') then<br />
 case stage_rom is<br />
<br />
 when &quot;00&quot; =&gt;<br />
 if(c0='1' or c2='1') then<br />
 romadd &lt;= &quot;000&quot; ;<br />
 elsif(c1='1' or c3='1') then<br />
 romadd &lt;= &quot;001&quot; ;<br />
 end if ;<br />
<br />
 when &quot;01&quot; =&gt;<br />
 if(butterfly_rom=0 or butterfly_rom=1) then<br />
  if(c0='1' or c2='1') then<br />
  romadd &lt;= &quot;000&quot; ;<br />
  elsif(c1='1' or c3='1') then<br />
  romadd &lt;= &quot;001&quot; ;<br />
  end if ;<br />
 elsif(butterfly_rom=2 or butterfly_rom=3) then<br />
  if(c0='1' or c2='1') then<br />
  romadd &lt;= &quot;100&quot; ;<br />
  elsif(c1='1' or c3='1') then<br />
  romadd &lt;= &quot;101&quot; ;<br />
  end if ;<br />
 end if ;<br />
<br />
 when &quot;10&quot; =&gt;<br />
  if(butterfly_rom=0) then<br />
   if(c0='1' or c2='1') then<br />
   romadd &lt;= &quot;000&quot; ;<br />
   elsif(c1='1' or c3='1') then<br />
   romadd &lt;= &quot;001&quot; ;<br />
   end if ;<br />
  elsif(butterfly_rom=1) then<br />
   if(c0='1' or c2='1') then<br />
   romadd &lt;= &quot;100&quot; ;<br />
   elsif(c1='1' or c3='1') then<br />
   romadd &lt;= &quot;101&quot; ;<br />
   end if ;<br />
  elsif(butterfly_rom=2) then<br />
   if(c0='1' or c2='1') then<br />
   romadd &lt;= &quot;010&quot; ;<br />
   elsif(c1='1' or c3='1') then<br />
   romadd &lt;= &quot;011&quot; ;<br />
   end if ;<br />
  elsif (butterfly_rom=3) then<br />
   if(c0='1' or c2='1') then<br />
   romadd &lt;= &quot;110&quot; ;<br />
   elsif(c1='1' or c3='1') then<br />
   romadd &lt;= &quot;111&quot; ;<br />
   end if ;<br />
  end if ;<br />
<br />
 when others =&gt;<br />
  romadd &lt;= &quot;000&quot; ;<br />
<br />
 end case ;<br />
end if ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- SHIFT UNIT<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_arith.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity shift2 is<br />
port (<br />
       sub_control : in std_logic_vector (8 downto 0) ;	<br />
       c_in  : in std_logic_vector (32 downto 0) ;<br />
       shift_out : out std_logic_vector (31 downto 0) ;<br />
       clock , shift_en , rst_shift : in std_logic ;<br />
       finish_out : out std_logic ) ;<br />
end shift2 ;<br />
architecture rtl of shift2 is<br />
begin<br />
process(clock)<br />
variable sub_temp : std_logic_vector(7 downto 0) ;<br />
variable  temp2 , temp4 : std_logic_vector(31 downto 0) ;<br />
variable temp3 , t : std_logic ;<br />
begin<br />
if(rst_shift='0') then<br />
if(shift_en = '1') then<br />
if(temp3 = '1') then<br />
if(sub_control(8) = '1') then <br />
sub_temp := sub_control (7 downto 0) ;<br />
temp2 := '1' &amp; c_in (31 downto 1) ; --'1' for implicit one<br />
temp3 := '0' ;<br />
end if ;<br />
end if ;<br />
end if ;<br />
end if ;<br />
<br />
if(rst_shift='0') then<br />
if(shift_en = '1') then<br />
if(t = '1') then<br />
if (sub_control(8) = '1') then<br />
if (conv_integer(sub_temp(7 downto 0)) = 0) then<br />
shift_out &lt;= temp2 ;<br />
finish_out &lt;= '1' ;<br />
t := '0' ;<br />
elsif ( clock = '1') then<br />
temp2 := '0' &amp; temp2 (31 downto 1) ;<br />
sub_temp := sub_temp - &quot;00000001&quot; ;<br />
end if ;<br />
end if ;<br />
end if ;<br />
end if ;<br />
elsif(rst_shift='1') then<br />
temp3 := '1' ;<br />
finish_out &lt;= '0' ;<br />
t := '1' ;<br />
end if ;<br />
<br />
end process ;<br />
end rtl ;<br />
-- SUBTRACTOR UNIT<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity subtractor is<br />
 port ( <br />
       a : in std_logic_vector (31 downto 0) ;<br />
       b : in std_logic_vector (31 downto 0) ;<br />
       clock , rst_sub , sub_en : in std_logic ;<br />
       a_smaller , fin_sub , num_zero : out std_logic ;<br />
       zero_detect : out std_logic_vector(1 downto 0) ;<br />
       sub : out std_logic_vector (8 downto 0) ;<br />
       change : out std_logic ) ;<br />
end subtractor ;<br />
<br />
architecture rtl of subtractor is<br />
begin<br />
process (a , b , clock , rst_sub , sub_en)<br />
variable temp ,c , d : std_logic_vector (7 downto 0) ;<br />
variable e , f : std_logic_vector (22 downto 0) ;<br />
begin<br />
if (rst_sub = '0') then<br />
c := a (30 downto 23) ;<br />
d := b (30 downto 23) ;<br />
e := a (22 downto 0) ;<br />
f := b (22 downto 0) ;<br />
<br />
if(sub_en = '1') then<br />
if (clock = '1') then<br />
if ((c=0)) then<br />
zero_detect &lt;= &quot;01&quot; ;<br />
num_zero &lt;= '1' ;<br />
<br />
elsif ((d=0)) then<br />
zero_detect &lt;= &quot;10&quot; ;<br />
num_zero &lt;= '1' ;<br />
<br />
elsif (c &lt; d ) then<br />
temp := d - c ;<br />
a_smaller &lt;= '1' ;<br />
sub &lt;= '1' &amp; temp (7 downto 0) ;<br />
fin_sub &lt;= '1' ;<br />
zero_detect &lt;= &quot;00&quot; ;<br />
num_zero &lt;= '0' ;<br />
<br />
elsif (d &lt; c) then<br />
temp := c - d ; <br />
a_smaller &lt;= '0' ;<br />
sub &lt;= '1' &amp; temp (7 downto 0) ;<br />
fin_sub &lt;= '1' ;<br />
zero_detect &lt;= &quot;00&quot; ;<br />
num_zero &lt;= '0' ;<br />
<br />
elsif((c=d) and e &lt; f) then<br />
a_smaller &lt;= '1' ;<br />
temp:= c-d ;<br />
sub &lt;= '1' &amp; temp (7 downto 0) ;<br />
fin_sub &lt;= '1' ;<br />
zero_detect &lt;= &quot;00&quot; ;<br />
num_zero &lt;= '0' ;<br />
<br />
elsif ((c=d) and e &gt; f) then <br />
a_smaller &lt;= '0' ;<br />
temp := c-d ;<br />
sub &lt;= '1' &amp; temp (7 downto 0) ;<br />
zero_detect &lt;= &quot;00&quot; ;<br />
num_zero &lt;= '0' ;<br />
fin_sub &lt;= '1' ;<br />
<br />
elsif ((c=d) and (e = f)) then<br />
temp := c-d ;<br />
a_smaller &lt;= '0' ;<br />
sub &lt;= '1' &amp; &quot;00000000&quot; ;<br />
fin_sub &lt;= '1' ;<br />
zero_detect &lt;= &quot;00&quot; ;<br />
num_zero &lt;= '0' ;<br />
<br />
<br />
end if ;<br />
end if ;<br />
end if ;<br />
<br />
elsif(rst_sub = '1') then<br />
fin_sub &lt;= '0' ;<br />
sub &lt;= &quot;000000000&quot; ;<br />
num_zero &lt;= '0' ;<br />
zero_detect &lt;= &quot;00&quot; ;<br />
<br />
end if ;<br />
<br />
end process ;<br />
<br />
process(a , b) -- process to identify when a new number comes<br />
begin<br />
change &lt;= transport '1' after 1 ns ;<br />
change &lt;= transport '0' after 5 ns ;<br />
end process ;<br />
<br />
end rtl ;<br />
-- SUMMER<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity summer is<br />
port ( <br />
       num1 , num2 : in std_logic_vector (31 downto 0) ;<br />
       exp : in std_logic_vector (7 downto 0) ;<br />
       addpulse_in , addsub , rst_sum : in std_logic ;<br />
       add_finish : out std_logic ;<br />
       sumout : out std_logic_vector ( 32 downto 0) ) ;<br />
end summer ;<br />
architecture rtl of summer is<br />
begin<br />
process (num1 , num2 , addpulse_in , rst_sum)<br />
variable temp_num1 , temp_sum , temp_num2 , temp_sum2 , res : std_logic_vector (32 downto 0);<br />
variable temp_exp : std_logic_vector (7 downto 0) ;<br />
begin<br />
if (rst_sum = '0') then<br />
if (addpulse_in = '1') then<br />
temp_num1 := '0' &amp; num1 (31 downto 0) ; --0 to find whether normalisation is required.<br />
temp_num2 := '0' &amp; num2 (31 downto 0) ; --if required MSB will be 1 after addition<br />
<br />
if (addsub = '1') then<br />
temp_sum := temp_num1 + temp_num2 ;<br />
sumout &lt;= temp_sum ;<br />
add_finish &lt;= '1' ;<br />
<br />
else<br />
temp_sum := temp_num2 - temp_num1 ;<br />
--res := temp_sum + temp_num1 ;<br />
sumout &lt;= temp_sum ;<br />
add_finish &lt;= '1' ;<br />
end if ;<br />
end if ;<br />
<br />
elsif (rst_sum = '1') then<br />
add_finish &lt;= '0';<br />
end if ;<br />
end process ;<br />
<br />
end rtl ;<br />
-- SWAP UNIT<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity swap is<br />
port (<br />
       a : in std_logic_vector (31 downto 0) ;<br />
       b : in std_logic_vector (31 downto 0) ;<br />
       clock : in std_logic ;<br />
       rst_swap , en_swap : in std_logic ;<br />
       finish_swap : out std_logic ;<br />
       d : out std_logic_vector (31 downto 0) ;<br />
       large_exp : out std_logic_vector (7 downto 0) ;<br />
       c  : out std_logic_vector (32 downto 0 ) ) ;<br />
end swap ;<br />
<br />
architecture rtl of swap is<br />
begin<br />
process (a , b , clock , rst_swap , en_swap)<br />
variable x , y : std_logic_vector (7 downto 0) ;<br />
variable p , q : std_logic_vector (22 downto 0) ;<br />
begin<br />
if(rst_swap = '1' ) then <br />
c &lt;= '0' &amp; a(22 downto 0) &amp; &quot;000000000&quot; ;<br />
finish_swap &lt;= '0' ;<br />
elsif(rst_swap = '0') then<br />
if(en_swap = '1') then<br />
x := a (30 downto 23) ;<br />
y := b (30 downto 23) ;<br />
p := a (22 downto 0) ;<br />
q := b (22 downto  0) ;<br />
if (clock = '1') then<br />
if (x &lt; y) then<br />
c &lt;= '1' &amp; a (22 downto 0) &amp; &quot;000000000&quot; ; -- '1' for checking<br />
d &lt;= '1' &amp; b (22 downto 0) &amp; &quot;00000000&quot; ; -- '1' for implicit one <br />
large_exp &lt;= b (30 downto 23) ; <br />
finish_swap &lt;= '1' ;<br />
<br />
elsif (y &lt; x) then<br />
c &lt;= '1' &amp; b (22 downto 0) &amp; &quot;000000000&quot; ;<br />
d &lt;= '1' &amp; a (22 downto 0) &amp; &quot;00000000&quot; ; -- '1' for implicit 1.<br />
large_exp &lt;= a (30 downto 23) ;<br />
finish_swap &lt;= '1' ;<br />
<br />
elsif ( (x=y) and (p &lt; q)) then<br />
c &lt;= '1' &amp; a (22 downto 0) &amp; &quot;000000000&quot; ; -- '1' for checking<br />
d &lt;= '1' &amp; b (22 downto 0) &amp; &quot;00000000&quot; ; -- '1' for implicit one<br />
large_exp &lt;= b (30 downto 23) ; <br />
finish_swap &lt;= '1' ; <br />
<br />
else<br />
c &lt;= '1' &amp; b (22 downto 0) &amp; &quot;000000000&quot; ;<br />
d &lt;= '1' &amp; a (22 downto 0) &amp; &quot;00000000&quot; ; -- '1' for implicit 1.<br />
large_exp &lt;= a (30 downto 23) ;<br />
finish_swap &lt;= '1' ;<br />
<br />
end if ;<br />
end if ;<br />
end if ;<br />
end if ;<br />
end process;<br />
end rtl;<br />
<br />
-- STAGE NUMBER GENERATOR.<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity stage_gen is<br />
port (<br />
      add_staged , add_clear : in std_logic ;<br />
      st_stage : out std_logic_vector(1 downto 0) ) ;  <br />
end stage_gen ;<br />
<br />
architecture rtl of stage_gen is<br />
<br />
variable s_count : std_logic_vector(1 downto 0) ;<br />
begin<br />
process(add_staged , add_clear)<br />
begin<br />
if (add_clear = '1') then<br />
st_stage &lt;= &quot;00&quot; ;<br />
s_count := &quot;00&quot; ;<br />
elsif(add_staged'event and add_staged= '1' ) then<br />
st_stage &lt;= s_count + 1 ;<br />
s_count := s_count + 1 ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
<br />
--WAVEFORM GENERATOR<br />
-- THE 4 BITS OF &quot;DATA_OUT&quot; ARE &quot;C0 C1 C2 C3&quot;<br />
library ieee ; <br />
use ieee.std_logic_1164.all ;<br />
use work.butter_lib.all ;<br />
<br />
entity cycles is <br />
port (<br />
      clock_main , preset , c0_en , cycles_clear : in std_logic ;<br />
      waves : out std_logic_vector(3 downto 0) ) ;<br />
end cycles ;<br />
architecture rtl of cycles is<br />
--type state_values is (st0 , st1 , st2 ,  st3) ;<br />
--signal pres_state1 , next_state1 : state_values ;<br />
shared variable data_out : std_logic_vector(3 downto 0)  ;<br />
begin<br />
process (clock_main , preset , c0_en,cycles_clear)<br />
variable t : std_logic ;<br />
begin<br />
if (c0_en = '1') then<br />
 if (preset = '1' and t='1')then<br />
 pres_state1 &lt;= st0 ;<br />
 t := '0' ;<br />
 elsif (clock_main'event and clock_main= '0') then<br />
 pres_state1 &lt;= next_state1 ;<br />
 end if ;<br />
end if ;<br />
if(cycles_clear = '1') then<br />
t := '1' ;<br />
end if ;<br />
end process ;<br />
<br />
process(pres_state1 , c0_en , clock_main)<br />
variable temp_clock : std_logic ;<br />
begin<br />
<br />
 case pres_state1 is<br />
  when st0 =&gt;<br />
   data_out := &quot;1000&quot; ; <br />
   next_state1 &lt;= st1 ;<br />
<br />
  when st1 =&gt;<br />
    data_out :=  &quot;0100&quot; ;<br />
    next_state1 &lt;= st2 ;<br />
 <br />
 when st2 =&gt;<br />
   data_out := &quot;0010&quot; ;<br />
   next_state1 &lt;= st3 ;<br />
<br />
 when st3 =&gt;<br />
   data_out := &quot;0001&quot; ;<br />
   next_state1 &lt;= st0 ;<br />
<br />
 when others =&gt;<br />
    next_state1 &lt;= st0 ;<br />
<br />
end case ;<br />
<br />
waves &lt;= data_out ;<br />
<br />
end process ;<br />
end rtl ;<br />
<br />
<br />
-- CONTROL UNIT OF THE PROCESSOR<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity cont_gen is<br />
port (<br />
      con_staged , con_iod , con_fftd , con_init : in std_logic ;<br />
      con_ip , con_op , con_iomode , con_fft : out std_logic ;<br />
      con_enbw , con_enbor , c0_enable , con_preset : out std_logic ;<br />
      con_clear , disable : out std_logic ;<br />
      c0 , clock_main : in std_logic ;<br />
      en_rom , en_romgen , reset_counter : out std_logic ; <br />
      con_clkcount : in std_logic_vector(2 downto 0) ) ;<br />
end cont_gen ;<br />
<br />
architecture rtl of cont_gen is<br />
type state is (rst1,rst2,rst3,rst4,rst5,rst6,rst7) ;<br />
signal current_state , next_state : state ;<br />
shared variable counter , temp2 : std_logic_vector(1 downto 0) := &quot;00&quot; ;<br />
begin<br />
process (current_state ,con_staged , con_iod , con_fftd , con_clkcount , c0) <br />
<br />
begin<br />
case current_state is<br />
 when rst1 =&gt;<br />
 con_iomode &lt;= '1' ; -- set mode to io.<br />
 con_ip &lt;= '1' ; -- input mode<br />
 con_clear &lt;= '1' ; -- clear all blocks<br />
 con_enbw &lt;= '1' ; -- enable write to RAM<br />
 con_enbor &lt;= '0' ; -- disable read<br />
 c0_enable &lt;= '0' ; -- disable cycles unit<br />
 disable &lt;= '1' ; -- disable counter<br />
 next_state &lt;= rst2 ;<br />
<br />
 when rst2 =&gt;<br />
  con_clear &lt;= '0' ; -- bring clear signal back to zero<br />
  next_state &lt;=rst3 ;<br />
<br />
 when rst3 =&gt;<br />
  if(con_iod = '1') then<br />
   con_preset &lt;= '1' ; -- reset cycles <br />
   reset_counter &lt;= '1' ; -- reset counter<br />
   c0_enable &lt;= '1' ; -- enable cycles<br />
   con_iomode &lt;= '0' ; -- set io mode to '0'<br />
   con_fft &lt;= '1' ; -- fft mode<br />
   en_rom &lt;= '1' ; -- enable ROM<br />
   en_romgen &lt;= '1' ; -- enable ROM address generator<br />
   con_clear &lt;= '1' ; -- clear all blocks<br />
   con_enbw &lt;= '0' ; -- disable write to RAM<br />
   con_enbor &lt;= '1' ; -- enable read from ROM<br />
   disable &lt;= '0' ; -- enable  counter unit. <br />
   next_state &lt;= rst4 ;<br />
  else<br />
  next_state &lt;= rst3 ;<br />
  end if ;<br />
<br />
 when rst4 =&gt;<br />
  con_preset &lt;= '0' ; -- reset for cycles <br />
  reset_counter &lt;= '0' ; -- reset for counter<br />
  con_clear &lt;= '0' ; -- clear all signals<br />
  if (con_clkcount = 5) then -- check whether 4 or not<br />
   con_enbw &lt;= '1' ; -- enable write to ROM<br />
   disable &lt;= '1' ; -- disable counter <br />
   reset_counter &lt;= '1' ; -- reset counter<br />
   next_state &lt;= rst5 ;<br />
  else<br />
   next_state &lt;= rst4 ;<br />
  end if ;<br />
 <br />
 when rst5 =&gt;<br />
  <br />
  if (con_fftd = '1') then <br />
  disable &lt;= '0' ; -- enable counter<br />
  reset_counter &lt;= '0' ; <br />
  con_clear &lt;= '1' ; -- clear butterfly generator<br />
  con_fft &lt;= '0' ; -- disable fft address generator<br />
  if (con_clkcount = 4) then<br />
    disable &lt;= '1';<br />
    con_enbw &lt;= '0' ;<br />
    con_iomode &lt;= '1' ;<br />
    con_op &lt;= '1' ;<br />
    con_ip &lt;= '0' ;<br />
    next_state &lt;= rst6 ;<br />
    else<br />
   next_state &lt;= rst5 ;<br />
   end if ;<br />
  else<br />
  next_state &lt;= rst5 ; <br />
 end if ;<br />
 <br />
 when rst6 =&gt;<br />
  con_clear &lt;= '0' ;<br />
  next_state &lt;= rst7 ;<br />
<br />
 when rst7 =&gt;<br />
  if(con_iod = '1') then<br />
   con_clear &lt;= '1' ;<br />
   con_preset &lt;= '1' ;<br />
   con_enbor &lt;= '0';<br />
  else<br />
  next_state &lt;= rst7 ;<br />
  end if ;<br />
  <br />
 <br />
 when others =&gt;<br />
  next_state &lt;= rst1 ;<br />
<br />
end case ;<br />
end process ;<br />
<br />
process(clock_main , con_init)<br />
begin<br />
if(con_init = '1') then<br />
current_state &lt;= rst1 ;<br />
elsif (clock_main'event and clock_main = '0') then<br />
current_state &lt;= next_state ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- CONTROL UNIT OF THE PROCESSOR<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity cont_gen is<br />
port (<br />
      con_staged , con_iod , con_fftd , con_init : in std_logic ;<br />
      con_ip , con_op , con_iomode , con_fft : out std_logic ;<br />
      con_enbw , con_enbor , c0_enable , con_preset : out std_logic ;<br />
      con_clear , disable : out std_logic ;<br />
      c0 , clock_main : in std_logic ;<br />
      en_rom , en_romgen , reset_counter : out std_logic ; <br />
      con_clkcount : in std_logic_vector(2 downto 0) ) ;<br />
end cont_gen ;<br />
<br />
architecture rtl of cont_gen is<br />
type state is (rst1,rst2,rst3,rst4,rst5,rst6,rst7) ;<br />
signal current_state , next_state : state ;<br />
shared variable counter , temp2 : std_logic_vector(1 downto 0) := &quot;00&quot; ;<br />
begin<br />
process (current_state ,con_staged , con_iod , con_fftd , con_clkcount , c0) <br />
<br />
begin<br />
case current_state is<br />
 when rst1 =&gt;<br />
 con_iomode &lt;= '1' ; -- set mode to io.<br />
 con_ip &lt;= '1' ; -- input mode<br />
 con_clear &lt;= '1' ; -- clear all blocks<br />
 con_enbw &lt;= '1' ; -- enable write to RAM<br />
 con_enbor &lt;= '0' ; -- disable read<br />
 c0_enable &lt;= '0' ; -- disable cycles unit<br />
 disable &lt;= '1' ; -- disable counter<br />
 next_state &lt;= rst2 ;<br />
<br />
 when rst2 =&gt;<br />
  con_clear &lt;= '0' ; -- bring clear signal back to zero<br />
  next_state &lt;=rst3 ;<br />
<br />
 when rst3 =&gt;<br />
  if(con_iod = '1') then<br />
   con_preset &lt;= '1' ; -- reset cycles <br />
   reset_counter &lt;= '1' ; -- reset counter<br />
   c0_enable &lt;= '1' ; -- enable cycles<br />
   con_iomode &lt;= '0' ; -- set io mode to '0'<br />
   con_fft &lt;= '1' ; -- fft mode<br />
   en_rom &lt;= '1' ; -- enable ROM<br />
   en_romgen &lt;= '1' ; -- enable ROM address generator<br />
   con_clear &lt;= '1' ; -- clear all blocks<br />
   con_enbw &lt;= '0' ; -- disable write to RAM<br />
   con_enbor &lt;= '1' ; -- enable read from ROM<br />
   disable &lt;= '0' ; -- enable  counter unit. <br />
   next_state &lt;= rst4 ;<br />
  else<br />
  next_state &lt;= rst3 ;<br />
  end if ;<br />
<br />
 when rst4 =&gt;<br />
  con_preset &lt;= '0' ; -- reset for cycles <br />
  reset_counter &lt;= '0' ; -- reset for counter<br />
  con_clear &lt;= '0' ; -- clear all signals<br />
  if (con_clkcount = 5) then -- check whether 4 or not<br />
   con_enbw &lt;= '1' ; -- enable write to ROM<br />
   disable &lt;= '1' ; -- disable counter <br />
   reset_counter &lt;= '1' ; -- reset counter<br />
   next_state &lt;= rst5 ;<br />
  else<br />
   next_state &lt;= rst4 ;<br />
  end if ;<br />
 <br />
 when rst5 =&gt;<br />
  <br />
  if (con_fftd = '1') then <br />
  disable &lt;= '0' ; -- enable counter<br />
  reset_counter &lt;= '0' ; <br />
  con_clear &lt;= '1' ; -- clear butterfly generator<br />
  con_fft &lt;= '0' ; -- disable fft address generator<br />
  if (con_clkcount = 4) then<br />
    disable &lt;= '1';<br />
    con_enbw &lt;= '0' ;<br />
    con_iomode &lt;= '1' ;<br />
    con_op &lt;= '1' ;<br />
    con_ip &lt;= '0' ;<br />
    next_state &lt;= rst6 ;<br />
    else<br />
   next_state &lt;= rst5 ;<br />
   end if ;<br />
  else<br />
  next_state &lt;= rst5 ; <br />
 end if ;<br />
 <br />
 when rst6 =&gt;<br />
  con_clear &lt;= '0' ;<br />
  next_state &lt;= rst7 ;<br />
<br />
 when rst7 =&gt;<br />
  if(con_iod = '1') then<br />
   con_clear &lt;= '1' ;<br />
   con_preset &lt;= '1' ;<br />
   con_enbor &lt;= '0';<br />
  else<br />
  next_state &lt;= rst7 ;<br />
  end if ;<br />
  <br />
 <br />
 when others =&gt;<br />
  next_state &lt;= rst1 ;<br />
<br />
end case ;<br />
end process ;<br />
<br />
process(clock_main , con_init)<br />
begin<br />
if(con_init = '1') then<br />
current_state &lt;= rst1 ;<br />
elsif (clock_main'event and clock_main = '0') then<br />
current_state &lt;= next_state ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
-- CONTROL UNIT OF THE PROCESSOR<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity cont_gen is<br />
port (<br />
      con_staged , con_iod , con_fftd , con_init : in std_logic ;<br />
      con_ip , con_op , con_iomode , con_fft : out std_logic ;<br />
      con_enbw , con_enbor , c0_enable , con_preset : out std_logic ;<br />
      con_clear , disable : out std_logic ;<br />
      c0 , clock_main : in std_logic ;<br />
      en_rom , en_romgen , reset_counter : out std_logic ; <br />
      con_clkcount : in std_logic_vector(2 downto 0) ) ;<br />
end cont_gen ;<br />
<br />
architecture rtl of cont_gen is<br />
type state is (rst1,rst2,rst3,rst4,rst5,rst6,rst7) ;<br />
signal current_state , next_state : state ;<br />
shared variable counter , temp2 : std_logic_vector(1 downto 0) := &quot;00&quot; ;<br />
begin<br />
process (current_state ,con_staged , con_iod , con_fftd , con_clkcount , c0) <br />
<br />
begin<br />
case current_state is<br />
 when rst1 =&gt;<br />
 con_iomode &lt;= '1' ; -- set mode to io.<br />
 con_ip &lt;= '1' ; -- input mode<br />
 con_clear &lt;= '1' ; -- clear all blocks<br />
 con_enbw &lt;= '1' ; -- enable write to RAM<br />
 con_enbor &lt;= '0' ; -- disable read<br />
 c0_enable &lt;= '0' ; -- disable cycles unit<br />
 disable &lt;= '1' ; -- disable counter<br />
 next_state &lt;= rst2 ;<br />
<br />
 when rst2 =&gt;<br />
  con_clear &lt;= '0' ; -- bring clear signal back to zero<br />
  next_state &lt;=rst3 ;<br />
<br />
 when rst3 =&gt;<br />
  if(con_iod = '1') then<br />
   con_preset &lt;= '1' ; -- reset cycles <br />
   reset_counter &lt;= '1' ; -- reset counter<br />
   c0_enable &lt;= '1' ; -- enable cycles<br />
   con_iomode &lt;= '0' ; -- set io mode to '0'<br />
   con_fft &lt;= '1' ; -- fft mode<br />
   en_rom &lt;= '1' ; -- enable ROM<br />
   en_romgen &lt;= '1' ; -- enable ROM address generator<br />
   con_clear &lt;= '1' ; -- clear all blocks<br />
   con_enbw &lt;= '0' ; -- disable write to RAM<br />
   con_enbor &lt;= '1' ; -- enable read from ROM<br />
   disable &lt;= '0' ; -- enable  counter unit. <br />
   next_state &lt;= rst4 ;<br />
  else<br />
  next_state &lt;= rst3 ;<br />
  end if ;<br />
<br />
 when rst4 =&gt;<br />
  con_preset &lt;= '0' ; -- reset for cycles <br />
  reset_counter &lt;= '0' ; -- reset for counter<br />
  con_clear &lt;= '0' ; -- clear all signals<br />
  if (con_clkcount = 5) then -- check whether 4 or not<br />
   con_enbw &lt;= '1' ; -- enable write to ROM<br />
   disable &lt;= '1' ; -- disable counter <br />
   reset_counter &lt;= '1' ; -- reset counter<br />
   next_state &lt;= rst5 ;<br />
  else<br />
   next_state &lt;= rst4 ;<br />
  end if ;<br />
 <br />
 when rst5 =&gt;<br />
  <br />
  if (con_fftd = '1') then <br />
  disable &lt;= '0' ; -- enable counter<br />
  reset_counter &lt;= '0' ; <br />
  con_clear &lt;= '1' ; -- clear butterfly generator<br />
  con_fft &lt;= '0' ; -- disable fft address generator<br />
  if (con_clkcount = 4) then<br />
    disable &lt;= '1';<br />
    con_enbw &lt;= '0' ;<br />
    con_iomode &lt;= '1' ;<br />
    con_op &lt;= '1' ;<br />
    con_ip &lt;= '0' ;<br />
    next_state &lt;= rst6 ;<br />
    else<br />
   next_state &lt;= rst5 ;<br />
   end if ;<br />
  else<br />
  next_state &lt;= rst5 ; <br />
 end if ;<br />
 <br />
 when rst6 =&gt;<br />
  con_clear &lt;= '0' ;<br />
  next_state &lt;= rst7 ;<br />
<br />
 when rst7 =&gt;<br />
  if(con_iod = '1') then<br />
   con_clear &lt;= '1' ;<br />
   con_preset &lt;= '1' ;<br />
   con_enbor &lt;= '0';<br />
  else<br />
  next_state &lt;= rst7 ;<br />
  end if ;<br />
  <br />
 <br />
 when others =&gt;<br />
  next_state &lt;= rst1 ;<br />
<br />
end case ;<br />
end process ;<br />
<br />
process(clock_main , con_init)<br />
begin<br />
if(con_init = '1') then<br />
current_state &lt;= rst1 ;<br />
elsif (clock_main'event and clock_main = '0') then<br />
current_state &lt;= next_state ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
<br />
<br />
<br />
-- OUTPUT RESULTS. SYNTHESISABLE<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity print_result is<br />
port (clock,op : in std_logic ;<br />
      fin_res : out std_logic_vector(31 downto 0) ;<br />
      result : in std_logic_vector(31 downto 0));<br />
end print_result ;<br />
<br />
architecture rtl of print_result is<br />
begin<br />
process(op,clock)<br />
variable count : integer := 1  ;<br />
begin <br />
if (op = '1') then<br />
if (count &lt; 17) then<br />
if(clock='0' and clock'event) then<br />
fin_res &lt;= result ;<br />
count := count + 1 ;<br />
end if ;<br />
end if ;<br />
end if ;<br />
end process ;<br />
end rtl ;<br />
<br />
<br />
<br />
<br />
<br />
<br />
    <br />
    <br />
<br />
library ieee ;<br />
use ieee.std_logic_1164.all ;<br />
use ieee.std_logic_arith.all ;<br />
use work.butter_lib.all ;<br />
use ieee.std_logic_unsigned.all ;<br />
<br />
entity synth_main is<br />
port (<br />
      data_io : in std_logic_vector(31 downto 0);<br />
      final_op : out std_logic_vector(31 downto 0) ;<br />
      clock_main,clock,enbl,reset,init : in std_logic) ;     <br />
end synth_main ;<br />
<br />
architecture rtl of synth_main is <br />
signal shft , waves : std_logic_vector(3 downto 0) ;<br />
<br />
component subtractor <br />
  port ( <br />
       a : in std_logic_vector (31 downto 0) ;<br />
       b : in std_logic_vector (31 downto 0) ;<br />
       clock , rst_sub , sub_en : in std_logic ;<br />
       a_smaller , fin_sub , num_zero : out std_logic ;<br />
       zero_detect : out std_logic_vector(1 downto 0) ;<br />
       sub : out std_logic_vector (8 downto 0);<br />
       change : out std_logic ) ;<br />
end component ;<br />
<br />
component swap<br />
 port (<br />
       a : in std_logic_vector (31 downto 0) ;<br />
       b : in std_logic_vector (31 downto 0) ;<br />
       clock : in std_logic ;<br />
       rst_swap , en_swap : in std_logic ;<br />
       finish_swap : out std_logic ;<br />
       d : out std_logic_vector (31 downto 0) ;<br />
       large_exp : out std_logic_vector (7 downto 0) ;<br />
       c  : out std_logic_vector (32 downto 0 ) ) ;<br />
end component ;<br />
<br />
 <br />
component shift2<br />
 port (<br />
       sub_control : in std_logic_vector (8 downto 0) ;	<br />
       c_in  : in std_logic_vector (32 downto 0) ;<br />
       shift_out : out std_logic_vector (31 downto 0) ;<br />
       clock , shift_en , rst_shift : in std_logic ;<br />
       finish_out : out std_logic ) ;<br />
end component ;<br />
<br />
component control_main<br />
 port ( <br />
       a_small , sign_a , sign_b : in std_logic ;<br />
       sign_out , add_sub , reset_all : out std_logic ;<br />
       en_sub , en_swap , en_shift , addpulse , normalise : out std_logic ;<br />
       fin_sub , fin_swap , finish_shift , add_finish , end_all : in std_logic ;<br />
       clock_main , clock , reset , enbl , zero_num , change : in std_logic ) ;<br />
end component ;<br />
<br />
component summer <br />
 port ( <br />
       num1 , num2 : in std_logic_vector (31 downto 0) ;<br />
       exp : in std_logic_vector (7 downto 0) ;<br />
       addpulse_in , addsub , rst_sum : in std_logic ;<br />
       add_finish : out std_logic ;<br />
       sumout : out std_logic_vector ( 32 downto 0) ) ;<br />
end component ;<br />
<br />
component normalize<br />
 port ( <br />
      a , b : in std_logic_vector (31 downto 0) ;<br />
      numb : in std_logic_vector (32 downto 0) ;<br />
      exp : in std_logic_vector (7 downto 0) ;<br />
      signbit , addsub , clock , en_norm , rst_norm  : in std_logic  ;<br />
      zero_detect : in std_logic_vector(1 downto 0) ;<br />
      exit_n : out std_logic ;<br />
      normal_sum : out std_logic_vector (31 downto 0) ) ;<br />
end component ;<br />
<br />
component but_gen<br />
port (<br />
      add_incr , add_clear , stagedone : in std_logic ;<br />
      but_butterfly : out std_logic_vector(3 downto 0) ) ;<br />
end component ;<br />
<br />
component stage_gen <br />
port (<br />
      add_staged , add_clear : in std_logic ;<br />
      st_stage : out std_logic_vector(1 downto 0) ) ;  <br />
end component ;<br />
<br />
component iod_staged <br />
port (<br />
      but_fly : in std_logic_vector(3 downto 0) ;<br />
      stage_no : in std_logic_vector(1 downto 0) ;<br />
      add_incr , io_mode  : in std_logic ;<br />
      add_iod , add_staged , add_fftd : out std_logic ; <br />
      butterfly_iod : out std_logic_vector(3 downto 0) ) ;<br />
end component ;<br />
<br />
component baseindex<br />
port (<br />
      ind_butterfly : in std_logic_vector(3 downto 0) ;<br />
      ind_stage : in std_logic_vector(1 downto 0) ;<br />
      add_fft : in std_logic ;<br />
      fftadd_rd : out std_logic_vector(3 downto 0) ;<br />
      c0 , c1 , c2 , c3 : in std_logic ) ; <br />
end component ;<br />
<br />
component ioadd_gen<br />
port (<br />
      io_butterfly : in std_logic_vector(3 downto 0) ;<br />
      add_iomode , add_ip , add_op : in std_logic ;<br />
      base_ioadd : out std_logic_vector(3 downto 0) ) ;<br />
end component ;<br />
<br />
component mux_add <br />
port (<br />
      a , b : in std_logic_vector(3 downto 0) ;<br />
      sel : in std_logic ;<br />
      q : out std_logic_vector(3 downto 0) ) ;<br />
end component ;<br />
<br />
component ram_shift<br />
port (<br />
      data_in : in std_logic_vector(3 downto 0) ;<br />
      clock_main : in std_logic ;<br />
      data_out : out std_logic_vector(3 downto 0) ) ;<br />
end component ;<br />
<br />
component cycles<br />
port (<br />
      clock_main , preset , c0_en , cycles_clear : in std_logic ;<br />
      waves : out std_logic_vector(3 downto 0) ) ;<br />
end component ;<br />
<br />
component counter <br />
port (<br />
      c : out std_logic_vector(2 downto 0) ;<br />
      disable , clock_main , reset : in std_logic) ;<br />
end component ;<br />
<br />
<br />
component mult_clock<br />
port (<br />
      clock_main , mult1_c0 , mult1_iomode , mult_clear : in std_logic ;<br />
      mult1_addincr : out std_logic ) ;<br />
end component ;<br />
<br />
component cont_gen <br />
port (<br />
      con_staged , con_iod , con_fftd , con_init : in std_logic ;<br />
      con_ip , con_op , con_iomode , con_fft : out std_logic ;<br />
      con_enbw , con_enbor , c0_enable , con_preset : out std_logic ;<br />
      con_clear , disable : out std_logic ;<br />
      c0 , clock_main : in std_logic ;<br />
      en_rom , en_romgen , reset_counter : out std_logic ; <br />
      con_clkcount : in std_logic_vector(2 downto 0) ) ;<br />
end component ;<br />
<br />
component and_gates <br />
port (<br />
      waves_and : in std_logic_vector(3 downto 0) ;<br />
      clock_main , c0_en : in std_logic ;<br />
      c0,c1,c2,c3 : out std_logic ;<br />
      c0_c1,c2_c3,c0_c2,c1_c3 : out std_logic ) ;<br />
end component ;<br />
<br />
component r_block<br />
port (<br />
       data : in std_logic_vector(31 downto 0) ;<br />
       trigger : in std_logic ;<br />
       r_out : out std_logic_vector(31 downto 0) ) ;<br />
end component ;<br />
<br />
component l_block<br />
port (<br />
       data_l : in std_logic_vector(31 downto 0) ;<br />
       trigger_l : in std_logic ;<br />
       l_out : out std_logic_vector(31 downto 0) ) ;<br />
end component ;<br />
<br />
component level_edge  <br />
 port (<br />
       data_edge : in std_logic_vector(31 downto 0) ;<br />
       trigger_edge : in std_logic ;<br />
       edge_out : out std_logic_vector(31 downto 0) ) ;<br />
end component ;<br />
<br />
component mux <br />
port (<br />
       d0 , d1 : in std_logic_vector(31 downto 0) ;<br />
       mux_out : out std_logic_vector(31 downto 0) ;<br />
       choose : in std_logic ) ;<br />
end component ;<br />
<br />
component negate <br />
port (<br />
       neg_in : in std_logic_vector(31 downto 0) ;<br />
       neg_en , clock_main : in std_logic ;<br />
       neg_out : out std_logic_vector(31 downto 0) ) ;<br />
end component ;<br />
<br />
component multiply<br />
port(<br />
      num_mux , num_rom : in std_logic_vector(31 downto 0) ;<br />
      clock  : in std_logic ;<br />
      mult_out : out std_logic_vector(31 downto 0) ) ;<br />
end component ;<br />
<br />
component divide<br />
port (<br />
       data_in : in std_logic_vector(31 downto 0) ;<br />
       data_out : out std_logic_vector(31 downto 0) ) ;<br />
end component ;<br />
<br />
component romadd_gen <br />
port (<br />
      io_rom,c0,c1,c2,c3 : in std_logic ;<br />
      stage_rom : in std_logic_vector(1 downto 0) ;<br />
      butterfly_rom : in std_logic_vector(3 downto 0) ;<br />
      romadd : out std_logic_vector(2 downto 0) ;<br />
      romgen_en : in std_logic );<br />
end component ;<br />
<br />
component reg_dpram <br />
port (<br />
      data_fft , data_io : in std_logic_vector (31 downto 0);<br />
      q : out std_logic_vector (31 downto 0);<br />
      clock , io_mode : in std_logic;<br />
      we , re : in std_logic;<br />
      waddress: in std_logic_vector (3 downto 0);<br />
      raddress: in std_logic_vector (3 downto 0));<br />
end component ;<br />
<br />
component rom <br />
port (<br />
      clock , en_rom : in std_logic ;<br />
      romadd : in std_logic_vector(2 downto 0) ;<br />
      rom_data : out std_logic_vector(31 downto 0) ) ;<br />
end component ;<br />
<br />
component print_result <br />
port (clock,op : in std_logic ;<br />
      fin_res : out std_logic_vector(31 downto 0) ;<br />
      result : in std_logic_vector(31 downto 0));<br />
end component ;<br />
<br />
begin<br />
<br />
result : print_result port map (clock_main,op,final_op,ram_data) ;<br />
but : but_gen port map (incr , clear , staged ,butterfly_iod) ;<br />
stg : stage_gen port map (staged , clear , stage) ;<br />
iod_stgd : iod_staged port map(butterfly_iod,stage,incr,io_mode,iod,staged,fftd,butterfly) ; <br />
base : baseindex port map (butterfly , stage , fft_en , fftadd_rd , c0 , c1 , c2 , c3) ;<br />
ioadd : ioadd_gen port map (butterfly , io_mode , ip , op , io_add) ;<br />
ram_shift1 : ram_shift port map (fftadd_rd , clock_main , shift1) ;<br />
ram_shift2 : ram_shift port map (shift1 , clock_main , shft) ;<br />
ram_shift3 : ram_shift port map (shft , clock_main , shift3) ;<br />
ram_shift4 : ram_shift port map (shift3 , clock_main ,shift4) ;<br />
ram_shift5 : ram_shift port map (shift4 , clock_main , shift5) ;<br />
--ram_shift6 : ram_shift port map (shift5 , clock_main , shift6) ;<br />
multx1 : mux_add port map (shift5 , io_add , io_mode , ram_wr) ;<br />
multx2 : mux_add port map (fftadd_rd , io_add , io_mode , ram_rd) ;<br />
cyc : cycles port map (clock_main , preset , c0_en , cyc_clear , waves) ;<br />
gates : and_gates port map(waves,clock_main,c0_en,c0,c1,c2,c3,c0_c1,c2_c3,c0_c2,c1_c3) ;<br />
cnt : counter port map (clk_count , disable , clock_main , reset_count) ; <br />
mux_clock : mult_clock port map (clock_main , c0 , io_mode , clear , incr) ;<br />
control : cont_gen port map (staged , iod , fftd , init , ip , op , io_mode , fft_en ,<br />
enbw , enbor , c0_en , preset , clear , disable , c0 , clock_main ,rom_en,romgen_en,reset_count,clk_count) ;<br />
<br />
reg_ram : reg_dpram port map (out_data,data_io,ram_data,clock_main,io_mode,enbw,enbor,ram_wr,ram_rd) ;<br />
<br />
f1 : r_block port map (ram_data , c0 , d2) ;<br />
f2 : l_block port map (ram_data , c1 , d3) ;<br />
f3 : r_block port map (ram_data , c2 , d4) ;<br />
f4 : r_block port map (ram_data , c3 , d5) ;<br />
f5 : r_block port map (d8 , c1_c3 , d9) ;<br />
f6 : l_block port map (d8 , c0_c2 , d10) ;<br />
f7 : l_block port map (d12 , c3 , d13) ;<br />
f8 : l_block port map (d12 , c1 , d14) ;<br />
f9 : r_block port map (d17 , clock_main , d18) ;<br />
f10 : r_block port map (data_rom , clock_main , rom_ff) ;<br />
mux1 : mux port map (d2 , d3 , d6 , c2_c3) ;<br />
mux2 : mux port map (d4 , d5 , d7 , c1_c3) ;<br />
mux3 : mux port map (d13 , d14 , d15 , c1_c3) ;<br />
neg1 : negate port map (d10 , c0_c1 ,clock_main , d11) ;<br />
neg2 : negate port map (d15 , c0_c1 ,clock_main , d16) ;<br />
mult1 : multiply port map (d6 , rom_ff , clock_main , d8) ;<br />
div : divide port map (d18 , d19) ;<br />
f11 : level_edge port map (d19,clock_main,out_data) ;<br />
<br />
rom_add1 : romadd_gen port map (io_mode,c0,c1,c2,c3,stage,butterfly,rom_add,romgen_en) ;<br />
rom1 : rom port map (clock ,rom_en,rom_add,data_rom) ;<br />
<br />
b11 : subtractor port map ( d16 , d7 , clock , rstb , ensubb , a_smallb , finsubb , numzerob , zerodetectb , subb ,  changeb) ;<br />
b2 : swap port map ( a=&gt;d16 , b=&gt;d7 , clock=&gt;clock , rst_swap=&gt;rstb , en_swap=&gt;enswapb , finish_swap=&gt;finswapb , d=&gt;swap_num2b , large_exp=&gt;expb , c=&gt;swap_num1b ) ;<br />
b4 : shift2 port map (sub_control=&gt;subb , c_in=&gt;swap_num1b , shift_out=&gt;shift_outb , clock=&gt;clock , shift_en=&gt;enshiftb,<br />
rst_shift=&gt;rstb , finish_out=&gt;finshiftb ) ;<br />
b5 : control_main port map ( a_smallb , d16(31) , d7(31) , signbitb , addsubb , rstb , ensubb , <br />
enswapb , enshiftb , addpulseb , normaliseb , finsubb , finswapb , finshiftb ,finish_sumb , end_allb , <br />
clock_main , clock , reset , enbl , numzerob , changeb ) ;<br />
b6 : summer port map ( shift_outb , swap_num2b , expb , addpulseb , addsubb , rstb , finish_sumb , sum_outb ) ;<br />
b7 : normalize port map (d16 , d7 , sum_outb , expb , signbitb , addsubb , clock , normaliseb , rstb , zerodetectb , end_allb , d17) ;<br />
<br />
a1 : subtractor port map ( d9 ,  d11 , clock , rst , ensub , a_small , finsub , numzero , zerodetect , suba , changea) ;<br />
a2 : swap port map (d9 ,d11 ,clock ,rst ,enswap , finswap ,swap_num2 , exp , swap_num1 ) ;<br />
a4 : shift2 port map (suba ,swap_num1 ,shift_outa ,clock , enshift , rst , finshift ) ;<br />
a5 : control_main port map ( a_small , d9(31) , d11(31) , signbit , addsub , rst , ensub , <br />
enswap , enshift , addpulse , normalise , finsub , finswap , finshift ,finish_sum , end_all , <br />
clock_main , clock , reset , enbl , numzero , changea ) ;<br />
a6 : summer port map ( shift_outa , swap_num2 , exp , addpulse , addsub , rst , finish_sum , sum_out ) ;<br />
a7 : normalize port map (d9 , d11 , sum_out , exp , signbit , addsub , clock , normalise , rst , zerodetect , end_all , d12) ;<br />
<br />
end rtl ;</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum42.html">Legacy and Other Languages</category>
			<dc:creator>dash8shamir</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236766.html</guid>
		</item>
		<item>
			<title>key strength</title>
			<link>http://www.daniweb.com/forums/thread236765.html</link>
			<pubDate>Sat, 07 Nov 2009 11:43:35 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I'm trying to create a program which provides a key strength. Visual studio don't show errors, but the program hangs on QuadWordFromBigEndian functions. Whats wrong?  
Program stop workin on this line: 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I'm trying to create a program which provides a key strength. Visual studio don't show errors, but the program hangs on QuadWordFromBigEndian functions. Whats wrong? <br />
Program stop workin on this line:<br />
 <pre style="margin:20px; line-height:13px">01.x = (&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  (((UInt64)block[0]) &lt;&lt; 56) | (((UInt64)block[1]) &lt;&lt; 48) |&nbsp;  <br />
02.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (((UInt64)block[2]) &lt;&lt; 40) | (((UInt64)block[3]) &lt;&lt; 32) |&nbsp;  <br />
03.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (((UInt64)block[4]) &lt;&lt; 24) | (((UInt64)block[5]) &lt;&lt; 16) |&nbsp;  <br />
04.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (((UInt64)block[6]) &lt;&lt; 8) | ((UInt64)block[7])&nbsp;  <br />
05.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );</pre><br />
An show this error: <br />
<br />
&quot;Index was outside the bounds of the array.&quot;  <br />
<br />
But I do not know how to fix. What should be the array index.<br />
<br />
Thanks <br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">private void button1_Click(object sender, EventArgs e)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte[] sec_key = System.Text.Encoding.UTF8.GetBytes(textBox1.Text);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (IsWeakKey(sec_key)) { label1.Text = &quot;Yes&quot;; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else { label1.Text = &quot;No&quot;; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private static bool IsLegalKeySize(byte[] sec_key) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (sec_key.Length == 8) return(true); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return(false); <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; private static UInt64 QuadWordFromBigEndian(byte[] block)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UInt64 x;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x = (<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (((UInt64)block[0]) &lt;&lt; 56) | (((UInt64)block[1]) &lt;&lt; 48) |<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (((UInt64)block[2]) &lt;&lt; 40) | (((UInt64)block[3]) &lt;&lt; 32) |<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (((UInt64)block[4]) &lt;&lt; 24) | (((UInt64)block[5]) &lt;&lt; 16) |<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (((UInt64)block[6]) &lt;&lt; 8) | ((UInt64)block[7])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (x);<br />
&nbsp; &nbsp; &nbsp; &nbsp; } <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static bool IsWeakKey(byte[] sec_key)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UInt64 key = QuadWordFromBigEndian(sec_key);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((key == 0x0101010101010101) ||<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (key == 0xfefefefefefefefe) ||<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (key == 0x1f1f1f1f0e0e0e0e) ||<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (key == 0xe0e0e0e0f1f1f1f1))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (false);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Lolalola</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236765.html</guid>
		</item>
		<item>
			<title>Code Gestalt</title>
			<link>http://www.daniweb.com/forums/thread236764.html</link>
			<pubDate>Sat, 07 Nov 2009 11:27:34 GMT</pubDate>
			<description><![CDATA[Hello, 
 
my name is Christopher Kurtz and I am a diploma thesis student at the Media Computing Group (http://hci.rwth-aachen.de/tiki-index.php) at RWTH Aachen University. 
 
In my diploma thesis code name "Code Gestalt" I want to find out if and how a programmer's daily work can be simplified by...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
my name is Christopher Kurtz and I am a diploma thesis student at the <a rel="nofollow" class="t" href="http://hci.rwth-aachen.de/tiki-index.php" target="_blank">Media Computing Group</a> at RWTH Aachen University.<br />
<br />
In my diploma thesis code name &quot;Code Gestalt&quot; I want to find out if and how a programmer's daily work can be simplified by providing new and intuitive ways to visualize source code. To that end I'd like to learn about your practical experience with visualization tools.<br />
<br />
The findings of this survey will be used exclusively for scientific and research purposes in the context of a diploma thesis. Of course all information you provide will be used 100% anonymously.<br />
<br />
The survey is available in <a rel="nofollow" class="t" href="http://startrek-journey.de/limesurvey/index.php?sid=43946&amp;lang=en" target="_blank">English</a> and <a rel="nofollow" class="t" href="http://startrek-journey.de/limesurvey/index.php?sid=43946&amp;lang=de" target="_blank">German</a>.<br />
<br />
Of course you are also invited leave any additional comments in the topic below. Also feel free to spread the word in your blogs and tweets :-)<br />
<br />
Thanks for your help!<br />
<br />
Chris</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum14.html">Computer Science</category>
			<dc:creator>ChrisMedia</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236764.html</guid>
		</item>
		<item>
			<title>Need help in factorial code</title>
			<link>http://www.daniweb.com/forums/thread236763.html</link>
			<pubDate>Sat, 07 Nov 2009 10:53:33 GMT</pubDate>
			<description>; this code gereates maximum factorial of 8 decimal 
; since, A is a 16-bit register and can hold max value of ;65535 dec (255h). 
; 
 
MOV A,#8d     		; value for the factorial (1-8max) 
MOV B,A				; B=A 
MOV C,#1d			; C=1	 
here:				; LOOP 
	SUB B,C			; B-1 
	MUL AB			; AxB</description>
			<content:encoded><![CDATA[<div>; this code gereates maximum factorial of 8 decimal<br />
; since, A is a 16-bit register and can hold max value of ;65535 dec (255h).<br />
;<br />
<br />
MOV A,#8d     		; value for the factorial (1-8max)<br />
MOV B,A				; B=A<br />
MOV C,#1d			; C=1	<br />
here:				; LOOP<br />
	SUB B,C			; B-1<br />
	MUL AB			; AxB<br />
	CMP B,C 		;if B=1<br />
	JNE here		;jump back<br />
<br />
END<br />
<br />
this code not work .please help me in thi and this also not work for lager values.(i have to take factorial of numbers 1 to 12)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum125.html">Assembly</category>
			<dc:creator>surfer2009</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236763.html</guid>
		</item>
		<item>
			<title>getting binary data out of the database</title>
			<link>http://www.daniweb.com/forums/thread236760.html</link>
			<pubDate>Sat, 07 Nov 2009 10:24:53 GMT</pubDate>
			<description><![CDATA[I am doing an app which inclueds richTextBox, for inserting text. I put some text into richTextBox and save it into my sql database (column is varbinary(MAX) data type, with this code: 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I am doing an app which inclueds richTextBox, for inserting text. I put some text into richTextBox and save it into my sql database (column is varbinary(MAX) data type, with this code:<br />
 <pre style="margin:20px; line-height:13px">byte[] myFile = Encoding.UTF8.GetBytes(richTextBox1.Text);</pre>Here the text is changed into binary data, and them I add parameters and all whats needed, and finally:<br />
 <pre style="margin:20px; line-height:13px">cmd1.ExecuteNonQuery();</pre>Then, when I want to open it, it opens in word (the code is made, that it opens in this program - depending on an extention and a file type). <br />
<br />
So, when the Word is starting up, 1st it asks me if I want to change it (to use some other coding). I select nothing and click Ok. The text is there but it is not in the shape I inserted it into richTextBox. The font are all the same and are in Courier New (I didn`t save the the text in with this font, and even the text was not all the same).<br />
<br />
Anyone has any clue how to get the same text out, as I saw inserted into richTextBox?  Is this maybe anything to do with richTextBox, or this is only a matter of coding?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>Mitja Bonca</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236760.html</guid>
		</item>
		<item>
			<title>Parse Logic/Code Need</title>
			<link>http://www.daniweb.com/forums/thread236755.html</link>
			<pubDate>Sat, 07 Nov 2009 09:43:02 GMT</pubDate>
			<description>------------------------------------ ----------- --------- ------------------------------------ ----------------------------- 
------- 
PRODUCT                              KIT TYPE    STATE     MAINTENANCE                          REFERENCED BY 
------------------------------------ -----------...</description>
			<content:encoded><![CDATA[<div>------------------------------------ ----------- --------- ------------------------------------ -----------------------------<br />
-------<br />
PRODUCT                              KIT TYPE    STATE     MAINTENANCE                          REFERENCED BY<br />
------------------------------------ ----------- --------- ------------------------------------ -----------------------------<br />
-------<br />
HP I64VMS ACUXE V6.40-11P09A         Full LP     Installed<br />
HP I64VMS AVAIL_MAN_BASE V8.3-1H1    Full LP     Installed                                      HP I64VMS OPENVMS V8.3-1H1<br />
HP I64VMS CDSA V2.3-306              Full LP     Installed                                      HP I64VMS OPENVMS V8.3-1H1<br />
HP I64VMS CSWS V2.1-1                Full LP     Installed HP I64VMS CSWS211_UPDATE V1.0<br />
HP I64VMS CSWS_PHP V1.3              Full LP     Installed HP I64VMS CSWS_PHP13_UPDATE V1.0<br />
HP I64VMS DECNET_PLUS V8.3-1H1       Full LP     Installed                                      HP I64VMS OPENVMS V8.3-1H1<br />
HP I64VMS DWMOTIF V1.6               Full LP     Installed                                      HP I64VMS OPENVMS V8.3-1H1<br />
HP I64VMS DWMOTIF_SUPPORT V8.3-1H1   Full LP     Installed                                      HP I64VMS VMS V8.3-1H1<br />
HP I64VMS KERBEROS V3.1-152          Full LP     Installed                                      HP I64VMS OPENVMS V8.3-1H1<br />
HP I64VMS OPENVMS V8.3-1H1           Platform    Installed<br />
HP I64VMS SMH V2.0-17                Full LP     Installed HP I64VMS SMHPAT V2.0-20<br />
HP I64VMS SSL V1.3-284               Full LP     Installed                                      HP I64VMS OPENVMS V8.3-1H1<br />
HP I64VMS TCPIP V5.6-9ECO2           Full LP     Installed                                      HP I64VMS OPENVMS V8.3-1H1<br />
HP I64VMS TDC_RT V2.3-1              Full LP     Installed                                      HP I64VMS OPENVMS V8.3-1H1<br />
HP I64VMS VMS V8.3-1H1               Oper System Installed                                      HP I64VMS CDSA V2.3-306<br />
                                                                                                HP I64VMS DECNET_PLUS V8.3-1H1  <br />
                                                                                                HP I64VMS DWMOTIF V1.6<br />
                                                                                                HP I64VMS KERBEROS V3.1-152<br />
                                                                                                HP I64VMS OPENVMS V8.3-1H1<br />
                                                                                                HP I64VMS TCPIP V5.6-9ECO2<br />
HP I64VMS WBEMCIM V2.61-A070728      Full LP     Installed                                      HP I64VMS OPENVMS V8.3-1H1<br />
HP I64VMS WBEMPROVIDERS V1.5-31      Full LP     Installed                                      HP I64VMS OPENVMS V8.3-1H1<br />
------------------------------------ ----------- --------- ------------------------------------ -----------------------------<br />
-------<br />
<br />
Hi above is my output of one of my command I want to filter each column value seprately. Please help me I am bugging my head from last 5-6 hours.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>krishna_sicsr</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236755.html</guid>
		</item>
		<item>
			<title>x86 help with procedures</title>
			<link>http://www.daniweb.com/forums/thread236754.html</link>
			<pubDate>Sat, 07 Nov 2009 09:39:18 GMT</pubDate>
			<description>I am having a hard time getting my program to execute correctly. it is supposed to take two numbers entered by the user store them in an array, and reverse the array so when added they display correctly.  i am to get the numbers using a procedure two seperate times, and reverse the arrays three...</description>
			<content:encoded><![CDATA[<div>I am having a hard time getting my program to execute correctly. it is supposed to take two numbers entered by the user store them in an array, and reverse the array so when added they display correctly.  i am to get the numbers using a procedure two seperate times, and reverse the arrays three times (reverse each entered number, and the sum array). furthermore when the user has entered one more than the max number of keys a + or = sign is to be entered for them. eg. i have the computer program set to take 3 numbers for each array so when the user enters a fourth a + or = sign should automatically appear. I cannot get the program to do this, or go any farther. I was hoping someone could let me know where i am going wrong with my code.<br />
<br />
here it is:<br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  BOZOS_CODE SEGMENT&nbsp; &nbsp; ;The &quot;logical&quot; segment is named BOZOS_CODE<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ASSUME CS:BOZOS_CODE&nbsp;  ;The &quot;assume&quot; statement tells the assembler<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; that BOZOS_CODE is a code segment (CS)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ORG 100h&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;In case we decide to convert the program<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ; to a COM file (makes 256 &quot;empty&quot; locations)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  START: jmp begin&nbsp; &nbsp; &nbsp; ;Since this is a code segment the first non-<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ; directive item must be an instruction. We<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ; jump around our data area<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; num_of_bytes EQU 3<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first_num db num_of_bytes dup (0), '$'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; second_num db num_of_bytes dup (0), '$'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; the_sum db num_of_bytes + 1 dup (0), '$'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; message_1 db 'Enter the first multi-digit number (up to 12 digits in length) followed by a'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db '&quot;+&quot; symbol then enter a second multi-digit number (up to 12 digits in '<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db&nbsp; &nbsp; &nbsp; &nbsp; 'length) followed by a &quot;=&quot; symbol&nbsp; $'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; key_stroke db 'x$'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand db 'x$'<br />
<br />
<br />
<br />
GET_NUM:&nbsp; &nbsp; &nbsp; &nbsp;  mov ah, 00h&nbsp; &nbsp; ;Read keyboard function<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int 16h&nbsp; &nbsp; &nbsp; &nbsp; ;Call BIOS (return occurs when key is pressed)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;AL now contains the ASCII code of key pressed<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov key_stroke, al<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov ah, 09h&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;Display string function<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov dx, offset key_stroke&nbsp; ;Pass the starting address of string<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int 21h&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;Call DOS<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov al, key_stroke<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cmp al, cl&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  jne continue<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ret&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;return<br />
<br />
continue:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  and al, 0fh<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov [BX], al<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  inc BX<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cmp [bx], ch<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  jbe get_num<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov operand, cl<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov ah, 09h&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;Display string function<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov dx, offset operand&nbsp; &nbsp; &nbsp;  ;Pass the starting address of string<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int 21h&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;Call DOS<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ret&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;return<br />
<br />
REV_NUM:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov cl, [bx]<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov ch, [di]<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov [di], cl<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov [bx], ch<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  dec BX<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  inc di<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cmp di, bx<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  jae rev_num<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ret<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
begin:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov ax, cs&nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov ds, ax&nbsp; &nbsp;  <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov cl, 0&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov ah, 06h&nbsp; &nbsp; ;Scroll-up window function<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov al, 0&nbsp; &nbsp; &nbsp; ; Clear entire window<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov bh, 1ch&nbsp; &nbsp; ; Display &quot;attribute byte&quot; for cleared area<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;&nbsp; Blue background/Red characters<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;&nbsp; Bit definitions: Blink|Background R,G,B|<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Intensity|Character R,G,B<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov ch, 0&nbsp; &nbsp; &nbsp; ; Y = 0&nbsp; &nbsp;  (Corner coordinates of window<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov cl, 0&nbsp; &nbsp; &nbsp; ; X = 0&nbsp; &nbsp; &nbsp; to clear)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov dh, 24&nbsp; &nbsp;  ; Y = 24&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov dl, 85&nbsp; &nbsp;  ; X = 79&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int 10h&nbsp; &nbsp; &nbsp; &nbsp; ;Call BIOS<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov ah, 02h&nbsp; &nbsp; ;Set cursor position function<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov bh, 0&nbsp; &nbsp; &nbsp; ; Display page 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov dh, 0&nbsp; &nbsp; &nbsp; ; Y position&nbsp; 25 rows&nbsp; &nbsp; (Y: 0 -&gt; 24)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov dl, 0&nbsp; &nbsp; &nbsp; ; X position&nbsp; 80 columns (X: 0 -&gt; 79)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int 10h&nbsp; &nbsp; &nbsp; &nbsp; ;Call BIOS<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov ah, 09h&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;Display string function<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov dx, offset message_1 ;Pass the starting offset of the<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ; string to be displayed<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ; (the string to be displayed starts <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;&nbsp; at the label message (in the data<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;&nbsp; area) and ends with a '$')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;Note: DS must point to the beginning<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;&nbsp; &nbsp; &nbsp; of the segment containing the<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;&nbsp; &nbsp; &nbsp; string to be displayed, e.g.,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;&nbsp; &nbsp; &nbsp; mov ax, cs&nbsp; (usually done at<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;&nbsp; &nbsp; &nbsp; mov ds, ax&nbsp;  the beginning of<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  the program)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;Note: This display procedure updates<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;&nbsp; &nbsp; &nbsp; the cursor position as each<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;&nbsp; &nbsp; &nbsp; character is displayed<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int 21h&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;Call DOS<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov bx, offset first_num<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov cl, '+'<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov ch, num_of_bytes<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  call get_num<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov bx, offset second_num<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov cl, '='<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov ch, num_of_bytes&nbsp; &nbsp; &nbsp;  ;do i need to do this again?<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  call get_num<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov di, offset first_num<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  call rev_num<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov di, offset second_num<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  call rev_num<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov BX, 0&nbsp;  ;Index set to zero now<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov ah, 0&nbsp;  ;ah now used for carry, and is set to zero<br />
<br />
adder:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov al, first_num[BX]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  add al, second_num[BX]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  add al, ah<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cmp al, 9<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  jbe no_carry<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov ah, 1 <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  sub al, 10<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  jmp make_ascii<br />
<br />
no_carry:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov ah, 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
make_ascii:&nbsp; &nbsp; &nbsp; &nbsp;  or al, 30h<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov the_sum[BX], al<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  inc BX<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cmp BX, num_of_bytes <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  je fix_carry&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; if array is full jump to fix carry character<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jmp adder<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
fix_carry:&nbsp; &nbsp; &nbsp; &nbsp;  or ah, 30h<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov the_sum[BX], ah<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov bx, num_of_bytes - 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov di, offset the_sum<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  call rev_num <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;to display sum<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
display:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov ah, 09h&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;Display string function<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov dx, offset the_sum&nbsp; &nbsp;  ;Pass the starting address of string<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int 21h&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;Call DOS<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;To exit to DOS<br />
<br />
exit:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mov ah, 4ch&nbsp; &nbsp; ;Exit to DOS function<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mov al, 0&nbsp; &nbsp; &nbsp; ;ERRORLEVEL = 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int 21h&nbsp; &nbsp; &nbsp; &nbsp; ;Call DOS<br />
<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  BOZOS_CODE ENDS<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  END START&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ;You MUST have a carriage return after START</pre><br />
thank you</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum125.html">Assembly</category>
			<dc:creator>RobBrown</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236754.html</guid>
		</item>
		<item>
			<title>automation scripts--help needed urgent</title>
			<link>http://www.daniweb.com/forums/thread236736.html</link>
			<pubDate>Sat, 07 Nov 2009 08:53:36 GMT</pubDate>
			<description>Hi team, 
 
Well i have been asked to make use of automation  scripts for my host production box.. .And i hope u will help me with the same. 
 
#script as below: 
a)when i run  script it should ask the person to key in..(means should be interactive) 
b) it should search a file  
c) it should...</description>
			<content:encoded><![CDATA[<div>Hi team,<br />
<br />
Well i have been asked to make use of automation  scripts for my host production box.. .And i hope u will help me with the same.<br />
<br />
#script as below:<br />
a)when i run  script it should ask the person to key in..(means should be interactive)<br />
b) it should search a file <br />
c) it should replace a word/ multiple word in a file and prompt user for more changes once he done with<br />
and finally..<br />
D) delete the line rows... (any rows- mentioned by the user on files)<br />
<br />
I am done with the 1st script but i am having probs with the second and third<br />
<br />
2)I knw sed will replace <br />
 <pre style="margin:20px; line-height:13px"> sed 's/(word)/(with-word)'/ file name</pre><br />
3)and sed 'line,lined' file<br />
<br />
but how to use in the below script and ask the user for more inputs..<br />
Please provide me with the earliest.. <br />
thankin you once again<br />
<br />
PS: Moderator pls dont treat this mail as repetative <br />
<br />
regards<br />
whizkidash<br />
<br />
<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">vi showme.sh(script name)<br />
<br />
echo &quot;type the file to be search&quot;<br />
&nbsp;read fname<br />
if ls -lart | $fname<br />
then <br />
echo &quot; File exist&quot;<br />
else echo &quot; File fail&quot;<br />
------(uptil here it run fine)<br />
echo &quot; type the file to be replace/or substituted&quot;<br />
read tname</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>whizkidash</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236736.html</guid>
		</item>
		<item>
			<title>Error!!!</title>
			<link>http://www.daniweb.com/forums/thread236735.html</link>
			<pubDate>Sat, 07 Nov 2009 08:49:21 GMT</pubDate>
			<description><![CDATA[My subscription system is now running though with errors here and there.the error that concerns me a lot is a runtime error that says  
 
---Quote--- 
multiple steps generated an error check value status 
---End Quote--- 
  
and points to this code....  <div class="codeblock"> <div class="spaced">...]]></description>
			<content:encoded><![CDATA[<div>My subscription system is now running though with errors here and there.the error that concerns me a lot is a runtime error that says <br />
<div style="margin:20px; margin-top:5px; "> <div class="smallfont" style="margin-bottom:2px">Quote:</div> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td class="alt2"> <hr />  multiple steps generated an error check value status  <hr /> </td> </tr> </table> </div>and points to this code.... <pre style="margin:20px; line-height:13px">r.Fields(&quot;companyphone&quot;) = txtcphone.Text<br />
r.Fields(&quot;companywebsite&quot;) = txtcwebsite.Text</pre>and this code is in my save button. at times the error doesnt show but at times it pops up when a user is testing...<br />
how best can i trap such an error because i know there must be  a way which i dont know.<br />
thank you in advance!!!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum4.html">Visual Basic 4 / 5 / 6</category>
			<dc:creator>Israelsimba</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236735.html</guid>
		</item>
		<item>
			<title>Questions on using the STL list sort method</title>
			<link>http://www.daniweb.com/forums/thread236726.html</link>
			<pubDate>Sat, 07 Nov 2009 07:49:16 GMT</pubDate>
			<description><![CDATA[I am very new to using the STL list library. From what I have been reading here and other places on the web is that I have to create a compare function to use within the sort member function of list. The reason being that the list node's contain structures. I have to sort the list by a few...]]></description>
			<content:encoded><![CDATA[<div>I am very new to using the STL list library. From what I have been reading here and other places on the web is that I have to create a compare function to use within the sort member function of list. The reason being that the list node's contain structures. I have to sort the list by a few different variables. Below is the class that controls my list. I am getting two errors.<br />
<br />
Error 1) error C3867: 'Standings::compareForSort': function call missing argument list; use '&amp;Standings::compareForSort' to create a pointer to member<br />
<br />
Error 2) error C2660: 'std::list&lt;_Ty&gt;::sort' : function does not take 1 arguments<br />
<br />
Any help here would be appreciated. <br />
<br />
 <pre style="margin:20px; line-height:13px">#ifndef STANDINGS_H<br />
#define STANDINGS_H<br />
<br />
#include &lt;iostream&gt;<br />
#include &lt;list&gt;<br />
#include &lt;fstream&gt;<br />
#include &lt;iomanip&gt;<br />
<br />
using namespace std;<br />
<br />
#define NAMELENGTH 20<br />
<br />
struct Records<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; int totalWin;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int totalLose;<br />
&nbsp; &nbsp; &nbsp; &nbsp; double winPercentage;<br />
&nbsp; &nbsp; &nbsp; &nbsp; double gamesBehind;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int streakWin;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int streakLose;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int streakLength;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int homeWin;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int homeLose;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int awayWin;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int awayLose;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int interWin;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int interLose;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int division;<br />
&nbsp; &nbsp; &nbsp; &nbsp; char teamName[NAMELENGTH];<br />
&nbsp; &nbsp; &nbsp; &nbsp; char streakType;<br />
<br />
};<br />
<br />
<br />
class Standings<br />
{<br />
private:<br />
&nbsp; &nbsp; &nbsp; &nbsp; list&lt;Records&gt; recordsList;<br />
&nbsp; &nbsp; &nbsp; &nbsp; friend class Team;<br />
public:<br />
&nbsp; &nbsp; &nbsp; &nbsp; Standings();<br />
&nbsp; &nbsp; &nbsp; &nbsp; ~Standings(){};<br />
&nbsp; &nbsp; &nbsp; &nbsp; void loadList();<br />
&nbsp; &nbsp; &nbsp; &nbsp; void saveList();<br />
&nbsp; &nbsp; &nbsp; &nbsp; void printStandings();<br />
&nbsp; &nbsp; &nbsp; &nbsp; bool compareForSort (Records&amp;, Records&amp;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
};<br />
<br />
#endif<br />
<br />
#include &quot;standings.h&quot;<br />
<br />
Standings::Standings()<br />
{<br />
<br />
}&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
<br />
void Standings::loadList(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Create a variable of ifstream type names loadFile<br />
&nbsp; &nbsp; &nbsp; &nbsp; ifstream loadFile;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; //Open standings txt file<br />
&nbsp; &nbsp; &nbsp; &nbsp; loadFile.open(&quot;standings.txt&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; //Temporary object of struct type Record<br />
&nbsp; &nbsp; &nbsp; &nbsp; Records r;<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Loop to take from file put into class <br />
&nbsp; &nbsp; &nbsp; &nbsp; //and than put class into list<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(!loadFile.eof()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loadFile &gt;&gt; r.teamName<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.totalWin<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.totalLose<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.winPercentage<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.gamesBehind<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.streakWin<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.streakLose<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.streakType<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.streakLength<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.homeWin<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.homeLose<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.awayWin<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.awayLose<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.interWin<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.interLose<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.division;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Checks to make sure its not the end of file.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //If its not the end of the file it inserts <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //the node at the end of the list<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(!loadFile.eof())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; recordsList.push_back(r);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  //closing the text file<br />
&nbsp; &nbsp; &nbsp; &nbsp; loadFile.close(); <br />
}<br />
<br />
void Standings::saveList()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Sorts the List before saving to txt<br />
&nbsp; &nbsp; &nbsp; &nbsp; recordsList.sort(compareForSort);<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Create a variable of ofstream type names saveFile<br />
&nbsp; &nbsp; &nbsp; &nbsp; ofstream saveFile;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //Open standings txt file<br />
&nbsp; &nbsp; &nbsp; &nbsp; saveFile.open(&quot;standings.txt&quot;);&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //Create an iterator to keep place of the nodes saved<br />
&nbsp; &nbsp; &nbsp; &nbsp; list&lt;Records&gt;::iterator i;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Loop through each node and save each member to that node<br />
&nbsp; &nbsp; &nbsp; &nbsp; for ( i=recordsList.begin(); i != recordsList.end(); ++i ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saveFile &lt;&lt; right &lt;&lt; setw(13) &lt;&lt; i-&gt;teamName &lt;&lt; setw(4) &lt;&lt; i-&gt;totalWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(4) &lt;&lt; i-&gt;totalLose &lt;&lt; setw(7) &lt;&lt; setprecision(3) &lt;&lt; i-&gt;winPercentage <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(6) &lt;&lt; i-&gt;gamesBehind &lt;&lt; setw(2) &lt;&lt; i-&gt;streakWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(2) &lt;&lt; i-&gt;streakLose&nbsp; &lt;&lt; setw(2) &lt;&lt; i-&gt;streakType <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(2) &lt;&lt; i-&gt;streakLength&nbsp; &lt;&lt; setw(3)&lt;&lt; i-&gt;homeWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(3) &lt;&lt; i-&gt;homeLose&nbsp; &lt;&lt; setw(3) &lt;&lt; i-&gt;awayWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(3) &lt;&lt; i-&gt;awayLose&nbsp; &lt;&lt; setw(3)&lt;&lt; i-&gt;interWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(3) &lt;&lt; i-&gt;interLose&nbsp; &lt;&lt; setw(2) &lt;&lt; i-&gt;division <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
//Flush and Close txt file<br />
&nbsp; &nbsp; &nbsp; &nbsp; saveFile.flush();<br />
&nbsp; &nbsp; &nbsp; &nbsp; saveFile.close();<br />
<br />
}<br />
<br />
void Standings::printStandings()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; list&lt;Records&gt;::iterator i;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Looping through each node and printing each variable of each node<br />
&nbsp; &nbsp; &nbsp; &nbsp; for ( i=recordsList.begin(); i != recordsList.end(); ++i ) <br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&nbsp; &lt;&lt; right &lt;&lt; setw(13) &lt;&lt; i-&gt;teamName &lt;&lt; setw(4) &lt;&lt; i-&gt;totalWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(4) &lt;&lt; i-&gt;totalLose &lt;&lt; right &lt;&lt; setw(7) &lt;&lt; i-&gt;winPercentage <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; right &lt;&lt; setw(6) &lt;&lt; i-&gt;gamesBehind &lt;&lt; right &lt;&lt; setw(2) &lt;&lt; i-&gt;streakWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; right &lt;&lt; setw(2) &lt;&lt; i-&gt;streakLose &lt;&lt; right &lt;&lt; setw(2) &lt;&lt; i-&gt;streakType <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; right &lt;&lt; setw(2) &lt;&lt; i-&gt;streakLength &lt;&lt;right &lt;&lt; setw(3)&lt;&lt; i-&gt;homeWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; right &lt;&lt; setw(3) &lt;&lt; i-&gt;homeLose &lt;&lt; right &lt;&lt; setw(3) &lt;&lt; i-&gt;awayWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; right &lt;&lt; setw(3) &lt;&lt; i-&gt;awayLose &lt;&lt; right &lt;&lt; setw(3)&lt;&lt; i-&gt;interWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; right &lt;&lt; setw(3) &lt;&lt; i-&gt;interLose &lt;&lt; right &lt;&lt; setw(2) &lt;&lt; i-&gt;division <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
<br />
<br />
bool Standings::compareForSort(Records&amp; node1, Records&amp; node2)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; list&lt;Records&gt;::iterator i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for ( i=recordsList.begin(); i != recordsList.end(); ++i ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((node1.totalWin &gt; node2.totalWin) &amp;&amp; (node1.winPercentage &gt; node2.winPercentage) &amp;&amp; (node1.division &lt; node2.division))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Afupi</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236726.html</guid>
		</item>
		<item>
			<title>Help with Code</title>
			<link>http://www.daniweb.com/forums/thread236724.html</link>
			<pubDate>Sat, 07 Nov 2009 07:45:37 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I am an online student in an intro to Java programming course and am a little stuck on my current program. The program is supposed to prompt for the name of files until the user enters "stop" to quit and includes the following methods in addition to the main method: 
 
1. countLines(),...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I am an online student in an intro to Java programming course and am a little stuck on my current program. The program is supposed to prompt for the name of files until the user enters &quot;stop&quot; to quit and includes the following methods in addition to the main method:<br />
<br />
1. countLines(), which takes a File object, and returns the number of lines of text in the file<br />
<br />
2. countLettersInLines(), which takes a File object, and returns an array of integers. In this array of integers, the first entry is the number of letters in the first line of the file, the second entry is the number of letters in the second line of the file, etc.<br />
<br />
3. countLetters(), which takes a File object, and returns the number of letters in the file<br />
<br />
4. countOneLetter() takes a File object and a letter, and returns the number of occurrences of the specified letter in the file (in uppercase or lowercase). This method and countLetters() can be used to determine the frequency of each letter in a text file.<br />
<br />
5. countAllLetters() takes a File object, and returns an array of 26 integers, such that the entries in the array contain the number of occurrences of each letter of the alphabet in the file, disregarding case. The first entry in the array will be the number of a's in the file (regardless of case), the second entry is the number of b's (regardless of case), and so on. This method should use countOneLetter().<br />
<br />
6. countIntegers() takes a File object, and returns the number of integers in the file<br />
<br />
An example to this program would be:<br />
Please enter the file name, or &quot;stop&quot; to end: short.txt<br />
<br />
Number of lines: 2<br />
Line with maximum number of letters: 1<br />
Line 1: 13 letters<br />
Line 2: 5 letters<br />
<br />
Number of letters: 18<br />
Frequency of a: 5.555555555555555<br />
Frequency of b: 0.0<br />
Frequency of c: 0.0<br />
Frequency of d: 0.0<br />
Frequency of e: 16.666666666666668<br />
Frequency of f: 0.0<br />
Frequency of g: 0.0<br />
Frequency of h: 5.555555555555555<br />
Frequency of i: 11.11111111111111<br />
Frequency of j: 0.0<br />
Frequency of k: 0.0<br />
Frequency of l: 16.666666666666668<br />
Frequency of m: 11.11111111111111<br />
Frequency of n: 5.555555555555555<br />
Frequency of o: 5.555555555555555<br />
Frequency of q: 0.0<br />
Frequency of r: 0.0<br />
Frequency of s: 11.11111111111111<br />
Frequency of t: 0.0<br />
Frequency of u: 0.0<br />
Frequency of v: 5.555555555555555<br />
Frequency of w: 0.0<br />
Frequency of x: 0.0<br />
Frequency of y: 5.555555555555555<br />
Frequency of z: 0.0<br />
<br />
Integers in the file: 2<br />
<br />
Please enter the file name, or &quot;stop&quot; to end: stop<br />
<br />
<br />
Thank you any help will be much appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>hedwards09</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236724.html</guid>
		</item>
		<item>
			<title>Help with Code</title>
			<link>http://www.daniweb.com/forums/thread236723.html</link>
			<pubDate>Sat, 07 Nov 2009 07:26:58 GMT</pubDate>
			<description><![CDATA[Hello, 
 
I am an online student in an intro to Java programming course and am a little stuck on my current program.  The program is supposed to prompt for the name of files until the user enters "stop" to quit and includes the following methods in addition to the main method: 
 
1. countLines(),...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I am an online student in an intro to Java programming course and am a little stuck on my current program.  The program is supposed to prompt for the name of files until the user enters &quot;stop&quot; to quit and includes the following methods in addition to the main method:<br />
<br />
1. countLines(), which takes a File object, and returns the number of lines of text in the file<br />
<br />
2. countLettersInLines(), which takes a File object, and returns an array of integers. In this array of integers, the first entry is the number of letters in the first line of the file, the second entry is the number of letters in the second line of the file, etc.<br />
<br />
3. countLetters(), which takes a File object, and returns the number of letters in the file<br />
<br />
4. countOneLetter() takes a File object and a letter, and returns the number of occurrences of the specified letter in the file (in uppercase or lowercase). This method and countLetters() can be used to determine the frequency of each letter in a text file.<br />
<br />
5.  countAllLetters() takes a File object, and returns an array of 26 integers, such that the entries in the array contain the number of occurrences of each letter of the alphabet in the file, disregarding case. The first entry in the array will be the number of a's in the file (regardless of case), the second entry is the number of b's (regardless of case), and so on. This method should use countOneLetter().<br />
<br />
6. countIntegers() takes a File object, and returns the number of integers in the file<br />
<br />
An example to this program would be:<br />
Please enter the file name, or &quot;stop&quot; to end: short.txt<br />
<br />
Number of lines: 2<br />
    Line with maximum number of letters: 1<br />
    Line 1: 13 letters<br />
    Line 2: 5 letters<br />
<br />
Number of letters: 18<br />
    Frequency of a: 5.555555555555555<br />
    Frequency of b: 0.0<br />
    Frequency of c: 0.0<br />
    Frequency of d: 0.0<br />
    Frequency of e: 16.666666666666668<br />
    Frequency of f: 0.0<br />
    Frequency of g: 0.0<br />
    Frequency of h: 5.555555555555555<br />
    Frequency of i: 11.11111111111111<br />
    Frequency of j: 0.0<br />
    Frequency of k: 0.0<br />
    Frequency of l: 16.666666666666668<br />
    Frequency of m: 11.11111111111111<br />
    Frequency of n: 5.555555555555555<br />
    Frequency of o: 5.555555555555555<br />
    Frequency of q: 0.0<br />
    Frequency of r: 0.0<br />
    Frequency of s: 11.11111111111111<br />
    Frequency of t: 0.0<br />
    Frequency of u: 0.0<br />
    Frequency of v: 5.555555555555555<br />
    Frequency of w: 0.0<br />
    Frequency of x: 0.0<br />
    Frequency of y: 5.555555555555555<br />
    Frequency of z: 0.0<br />
<br />
Integers in the file: 2<br />
<br />
Please enter the file name, or &quot;stop&quot; to end: stop<br />
<br />
<br />
Thank you any help will be much appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>hedwards09</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236723.html</guid>
		</item>
		<item>
			<title>Visual C++ form question</title>
			<link>http://www.daniweb.com/forums/thread236721.html</link>
			<pubDate>Sat, 07 Nov 2009 07:05:32 GMT</pubDate>
			<description>Hi, 
 
I am creating a Visual C++ application with a bunch of forms. I would like one form to stay open the entire time (just a screen to show app is running), then I need one form with two radio buttons, an OK button and a Cancel. If the OK button is clicked I want to close the form and continue...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I am creating a Visual C++ application with a bunch of forms. I would like one form to stay open the entire time (just a screen to show app is running), then I need one form with two radio buttons, an OK button and a Cancel. If the OK button is clicked I want to close the form and continue with the code in main, however, I can't seem to get this working.<br />
<br />
<br />
Any advice would be GREATLY appreciated.<br />
Thanks in advance.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Laryssaparker</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236721.html</guid>
		</item>
		<item>
			<title>Working with files</title>
			<link>http://www.daniweb.com/forums/thread236716.html</link>
			<pubDate>Sat, 07 Nov 2009 06:24:36 GMT</pubDate>
			<description><![CDATA[I have a file like this: 
a,z,1 
b,y 
c,x,1 
d,w,1 
e,v 
f,u 
What I need to do is to create a dictionary that has the characters in the first column as keys and characters in the third column as values. The rest should be ignored, i.e. {a:1, c:1, d:1}. This is what I have so far: 
  <div...]]></description>
			<content:encoded><![CDATA[<div>I have a file like this:<br />
a,z,1<br />
b,y<br />
c,x,1<br />
d,w,1<br />
e,v<br />
f,u<br />
What I need to do is to create a dictionary that has the characters in the first column as keys and characters in the third column as values. The rest should be ignored, i.e. {a:1, c:1, d:1}. This is what I have so far:<br />
 <pre style="margin:20px; line-height:13px">def create_dict(f):<br />
&nbsp; &nbsp; f = open(&quot;something.txt&quot;)<br />
&nbsp; &nbsp; d = {}<br />
&nbsp; &nbsp; for line in f:<br />
&nbsp; &nbsp; &nbsp; &nbsp; columns = line.split(&quot;,&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; letters = columns[0]<br />
&nbsp; &nbsp; &nbsp; &nbsp; numbers = columns[2]</pre><br />
I am confused about next steps. Please, help.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>pyprog</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236716.html</guid>
		</item>
		<item>
			<title>Compiler inside a Interpreter</title>
			<link>http://www.daniweb.com/forums/thread236712.html</link>
			<pubDate>Sat, 07 Nov 2009 05:43:59 GMT</pubDate>
			<description>Hello All, 
 
I have a doubt...  
 
basically I worte my first interpreter in C (A very simple one though... ) 
 
I will take a input file and will pass as command line arguements to my interpreter . This file will convert the input file to standard C file and will store in .C extension. 
 
Now how...</description>
			<content:encoded><![CDATA[<div>Hello All,<br />
<br />
I have a doubt... <br />
<br />
basically I worte my first interpreter in C (A very simple one though... )<br />
<br />
I will take a input file and will pass as command line arguements to my interpreter . This file will convert the input file to standard C file and will store in .C extension.<br />
<br />
Now how do I call a C compiler insider my function itself, so that this generated C file will be compiled and executed at once.<br />
<br />
Eg.<br />
<br />
I create a text file test.txr as follows<br />
<br />
Hello PRINTA  ......<br />
<br />
Hello GETTA  .....<br />
<br />
I pass this file as a command line...<br />
<br />
conv text.txr  (In command line)<br />
<br />
This conv.C  takes this file as input and convert PRINTA as printf and GETTA as scanf etc . (As you know..... simple pre processor).<br />
<br />
So as the end, text.C will be generated.... All was fine till here.<br />
<br />
Now I wanna compile this text.C and execute inside this conv.C itself.<br />
<br />
Do you get my objective...............???????????/<br />
<br />
Is this possible??????????<br />
<br />
Waiting for your help guys......... I;m doing it for one charity process. I want this to happen ASAP.<br />
<br />
--Rigidboss</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum14.html">Computer Science</category>
			<dc:creator>rigidboss</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236712.html</guid>
		</item>
		<item>
			<title>Cannot Open Flash Files From the VB.Net EXE</title>
			<link>http://www.daniweb.com/forums/thread236711.html</link>
			<pubDate>Sat, 07 Nov 2009 05:41:13 GMT</pubDate>
			<description>I have created a small application to open the Flash File from my VB.Net Windows Application. To open the Flash file - I have used the Shockwave Flash Object. When I run the application directly from the Solution, the flash files are opening perfectly. But, once I created the EXE and tried to open...</description>
			<content:encoded><![CDATA[<div>I have created a small application to open the Flash File from my VB.Net Windows Application. To open the Flash file - I have used the Shockwave Flash Object. When I run the application directly from the Solution, the flash files are opening perfectly. But, once I created the EXE and tried to open the same file, I could not. But I can still open other files such as XML, PDF, and Word file from the same directory. <br />
<br />
Can Anyone Help me?<br />
<br />
Thanks,<br />
<br />
ArunSankar</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum58.html">VB.NET</category>
			<dc:creator>a_arunsankar</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236711.html</guid>
		</item>
		<item>
			<title>Array of structures not returning elements</title>
			<link>http://www.daniweb.com/forums/thread236708.html</link>
			<pubDate>Sat, 07 Nov 2009 05:22:07 GMT</pubDate>
			<description><![CDATA[Hi, 
The following code I've been working on (as hobbyist) compiles okay, buy at runtime it fails to output the dates that it is supposed to extract from a csv file. I've been staring at this forever and no progress. 
 
I am thinking that the problem occurs before the date verification function,...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
The following code I've been working on (as hobbyist) compiles okay, buy at runtime it fails to output the dates that it is supposed to extract from a csv file. I've been staring at this forever and no progress.<br />
<br />
I am thinking that the problem occurs before the date verification function, because  when the program gets to cout &lt;&lt; &quot;This is the first date in the database&quot; and cout &lt;&lt; dataArray[0].date &lt;&lt; endl, it does not output the date. This means that the first element in the array is empty, which means that the array did not populate for some reason.<br />
<br />
Would appreciate any suggestions to identify the problem.<br />
<br />
Thanks<br />
TR<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">// Dataprep.cpp : Defines the entry point for the console application<br />
<br />
#include &quot;stdafx.h&quot;<br />
#include &lt;vector&gt;<br />
#include &lt;fstream&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;string&gt; <br />
#include &lt;sstream&gt;<br />
#include &lt;math.h&gt;<br />
#include &lt;cstring&gt;<br />
using namespace std;<br />
int NumLines;<br />
void Error (int);<br />
int Open_Price_Data_File (char* filename);<br />
struct Bar* Define_Array (const char*);<br />
void Parse_Output_To_File (struct Bar* dataArray, const char*);<br />
void Date_Verification ();<br />
void ExitScreen ();<br />
<br />
<br />
<br />
//Structure Declaration and Array Initialization <br />
&nbsp; &nbsp; &nbsp;  struct Bar<br />
&nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  string date;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // date<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  double open;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // opening price<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  double high;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // high price<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  double low;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // low price <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  double close;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // closing price<br />
<br />
&nbsp; &nbsp; &nbsp;  };<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  struct Bar *bararray;<br />
<br />
//Error catching function<br />
void Error(int errorcode) <br />
{<br />
&nbsp;if(errorcode == 1) {<br />
&nbsp; &nbsp;  cout &lt;&lt; &quot;Error in opening file...&quot;;<br />
&nbsp;}<br />
&nbsp;else cout &lt;&lt; &quot;OK&quot;;<br />
}<br />
<br />
<br />
//Function to open price data file<br />
&nbsp;int Open_Price_Data_File (char* filename)<br />
&nbsp;{<br />
&nbsp;  cout &lt;&lt; &quot;Enter filename in the following&nbsp; format c: backslash filename.csv: &quot;; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cin &gt;&gt; filename;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ifstream infile;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;Reading from the price data file&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  infile.open(filename); <br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!infile.is_open()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Error (1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else return 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; infile.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return 1;<br />
&nbsp;}<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
<br />
// Function to count number of lines in file &amp; define the array of structures accordingly<br />
struct Bar* Define_Array (const char* filename)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; ifstream infile;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; infile.open(filename); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(!infile.is_open())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Error (1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  string line;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  while(getline(infile, line))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  NumLines++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;This is the total number of lines in the source file: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; NumLines &lt;&lt; endl; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Bar *bararray = NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  bararray = new Bar[NumLines];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  infile.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return bararray;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
<br />
// String Parsing to Skip Commas<br />
&nbsp;void Parse_Output_To_File (struct Bar *dataArray, char* filename)<br />
&nbsp;{<br />
&nbsp; &nbsp; &nbsp; &nbsp; ofstream outfile;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outfile.open (&quot;c:\\Outputfile.txt&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!outfile.is_open())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;Error in opening file for writing!&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else return;&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ifstream redo;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  redo.open(filename);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int i = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  while (!redo.fail())&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int j = 0;&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  string data, token;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  getline(redo, data);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  istringstream isstream (data);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  while (getline(isstream,token,',')) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  outfile &lt;&lt; token &lt;&lt; &quot; &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(j == 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  dataArray[i].date = token;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  j++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(j == 1) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  dataArray[i].open = atof( token.c_str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  j++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(j == 2) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  dataArray[i].high = atof( token.c_str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  j++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  continue; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(j == 3) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  dataArray[i].low = atof( token.c_str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  j++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(j == 4) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dataArray[i].close = atof(token.c_str ());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; j++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  continue;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  i++&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outfile &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; redo.close()&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outfile.close(); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;}<br />
<br />
// Date Verification Function<br />
<br />
void Date_Verification (struct Bar *dataArray)<br />
{<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;This is the first date in the database: &quot;;<br />
&nbsp; &nbsp; cout &lt;&lt; dataArray[0].date &lt;&lt; endl;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;This is the last date in the database:&nbsp; &quot;;<br />
&nbsp; &nbsp; cout &lt;&lt; dataArray[NumLines - 1].date &lt;&lt; endl;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Enter the start date for the analysis in the mm/dd/yyyy format: &quot;;<br />
&nbsp; &nbsp; string startdate;<br />
&nbsp; &nbsp; cin &gt;&gt; startdate;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;The startdate you entered is: &quot; &lt;&lt; startdate &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; int i;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;  for (i = 0; i &lt;= NumLines -1;)<br />
&nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!strcmp(startdate.c_str(), dataArray[i].date.c_str()) == 0)&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (i == NumLines -1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Incorrect start date &quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Start date exists in the database&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
cout &lt;&lt; &quot;Enter the end date for the analysis in the mm/dd/yyyy format: &quot;;<br />
&nbsp; &nbsp; &nbsp;  string enddate;<br />
&nbsp; &nbsp; &nbsp;  cin &gt;&gt; enddate;<br />
&nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;The enddate you entered is: &quot; &lt;&lt; enddate &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp;  for (i = 0; i &lt;= NumLines -1;)<br />
&nbsp;{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!strcmp(enddate.c_str(), dataArray[i].date.c_str()) == 0)&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (i == NumLines -1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; out &lt;&lt; &quot;Incorrect end date&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;End date exists in the database&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;}<br />
<br />
}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
<br />
<br />
// User Prompt to Retain Command Window <br />
void ExitScreen ()<br />
&nbsp;{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  char ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;Please press Q or q to quit: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (ch=='Q' &amp;&amp; ch=='q') <br />
&nbsp; &nbsp; &nbsp; &nbsp; { <br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Exiting...&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;Please press Q or q to quit: &quot;;<br />
&nbsp;}<br />
<br />
<br />
//Main Program<br />
int main ()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  char filename [80];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Open_Price_Data_File (filename);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  struct Bar* Array;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Array = Define_Array (filename);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Parse_Output_To_File (Array, filename);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Date_Verification (Array);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ExitScreen ();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return 0;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>toneranger</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236708.html</guid>
		</item>
		<item>
			<title>findall</title>
			<link>http://www.daniweb.com/forums/thread236706.html</link>
			<pubDate>Sat, 07 Nov 2009 04:52:17 GMT</pubDate>
			<description><![CDATA[hey guys, 
i have a problem.. i have this chunk of text like this..... 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags"...]]></description>
			<content:encoded><![CDATA[<div>hey guys,<br />
i have a problem.. i have this chunk of text like this.....<br />
<br />
 <pre style="margin:20px; line-height:13px">No.&nbsp; &nbsp;  Time&nbsp; &nbsp; &nbsp; &nbsp; Source&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Destination&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Protocol Info<br />
&nbsp; &nbsp; &nbsp; 2 0.005318&nbsp; &nbsp; 192.168.110.33&nbsp; &nbsp; &nbsp; &nbsp; 192.168.110.44&nbsp; &nbsp; &nbsp; &nbsp; ICMP&nbsp; &nbsp;  Echo (ping) request<br />
<br />
Frame 2 (98 bytes on wire, 98 bytes captured)<br />
Ethernet II, Src: Cisco-Li_4d:e1:30 (00:1c:10:4d:e1:30), Dst: IntelCor_4d:77:83 (00:13:02:4d:77:83)<br />
Internet Protocol, Src: 192.168.110.33 (192.168.110.33), Dst: 192.168.110.44 (192.168.110.44)<br />
Internet Control Message Protocol<br />
<br />
No.&nbsp; &nbsp;  Time&nbsp; &nbsp; &nbsp; &nbsp; Source&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Destination&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Protocol Info<br />
&nbsp; &nbsp; &nbsp; 3 0.998730&nbsp; &nbsp; 192.168.110.33&nbsp; &nbsp; &nbsp; &nbsp; 192.168.110.44&nbsp; &nbsp; &nbsp; &nbsp; DHCP&nbsp; &nbsp;  DHCP Offer&nbsp; &nbsp; - Transaction ID 0x9e0e832<br />
<br />
Frame 3 (347 bytes on wire, 347 bytes captured)<br />
Ethernet II, Src: Cisco-Li_4d:e1:30 (00:1c:10:4d:e1:30), Dst: IntelCor_4d:77:83 (00:13:02:4d:77:83)<br />
Internet Protocol, Src: 192.168.110.33 (192.168.110.33), Dst: 192.168.110.44 (192.168.110.44)<br />
User Datagram Protocol, Src Port: bootps (67), Dst Port: bootpc (68)<br />
Bootstrap Protocol<br />
<br />
No.&nbsp; &nbsp;  Time&nbsp; &nbsp; &nbsp; &nbsp; Source&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Destination&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Protocol Info<br />
&nbsp; &nbsp; &nbsp; 4 0.998917&nbsp; &nbsp; 0.0.0.0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  255.255.255.255&nbsp; &nbsp; &nbsp;  DHCP&nbsp; &nbsp;  DHCP Request&nbsp; - Transaction ID 0x9e0e832<br />
<br />
Frame 4 (348 bytes on wire, 348 bytes captured)<br />
Ethernet II, Src: IntelCor_4d:77:83 (00:13:02:4d:77:83), Dst: Broadcast (ff:ff:ff:ff:ff:ff)<br />
Internet Protocol, Src: 0.0.0.0 (0.0.0.0), Dst: 255.255.255.255 (255.255.255.255)<br />
User Datagram Protocol, Src Port: bootpc (68), Dst Port: bootps (67)<br />
Bootstrap Protocol</pre><br />
basically i'm trying to extract the DHCP server and the the IP address its giving me... sp i want to look for the text between &quot;DHCP Offer&quot; and &quot;bootstrap&quot; and then from that chunk get the part between &quot;Internet Protocol) Src:&quot; and &quot;(&quot;<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; temp = re.findall(&quot;DHCP\s+Offer(.)Bootstrap&quot;, text)<br />
&nbsp; &nbsp; print (temp)<br />
&nbsp; &nbsp; name=re.findall(&quot;(Internet Protocol)\sSrc:.[(]&quot;, temp)<br />
&nbsp; &nbsp; print name</pre><br />
but i think its not reading past the 1st line between the srearch words</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>mitsuevo</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236706.html</guid>
		</item>
		<item>
			<title>Blank JFrame</title>
			<link>http://www.daniweb.com/forums/thread236704.html</link>
			<pubDate>Sat, 07 Nov 2009 04:38:58 GMT</pubDate>
			<description><![CDATA[Hi guys, 
The following program works the way I want it to but there's one small problem; when it loads, it doesn't give a blank frame. It want it to show the output after I click on the blank area. Help me please. 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>Hi guys,<br />
The following program works the way I want it to but there's one small problem; when it loads, it doesn't give a blank frame. It want it to show the output after I click on the blank area. Help me please.<br />
 <pre style="margin:20px; line-height:13px">import java.awt.*;<br />
import javax.swing.*;<br />
import java.awt.event.MouseAdapter;<br />
import java.awt.event.MouseEvent;<br />
<br />
public class TrackMouseMovementTest{<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String[] args){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EventQueue.invokeLater(new Runnable(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void run(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MouseFrame frame = new MouseFrame();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; frame.setVisible(true);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
<br />
class MouseFrame extends JFrame<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; public MouseFrame(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; setTitle(&quot;Mouse Movement Tracker&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; MouseComponent component = new MouseComponent();<br />
&nbsp; &nbsp; &nbsp; &nbsp; add(component);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static final int DEFAULT_WIDTH = 500;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public static final int DEFAULT_HEIGHT = 500;<br />
}<br />
<br />
class MouseComponent extends JComponent{<br />
&nbsp; &nbsp; &nbsp; &nbsp; public MouseComponent(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addMouseListener(new MouseHandler());<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; private class MouseHandler extends MouseAdapter{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void mousePressed(MouseEvent event){&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x = event.getX();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y = event.getY();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; repaint();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void paintComponent(Graphics g){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; g.drawString(&quot;X: &quot; + x + &quot;,Y: &quot; + y + &quot;&quot;,x,y);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; g.drawString(&quot;Click #: &quot; + counter ++ ,x , y + 16);<br />
&nbsp; &nbsp; } <br />
&nbsp; &nbsp; &nbsp; &nbsp; int x;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int y;&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; private static int counter=-1;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>babylonlion</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236704.html</guid>
		</item>
		<item>
			<title>php coding</title>
			<link>http://www.daniweb.com/forums/thread236703.html</link>
			<pubDate>Sat, 07 Nov 2009 04:32:09 GMT</pubDate>
			<description><![CDATA[<?php  
session_start(); 
//Check User Session 
include ("includes/check_session.php"); 
 
include 'includes/config.php'; 
$current_module = 'MATERIALREQ'; 
//$related_modules = array('BIDDINGENTRY','PIRRAISING','POLIST','BIDDINGSELECTION','GRV'); 
include ('includes/check_acl.php');]]></description>
			<content:encoded><![CDATA[<div>&lt;?php <br />
session_start();<br />
//Check User Session<br />
include (&quot;includes/check_session.php&quot;);<br />
<br />
include 'includes/config.php';<br />
$current_module = 'MATERIALREQ';<br />
//$related_modules = array('BIDDINGENTRY','PIRRAISING','POLIST','BIDDINGSELECTION','GRV');<br />
include ('includes/check_acl.php');<br />
<br />
//include 'includes/config.php';<br />
include 'includes/sqlquery.php';<br />
include 'includes/message.php';<br />
$valid = '';<br />
<br />
$current_user_id = $_SESSION['associate_id'];	<br />
<br />
//if the session value is present, set whether the last transaction is stored or not<br />
if (isset($_SESSION['mrmsg']) &amp;&amp; ($_SESSION['mrmsg']!='')) <br />
{<br />
	$valid = $_SESSION['mrmsg'];<br />
	$last_mr_id = $_SESSION['last_mr_id'];<br />
	$_SESSION['mrmsg']=''; //clear it <br />
	$_SESSION['last_mr_id']=''; //clear it <br />
}<br />
<br />
if(!empty($_POST['hdn_total'])){<br />
try {<br />
		begin();<br />
		<br />
		if(!$acl['MATERIALREQ']['write']) throw new Exception(&quot;You don't have rights to do Material Request&quot;);<br />
		<br />
		$valid = 'failure';<br />
		//$getVal['MRNo']			= mysql_real_escape_string($_POST['txtMatReqNo']);<br />
		$getVal['MRDate'] 		= mysql_real_escape_string(DBdate($_POST['txtMatReqDate']));<br />
		$getVal['PreperdBy'] 	= mysql_real_escape_string($_POST['cmbRequestedBy']);		<br />
		$getVal['StoreNo']  	= mysql_real_escape_string($_POST['cmbStoreID']);<br />
		$getVal['RequiredAt']  	= mysql_real_escape_string($_POST['cmbRequiredAt']);		<br />
		$getVal['Remarks']		= mysql_real_escape_string($_POST['txtRemarks']);<br />
<br />
		<br />
		$getError	=	addMaterialReq($getVal);<br />
		<br />
		if(!empty($getError)) throw new Exception($getError);<br />
		<br />
		if(empty($getError)){<br />
			$getVal[&quot;MRNo&quot;] = mysql_insert_id();<br />
			$hdnId	=	explode(&quot;,&quot;, $_POST['hdn_total']);<br />
			$count	=	count($hdnId);<br />
			$j=1;<br />
			for($i=0;$i&lt;$count;$i++){<br />
				$getVal['ItemCode'.$j] 		= mysql_real_escape_string($_POST['ItemCode'.$j]);<br />
				$getVal['ItemName'.$j] 		= mysql_real_escape_string($_POST['ItemName'.$j]);<br />
				$getVal['Description'.$j] 	= mysql_real_escape_string($_POST['Description'.$j]);<br />
				$getVal['Quantity'.$j] 		= mysql_real_escape_string($_POST['Quantity'.$j]);<br />
				<br />
				$getError	=	addMaterialReqItems($getVal, $i);<br />
				if(!empty($getError)) throw new Exception($getError);<br />
				$j++;<br />
			}<br />
			$valid = 'success';	<br />
		}<br />
		<br />
		$_SESSION['mrmsg'] = $valid;<br />
		$_SESSION['last_mr_id'] = $getVal[&quot;MRNo&quot;];<br />
		commit();<br />
		//header(&quot;Location: materialrequest.php&quot;);<br />
		echo &quot;&lt;META HTTP-EQUIV='Refresh' CONTENT='0;materialrequest.php'&gt;&quot;;<br />
	}<br />
	catch(Exception $s)<br />
	{<br />
		rollback();				<br />
		$errmsg = $s-&gt;getMessage();	<br />
		myExceptionHandler($s);<br />
		$valid = false;<br />
	}<br />
}	<br />
?&gt;<br />
<br />
<br />
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;<br />
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;MintHome&lt;/title&gt;<br />
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;<br />
&lt;script type=&quot;text/javascript&quot; src=&quot;javascripts/autosuggest.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;<br />
&lt;link href=&quot;css/style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;<br />
&lt;link href=&quot;css/autosuggest_inquisitor.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; charset=&quot;utf-8&quot; /&gt;<br />
&lt;style type=&quot;text/css&quot;&gt;<br />
&lt;!--<br />
.style1 {color: #E78D2E}<br />
--&gt;<br />
&lt;/style&gt;<br />
<br />
<br />
&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;javascripts/datetimepicker_css.js&quot;&gt;<br />
&lt;/script&gt;<br />
<br />
&lt;script language=&quot;javascript&quot;&gt;<br />
<br />
function checkForm()<br />
{<br />
		return false;<br />
}<br />
<br />
 		function itemcode_checker()<br />
		{			<br />
			var invalid = false;<br />
			DGrid.setTotalRow();	<br />
			var rowNos = document.getElementById('hdn_total').value;	<br />
			indivRow = rowNos.split(',');<br />
			cnt_rows = indivRow.length;	<br />
			var cnt_itemTotalindb = itemIDS.length;<br />
			var itempresent_db = false;<br />
<br />
			for(i=0;i&lt;cnt_rows;i++)<br />
			{<br />
				itemcode_rowID = 'ItemCode'+indivRow[i];<br />
				itemcode_val = document.getElementById(itemcode_rowID).value;<br />
				if (itemcode_val != '')<br />
				{<br />
					itempresent_db = false;<br />
					for(j=0;j&lt;cnt_itemTotalindb;j++)<br />
					{<br />
						if (itemcode_val == itemIDS[j])<br />
						{<br />
							itempresent_db = true; <br />
							break;													<br />
						}<br />
					}<br />
<br />
					if (itempresent_db == false)<br />
					{<br />
						alert('Item Code Not Correctly Entered');	<br />
						document.getElementById(itemcode_rowID).focus();<br />
						break;<br />
					}<br />
				}<br />
			}<br />
			if (itempresent_db == false) return false;<br />
			return true;<br />
		}<br />
<br />
function validateGrid()<br />
{<br />
	var rowNos = document.getElementById('hdn_total').value;<br />
	//alert(rowNos);<br />
	indivRow = rowNos.split(',');<br />
	cnt_rows = indivRow.length;<br />
	atleast_oneitem = false;<br />
<br />
	for(i=0;i&lt;cnt_rows;i++)<br />
	{<br />
		itemcode_rowID = 'ItemCode'+indivRow[i];<br />
		itemqty_rowID = 'Quantity'+indivRow[i];<br />
		<br />
		itemcode_val = document.getElementById(itemcode_rowID).value;	<br />
		itemqty_val = document.getElementById(itemqty_rowID).value;	<br />
<br />
		if (itemqty_val &gt; 0 &amp;&amp; (itemcode_val == '' || itemcode_val &lt;= 0))<br />
		{<br />
			document.getElementById(itemcode_rowID).focus();	<br />
			alert('Enter Item code');<br />
			return false;<br />
		}<br />
<br />
<br />
		if (itemcode_val &gt; 0 &amp;&amp; (itemqty_val == '' || itemqty_val &lt;= 0))<br />
		{<br />
			document.getElementById(itemqty_rowID).focus();	<br />
			alert('Enter Item Code '+itemcode_val+': Quantity Level');<br />
			return false;<br />
		}<br />
<br />
		if (itemcode_val &gt; 0 &amp;&amp; itemqty_val &gt; 0)<br />
		{<br />
			atleast_oneitem = true;<br />
		}<br />
	}<br />
<br />
	//Check atleast one item is added to Grid<br />
	if (atleast_oneitem == false)<br />
	{<br />
		alert('No Items is added in the Grid to raise Purchase Indent');<br />
		itemcode_rowID = 'ItemCode'+indivRow[0];				<br />
		itemcode_val = document.getElementById(itemcode_rowID).value;	<br />
		return false;<br />
	}<br />
	return true;<br />
}<br />
<br />
function CompareDates()<br />
{<br />
   var str1  = document.getElementById(&quot;serverdate&quot;).value;<br />
   var str2  = document.getElementById(&quot;txtMatReqDate&quot;).value;<br />
   var date1 = str1.split(&quot;-&quot;, 3);<br />
   var dt1   = parseInt(date1[0]);<br />
   var mon1  = date1[1];<br />
 //  mon1 = parseInt(mon1);<br />
   var yr1   = parseInt(date1[2]);<br />
  // alert(dt1+&quot; &quot;+mon1+&quot; &quot;+yr1);<br />
   var date2 = str2.split(&quot;-&quot;, 3);<br />
   var dt2   = parseInt(date2[0]);<br />
   var mon2  = date2[1];<br />
 //  mon2 = parseInt(mon2);<br />
   var yr2   = parseInt(date2[2]);<br />
  // alert(dt2+&quot; &quot;+mon2+&quot; &quot;+yr2);<br />
   //var dt1   = parseInt(str1.substring(0,2),10);<br />
   //var mon1  = parseInt(str1.substring(3,5),10);<br />
   //var yr1   = parseInt(str1.substring(6,10),10);<br />
   //var dt2   = parseInt(str2.substring(0,2),10);<br />
   //var mon2  = parseInt(str2.substring(3,5),10);<br />
   //var yr2   = parseInt(str2.substring(6,10),10);<br />
   var date1 = new Date(yr1, mon1, dt1);<br />
   var date2 = new Date(yr2, mon2, dt2);<br />
<br />
   if(date2 &lt; date1)<br />
   {<br />
      alert(&quot;Request Date should be current or future date&quot;);<br />
	  document.getElementById(&quot;txtMatReqDate&quot;).focus();<br />
      return false;<br />
   }<br />
   return true;<br />
}<br />
<br />
function validateForm()<br />
{<br />
		valid = true;<br />
		<br />
		if ( document.MatReq_Form.txtMatReqDate.value == '')<br />
        {<br />
                alert ( &quot;Please Select PIR Transaction Date&quot; );<br />
				document.MatReq_Form.txtMatReqDate.focus();<br />
                return false;<br />
        }<br />
<br />
		if (!CompareDates()) return false;<br />
		<br />
        if ( document.MatReq_Form.cmbRequestedBy.selectedIndex &lt;= 0)<br />
        {<br />
                alert ( &quot;Please Select a Requested By User&quot; );<br />
				document.MatReq_Form.cmbRequestedBy.focus();<br />
                return false;<br />
        }<br />
        if ( document.MatReq_Form.cmbStoreID.selectedIndex &lt;= 0)<br />
        {<br />
                alert ( &quot;Please Select a Store name&quot; );<br />
				document.MatReq_Form.cmbStoreID.focus();<br />
                return false;<br />
        }<br />
        if ( document.MatReq_Form.cmbRequiredAt.selectedIndex &lt;= 0)<br />
        {<br />
                alert ( &quot;Please Select a Requested At&quot; );<br />
				document.MatReq_Form.cmbRequiredAt.focus();<br />
                return false;<br />
        }<br />
        if ( document.MatReq_Form.txtRemarks.value == '')<br />
        {<br />
                alert ( &quot;Please Enter Remarks&quot; );<br />
				document.MatReq_Form.txtRemarks.focus();<br />
                return false;<br />
        }<br />
		<br />
		DGrid.setTotalRow();<br />
<br />
		if (!itemcode_checker()) return false;<br />
		if (!validateGrid()) return false;<br />
		<br />
		document.MatReq_Form.action = &quot;materialrequest.php&quot;;<br />
		document.MatReq_Form.submit();<br />
		//location.href='materialapproval.php';<br />
		<br />
}<br />
<br />
function isNumberKey(evt)<br />
{<br />
 var charCode = (evt.which) ? evt.which : event.keyCode	<br />
 if (charCode &gt; 31 &amp;&amp; (charCode &lt; 48 || charCode &gt; 57) &amp;&amp; (charCode &lt; 96 || charCode &gt; 105))<br />
	{<br />
		if  (charCode &lt; 96 || charCode &gt; 105)<br />
		{<br />
			var keychar = String.fromCharCode(charCode);<br />
			reg = /\d/;<br />
			return reg.test(keychar);<br />
		}<br />
		return false;<br />
	}<br />
 return true;<br />
}<br />
<br />
function isNumberKey2(evt)<br />
{<br />
 var charCode = (evt.which) ? evt.which : event.keyCode	<br />
 if (charCode &gt; 31 &amp;&amp; (charCode &lt; 48 || charCode &gt; 57))<br />
	{<br />
		return false;<br />
	}<br />
 return true;<br />
}<br />
<br />
function checkForInvalid(obj)<br />
{<br />
	if( /[^0-9\-]|-{2,}/gi.test(obj.value) ) <br />
		{<br />
		  alert(&quot;Only Numbers Allowed !&quot;)<br />
		  obj.value=&quot;&quot;;<br />
		  obj.focus();<br />
		  obj.select();<br />
		  return false;<br />
	   }<br />
	return true;<br />
}<br />
<br />
function editpirForm()<br />
{<br />
window.location.href= (&quot;editmrlist.php&quot;);<br />
document.formname.submit();<br />
}<br />
<br />
&lt;/script&gt;<br />
<br />
&lt;/head&gt;<br />
&lt;body&gt; <br />
&lt;form name= &quot;MatReq_Form&quot; method=&quot;post&quot;  onsubmit=&quot;return checkForm();&quot;&gt; <br />
  &lt;div style=&quot;text-align:left; width:760px !important;&quot;&gt; <br />
   &lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;left&quot;&gt; <br />
     &lt;tr id=&quot;header&quot;&gt; <br />
      &lt;td width=&quot;481&quot;&gt; <br />
		&lt;?php include ('banner.php'); ?&gt;<br />
	  &lt;/td&gt; <br />
	  &lt;td width=&quot;519&quot; align=&quot;right&quot;&gt;	<br />
	 	&lt;?php include ('background.php'); ?&gt;<br />
	  &lt;/td&gt;<br />
     &lt;/tr&gt; <br />
	 &lt;tr&gt; <br />
	  &lt;td colspan=&quot;2&quot; valign=&quot;top&quot;&gt; <br />
		 &lt;table id=&quot;main&quot; width=&quot;1000&quot; height=&quot;333&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;left&quot;&gt; <br />
	    &lt;tr&gt; <br />
			&lt;td height=&quot;331&quot; valign=&quot;top&quot; id=&quot;leftside&quot;&gt;&lt;div class=&quot;box1&quot;&gt;&lt;?php include'leftmenu.php' ?&gt;&lt;/div&gt;<br />
            &lt;/td&gt;       <br />
			&lt;td valign=&quot;top&quot;&gt;<br />
   		&lt;table align=&quot;center&quot; &gt;<br />
  			&lt;tr&gt;<br />
  				  &lt;th scope=&quot;row&quot;&gt;&lt;font color=&quot;#000000&quot; size=&quot;2&quot;&gt;&lt;strong&gt;Material Request Screen&lt;/strong&gt;&lt;/font&gt;&lt;/th&gt;<br />
  			&lt;/tr&gt;<br />
		&lt;/table&gt;<br />
		&lt;br /&gt;<br />
		&lt;fieldset&gt;<br />
		&lt;table width=&quot;597&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;<br />
        	&lt;?php <br />
			if($valid!='')<br />
			{<br />
				if($valid=='failure') $Msg = &quot;FAIL&quot;;<br />
				if($valid=='success') $Msg = &quot;SUCCESS&quot;;				<br />
				if ($valid == 'success') <br />
				{<br />
				?&gt;<br />
					&lt;div align=&quot;center&quot; class=&quot;&lt;?php echo $Msg;?&gt;&quot; &gt;<br />
					&lt;?php echo $MRMessage['WARNNING'][&quot;MR&quot;.$Msg].&quot;, Your Request Number is &lt;strong&gt;&quot;.$last_mr_id.&quot;&lt;/strong&gt;&quot;;?&gt;&lt;/div&gt;<br />
				&lt;?php <br />
				}<br />
				else if ($valid == 'failure')<br />
				{	<br />
				?&gt;<br />
					&lt;div align=&quot;center&quot; class=&quot;&lt;?php echo $Msg;?&gt;&quot; &gt;<br />
					&lt;?php echo $MRMessage['WARNNING'][&quot;MR&quot;.$Msg];?&gt;&lt;/div&gt;<br />
				&lt;?php<br />
				}<br />
			} 	<br />
			?&gt;<br />
			&lt;?php if ($errmsg != '') { ?&gt;<br />
			&lt;div align=&quot;center&quot; class=&quot;FAIL&quot;&gt;<br />
				&lt;?php echo $errmsg;?&gt;<br />
			&lt;/div&gt;			<br />
			&lt;?php } ?&gt;<br />
        &lt;tr&gt;<br />
        <br />
&lt;?php /*?&gt;			&lt;td&gt;&lt;font size=&quot;2&quot;&gt;Material Request No&lt;/font&gt;&lt;/td&gt;<br />
			&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;txtMatReqNo&quot; id=&quot;txtMatReqNo&quot; value=&quot;&lt;?=$row['MRNO']?&gt;&quot; onkeypress=&quot;return isNumberKey2(event)&quot; onkeyup=&quot;checkForInvalid(this)&quot;&gt;&lt;/td&gt;&lt;?php */?&gt;<br />
			&lt;td&gt;&lt;font size=&quot;2&quot;&gt;Transaction Date&lt;/font&gt;&lt;/td&gt;<br />
			&lt;td&gt;&lt;p&gt;&lt;input type=&quot;text&quot; name=&quot;txtMatReqDate&quot; id=&quot;txtMatReqDate&quot; value=&quot;&lt;?php echo date('d-m-Y');?&gt;&quot; readonly onclick=&quot;alert('Click the image to change Date')&quot;&gt;<br />
          &lt;a href=&quot;javascript<b></b>:NewCssCal('txtMatReqDate','ddmmyyy','arrow')&quot;&gt;&lt;img src=&quot;images/cal.gif&quot; width=&quot;16&quot; height=&quot;16&quot; border=&quot;0&quot; alt=&quot;Pick a date&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/td<br />
			&gt;<br />
			&lt;td&gt;&lt;font size=&quot;2&quot; color=&quot;&quot;&gt;Requested By&lt;/font&gt;&lt;/td&gt;<br />
            &lt;?php<br />
				$qry = &quot;select ASSOCIATEID,ASSOCIATENAME FROM associatemst WHERE STATUS = 1&quot;;<br />
				$result2 = mysql_query($qry);<br />
			?&gt;<br />
			&lt;td&gt;&lt;p&gt;&lt;select name=&quot;cmbRequestedBy&quot; readonly style=&quot;background-color:<br />
#ababab&quot; onFocus=&quot;this.blur(); return false;&quot;&gt; &lt;option&gt;Select Name&lt;/option&gt;<br />
			&lt;?php<br />
										<br />
				if (mysql_affected_rows()&gt;0)<br />
				{<br />
					while (list($k,$v) = mysql_fetch_array($result2))<br />
					{<br />
						$selected = ($current_user_id  == $k ) ? ' selected=&quot;selected&quot;' : '';<br />
						echo &quot;&lt;option value='&quot;.$k.&quot;' &quot;.$selected.&quot;&gt; (Id: $k) &quot;.$v.&quot;&lt;/option&gt;&quot;;	<br />
					}<br />
				}										<br />
			?&gt;<br />
				&lt;/select&gt;&lt;/p&gt; &lt;/td&gt;<br />
		<br />
        &lt;/tr&gt;<br />
        &lt;tr&gt;<br />
      &lt;td&gt;&lt;font size=&quot;2&quot; &gt;Store No&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/td&gt;<br />
      &lt;?php<br />
				$qry = &quot;select STORENO,STORENAME FROM storemst WHERE STATUS = 1&quot;;<br />
				$result2 = mysql_query($qry);<br />
			?&gt;<br />
			&lt;td&gt;&lt;select name=&quot;cmbStoreID&quot;&gt; &lt;option&gt;Select Name&lt;/option&gt;<br />
			&lt;?php<br />
										<br />
				if (mysql_affected_rows()&gt;0)<br />
				{<br />
					while (list($k,$v) = mysql_fetch_array($result2))<br />
					{<br />
						echo &quot;&lt;option value='&quot;.$k.&quot;'&gt; (Id: $k) &quot;.$v.&quot;&lt;/option&gt;&quot;;	<br />
					}<br />
				}										<br />
			?&gt;<br />
				&lt;/select&gt; &lt;/td&gt;<br />
       &lt;td&gt;&lt;font size=&quot;2&quot; &gt;Required At&lt;/font&gt;&lt;/td&gt;<br />
      &lt;?php<br />
				$qry = &quot;select LOCATIONID,LOCATIONNAME FROM location WHERE STATUS = 1&quot;;<br />
				$result2 = mysql_query($qry);<br />
			?&gt;<br />
			&lt;td&gt;&lt;p&gt;&lt;select name=&quot;cmbRequiredAt&quot;&gt; &lt;option&gt;Select Name&lt;/option&gt;<br />
			&lt;?php<br />
										<br />
				if (mysql_affected_rows()&gt;0)<br />
				{<br />
					while (list($k,$v) = mysql_fetch_array($result2))<br />
					{<br />
						echo &quot;&lt;option value='&quot;.$k.&quot;'&gt; (Id : $k) &quot;.$v.&quot;&lt;/option&gt;&quot;;	<br />
					}<br />
				}										<br />
			?&gt;<br />
				&lt;/select&gt;&lt;/p&gt; <br />
           &lt;/td&gt;<br />
        &lt;/tr&gt;		 <br />
		&lt;table width=&quot;817&quot;&gt;<br />
            &lt;tr&gt;<br />
                &lt;td width=&quot;225&quot;&gt;&lt;font size=&quot;2&quot;&gt;Remarks&lt;/font&gt;&lt;/td&gt;<br />
                &lt;td width=&quot;651&quot;&gt;&lt;input type=&quot;text&quot; name=&quot;txtRemarks&quot; id=&quot;txtRemarks&quot;  size=&quot;106&quot;value=&quot;&lt;?=$row['REMARKS']?&gt;&quot;&gt;&lt;/td&gt;<br />
                &lt;td width=&quot;22&quot;&gt;&lt;p&gt;&lt;input type=&quot;hidden&quot; name=&quot;hdn_total&quot;  id=&quot;hdn_total&quot; value=&quot;test&quot;&gt;<br />
                &lt;input type=&quot;hidden&quot; value=&quot;&lt;?=date('d-m-Y')?&gt;&quot; name=&quot;serverdate&quot; id=&quot;serverdate&quot;/&gt;<br />
                &lt;/p&gt;&lt;/td&gt;<br />
            &lt;/tr&gt;<br />
		&lt;/table&gt;<br />
        &lt;br /&gt;<br />
        &lt;table&gt;<br />
        &lt;tr&gt;<br />
		  &lt;td&gt;<br />
	  &lt;div style=&quot;overflow:auto;width:820px;auto;height:280px;border:#E78D2E solid 1px;&quot;&gt;<br />
	  &lt;table width=&quot;100%&quot; border=&quot;0&quot; id=&quot;tableId&quot; cellspacing=&quot;0&quot;  class='' cellpadding=&quot;0&quot;&gt;<br />
          &lt;tr class=&quot;table_heading&quot;&gt; <br />
            &lt;td width=&quot;2%&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/td&gt;<br />
            &lt;td width=&quot;22%&quot;&gt;Item Code&lt;/td&gt;<br />
            &lt;td width=&quot;22%&quot;&gt;Item Name&lt;/td&gt;<br />
            &lt;td width=&quot;22%&quot;&gt;Description&lt;/td&gt;<br />
			&lt;td width=&quot;22%&quot;&gt;Unit&lt;/td&gt;<br />
            &lt;td width=&quot;22%&quot;&gt;Quantity&lt;/td&gt;<br />
          &lt;/tr&gt;<br />
        &lt;/table&gt;<br />
        &lt;script src=&quot;javascripts/dGrid.js&quot;&gt;&lt;/script&gt;<br />
		&lt;script language=&quot;javascript&quot;&gt;<br />
		var itemIDS = new Array();<br />
				&lt;?php<br />
				$sqlQry2		=	&quot;select ITEMCODE from itemmaster&quot;;<br />
				$getQry2		=	mysql_query($sqlQry2);<br />
				$count2			=	mysql_num_rows($getQry2); <br />
				$itr = 0;<br />
				while ($rows2 = mysql_fetch_array($getQry2))<br />
				{				<br />
					echo &quot;itemIDS[$itr] = '&quot;.$rows2['ITEMCODE'].&quot;';\n&quot;;<br />
					$itr++;<br />
				}<br />
		?&gt;<br />
		var error_onfield = null;<br />
		<br />
		<br />
		var Fileds 		=  ['ItemCode','ItemName','Description','Unit','Quantity'];<br />
		var Functions	=  ['showItemcode','showItemName',,'checkforerror','isNumberKey'];<br />
		//var Fileds 	=  ['ItemCode','ItemName','Description','unit','Quantity'];<br />
		//var Functions	=  ['showItemcode','showItemName','showDescription','showUnit'];<br />
		var DefaultRows	=	5;<br />
		//var UDefaultRows=	1;<br />
		<br />
		var Tbl	= new DGrid(&quot;tableId&quot;, DefaultRows, Fileds, Functions);<br />
		<br />
		function showItemcode(obj){<br />
			<br />
			var RowIndex  = obj.id.split('ItemCode');<br />
			var fillValue = &quot;ItemName&quot;+RowIndex[1];<br />
			var descr = &quot;Description&quot;+RowIndex[1];<br />
			var unit = &quot;Unit&quot;+RowIndex[1];<br />
			var options ={<br />
			script:&quot;autosuggest.php?limit=6&amp;searchby=ITEMCODE,ITEMNAME,DESCRIPTION,UNIT&amp;tablename=itemmaster&amp;orderby=ITEMCODE&amp;&quot;,<br />
			varname:&quot;input&quot;,<br />
			json:false,<br />
			shownoresults:false,<br />
			maxresults:6,<br />
			callback: function (obj) <br />
			{ <br />
				document.getElementById(fillValue).value = obj.info;<br />
				document.getElementById(descr).value = obj.desc;<br />
				document.getElementById(unit).value = obj.unit;<br />
				document.getElementById(unit).focus(); <br />
<br />
			}<br />
		};<br />
			<br />
		var as_json = new bsn.AutoSuggest(obj.id, options);<br />
			//alert(obj.name);<br />
		}<br />
		<br />
		function checkforerror()<br />
		{<br />
			if (error_onfield!= null)<br />
			{<br />
				error_onfield.focus();<br />
				error_onfield = null;<br />
			}<br />
		}<br />
		<br />
		function showItemName(obj){<br />
			<br />
			var RowIndex  = obj.id.split('ItemName');<br />
			var fillValue = &quot;ItemCode&quot;+RowIndex[1];<br />
			var descr = &quot;Description&quot;+RowIndex[1];<br />
			var unit = &quot;Unit&quot;+RowIndex[1];<br />
			var options ={<br />
			script:&quot;autosuggest.php?limit=6&amp;searchby=ITEMNAME,ITEMCODE,DESCRIPTION,UNIT&amp;tablename=itemmaster&amp;orderby=ITEMCODE&amp;&quot;,<br />
			varname:&quot;input&quot;,<br />
			json:false,<br />
			shownoresults:false,<br />
			maxresults:6,<br />
			callback: function (obj) <br />
			{ <br />
				document.getElementById(fillValue).value = obj.info;<br />
				document.getElementById(descr).value = obj.desc;<br />
				document.getElementById(unit).value = obj.unit;<br />
				document.getElementById(unit).focus(); <br />
<br />
			}<br />
		};<br />
			<br />
		var as_json = new bsn.AutoSuggest(obj.id, options);<br />
			//alert(obj.name);<br />
		}<br />
	&lt;/script&gt;<br />
<br />
		&lt;/div&gt;<br />
<br />
    <br />
<br />
&lt;table align=&quot;center&quot;&gt;<br />
&lt;tr&gt;<br />
		&lt;td width=&quot;1%&quot;&gt;&lt;div name=&quot;addtoGrid&quot; title=&quot;Add New Row&quot; onclick=&quot;javascript<b></b>:DGrid.addToGrid(UDefaultRows);&quot; id=&quot;addtoGrid2&quot; value=&quot;Add Row&quot;&gt;&lt;a class=&quot;actions&quot;&gt;&lt;img src=&quot;images/addrow.jpg&quot; width=&quot;20&quot; height=&quot;20&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;<br />
<br />
		&lt;td width=&quot;9%&quot;&gt;&lt;div name=&quot;addtoGrid&quot; title=&quot;Add New Row&quot; onclick=&quot;javascript<b></b>:DGrid.addToGrid(UDefaultRows);&quot; id=&quot;addtoGrid2&quot; value=&quot;Add Row&quot;&gt;<br />
        &lt;a class=&quot;actions&quot;&gt;Add Row&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;<br />
		&lt;td width=&quot;1%&quot;&gt;&lt;div onclick=&quot;validateForm();&quot; title=&quot;Raise Material Request&quot;&gt;&lt;a class=&quot;actions&quot;&gt;&lt;img src=&quot;images/add.jpg&quot; width=&quot;20&quot; height=&quot;20&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;<br />
		&lt;td width=&quot;15%&quot;&gt;&lt;div onclick=&quot;validateForm();&quot; title=&quot;Raise Material Request&quot;&gt;&lt;a class=&quot;actions&quot;&gt;Raise Request&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;<br />
        &lt;td width=&quot;1%&quot;&gt;&lt;div onClick=&quot;editpirForm()&quot; title=&quot;Edit a Material Request&quot;&gt;&lt;a class=&quot;actions&quot;&gt;&lt;img src=&quot;images/edit.jpg&quot; width=&quot;20&quot; height=&quot;20&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;<br />
		&lt;td width=&quot;8%&quot;&gt;&lt;div onClick=&quot;editpirForm()&quot; title=&quot;Edit a Material Request&quot;&gt;&lt;a class=&quot;actions&quot;&gt;Edit&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;<br />
		&lt;td width=&quot;1%&quot;&gt;&lt;div title=&quot;Close this Screen&quot;&gt;&lt;a class=&quot;actions&quot;&gt;&lt;img src=&quot;images/close.jpg&quot; width=&quot;20&quot; height=&quot;20&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;<br />
		&lt;td&gt;&lt;div width=&quot;73%&quot; title=&quot;Close this Screen&quot;&gt;&lt;a class=&quot;actions&quot;&gt;Close&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;<br />
			&lt;/td&gt;<br />
		 &lt;/tr&gt; <br />
        <br />
			&lt;/table&gt;<br />
	<br />
	&lt;/table&gt;<br />
	&lt;/fieldset&gt;<br />
    &lt;/td&gt;	<br />
    	&lt;/tr&gt;<br />
    &lt;/table&gt; <br />
	 	&lt;/td&gt;<br />
         &lt;/tr&gt;<br />
          	&lt;tr&gt; <br />
        	&lt;td colspan=&quot;2&quot;&gt;&lt;?php include'footer.php' ?&gt;&lt;/td&gt; <br />
 			&lt;/tr&gt;<br />
	   &lt;/table&gt; <br />
<br />
       &lt;/div&gt;<br />
&lt;/form&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum112.html">Perl</category>
			<dc:creator>sen1978</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236703.html</guid>
		</item>
		<item>
			<title>Convert 1-Dim String Array to String</title>
			<link>http://www.daniweb.com/forums/thread236701.html</link>
			<pubDate>Sat, 07 Nov 2009 04:14:53 GMT</pubDate>
			<description><![CDATA[I'm working on a mass text replacer program because I'm sick of all the 10-day trial ones out there that aren't very good. 
 
The entire program is basically finished (All easy stuff), but now I need to code the actual replace/delete stuff, which I'm stuck on because apparently the way I originally...]]></description>
			<content:encoded><![CDATA[<div>I'm working on a mass text replacer program because I'm sick of all the 10-day trial ones out there that aren't very good.<br />
<br />
The entire program is basically finished (All easy stuff), but now I need to code the actual replace/delete stuff, which I'm stuck on because apparently the way I originally intended to do it is not possible.<br />
<br />
The way it works is you load a text file (.txt, .cfg, .ini, .doc, etc.) which opens a StreamReader which writes all the data into a listbox. Then you pick whether you want to replace or delete a string. If you select replace, then you enter the string to search for and in another textbox you enter the string to replace it with.<br />
<br />
The way I originally intended to do this was like this:<br />
<br />
 <pre style="margin:20px; line-height:13px">If o1.Text = &quot;Replace&quot; Then 'The option<br />
&nbsp; &nbsp; Replace(txtfile, str1, a1) 'txtfile is the data, str1 is the string to find and a1 is the replacement<br />
End If</pre><br />
The problem is, I believe this method requires txtfile, str1 and a1 to be strings, but they're all 1-dimensional string arrays, which cannot be converted to strings, or at least I don't know how to convert them.<br />
<br />
A friend told me one way I could do this is to open both a StreamReader and StreamWriter and do the replace/delete line by line as they are entered into the memory and write them to a temporary file which is then copied over the original. I can do this kind of, but I still don't know the proper way of doing the actual replace code because the string to find and the string to replace with are still 1-dimensional string arrays rather than strings.<br />
<br />
I can't think of any other way to do this, due to I'm not that experienced in VBNet. Any help is greatly appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum58.html">VB.NET</category>
			<dc:creator>Darkicon</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236701.html</guid>
		</item>
		<item>
			<title>Complete newb needing help with drawing histograms.</title>
			<link>http://www.daniweb.com/forums/thread236700.html</link>
			<pubDate>Sat, 07 Nov 2009 03:45:30 GMT</pubDate>
			<description>Hello all. My name is Younis, I am a computer science newb. I occasionally browse this website reading some fascinating threads. I have a simple project at hand which i am finding the extra credit portion to be somewhat difficult.  
 
The project is very simple,  
the project takes a number from...</description>
			<content:encoded><![CDATA[<div>Hello all. My name is Younis, I am a computer science newb. I occasionally browse this website reading some fascinating threads. I have a simple project at hand which i am finding the extra credit portion to be somewhat difficult. <br />
<br />
The project is very simple, <br />
the project takes a number from the user and <br />
- if the number is one, it quits<br />
-if the number is even, we cut it in half<br />
-if the number is odd, multiply is by 3 and add 1<br />
<br />
so if we look at the number 13 it goes like this:<br />
13 -&gt; 40 -&gt; 20 -&gt; 10 -&gt; 5 -&gt; 16 -&gt; 8 -&gt; 4 -&gt; 2 -&gt; 1 <br />
<br />
so the length of the chain would be 10.<br />
<br />
So our job is to print a menu to the user.<br />
If the user enters &quot;I&quot;, ask the user for a number, print the chain and length of the chain for that number<br />
<br />
if the user enters &quot;R&quot;, ask the user for a range of numbers, and print the length and chain of each number<br />
<br />
If the user enters &quot;L&quot;, ask the user for a range of numbers, and print the number with the longest chain length. <br />
<br />
If the user enters &quot;Q&quot;, then quit. <br />
<br />
I have all of that working. now i the extra credit says:<br />
if the user enters a number, and the next 10 numbers after that and draw a histograms. <br />
<br />
so the x axis would be each of the number, and the y axis would be the chain length of that number. <br />
<br />
I can get the number and length of each number in a list. but i am a newb as to how to draw  this. <br />
so if the user entered 2, we would draw a histogram of 2-11 and each bar of the number would reach up to the chain length of that number.  <br />
<br />
here is my code:<br />
 <pre style="margin:20px; line-height:13px"># Filename:&nbsp; &nbsp; hw6.py<br />
# Date:&nbsp; &nbsp; &nbsp; &nbsp; 10/16/09<br />
# Section #:&nbsp;  06<br />
# Description:<br />
# This file contains python code for hailstone sequence.<br />
# It follows the rules, if a number is even, it will divide the<br />
# next number by two, if the number is odd, it will multiply the next<br />
# number by three and then add 1. This will continuie forming a chain<br />
# until the last number is 1. <br />
<br />
# this function prints the chain of numbers using the rules<br />
# also adds up the length chain<br />
# Inputs : n<br />
# Outputs : none<br />
<br />
import string<br />
# from graphics import *<br />
from graphics import *<br />
<br />
#Constant<br />
MAX = 10000<br />
<br />
# printing functions<br />
<br />
# this function prints a brief description of the program to the user<br />
# Inputs: none<br />
# Outputs : none<br />
def printGreeting():<br />
&nbsp; &nbsp; print &quot;&quot;<br />
&nbsp; &nbsp; print &quot; This program finds hailstones sequences of numbers&quot;<br />
&nbsp; &nbsp; print &quot; you choose. The next number in the sequence if found by&quot;<br />
&nbsp; &nbsp; print &quot; either dividing it by two(if even) or multiplying by 3&quot;<br />
&nbsp; &nbsp; print &quot; and adding 1(if odd).The program quits when the last&quot;<br />
&nbsp; &nbsp; print &quot; number in the sequence is 1\n&quot;<br />
<br />
# this functions prints the menu for the user <br />
# Inputs: none<br />
# Outputs : none<br />
def printMenu():<br />
&nbsp; &nbsp; print &quot;\n\tHere are your menu choices:&quot;<br />
&nbsp; &nbsp; print &quot;\n\tI - view squence for an individual value\n&quot;<br />
&nbsp; &nbsp; print &quot;\tR - veiw sequence for range of values\n&quot;<br />
&nbsp; &nbsp; print &quot;\tL - Find the longest chain\n&quot;<br />
&nbsp; &nbsp; print &quot;\tH - Print out the histogram\n&quot;<br />
&nbsp; &nbsp; print &quot;\tQ - Quit\n\n&quot;<br />
<br />
# end of printing funtions<br />
<br />
<br />
# hailstone(number) prints the hailstone sequence<br />
# Inputs: number<br />
# Outputs: none<br />
def hailstone(n):<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; length = 1<br />
&nbsp; &nbsp; print n,<br />
&nbsp; &nbsp; # checks if n is not sential <br />
&nbsp; &nbsp; while n != 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; # if even, divide by 2 (rule). add 1 to length<br />
&nbsp; &nbsp; &nbsp; &nbsp; if n % 2 == 0:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; n = n / 2<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &quot;-&gt;&quot;,n,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; length = length + 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; # if odd, multiply by 3, add 1 (rule). add 1 to length<br />
&nbsp; &nbsp; &nbsp; &nbsp; elif n % 2 != 0:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; n = ( 3 * n ) + 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &quot;-&gt;&quot;,n,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; length = length + 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; # print the length at the end of each chain<br />
&nbsp; &nbsp; print &quot;; length =&quot;,length<br />
&nbsp; &nbsp; print &quot;----------------------------------------------------------------&quot;,<br />
&nbsp; &nbsp; print &quot;--------------\n&quot;<br />
&nbsp; &nbsp; return length<br />
<br />
# this function returns the length of each chain from the starting number, n<br />
# Inputs : n<br />
# Outputs : none<br />
def chain(n):<br />
&nbsp;  <br />
&nbsp; &nbsp; length = 1<br />
&nbsp; &nbsp; while n != 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; # if even, divide by 2 (rule). add 1 to length<br />
&nbsp; &nbsp; &nbsp; &nbsp; if n % 2 == 0:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; n = n / 2<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; length&nbsp; = length + 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; # if even, divide by 2 (rule). add 1 to length<br />
&nbsp; &nbsp; &nbsp; &nbsp; elif n % 2 != 0:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; n = ( 3 * n ) + 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; length = length + 1<br />
&nbsp; &nbsp; return length<br />
<br />
# getValidInt() prompts the user to enter an integer in the specified range,<br />
# rejects values not in that range by requiring new input, and only returns<br />
# a valid integer.<br />
# Inputs: the question of the prompt,<br />
#&nbsp; &nbsp; &nbsp; &nbsp;  the minimum value in the range<br />
#&nbsp; &nbsp; &nbsp; &nbsp;  and the maximum value in the range<br />
# Output: an integer in the specified range<br />
def getValidInt(question, min, max):<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; # use a bad value to enter the loop<br />
&nbsp; &nbsp; value = max + 1<br />
<br />
&nbsp; &nbsp; # compose the prompt <br />
&nbsp; &nbsp; prompt = question + &quot; (&quot; + str(min) + &quot;-&quot; + str(max) + &quot;): &quot;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; # continue to get values until the user enters a valid one<br />
&nbsp; &nbsp; while value == &quot;&quot; or value &lt; min or value &gt; max:<br />
&nbsp; &nbsp; &nbsp; &nbsp; value = raw_input(prompt)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if len(value) != 0:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value = int(value)<br />
<br />
&nbsp; &nbsp; # return a valid value<br />
&nbsp; &nbsp; return value<br />
<br />
<br />
# this function finds the longest chain<br />
# Inputs: none<br />
# Outputs : none<br />
def longChain():<br />
&nbsp; &nbsp;  begin = &quot;Please enter the begining integer for the range&quot;<br />
&nbsp; &nbsp;  end = &quot;Please enter the ending integer for the range&quot;<br />
<br />
&nbsp; &nbsp;  # calls to getValidInt for starting and ending values<br />
&nbsp; &nbsp;  beginNum = getValidInt(begin, 1, MAX)<br />
&nbsp; &nbsp;  endNum = getValidInt(end, beginNum + 1, MAX)<br />
<br />
&nbsp; &nbsp;  largestChain = beginNum<br />
<br />
&nbsp; &nbsp;  for i in range(beginNum, endNum+1):<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if largestChain &lt;= chain(i):<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  largestChain = i<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  length = chain(i)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp;  print largestChain, &quot; had the longest chain &quot;, length<br />
<br />
# this function finds the longest chain***************************8<br />
# Inputs: none*************<br />
# Outputs : none&nbsp; &nbsp; <br />
def histogram():<br />
&nbsp; &nbsp; # initialize variables&nbsp; <br />
&nbsp; &nbsp; longestLength = 1<br />
&nbsp; &nbsp; list = []<br />
<br />
&nbsp; &nbsp; start = input(&quot;Please enter the begining integer for the range: &quot;)<br />
&nbsp; &nbsp; for n in range (start, start + 10):<br />
&nbsp; &nbsp; &nbsp; &nbsp; length = chain(n)<br />
&nbsp; &nbsp; &nbsp; &nbsp; list.append(length)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if longestLength &lt;= chain(n):<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; longestLength = n<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; length = chain(n)<br />
&nbsp; &nbsp; &nbsp; &nbsp; print longestLength<br />
&nbsp; &nbsp; &nbsp; &nbsp; print list<br />
<br />
def main():<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; # prints the greeting to the user<br />
&nbsp; &nbsp; printGreeting()<br />
<br />
&nbsp; &nbsp; # prints the menu to the user<br />
&nbsp; &nbsp; printMenu()<br />
<br />
&nbsp; &nbsp; # asks user the menu choice<br />
&nbsp; &nbsp; choice = raw_input(&quot;Please enter your choice : &quot;).upper()<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; # checks to see if choice entered is from the menu<br />
&nbsp; &nbsp; while choice != 'Q': <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; # if choice is &quot;I&quot; or &quot;i&quot;, proceeds to follow the individual steps<br />
&nbsp; &nbsp; &nbsp; &nbsp; if choice == 'I':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; n = input(&quot;Please enter your integer (1-10000):&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hailstone(n)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; # if choice is &quot;R&quot; or &quot;r&quot;, proceds print each number and its sequence<br />
&nbsp; &nbsp; &nbsp; &nbsp; # until the last number is 1, uses getValidInt to get valid integers<br />
&nbsp; &nbsp; &nbsp; &nbsp; # for the function<br />
&nbsp; &nbsp; &nbsp; &nbsp; elif choice == 'R':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin = &quot;Please enter the begining integer for the range&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end = &quot;Please enter the ending integer for the range&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # calls to getValidInt for starting and ending values<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; beginNum = getValidInt(begin, 1, MAX)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; endNum = getValidInt(end, beginNum + 1, MAX)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # for loop to get the values between starting and ending value<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for n in range(beginNum,endNum+1):<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #call to the hailstone function<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hailstone(n)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; # if choice is &quot;L&quot; or &quot;l&quot;, proceeds to use getValidInt again to get the<br />
&nbsp; &nbsp; &nbsp; &nbsp; # range, error checks on the range, and then calls the function chain<br />
&nbsp; &nbsp; &nbsp; &nbsp; # to determine the length. <br />
&nbsp; &nbsp; &nbsp; &nbsp; elif choice == 'L':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # call to function longchain<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; longChain()<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; elif choice == 'H':<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; histogram()<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; # if niether of the menu choices, then it prints that the<br />
&nbsp; &nbsp; &nbsp; &nbsp; # entered text is not a valid choices<br />
&nbsp; &nbsp; &nbsp; &nbsp; else:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print choice, &quot;is not a valid choice&quot;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; # prints the menu to the user<br />
&nbsp; &nbsp; &nbsp; &nbsp; printMenu()<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; # asks user the menu choice<br />
&nbsp; &nbsp; &nbsp; &nbsp; choice = raw_input(&quot;Please enter your choice : &quot;).upper()<br />
&nbsp; &nbsp; &nbsp; <br />
main()</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>truekid</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236700.html</guid>
		</item>
		<item>
			<title>Web Browser Help.</title>
			<link>http://www.daniweb.com/forums/thread236696.html</link>
			<pubDate>Sat, 07 Nov 2009 03:37:16 GMT</pubDate>
			<description><![CDATA[I am currently trying to create a Web Design program, freeware, for use to help with the aid of web design.  I want it to be sorta like... "Web-Design-Toy"  by ACME, only with more features.  To where when you type in the textbox, it comes out in a live view using a web browser.  Anybody have any...]]></description>
			<content:encoded><![CDATA[<div>I am currently trying to create a Web Design program, freeware, for use to help with the aid of web design.  I want it to be sorta like... &quot;Web-Design-Toy&quot;  by ACME, only with more features.  To where when you type in the textbox, it comes out in a live view using a web browser.  Anybody have any ideas of how to code that with Visual Basic 2008 Express Edition!?!  Please and Thank-You!!!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum58.html">VB.NET</category>
			<dc:creator>Gangstafier</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236696.html</guid>
		</item>
		<item>
			<title>ContextMenuStrip</title>
			<link>http://www.daniweb.com/forums/thread236691.html</link>
			<pubDate>Sat, 07 Nov 2009 02:52:20 GMT</pubDate>
			<description><![CDATA[HI 
 
I'm trying to use a menu on a datagridview, I have put a Contextmenutrip on the form. When I right click in a cell 
I would like a menu to pop up. but nothing happens. 
This is the code I have tried. 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>HI<br />
<br />
I'm trying to use a menu on a datagridview, I have put a Contextmenutrip on the form. When I right click in a cell<br />
I would like a menu to pop up. but nothing happens.<br />
This is the code I have tried.<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp;  Private Sub CustomerPopMenu_ItemClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Select Case e.ClickedItem.ToString()<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Case &quot;Edit&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MsgBox(&quot;Edit&quot;)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Case &quot;Delete&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MsgBox(&quot;Delete&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; End Select<br />
<br />
&nbsp; &nbsp; End Sub</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum58.html">VB.NET</category>
			<dc:creator>VIPER5646</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236691.html</guid>
		</item>
		<item>
			<title>Is calling Win32 API from Java possible??</title>
			<link>http://www.daniweb.com/forums/thread236683.html</link>
			<pubDate>Sat, 07 Nov 2009 02:32:04 GMT</pubDate>
			<description><![CDATA[Is there any other way besides Jawin to call Win32 API methods from within Java? I have the option of using C++ as im going to be using the API a fair amount however i'm also doing GUI stuff and i would prefer the Java GUI features over C++. 
 
If i can find a way to call the windows API from Java...]]></description>
			<content:encoded><![CDATA[<div>Is there any other way besides Jawin to call Win32 API methods from within Java? I have the option of using C++ as im going to be using the API a fair amount however i'm also doing GUI stuff and i would prefer the Java GUI features over C++.<br />
<br />
If i can find a way to call the windows API from Java then i can stick to Java.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>futureaussiecto</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236683.html</guid>
		</item>
		<item>
			<title>I require help with making 3 simple program/functions</title>
			<link>http://www.daniweb.com/forums/thread236680.html</link>
			<pubDate>Sat, 07 Nov 2009 01:46:33 GMT</pubDate>
			<description><![CDATA[1. I need to make a program that creates a list that contains the first n perfect squares. All I know is that it starts with 
 
n = int(raw_input("How many squares? ")) 
 
and ends with 
 
print squares 
 
An example of how this program should work is:]]></description>
			<content:encoded><![CDATA[<div>1. I need to make a program that creates a list that contains the first n perfect squares. All I know is that it starts with<br />
<br />
n = int(raw_input(&quot;How many squares? &quot;))<br />
<br />
and ends with<br />
<br />
print squares<br />
<br />
An example of how this program should work is:<br />
<br />
How many squares? 5<br />
[1, 4, 9, 16, 25]<br />
<br />
2. I need to create a function that takes a list as its only argument. It's needs to return a new list containing all (and only) the elements of 1 which are divisible by 2. The original list needs to remain the same.<br />
<br />
Example of how this works is:<br />
<br />
even_only([1, 3, 6, 10, 15, 21, 28])       should return<br />
[6, 10, 28]<br />
<br />
3. I need a function that translates a single English sentence into pig latin.<br />
<br />
I honestly have no idea how to start any of these and any help would be greatly appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>Judgment</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236680.html</guid>
		</item>
		<item>
			<title>Dynamic Array and tacking a linked list to array?</title>
			<link>http://www.daniweb.com/forums/thread236679.html</link>
			<pubDate>Sat, 07 Nov 2009 01:40:54 GMT</pubDate>
			<description><![CDATA[Ok, I am trying to figure out how to purse this current project which deals with dynamic allocation and linked list 
 
Here is the information I am given the following two structs  
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Ok, I am trying to figure out how to purse this current project which deals with dynamic allocation and linked list<br />
<br />
Here is the information I am given the following two structs <br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
struct employee<br />
{<br />
&nbsp; int ssn;<br />
&nbsp; string name;<br />
&nbsp; float hours;<br />
&nbsp; assignment * list;<br />
};<br />
<br />
struct assignment<br />
{<br />
&nbsp; string proj;<br />
&nbsp; float hours;<br />
&nbsp; assignment *next;<br />
};</pre><br />
Objectives:<br />
<br />
read from a file into a dynamic array of employee struct, size of array will be 3 when program starts, int ssn will serve as unique identifer. <br />
<br />
read the second file and add a new node to the employee's linked list of assigned projects. The final arrangement<br />
will be an array (dynamically allocated) of struct1 where each employee contains a pointer to a linked<br />
list of the projects to which they are assigned. The employees in the array will be in ascending order by<br />
SSN. The projects assigned to each employee will be in descending order by the hours assigned.<br />
<br />
Any tips to get me going?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>power_computer</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236679.html</guid>
		</item>
		<item>
			<title>Reading data from a file and storing into seperate variables</title>
			<link>http://www.daniweb.com/forums/thread236678.html</link>
			<pubDate>Sat, 07 Nov 2009 01:34:01 GMT</pubDate>
			<description><![CDATA[Hi all, I am trying to write code that will read from a file that is set up as an inventory file.  So, on each line you'll have something similar to: 
 
1.               Toothpaste 
2.               Toothbrush 
etc... 
 
The problem I'm having is saving the numeric item number into one array index,...]]></description>
			<content:encoded><![CDATA[<div>Hi all, I am trying to write code that will read from a file that is set up as an inventory file.  So, on each line you'll have something similar to:<br />
<br />
1.               Toothpaste<br />
2.               Toothbrush<br />
etc...<br />
<br />
The problem I'm having is saving the numeric item number into one array index, then the item description into a different array index.  The user should be able to add to the file and the program will need to sort this based on item number.  I can use getline, but don't know how to delimit it based on this type of file.  I've tried using get, but don't know how to assemble the individual characters into one array index.  Any help would be greatly appreciated, I'm new to this.  Thanks in advance.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Jalwes</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236678.html</guid>
		</item>
		<item>
			<title>Problem with passing char arrays to functions</title>
			<link>http://www.daniweb.com/forums/thread236675.html</link>
			<pubDate>Sat, 07 Nov 2009 01:15:54 GMT</pubDate>
			<description><![CDATA[Hi there, I'm assuming the answer to this problem is really easy, but I just can't work out where the problem is. It's driving me insane and I'd really appreciate some help. I'm new to C++. 
 
My problem is this: I'm trying to pass a char array to a function, where a line is read from a file and...]]></description>
			<content:encoded><![CDATA[<div>Hi there, I'm assuming the answer to this problem is really easy, but I just can't work out where the problem is. It's driving me insane and I'd really appreciate some help. I'm new to C++.<br />
<br />
My problem is this: I'm trying to pass a char array to a function, where a line is read from a file and then the array is passed back. However, the function returns gibberish - but ONLY when returning a file-derived array element. Here is my code:<br />
<br />
 <pre style="margin:20px; line-height:13px">int main ()<br />
{<br />
&nbsp; &nbsp; char* tags[128];<br />
&nbsp; &nbsp; char* file=&quot;project3.xml&quot;;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; FILE *fp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  fp=fopen(file, &quot;r&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int tits = NextTag( fp, tags );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;tags[0] post-Fn = *&quot; &lt;&lt; tags[0] &lt;&lt; &quot;*\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;tags[1] post-Fn = *&quot; &lt;&lt; tags[1] &lt;&lt; &quot;*\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; system(&quot;PAUSE&quot;);<br />
&nbsp; &nbsp; return 0;<br />
}<br />
<br />
int NextTag( FILE* fp, char* tags[] )<br />
{<br />
&nbsp; &nbsp; int count2 = 0;<br />
&nbsp; &nbsp; char* pch;<br />
&nbsp; &nbsp; char rida1[512];<br />
&nbsp; &nbsp; fgets(rida1, sizeof(rida1), fp);<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;rida1 in-Fn = *&quot; &lt;&lt; rida1 &lt;&lt; &quot;*\n&quot;;<br />
&nbsp; &nbsp; tags[0] = &quot;bottoms&quot;;<br />
&nbsp; &nbsp; tags[1] = rida1;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;tags[0] in-Fn = *&quot; &lt;&lt; tags[0] &lt;&lt; &quot;*\n&quot;;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;tags[1] in-Fn = *&quot; &lt;&lt; tags[1] &lt;&lt; &quot;*\n&quot;;<br />
}</pre><br />
The .xml file it's reading from just contains the word 'bottoms'. Here is the output:<br />
<br />
 <pre style="margin:20px; line-height:13px">rida1 in-Fn = *bottoms*<br />
tags[0] in-Fn = *bottoms*<br />
tags[1] in-Fn = *bottoms*<br />
tags[0] post-Fn = *bottoms*<br />
tags[1] post-Fn = *L1&quot;*<br />
Press any key to continue. . .</pre><br />
Why the gibberish on line 5 of the output when it returns the manually entered entry fine? Any ideas? It's driving me insane!!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>spankboy11</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236675.html</guid>
		</item>
		<item>
			<title>Editing Textfiles</title>
			<link>http://www.daniweb.com/forums/thread236672.html</link>
			<pubDate>Sat, 07 Nov 2009 00:46:07 GMT</pubDate>
			<description>Hey 
im new here to excuse the nubneess 
i wanted to make a family tree thingy and wanted to do it in python  
i wanted to make a way so that it could read a text file and auto add a new entry called summary which would include the initials,yr of birth and the childnum could any one help me out? at...</description>
			<content:encoded><![CDATA[<div>Hey<br />
im new here to excuse the nubneess<br />
i wanted to make a family tree thingy and wanted to do it in python <br />
i wanted to make a way so that it could read a text file and auto add a new entry called summary which would include the initials,yr of birth and the childnum could any one help me out? at the moment ive gotten it to add the summary field but i cant figure out how to do the rest<br />
[exampletxt]<br />
Fname,LName,DOB,childnum<br />
bob,smith,17/08/99/1</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>Jewsy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236672.html</guid>
		</item>
		<item>
			<title>I need help with deep copy constructors</title>
			<link>http://www.daniweb.com/forums/thread236664.html</link>
			<pubDate>Fri, 06 Nov 2009 23:41:23 GMT</pubDate>
			<description><![CDATA[I tried looking at the other examples on the site, but I still get segmentation errors whenever I run the file.  I need help with the constructors in *bold* in the "List" class. 
 
   <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I tried looking at the other examples on the site, but I still get segmentation errors whenever I run the file.  I need help with the constructors in <span style="font-weight:bold">bold</span> in the &quot;List&quot; class.<br />
<br />
  <pre style="margin:20px; line-height:13px">#include &lt;iostream&gt;<br />
using std::cout;<br />
using std::endl;<br />
<br />
// forward declaration of List class, so ListElement can make <br />
// it a friend.&nbsp; NOTE: If List is a friend of ListElement, that<br />
// means that the List class has access to the private members<br />
// of the ListElement class, but no one else does (besides ListElement<br />
// itself). <br />
<br />
class List;<br />
class ListIterator;<br />
<br />
class ListElement {<br />
&nbsp;friend class List;<br />
&nbsp;friend class ListIterator;<br />
&nbsp;public:<br />
&nbsp;ListElement(): next(this), prev(this), isHeader(true) {}<br />
&nbsp;ListElement(int i): item(i), isHeader(false) {}<br />
&nbsp;~ListElement() {}&nbsp; // default destructor<br />
&nbsp;private:<br />
&nbsp; int item;<br />
&nbsp; ListElement *next;&nbsp; &nbsp; <br />
&nbsp; ListElement *prev;&nbsp; &nbsp; <br />
&nbsp; bool isHeader;<br />
};<br />
<br />
class ListIterator {<br />
&nbsp;friend class List;<br />
&nbsp;public:<br />
&nbsp; ListIterator() : currentPtr(NULL) { }<br />
&nbsp; ListIterator operator++(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;currentPtr-&gt;prev=this-&gt;currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;currentPtr-&gt;next=this-&gt;currentPtr-&gt;next-&gt;next;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return *this;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; // advance iterator to the next list node; return value is iterator *after* advancing&nbsp; <br />
&nbsp; ListIterator operator--(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;currentPtr-&gt;next=this-&gt;currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;currentPtr-&gt;prev=this-&gt;currentPtr-&gt;prev-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return *this;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; // advance iterator to the previous list node; return value is iterator *after* advancing<br />
&nbsp; ListIterator operator++(int){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this-&gt;currentPtr-&gt;prev=this-&gt;currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;currentPtr-&gt;next=this-&gt;currentPtr-&gt;next-&gt;next;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return *this;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; // advance iterator to the next list node; return value is iterator *before* advancing<br />
&nbsp; ListIterator operator--(int){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;currentPtr-&gt;next=this-&gt;currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;currentPtr-&gt;prev=this-&gt;currentPtr-&gt;prev-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return *this;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; // advance iterator to the previous list node; return value is iterator *before* advancing<br />
&nbsp; int operator*(){<br />
&nbsp; &nbsp; &nbsp;  if(currentPtr-&gt;isHeader){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;error\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit(1); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; return currentPtr-&gt;item;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; } // return contents pointed to by iterator; print &quot;error\n&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; // and terminate program if iterator refers to header node<br />
&nbsp;private:<br />
&nbsp; ListElement *currentPtr;<br />
};<br />
<br />
class List {<br />
&nbsp; public:<br />
&nbsp; &nbsp; List(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  listSize=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp;  // creates an empty list<br />
&nbsp; &nbsp; ~List(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; ListIterator *nodePtr, *nextNodePtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; nodePtr-&gt;currentPtr = head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (nodePtr-&gt;currentPtr != NULL)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; nextNodePtr-&gt;currentPtr = nodePtr-&gt;currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; delete nodePtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; nodePtr = nextNodePtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; // *must* deallocate the entire list<br />
&nbsp; &nbsp; <span style="font-weight:bold">List(const List &amp;L){<br />
&nbsp; &nbsp; &nbsp;  ListIterator lTemp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int value;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp;  lTemp.currentPtr=L.head;<br />
&nbsp; &nbsp; &nbsp;  while(lTemp.currentPtr-&gt;next!=L.head){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  lTemp.currentPtr=lTemp.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp=lTemp.currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;head-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this-&gt;head-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;next=this-&gt;head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;prev=this-&gt;head; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  listSize++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; // copy constructor (*must* be a deep copy)<br />
&nbsp; &nbsp; List &amp; operator =(List &amp;L){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }</span>&nbsp; // *must* (deep) copy list, and must avoid memory leak<br />
<br />
&nbsp; &nbsp; // these are functions to set and test the list iterator<br />
&nbsp; &nbsp; void SetStartList(ListIterator &amp;p) {p.currentPtr = head-&gt;next;}<br />
&nbsp; &nbsp; void SetEndList(ListIterator &amp;p) {p.currentPtr = head-&gt;prev;}<br />
&nbsp; &nbsp; bool IsUndefined(ListIterator p) {return (p.currentPtr == head);}<br />
&nbsp; &nbsp; bool AtEndList(ListIterator p) {return (p.currentPtr == head);}<br />
&nbsp; &nbsp; bool AtStartList(ListIterator p) {return (p.currentPtr == head);}<br />
&nbsp; &nbsp; bool AtFirstNode(ListIterator p) {return (p.currentPtr == head-&gt;next);}<br />
&nbsp; &nbsp; bool AtLastNode(ListIterator p) {return (p.currentPtr == head-&gt;prev);}<br />
&nbsp; &nbsp; // Insert integer at the beginning of the list&nbsp; <br />
&nbsp; &nbsp; void Prepend(int it){<br />
&nbsp; &nbsp; &nbsp; &nbsp;  ListIterator p;&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr=this-&gt;head;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement();&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;item=it;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(this-&gt;IsEmpty()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this-&gt;head-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this-&gt;head-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;next=this-&gt;head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;prev=this-&gt;head;&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;prev=p.currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;next=p.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;next-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  listSize++;<br />
}<br />
&nbsp; &nbsp; // Insert integer at the end of the list<br />
&nbsp; &nbsp; void Append(int it){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ListIterator p;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr=this-&gt;head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement();&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;item=it;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(this-&gt;IsEmpty()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this-&gt;head-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this-&gt;head-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;next=this-&gt;head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;prev=this-&gt;head;&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else{ <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;next=p.currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;prev=p.currentPtr-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;prev-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  listSize++;<br />
}<br />
&nbsp; &nbsp; // Remove first integer from list, return through first parameter.<br />
&nbsp; &nbsp; // Success is set to true if original list is nonempty, false if empty<br />
&nbsp; &nbsp; void Pop(int &amp;it, bool &amp;success){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(IsEmpty()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=false;&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement(); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp=this-&gt;head-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  it=temp-&gt;item;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;next-&gt;prev=this-&gt;head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;head-&gt;next=temp-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;prev=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;next=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listSize--;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; <br />
&nbsp; &nbsp; // Remove last integer from list, return through first parameter.<br />
&nbsp; &nbsp; // Success is set to true if original list is nonempty, false if empty<br />
&nbsp; &nbsp; void Pull(int &amp;it, bool &amp;success){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(IsEmpty()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=false;&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement(); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp=this-&gt;head-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  it=temp-&gt;item;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;prev-&gt;next=this-&gt;head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;head-&gt;prev=temp-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;prev=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;next=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listSize--;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; // Get first integer on list, return through first parameter<br />
&nbsp; &nbsp; // Success is set to true if original list is nonempty, false if empty<br />
&nbsp; &nbsp; void First(int &amp;it, bool &amp;success){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(IsEmpty()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=false;&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else{&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=true;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp=head-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  it=temp-&gt;item;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
}<br />
&nbsp; &nbsp; // Get last integer on list, return through first parameter<br />
&nbsp; &nbsp; // Success is set to true if original list is nonempty, false if empty<br />
&nbsp; &nbsp; void Last(int &amp;it, bool &amp;success){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(IsEmpty()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=false;&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else{&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=true;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp=head-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  it=temp-&gt;item;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
}<br />
&nbsp; &nbsp; // insert integer before list element referred to by p<br />
&nbsp; &nbsp; void InsertBefore(int it, ListIterator p){ //may need to check if 'p' is NULL<br />
&nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement();&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;item=it;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if(p.currentPtr-&gt;prev==head){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;prev=head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; head-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;next=p.currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  else{&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;next=p.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;next-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;prev=p.currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  listSize++;<br />
}<br />
&nbsp; &nbsp; // insert integer after list element referred to by p<br />
&nbsp; &nbsp; void InsertAfter(int it, ListIterator p){ //may need to check if 'p' is NULL<br />
&nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement();&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;item=it;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if(p.currentPtr-&gt;next==head){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;next=head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; head-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;prev=p.currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  else{&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;next-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;next=p.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;prev=p.currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  listSize++;<br />
}<br />
&nbsp; &nbsp; // delete list element referred to by p; print &quot;error\n&quot;<br />
&nbsp; &nbsp; // and exit if p refers to the header node<br />
&nbsp; &nbsp; // p is undefined after this function<br />
&nbsp; &nbsp; void Delete(ListIterator p){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(p.currentPtr==head){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;error\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(p.currentPtr-&gt;prev==head){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;next-&gt;prev=head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  head-&gt;next=p.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;next=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;prev=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (p.currentPtr-&gt;next==head){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;prev-&gt;next=head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  head-&gt;prev=p.currentPtr-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;prev=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;next=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;prev-&gt;next=p.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;next-&gt;prev=p.currentPtr-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;next=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;prev=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; listSize--;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; // apply function &quot;func&quot; to each element on the list<br />
&nbsp; &nbsp; void MapFunction(void (*func)(int &amp;)){<br />
&nbsp; &nbsp; &nbsp; &nbsp;  ListIterator p;&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;AtFirstNode(p);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  for(int i=0;i&lt;listSize;i++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  func(p.currentPtr-&gt;item);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr=p.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
}&nbsp; &nbsp;  <br />
&nbsp; &nbsp; // returns true if list empty, false otherwise<br />
&nbsp; &nbsp; bool IsEmpty(){<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if(listSize==0){<br />
&nbsp; &nbsp; &nbsp; &nbsp;  return true;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  return false;<br />
}<br />
&nbsp; &nbsp; int GetSize() {return listSize;}<br />
<br />
&nbsp; &nbsp; // must print out list elements, one per line<br />
&nbsp; &nbsp; void Print(){<br />
&nbsp; &nbsp; &nbsp; &nbsp;  ListIterator p;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr=this-&gt;head-&gt;next;&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  for(int i=0;i&lt;listSize;i++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; p.currentPtr-&gt;item &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr=p.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
}<br />
&nbsp; private:<br />
&nbsp; &nbsp; ListElement *head;<br />
&nbsp; &nbsp; int listSize;<br />
};</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>.:Pudge:.</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236664.html</guid>
		</item>
		<item>
			<title>Unable to expand window</title>
			<link>http://www.daniweb.com/forums/thread236660.html</link>
			<pubDate>Fri, 06 Nov 2009 23:22:41 GMT</pubDate>
			<description>I have a GUI window with a JFrame. On this JFrame, I have a JPanel that completely covers the JFrame. I then have another JPanel within this first JPanel that contains a text box and 3 buttons.  Within an event handler, I want to expand the JFrame and 2 JPanels by a height of 20 px. I then want to ...</description>
			<content:encoded><![CDATA[<div>I have a GUI window with a JFrame. On this JFrame, I have a JPanel that completely covers the JFrame. I then have another JPanel within this first JPanel that contains a text box and 3 buttons.  Within an event handler, I want to expand the JFrame and 2 JPanels by a height of 20 px. I then want to  move down the text box and 3 buttons, 20 px.<br />
<br />
I can expand the JFrame and the first JPanel with the following code snip. But, it doesn't work on the second panel nor does it work to move the button  down.<br />
<br />
Appreciate your help. Thanks..<br />
<br />
 <pre style="margin:20px; line-height:13px">// Make room for an additional text box<br />
&nbsp; &nbsp; &nbsp; &nbsp; int heightInc = 20;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; Dimension frameSize = new Dimension();<br />
&nbsp; &nbsp; &nbsp; &nbsp; Rectangle rectangle = new Rectangle();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; Adjust JFrame size (This Works)<br />
&nbsp; &nbsp; &nbsp; &nbsp; frameSize = this.getSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; frameSize.height += heightInc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; this.setSize(frameSize);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; Adjust the bounding JPanel size (This Works)<br />
&nbsp; &nbsp; &nbsp; &nbsp; frameSize = jplFrame.getSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; frameSize.height += heightInc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; jplFrame.setPreferredSize(frameSize);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; Adjust the AddSubtitle JPanel size&nbsp; (This doesn't work)<br />
&nbsp; &nbsp; &nbsp; &nbsp; frameSize = jplAddSubtitle.getSize();<br />
&nbsp; &nbsp; &nbsp; &nbsp; frameSize.height += heightInc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; jplAddSubtitle.setPreferredSize(frameSize);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; Move the &quot;Add Another&quot; button down (This doesn't work)<br />
&nbsp; &nbsp; &nbsp; &nbsp; rectangle = btnAddAnother.getBounds();<br />
&nbsp; &nbsp; &nbsp; &nbsp; rectangle.y += heightInc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; btnAddAnother.setBounds(rectangle);</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>bruceaj</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236660.html</guid>
		</item>
		<item>
			<title><![CDATA[help with 'for' function to construct a diamond!]]></title>
			<link>http://www.daniweb.com/forums/thread236659.html</link>
			<pubDate>Fri, 06 Nov 2009 23:19:50 GMT</pubDate>
			<description><![CDATA[Hey guys, 
I justs started this code to make a diamond with stars (*), but I get confused how to print the spaces that I need, I don't know if you understant what I'm trying to say.  It is something like this: 
 
Prompt the user to enter (odd) height (of a diamond) and outputs the following: 
...]]></description>
			<content:encoded><![CDATA[<div>Hey guys,<br />
I justs started this code to make a diamond with stars (*), but I get confused how to print the spaces that I need, I don't know if you understant what I'm trying to say.  It is something like this:<br />
<br />
Prompt the user to enter (odd) height (of a diamond) and outputs the following:<br />
<br />
Example height = 7<br />
<br />
Output:<br />
<br />
<span style="color:green">****</span><span style="font-weight:bold">*</span><br />
<span style="color:green">***</span><span style="font-weight:bold">***</span><br />
<span style="color:green">**</span><span style="font-weight:bold">*****</span><br />
<span style="color:green">*</span><span style="font-weight:bold">*******</span><br />
<span style="color:green">**</span><span style="font-weight:bold">*****</span> <br />
<span style="color:green">***</span><span style="font-weight:bold">***</span><br />
<span style="color:green">****</span><span style="font-weight:bold">*</span><br />
<br />
and this is the code I'm working on, it is very basic but I'm struggling finding the mistakes and that is just the top part of the diamond:<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream&gt;<br />
#include &lt;string&gt;<br />
<br />
using namespace std;<br />
<br />
<br />
int main(){<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int h; //height<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;Enter any positive number: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin&gt;&gt;h;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; int str = 1; //stars<br />
&nbsp; &nbsp; &nbsp; &nbsp; int spc = h/2; //space<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int k=0; k&lt;str; k++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;*&quot;&lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int i=0; i&lt;spc; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot; &quot;&lt;&lt;endl;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; str = h/2+1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spc--;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
system(&quot;PAUSE&quot;);<br />
return 0;<br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>sebassn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236659.html</guid>
		</item>
		<item>
			<title>Serial State Change Monitoring</title>
			<link>http://www.daniweb.com/forums/thread236657.html</link>
			<pubDate>Fri, 06 Nov 2009 23:16:18 GMT</pubDate>
			<description>HI, 
What I am trying to do is find a program that will track incoming information through a serial port and log any state changes. If anyone has any ideas on how to solve this problem please let me know.</description>
			<content:encoded><![CDATA[<div>HI,<br />
What I am trying to do is find a program that will track incoming information through a serial port and log any state changes. If anyone has any ideas on how to solve this problem please let me know.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum58.html">VB.NET</category>
			<dc:creator>tyesbooks</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236657.html</guid>
		</item>
		<item>
			<title>Message Queue Error</title>
			<link>http://www.daniweb.com/forums/thread236656.html</link>
			<pubDate>Fri, 06 Nov 2009 23:12:47 GMT</pubDate>
			<description>I am new to message queues and IPC in general.  I am trying to have a process establish the queue and send a message.  Then I fork and the child will read the message.  The goal is to measure the execution time for different sized messages. 
 
The msgsnd is returning a -1 and I have no idea as to...</description>
			<content:encoded><![CDATA[<div>I am new to message queues and IPC in general.  I am trying to have a process establish the queue and send a message.  Then I fork and the child will read the message.  The goal is to measure the execution time for different sized messages.<br />
<br />
The msgsnd is returning a -1 and I have no idea as to why its not sending anything.  Any help is appreciated.  Thanks in advance<br />
<br />
 <pre style="margin:20px; line-height:13px">int main() {<br />
<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //establish the character array to be passed around<br />
&nbsp; &nbsp; &nbsp; &nbsp; int msgSize = 1024;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; char charArray[msgSize];<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; clock_t timeStampBegin;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; clock_t timeStampEnd;<br />
<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; key_t key = 1234; /* key to be passed to msgget() */ <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int msqid; /* return value from msgget() */ <br />
<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //establish the message queue and make sure that it properly established<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if ((msqid = msgget(key, IPC_CREAT)) == 1) {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; perror(&quot;msgget: msgget failed&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //exit(1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; } else {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (void) fprintf(stderr, &quot;msgget succeeded\n&quot;); <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //Take an initial timestamp<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; timeStampBegin = clock();<br />
&nbsp; &nbsp; &nbsp; &nbsp; //printf(&quot;\nTimeStampBegin = %d\n&quot;, timeStampBegin);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int amountSent = msgsnd(1234, &amp;charArray, msgSize, 0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;%d bytes were sent&quot;, amountSent);<br />
<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(fork() == 0) {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //this is the child, this is the one that we want to recieve the info.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char recievedArray[100000];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((size_t)msgSize == msgrcv(1234, &amp;recievedArray, msgSize, 0, 0))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Mesage was recieved&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timeStampEnd = clock();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //printf(&quot;Time for transit of size %d = %f&quot;, msgSize, (double)(timeStampEnd-timeStampBegin));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br />
<br />
<br />
<br />
}</pre><br />
Output<br />
 <pre style="margin:20px; line-height:13px">msgget succeeded<br />
-1 bytes were sent<br />
-1 bytes were sent</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum118.html">C</category>
			<dc:creator>chunalt787</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236656.html</guid>
		</item>
		<item>
			<title>Password Generator</title>
			<link>http://www.daniweb.com/forums/thread236655.html</link>
			<pubDate>Fri, 06 Nov 2009 23:03:19 GMT</pubDate>
			<description><![CDATA[I know Remembering secure passwords is difficult. So I made this. 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags"...]]></description>
			<content:encoded><![CDATA[<div>I know Remembering secure passwords is difficult. So I made this.<br />
 <pre style="margin:20px; line-height:13px">import random, os<br />
a= ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','{',':','&gt;','?','}','|','!','@','#','$','%','^','&amp;','*','(',')','-','+']<br />
<br />
z = int(raw_input(&quot;How many words in your password?: &quot;))<br />
os.system(&quot;clear&quot;)<br />
List = []<br />
for x in xrange(z):<br />
&nbsp; &nbsp; &nbsp; &nbsp; List.append(random.choice(a))<br />
print &quot;&quot;.join(List) <br />
print &quot;1) Yes&quot;<br />
print &quot;2) No&quot;<br />
b = int(raw_input(&quot;Would you like to save this password to a text file?: &quot;))<br />
if b == 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; c = raw_input(&quot;What is this password for?: &quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; x = open(&quot;%s.txt&quot; % c, &quot;w&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; y = &quot;&quot;.join(List)<br />
&nbsp; &nbsp; &nbsp; &nbsp; x.write(y)<br />
&nbsp; &nbsp; &nbsp; &nbsp; x.close<br />
&nbsp; &nbsp; &nbsp; &nbsp; x = open(&quot;%s.txt&quot; % c, &quot;r&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; x.read<br />
&nbsp; &nbsp; &nbsp; &nbsp; print &quot;Saved!&quot;<br />
elif b == 2:<br />
&nbsp; &nbsp; &nbsp; &nbsp; raw_input(&quot;Press Enter To Continue&quot;)</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum114.html">Python</category>
			<dc:creator>nevets04</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236655.html</guid>
		</item>
		<item>
			<title>int 21h/ah=09h string output</title>
			<link>http://www.daniweb.com/forums/thread236650.html</link>
			<pubDate>Fri, 06 Nov 2009 22:50:10 GMT</pubDate>
			<description><![CDATA[im using fasm (flat assembler 1.68), and im trying to output a string with int21h/ah=09h 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with...]]></description>
			<content:encoded><![CDATA[<div>im using fasm (flat assembler 1.68), and im trying to output a string with int21h/ah=09h<br />
<br />
 <pre style="margin:20px; line-height:13px">jmp main<br />
msg db &quot;hello world$&quot;<br />
main:<br />
mov dx, msg<br />
mov ah, 09<br />
int 21h</pre><br />
this code outputs &quot;hello world&quot;, but it outputs some control characters before it ([SOME WEIRD CONTROL CHARACTERS]hello world)<br />
<br />
so how can i fix this?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum125.html">Assembly</category>
			<dc:creator>brando|away</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236650.html</guid>
		</item>
		<item>
			<title>Incompatible types found (HELP!)</title>
			<link>http://www.daniweb.com/forums/thread236649.html</link>
			<pubDate>Fri, 06 Nov 2009 21:52:29 GMT</pubDate>
			<description><![CDATA[<div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a> </div> <div>(<a href="#"...]]></description>
			<content:encoded><![CDATA[<div> <pre style="margin:20px; line-height:13px">/*<br />
&nbsp;* CensusCalculator.java<br />
&nbsp;* <br />
&nbsp;* Computer Science 111, Boston University<br />
&nbsp;*<br />
&nbsp;* This program performs various computations on census data stored in a text file.<br />
&nbsp;* It uses arrays in several ways, including for storage of the results of<br />
&nbsp;* the computations.<br />
&nbsp;* <br />
&nbsp;* modified by: [Daniel Sutton (dan13@bu.edu)]<br />
&nbsp;*&nbsp; &nbsp; &nbsp; &nbsp; date: 11/4/09<br />
&nbsp;*/<br />
<br />
import java.util.*;<br />
import java.io.*;<br />
<br />
<br />
public class CensusCalculator {<br />
&nbsp;  <br />
&nbsp;  public static final String DATA_FILE_NAME = &quot;census.txt&quot;;<br />
&nbsp;  <br />
&nbsp;  /* The number of population counts for each county.<br />
&nbsp; &nbsp; * Changing the value of this constant should be all that is needed<br />
&nbsp; &nbsp; * to allow your program to handle a data file with a different<br />
&nbsp; &nbsp; * number of counts.<br />
&nbsp; &nbsp; */<br />
&nbsp;  public static final int NUM_POPULATION_COUNTS = 2;&nbsp; &nbsp; <br />
&nbsp;  <br />
&nbsp;  /* A class-constant array of Strings containing the names of the states<br />
&nbsp; &nbsp; * in the data file.<br />
&nbsp; &nbsp; * <br />
&nbsp; &nbsp; * The index of a given state name in the array is the<br />
&nbsp; &nbsp; * same as the numeric code of the state in the data file.<br />
&nbsp; &nbsp; * For example, Alaska has a state code of 1 in the data file, <br />
&nbsp; &nbsp; * so its name is at position 1 in this array.<br />
&nbsp; &nbsp; */<br />
&nbsp;  public static final String[] STATE_NAMES = {&quot;Alabama&quot;, &quot;Alaska&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;Arizona&quot;, &quot;Arkansas&quot;, &quot;California&quot;, &quot;Colorado&quot;, &quot;Connecticut&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;Delaware&quot;, &quot;Florida&quot;, &quot;Georgia&quot;, &quot;Hawaii&quot;, &quot;Idaho&quot;, &quot;Illinois&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;Indiana&quot;, &quot;Iowa&quot;, &quot;Kansas&quot;, &quot;Kentucky&quot;, &quot;Louisiana&quot;, &quot;Maine&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;Maryland&quot;, &quot;Massachusetts&quot;, &quot;Michigan&quot;, &quot;Minnesota&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;Mississippi&quot;, &quot;Missouri&quot;, &quot;Montana&quot;, &quot;Nebraska&quot;, &quot;Nevada&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;New Hampshire&quot;, &quot;New Jersey&quot;, &quot;New Mexico&quot;, &quot;New York&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;North Carolina&quot;, &quot;North Dakota&quot;, &quot;Ohio&quot;, &quot;Oklahoma&quot;, &quot;Oregon&quot;, <br />
&nbsp; &nbsp; &nbsp; &quot;Pennsylvania&quot;, &quot;Rhode Island&quot;, &quot;South Carolina&quot;, &quot;South Dakota&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;Tennessee&quot;, &quot;Texas&quot;, &quot;Utah&quot;, &quot;Vermont&quot;, &quot;Virginia&quot;, &quot;Washington&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;West Virginia&quot;, &quot;Wisconsin&quot;, &quot;Wyoming&quot;, &quot;District of Columbia&quot;};<br />
&nbsp;  <br />
&nbsp;  /* <br />
&nbsp; &nbsp; * A class-constant array of Strings containing the names of <br />
&nbsp; &nbsp; * the nine divisions used by the Census Bureau.<br />
&nbsp; &nbsp; * <br />
&nbsp; &nbsp; * The Census Bureau also numbers the divisions, and we have<br />
&nbsp; &nbsp; * used a division's number as its index in this array.<br />
&nbsp; &nbsp; * For example, New England is Division 1, so its name is at<br />
&nbsp; &nbsp; * position 1 in this array.<br />
&nbsp; &nbsp; * <br />
&nbsp; &nbsp; * Note that there is no division 0, so we have put the name<br />
&nbsp; &nbsp; * &quot;none&quot; in position 0 of the array.<br />
&nbsp; &nbsp; */<br />
&nbsp;  public static final String[] DIVISION_NAMES = {<br />
&nbsp; &nbsp; &nbsp; &quot;none&quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;New England (CT,ME,MA,NH,RI,VT)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;, <br />
&nbsp; &nbsp; &nbsp; &quot;Mid-Atlantic (NJ,NY,PA)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;, <br />
&nbsp; &nbsp; &nbsp; &quot;East North Central (IL,IN,MI,OH,WI)&nbsp; &nbsp; &nbsp; &nbsp; &quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;West North Central (IA,KS,MN,MO,NE,ND,SD)&nbsp; &quot;, <br />
&nbsp; &nbsp; &nbsp; &quot;South Atlantic (DE,FL,GA,MD,NC,SC,VA,WV,DC)&quot;, <br />
&nbsp; &nbsp; &nbsp; &quot;East South Central (AL,KY,MS,TN)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &quot;,<br />
&nbsp; &nbsp; &nbsp; &quot;West South Central (AR,LA,OK,TX)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &quot;, <br />
&nbsp; &nbsp; &nbsp; &quot;Mountain (AZ,CO,ID,MT,NV,NM,UT,WY)&nbsp; &nbsp; &nbsp; &nbsp;  &quot;, <br />
&nbsp; &nbsp; &nbsp; &quot;Pacific (AK,CA,HI,OR,WA)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &quot;};&nbsp; <br />
&nbsp;  <br />
&nbsp;  /*<br />
&nbsp; &nbsp; * A class-constant array of integers that allows you to<br />
&nbsp; &nbsp; * determine the number of the division to which each<br />
&nbsp; &nbsp; * state belongs.<br />
&nbsp; &nbsp; * <br />
&nbsp; &nbsp; * For example, Alaska has a state code of 1.<br />
&nbsp; &nbsp; * Element 1 of this array is the integer 9, which indicates<br />
&nbsp; &nbsp; * that Alaska is in division 9 (Pacific).<br />
&nbsp; &nbsp; */<br />
&nbsp;  public static final int[] DIVISION_FOR_STATE = {6, 9,<br />
&nbsp; &nbsp; &nbsp; 8, 7, 9, 8, 1, 5, 5, 5, 9, 8, 3, 3, 4, 4, 6, 7, 1, 5, <br />
&nbsp; &nbsp; &nbsp; 1, 3, 4, 6, 4, 8, 4, 8, 1, 2, 8, 2, 5, 4, 3, 7, 9, 2,<br />
&nbsp; &nbsp; &nbsp; 1, 5, 4, 6, 7, 8, 1, 5, 9, 5, 3, 8, 5};<br />
&nbsp;  <br />
&nbsp;  /*<br />
&nbsp; &nbsp; * printOneDivision - prints the counts for a single division with the<br />
&nbsp; &nbsp; * specified name, old population (oldPop), and new population (newPop).<br />
&nbsp; &nbsp; * It computes the percent change for you. It displays the results so that<br />
&nbsp; &nbsp; * the full list of division results will be lined up in columns, and<br />
&nbsp; &nbsp; * it adds commas and rounds the percents to one place after the decimal.<br />
&nbsp; &nbsp; */<br />
&nbsp;  <br />
&nbsp;  public static void main(String[] args) throws FileNotFoundException {<br />
&nbsp; &nbsp; &nbsp; Scanner console = new Scanner(System.in);<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;MENU: &quot;);<br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;\t1. compute state totals&quot;);<br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;\t2. compute division totals&quot;);<br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;\t3. quit&quot;);<br />
&nbsp; &nbsp; &nbsp; System.out.print(&quot;Enter the number of your choice: &quot;);<br />
&nbsp; &nbsp; &nbsp; int choice = console.nextInt();<br />
&nbsp; &nbsp; &nbsp; console.nextLine();<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; if (choice == 1) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  System.out.print(&quot;state name: &quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  String stateName = console.nextLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp;  getStateCode(stateName);<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; if (choice == 2) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; if (choice == 3) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  boolean end = true;<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; if (choice &lt; 1 || choice &gt; 3) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  System.out.println(&quot;Not a valid choice.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  System.out.print(&quot;Enter the number of your choice: &quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  choice = console.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp;  console.nextLine();<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp;  }<br />
&nbsp;  public static void printOneDivision(String name, int oldPop, int newPop) {<br />
&nbsp; &nbsp; &nbsp; double percChange = (newPop - oldPop) * 100.0 / oldPop;<br />
&nbsp; &nbsp; &nbsp; System.out.printf(&quot;%43s\t&nbsp; %,d\t&nbsp; %,d\t&nbsp; %4.1f%%\n&quot;, name, oldPop, newPop, percChange);<br />
&nbsp;  }<br />
&nbsp;  <br />
&nbsp;  /*<br />
&nbsp; &nbsp; * getStateCode - finds and returns the state code for<br />
&nbsp; &nbsp; * the specified state name, and -1 if the specified<br />
&nbsp; &nbsp; * state name is not found.<br />
&nbsp; &nbsp; * <br />
&nbsp; &nbsp; * You will complete this method so that it searches <br />
&nbsp; &nbsp; * through the STATE_NAMES array and returns the index<br />
&nbsp; &nbsp; * of stateName in that array, or -1 is stateName<br />
&nbsp; &nbsp; * is not found in that array.<br />
&nbsp; &nbsp; */<br />
&nbsp;  <br />
&nbsp;  public static int getStateCode(String stateName) {<br />
&nbsp; &nbsp; &nbsp; int stateCode = 0;<br />
&nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; STATE_NAMES.length; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if (stateName.equals(STATE_NAMES[i])) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i = stateCode;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; return stateCode;<br />
&nbsp;  }<br />
&nbsp;  <br />
&nbsp;  public static int getStateInfo (int[] stateCode, int[] oldPop, int[] newPop) <br />
&nbsp; &nbsp; &nbsp; throws FileNotFoundException {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  Scanner input = new Scanner(new File(DATA_FILE_NAME));&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  input.useDelimiter(&quot;\t|\r\n|\n|\r&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  boolean found = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  int count=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  while (input.hasNextLine()) {<br />
<span style="color:Red">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  stateCode = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  oldPop = input.nextInt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  newPop = input.nextInt();</span>&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:Red"> return stateCode;</span><br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp;  <br />
<br />
&nbsp;  }</pre><br />
When I try to compile this code (I am not finished with it yet) I get 4 error messages that all say incompatible types<br />
found   : int<br />
required: int[]<br />
<br />
directed toward the highlighted lines in the code. I feel like i've tried everything, but nothing is working. Any help would be greatly appreciated!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>DanieL34749</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236649.html</guid>
		</item>
		<item>
			<title>d.s. malik</title>
			<link>http://www.daniweb.com/forums/thread236645.html</link>
			<pubDate>Fri, 06 Nov 2009 21:34:13 GMT</pubDate>
			<description>salam, hope u people ll fine , any body have solved excercises of CHAP 2, CHAP 3,CHAP4 AND CHAP 5 BY D.S AMLIK book i need these urgent so kindly help me  my exams r very near n i w ant to prepare them</description>
			<content:encoded><![CDATA[<div>salam, hope u people ll fine , any body have solved excercises of CHAP 2, CHAP 3,CHAP4 AND CHAP 5 BY D.S AMLIK book i need these urgent so kindly help me  my exams r very near n i w ant to prepare them</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>IT seeker</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236645.html</guid>
		</item>
		<item>
			<title>Error - Going from Java to C++</title>
			<link>http://www.daniweb.com/forums/thread236644.html</link>
			<pubDate>Fri, 06 Nov 2009 21:30:13 GMT</pubDate>
			<description><![CDATA[I have created a linked list in Java, and now I am trying to convert my program to C++.  
When I try to compile, it gives me the error saying that 'next' uses 'CarNode' which is being defined. I am wondering if there is any way around this? 
 
Java: 
  <div class="codeblock"> <div class="spaced">...]]></description>
			<content:encoded><![CDATA[<div>I have created a linked list in Java, and now I am trying to convert my program to C++. <br />
When I try to compile, it gives me the error saying that 'next' uses 'CarNode' which is being defined. I am wondering if there is any way around this?<br />
<br />
Java:<br />
 <pre style="margin:20px; line-height:13px">public class CarNode {<br />
&nbsp; public Car carObject;<br />
&nbsp; public CarNode next;<br />
<br />
&nbsp; public CarNode (Car newCar, CarNode newNext) {<br />
&nbsp; &nbsp; carObject = newCar;<br />
&nbsp; &nbsp; next = newNext;<br />
&nbsp; }<br />
}</pre><br />
<br />
C++:<br />
 <pre style="margin:20px; line-height:13px">class CarNode: public Car {<br />
&nbsp; public:<br />
&nbsp; &nbsp; Car carObject;<br />
&nbsp; &nbsp; CarNode next;<br />
<br />
&nbsp; &nbsp; CarNode(Car newCar, CarNode newNext) {<br />
&nbsp; &nbsp; &nbsp; carObject = newCar;<br />
&nbsp; &nbsp; &nbsp; next = newNext;<br />
&nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>icu222much</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236644.html</guid>
		</item>
		<item>
			<title>I really need help,please</title>
			<link>http://www.daniweb.com/forums/thread236641.html</link>
			<pubDate>Fri, 06 Nov 2009 21:18:38 GMT</pubDate>
			<description><![CDATA[heey all ,,  
I'v a question about the pow ,, but when I run the programe it didn't work =S  
I really need help because tomorrow I shloud give it to my teacher,,  
  
     ******************************************** 
import java.lang.Math; 
public class ques3 
{ 
public static void...]]></description>
			<content:encoded><![CDATA[<div>heey all ,, <br />
I'v a question about the pow ,, but when I run the programe it didn't work =S <br />
I really need help because tomorrow I shloud give it to my teacher,, <br />
 <br />
     ********************************************<br />
import java.lang.Math;<br />
public class ques3<br />
{<br />
public static void main(String[]args)<br />
{<br />
static Scanner console =  new Scanner(System.in);<br />
float a,b,c;<br />
System.out.println(&quot;Enter a &quot;);<br />
a=console.nextFloat();<br />
System.out.println(&quot;Enter b &quot;);<br />
b=console.nextFloat();<br />
System.out.println(&quot;Enter c &quot;);<br />
c=console.nextFloat();<br />
sum=Math.Pow((double)b*b-4*a*c,0.5);</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>somewhere</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236641.html</guid>
		</item>
		<item>
			<title>C++ internals</title>
			<link>http://www.daniweb.com/forums/thread236638.html</link>
			<pubDate>Fri, 06 Nov 2009 20:51:38 GMT</pubDate>
			<description><![CDATA[I'm trying to advance my understanding of how computers and compilers work. 
 
Given the C++ program bellow with exceptions and runtime typing turned off and no optimizing that removes main or makes it into a non-standard function. 
int main() {return0;} 
Produced an disassembly with the following...]]></description>
			<content:encoded><![CDATA[<div>I'm trying to advance my understanding of how computers and compilers work.<br />
<br />
Given the C++ program bellow with exceptions and runtime typing turned off and no optimizing that removes main or makes it into a non-standard function.<br />
 <pre style="margin:20px; line-height:13px">int main() {return0;}</pre><br />
Produced an disassembly with the following code for main:<br />
 <pre style="margin:20px; line-height:13px">pushl&nbsp; &nbsp; &nbsp; &nbsp; %ebp ; pushes the stack frame<br />
xorl&nbsp; &nbsp; &nbsp; &nbsp; %eax, %eax&nbsp; ; sets the eax register to zero<br />
movl&nbsp; &nbsp; &nbsp; &nbsp; %esp, %ebp&nbsp; ; empties the stack frame<br />
leave<br />
ret ; return with 0 in eax</pre><br />
1. What will the assembly that calls the main function look like?<br />
2. What will be on the start before this code is run?<br />
3. What will EBP (the stack frame pointer) be at the start? Garbage values?<br />
4. What is in the accumulator at the start? Garbage values again?<br />
5. What does the leave function do? I've read around for this but I can't find anything that makes much sense.<br />
6. To what address will ret jump the instruction pointer to?<br />
7. What does the assembly look like for the code that is executed the main function exits?<br />
8. Another thing that is being getting at me is: why does C++ CDECL calling convention pass argument right to left? It seems counter intuitive to me as it rewards doing right to left as the order of evaluation of the parameters which is also counter intuitive to me.<br />
<br />
Thanks in advance, any help would be much appreciated</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum14.html">Computer Science</category>
			<dc:creator>ganbree</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236638.html</guid>
		</item>
		<item>
			<title>how to store data into a single file</title>
			<link>http://www.daniweb.com/forums/thread236635.html</link>
			<pubDate>Fri, 06 Nov 2009 20:28:58 GMT</pubDate>
			<description>hi..i am writng a program.....i have collected a lot of information(name,hobbies etc.....) of about a hundred students in my school.......i have also stored their photographs in .jpeg format.........i am using Dev c++ and windows xp..........i want to store all this info + photos in a single...</description>
			<content:encoded><![CDATA[<div>hi..i am writng a program.....i have collected a lot of information(name,hobbies etc.....) of about a hundred students in my school.......i have also stored their photographs in .jpeg format.........i am using Dev c++ and windows xp..........i want to store all this info + photos in a single file....how do i go about it............i started programmin a few days ago......so whatever u explain...please explain it in lay mans terms..........i dont want the entire code....but parts of the code ....it wud be great if you could explain it a bit n could give sources for me study it in greater detail</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>karanmehra18</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236635.html</guid>
		</item>
		<item>
			<title>Can I have some help on storing a running total and how to exit out for each section?</title>
			<link>http://www.daniweb.com/forums/thread236633.html</link>
			<pubDate>Fri, 06 Nov 2009 20:19:15 GMT</pubDate>
			<description><![CDATA[Hello Guys, 
 
I am trying to code this assignment below but I can't seem to get the running total 
stored for each user that I have listed below(A, B, E).  Can someone guide me on how 
I can store the running total for each user so that I can have it stored when the 
user enters "Z"?  I have...]]></description>
			<content:encoded><![CDATA[<div>Hello Guys,<br />
<br />
I am trying to code this assignment below but I can't seem to get the running total<br />
stored for each user that I have listed below(A, B, E).  Can someone guide me on how<br />
I can store the running total for each user so that I can have it stored when the<br />
user enters &quot;Z&quot;?  I have searched on different webpages and forums but I have yet<br />
to find one that helps?  I joined this forum to help me in my assistance to<br />
conquer .NET(C#)so that I can be a developer in this.  Can someone assist me kindly?<br />
(I am a current I.T. professional and this sucks that I can't seem to solve it, it seems<br />
so simple.)<br />
<br />
Assignment question:<br />
<br />
Three salespeople work at Sunshine Hot Tubs-Andrea, Brittany, and Eric.  <br />
Write a program that prompts the user for a salesperson’s initial (‘A’,’B’, or’E’). <br />
 While the user does not type ‘Z’, continue by prompting for the amount of <br />
a sale the salesperson made.  Calculate the salesperson’s commission as <br />
10 percent of the sale amount, and add the commission to a running total <br />
for that salesperson.  After the user types ‘Z’ for an initial, display each <br />
salesperson’s total commission earned.<br />
<br />
 <pre style="margin:20px; line-height:13px">using System;<br />
public class TubSales<br />
{<br />
&nbsp; &nbsp; public static void Main()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; string inputString;//This grabs the user's response for the salespersons initial.<br />
&nbsp; &nbsp; &nbsp; &nbsp; char response;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Please enter a salesperson's initial('A' for Andrea, 'B' for Brittany and 'E' for Eric and 'Z'to display each saleperson's total commmission earned)&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; inputString = Console.ReadLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; response = Convert.ToChar(inputString);<br />
&nbsp; &nbsp; &nbsp; &nbsp; double saleAmount = new double();<br />
&nbsp; &nbsp; &nbsp; &nbsp; double saleAmount_A = new double();<br />
&nbsp; &nbsp; &nbsp; &nbsp; double saleAmount_B = new double();<br />
&nbsp; &nbsp; &nbsp; &nbsp; double saleAmount_E = new double();<br />
&nbsp; &nbsp; &nbsp; &nbsp; double commission = 0.10 * saleAmount;<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (response != 'Z')<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (response == 'A')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Permitted user please enter the sale amount that you made.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inputString = Console.ReadLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saleAmount = Convert.ToDouble(inputString);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saleAmount_A = commission;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saleAmount_A += saleAmount;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (response == 'B')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Permitted user please enter the sale amount that you made.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inputString = Console.ReadLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saleAmount = Convert.ToDouble(inputString);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saleAmount_B = commission;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saleAmount_B += commission;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (response == 'E')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Permitted user please enter the sale amount that you made.&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inputString = Console.ReadLine();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saleAmount = Convert.ToDouble(inputString);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saleAmount_E = commission;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saleAmount_E += commission;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (response == 'Z')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;The total commission for each salesperson respectively is: Andrea with {0}, Brittany with {1} and Eric with {2}.&quot;, saleAmount_A.ToString(&quot;C&quot;), saleAmount_B.ToString(&quot;C&quot;), saleAmount_E.ToString(&quot;C&quot;));<br />
&nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum61.html">C#</category>
			<dc:creator>choosenalpha</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236633.html</guid>
		</item>
		<item>
			<title>Multi-Threading</title>
			<link>http://www.daniweb.com/forums/thread236630.html</link>
			<pubDate>Fri, 06 Nov 2009 19:53:57 GMT</pubDate>
			<description><![CDATA[Hey guys, 
 
I'm about to start on a research project about multi-threading.  I'm very comfortable with c++ oop/data structures concepts, but am completely new to programming with multiple threads.   Does anyone have suggested resources for me to get started?]]></description>
			<content:encoded><![CDATA[<div>Hey guys,<br />
<br />
I'm about to start on a research project about multi-threading.  I'm very comfortable with c++ oop/data structures concepts, but am completely new to programming with multiple threads.   Does anyone have suggested resources for me to get started?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Duki</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236630.html</guid>
		</item>
		<item>
			<title>Reading from the Command line</title>
			<link>http://www.daniweb.com/forums/thread236628.html</link>
			<pubDate>Fri, 06 Nov 2009 19:32:50 GMT</pubDate>
			<description><![CDATA[Hey, 
How do you read from the command line in C? I need to read 10 arguments from the command line. Can I use char* argv[] as a parameter in the main function to do so? 
 
Thanks.]]></description>
			<content:encoded><![CDATA[<div>Hey,<br />
How do you read from the command line in C? I need to read 10 arguments from the command line. Can I use char* argv[] as a parameter in the main function to do so?<br />
<br />
Thanks.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum118.html">C</category>
			<dc:creator>shakunni</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236628.html</guid>
		</item>
	</channel>
</rss>
