FC Jamison 31 Posting Pro in Training Team Colleague

I have been asked to explicitly convert a decimal number to hexadecimal (radix sixteen) number in 1s complement...how the heck is that done?

I can convert to a binary number using 1s compliment...do I just take that and convert to hex after the fact?

FC Jamison 31 Posting Pro in Training Team Colleague

How would one construct a Hamming code that can correct up to 4 bit errors in the resulting code words?

FC Jamison 31 Posting Pro in Training Team Colleague

So you need to create a linked list with three nodes and then call a function that follows the links and counts the number of nodes...is that correct?

FC Jamison 31 Posting Pro in Training Team Colleague

Last quarter our last assignment was to create two programs that gernerate silly sentences from words contained in a file.

I was able to create the program with a map, but have no idea how to do it with a hash map. Since it was the end of the quarter, the instructor didn't go over how to do this.

I am using Microsoft Visual Studio 2005 (the school uses Linux, of course...so even the example code is useless to me here).

I am attaching the project files and am wondering if someone would be kind enough to explain how to do this with a hash map.

FC Jamison 31 Posting Pro in Training Team Colleague

Yeah...like that.

I actually saw that in my research, but didn't think I could convert it to what I needed.

Your suggestion prompted me to look at the code a little closer, and I came up with this solution:

template <class T>
void mergeSort(vector<T>& s) { 
	vector<T>* temp = new vector<T>(s.size());
	if(temp != NULL) { mergeHelper(s.begin(), 0, s.size(), temp->begin()); }
	delete temp;
}


template <class T>
T max(int x, int y) {
	if(x > y) { return x; }
    else { return y; }
}


template <class Itr>
void mergeHelper(Itr start, unsigned int low, unsigned int high, Itr temp) {
	if (low + 1 == high) return;
	else {
		unsigned int center = ((high + low) / 2);
		int l = low;
		int h = center;

		mergeHelper(start, low, center, temp);
		mergeHelper(start, center, high, temp);
		
		for(int i = 0; i < (high - low); i++) {
			if (l < center && (h == high || max(start[l], start[h]) == start[h])) {
				temp[i] = start[l];
				l++;
			}
			else {
				temp[i] = start[h];
				h++;
			}
		}

		for(i = low; i < high; i++) { start[i] = temp[i - low]; }
	}
}

Thanks for the nudge in the right direction!

FC Jamison 31 Posting Pro in Training Team Colleague

Have you tried specifying a height and width for each image?

<body>
<center>
<div id="macbar" align="middle">
<a href="http://www.google.com" target="body"><img src="img/ball.bmp" align="middle" height="50" width="50"></a><nobr>
<a href="http://www.google.com" target="body"><img src="img/sergant.bmp" align="middle" height="50" width="50"></a><nobr>
<a href="http://www.google.com" target="body"><img src="img/xbox.bmp" align="middle" height="50" width="50"></a><nobr>
</div>
</center>
<!-- --><script type="text/javascript" src="/i.js"></script></body>
FC Jamison 31 Posting Pro in Training Team Colleague

I'm just learning C++ myself...

Wouldn't you use a public member function to access and modify private member variables?

FC Jamison 31 Posting Pro in Training Team Colleague

Just glancing at the code, would this modification work?

unsigned int getVolume() {
     setVolume();
     return Volume;
}
FC Jamison 31 Posting Pro in Training Team Colleague

I am trying to learn how to write a merge sort function, but I have only gotten so far with the book I am using now:

template <class T>
void mergeSort(vector<T>& s) { mergeHelper(s.begin(), 0, s.size()); }


template <class Itr>
void mergeHelper(Itr start, unsigned int low, unsigned int high) {

	// If current element is the only element in the vector, return the element
	if (low + 1 == high) return;

	// Find the center of the current vector
	unsigned int center = ((high + low) / 2);
	
	// Sort lower half  
	mergeHelper(start, low, center);

	// Sort upper half
	mergeHelper(start, center, high);

	// Combine consecutive sorted ranges [first, middle) and [middle, last) 
	// into a single sorted range [first, last)  
	inplace_merge(start + low, start + center, start + high);
}

I understand "what" the inplace merge function is supposed to do...but I'll be damned if I can figure out how to write the code for it and I have been unsuccessful in my online searches.

How would I write the code for my own inplace_merge function?

FC Jamison 31 Posting Pro in Training Team Colleague

That depends on what you consider "wrong."

Technically, yes, according to the W3C, tables for layout is "wrong." I think browsers still have a little way to go in the way of rendering CSS uniformly across platforms, so sometimes a table is easier for those who are familiar with them.

I personally use CSS...but I won't hang someone who doesn't (unless they are working on my site).

Hey...I've been known to use a screwdriver for a chisel in the past. It may not be "right"...but it works in a pinch.

FC Jamison 31 Posting Pro in Training Team Colleague

It appears to be working in IE7.

I can't check it in IE6 because Microsoft tricked me into installing IE7 as an update.

FC Jamison 31 Posting Pro in Training Team Colleague

Ha!

It really is a preference issue.

Most people will tell you that tables were created exclusively to hold tabular data...and that any other use is wrong.

Since we have been using tables long before CSS, this is obviously false.

If your client doesn't care and you are GOOD at using tables, knock yourself out. If you are using 50 tables to position items on a small page, however, you should really look into learning CSS.

FC Jamison 31 Posting Pro in Training Team Colleague

Click on sites/manage sites/edit and click through until you get to the ftp page for the site you want.

Click the SAVE checkbox next to "What is your FTP password?"

I've never had a problem with it not connecting to my site. If it is not connecting, recheck your ftp hostname, username, and password. You should also check to see if you are connecting to the correct folder on the ftp server.

FC Jamison 31 Posting Pro in Training Team Colleague

This forum uses PHP and the code is embedded into the software.

I do not know if it can be done with javascript.

FC Jamison 31 Posting Pro in Training Team Colleague

We really need to see a working page so we can identify the problem.

My guess is that there is some object that is getting moved to a different position and is bumping everything else down.

FC Jamison 31 Posting Pro in Training Team Colleague

Can you give us a link to the page so we can look at it?

FC Jamison 31 Posting Pro in Training Team Colleague

It looks good in IE7 on my laptop.

FC Jamison 31 Posting Pro in Training Team Colleague

Nevermind...

I got it to work using

char &operator[](unsigned int index) {
   return str[index];
}
FC Jamison 31 Posting Pro in Training Team Colleague

I was absent for the discussion and lab due to illness and I am at a total loss as to how to do this assignment.

Implement the my_string class in header file my_string.h, so that the test code given below reports SUCCESS.

// test_my_string.cpp

#include <iostream>
#include <string>
#include <cassert>
#include "my_string.h"

using namespace std;

//#define STRING string
#define STRING my_string

int main()
{
   STRING s1; // s1 == ""
   assert(s1.length() == 0);

   STRING s2("hi");  // s2 == "hi"
   assert(s2.length() == 2);

   STRING s3(s2);  // s3 == "hi"
   assert(s3.length() == 2);
   assert(s3[0] == 'h');
   assert(s3[1] == 'i');

   s1 = s2;  // s1 == "hi"

   s3 = "bye";  // s3 == "bye"
   assert(s3.length() == 3);
   assert(s3[0] == 'b');
   assert(s3[1] == 'y');
   assert(s3[2] == 'e');
   
   s1 += "re";  // s1 == "hire"
   assert(s1.length() == 4);
   assert(s1[0] == 'h');
   assert(s1[1] == 'i');
   assert(s1[2] == 'r');
   assert(s1[3] == 'e');

   cout << "SUCCESS" << endl;

I cannot get the program to get past assert(s3[0] == 'h'); nor can I get cout << s3[0]; to work.

What am I missing here?

FC Jamison 31 Posting Pro in Training Team Colleague

I have to agree.

Dreamweaver derived code is absolutely horrible. I use dreamweaver, but only as a coding tool...not to do the coding for me.

You should know how to code by hand before using any program to do it for you...just like you should know how to add before using a calculator.

FC Jamison 31 Posting Pro in Training Team Colleague

You need to check your web hosting company for their form mail program. It should have instructions for setting up your form.

FC Jamison 31 Posting Pro in Training Team Colleague

I had a midterm problem similar to this last year.

The question was

3) Write a function using the following structure and prototype.

struct stat
{
    float avg;
    float median;
    float *mode;
    int nModes;
};

stat *avgMedMode(int *,int);

The function takes in an integer array and the size of the array.
Then returns a pointer to a structure containing the average, median
and mode. I will input a small array to test this out so ask for
how many inputs to fill the array, then the values to place into the
array. Make sure you delete the dynamic array creation for the mode
when you exit the problem.

My solution (as a module of the entire midterm program) is as follows:

// Frank C. Jamison
// April 08, 2006
// CIS 17A - Section 43052
// Borland C++ Builder Enterprise Suite Version 6.0
// Purpose:  Midterm Examination Program 3
// Midterm Examination

#include <iostream>
using namespace std;

// Structure Declarations - Midterm Program 3
struct stats {
  float avg;
  float median;
  int  *mode;
  int   nmodes;
};

// Function Declarations - Midterm Program 3
stats *avgMedMode(int *, int);
int   *createArray(int);
void   displayStats(stats);
int    findHighFrequency(int*, int);
int    findNumModes(int *, int, int);
float  getArrayAverage(int *, int);
void   getArrayElements(int *, int);
float  getArrayMedian(int *, int);
int    getModeArray(int *, int, int *, int);
void   programHeader3();
void   sortArrayElements(int *, int);

// Function Declarations - Multiple Files
void clear();
bool validLoNum(int, int);
void wait();


//*****************************************************************************
// FUNCTION: MIDTERM PROBLEM 3                                                * …
FC Jamison 31 Posting Pro in Training Team Colleague

If this is a form, have you tried

<input type="reset" value="Reset!">
FC Jamison 31 Posting Pro in Training Team Colleague

It might help if we can see all of the coding so that we can determine where the error lies.

FC Jamison 31 Posting Pro in Training Team Colleague

Here is a script that captures any text that has been highlighted with the cursor. In Internet Explorer, it even grabs text highlighted within a text box or textarea.

http://javascript.internet.com/page-details/highlighted-text.html

It shouldn't be to much of a stretch to modify the code to change font size and color instead of copying it to a textbox.

FC Jamison 31 Posting Pro in Training Team Colleague

I see your problem, but am not sure if it can be countered.

The problem is not with your code, but appears to be on the page that is being called.

My guess is that the OnLoad function on the SSL page is causing the form to show up in a new window.

FC Jamison 31 Posting Pro in Training Team Colleague

In the past, because I have no server-side coding experience, I have created the page template and then used an external javascript for the client to update his product specials.

This is not the best way...but it is the easiest. I simply showed the client how to modify the javascript in notepad.

FC Jamison 31 Posting Pro in Training Team Colleague

I learned html, css, and rudimentary javascript on my own by surfing the web, looking at tutorials, and just plain creating sites.

I later took a college course in html...and to be perfectly honest, I learned a heck of a lot more on my own than in the college course.

FC Jamison 31 Posting Pro in Training Team Colleague

I generally use external javascript files to do this.

FC Jamison 31 Posting Pro in Training Team Colleague

Answer to the last question...

You need to upload your filesd to a Web server.

You can either find a free Web hosting provider or purchase a domain name and a hosting plan.

FC Jamison 31 Posting Pro in Training Team Colleague

If you upload the image to this thread, we would be able to see what you problem is.

FC Jamison 31 Posting Pro in Training Team Colleague

Take a look at my dropdown tutorial in the tutorials ssection of this site.

It uses list items and contains comments which will tell you what each CSS entry does.

FC Jamison 31 Posting Pro in Training Team Colleague

The problem is that your array

Names[0] "Matt"

Is actually a two dimensional array of characters...so

Names[0][0] = 'M'
Names[0][1] = 'A'

etc.

You will need to use something like this...

tmenu[3] = [["Departments", "#", "dropdown"]];
		smenu[3] = new Array(); fmenu[3] = new Array();
		smenu[3][1] = [["Administration", "#", "noFlyout"]];
		smenu[3][2] = [["Human Resources", "#", "flyout"]];
			fmenu[3][2] = new Array();
			fmenu[3][2][1] = [["Home Page", "#"]];
			fmenu[3][2][2] = [["Employment Opportunities", "#"]];
			fmenu[3][2][3] = [["Teach in Iowa", "#"]];
			fmenu[3][2][4] = [["Info for Teacher Candidates", "#"]];
			fmenu[3][2][5] = [["Master Contract", "#"]];
			fmenu[3][2][6] = [["Iowa Teaching Standards", "#"]];
			fmenu[3][2][7] = [["Non-Discrimination Policy", "#"]];
		smenu[3][3] = [["School Improvement", "#", "noFlyout"]];
		smenu[3][4] = [["Financial Information", "#", "noFlyout"]];
		smenu[3][5] = [["Facilities", "#", "noFlyout"]];
		smenu[3][6] = [["Food Service", "#", "flyout"]];
			fmenu[3][6] = new Array();
			fmenu[3][6][1] = [["Home Page", "#"]];
			fmenu[3][6][2] = [["Account Balances", "#"]];
		smenu[3][7] = [["Child Care", "#", "noFlyout"]];
		smenu[3][8] = [["Transportation", "#", "noFlyout"]];
		smenu[3][9] = [["Adult Education", "#", "noFlyout"]];
FC Jamison 31 Posting Pro in Training Team Colleague

Do you mean a dropdown form field?

FC Jamison 31 Posting Pro in Training Team Colleague

You might try creating a javascript that will allow you to edit one file to update the links on all of your pages.

FC Jamison 31 Posting Pro in Training Team Colleague

I would use css for that.

a:link { color: blue }
a:visited { color: #0000FF }
a:hover { color: #0000FF }
a:focus { color: #0000FF }

FC Jamison 31 Posting Pro in Training Team Colleague

You might try a program called Tigra Scroller.

http://www.softcomplex.com/products/tigra_scroller/demo1.html

FC Jamison 31 Posting Pro in Training Team Colleague

Sometimes that onload is snuck into the .js file (I do this a lot).

FC Jamison 31 Posting Pro in Training Team Colleague

I really can't see what you mean.

Did you fix it?

FC Jamison 31 Posting Pro in Training Team Colleague

Without loading this into a Web page, there are a couple of things it could be,

If there is a 1px space between the submenus, the menu will close when you roll over it.

The other common problem is te css for hovering.

As for menu overflow...there is really no foolproof way to do this. I would suggest having the browser check the width of the window vs. the position and width of the menu and reposition the submenus on overflow.

Your best bet is to design your site in such a way that this situation does not happen or happens only under certain conditions that can be easily avoided.

FC Jamison 31 Posting Pro in Training Team Colleague

I've done that before.

I believe that the UNIX servers are case sensitive. It is always good practice to keep your file names in lowercase and without any spaces.

FC Jamison 31 Posting Pro in Training Team Colleague

You would need to do somethng like this:

tmenu[3] = [["Departments", "#", "dropdown"]];
		smenu[3] = new Array(); fmenu[3] = new Array();
		smenu[3][1] = [["Administration", "#", "noFlyout"]];
		smenu[3][2] = [["Human Resources", "#", "flyout"]];
			fmenu[3][2] = new Array();
			fmenu[3][2][1] = [["Home Page", "#"]];
			fmenu[3][2][2] = [["Employment Opportunities", "#"]];
			fmenu[3][2][3] = [["Teach in Iowa", "#"]];
			fmenu[3][2][4] = [["Info for Teacher Candidates", "#"]];
			fmenu[3][2][5] = [["Master Contract", "#"]];
			fmenu[3][2][6] = [["Iowa Teaching Standards", "#"]];
			fmenu[3][2][7] = [["Non-Discrimination Policy", "#"]];

The problem you run into with your way is that "hello" is an array of characters...so the elements of the array are 'h', 'e', 'l' 'l', and 'o'.

FC Jamison 31 Posting Pro in Training Team Colleague

Hmm...I have never noticed this problem...but I have high speed DSL. Are you sure there is not an onload function floating aruond in there somewhere that tells the browser to wait until the page is loaded to process the menu script?

Mike555 commented: -mike555 +1
FC Jamison 31 Posting Pro in Training Team Colleague

Yeah...it has nothing to do with Dreamweaver.

FC Jamison 31 Posting Pro in Training Team Colleague

Why not just plug it in here

http://www.adcott.net/binary/

FC Jamison 31 Posting Pro in Training Team Colleague

walmart --> mother's day

You have to work there or know someone who has to understand...

FC Jamison 31 Posting Pro in Training Team Colleague

stark, raving lunatic.

FC Jamison 31 Posting Pro in Training Team Colleague

Yes...scrollbar coloring only works in IE and not at all with an xhtml DOCTYPE.

FC Jamison 31 Posting Pro in Training Team Colleague

and realized that

FC Jamison 31 Posting Pro in Training Team Colleague

Have you tried revoving windows media player altogether with add/remove Windows components and then installing WMP 10?