knight fyre 1 Junior Poster in Training

Not sure where this post should go but I'm having trouble with writing a code in Textinfo. I want the menu and layout to be like that you see in the attached picture picture but anytime I test the code I get the following error.

C:\Program Files\GnuWin32\bin>makeinfo --html spssbase.tex
spssbase.tex:18: Node `Top' previously defined at line 12.
C:\Program Files\GnuWin32\bin//spssbase.tex:12: Node `Top' lacks menu item for `
ACF' despite being its Up target.
C:\Program Files\GnuWin32\bin//spssbase.tex:12: Node `Top' lacks menu item for `
2SLS' despite being its Up target.
makeinfo: Removing output file `C:\Program Files\GnuWin32\bin/spssbase-file' due
to errors; use --force to preserve.

Here is my code

\input texinfo
@setfilename spssbase-file
@settitle spssbase-manual

@copying
SPSS is a registered trademark and the other product names are the trademarks of SPSS Inc. for its proprietary computer
software. No material describing such software may be produced or distributed without the written permission of the owners of
the trademark and license rights in the software and the copyrights in the published materials.
@end copying

@ifnottex
@node Top
@top Topmost

This is the top node
@end ifnottex

@menu
	* 2SLS::
	* ACF::
@end menu

@node 	Top, 2SLS, (dir), (dir)

@node 2SLS, ACF, Top, Top 
@chapter 2SLS

@node ACF, (dir), 2SLS, Top 
@chapter ACF


@bye
knight fyre 1 Junior Poster in Training

An old friend of my mom from her University days tells me about a job she thinks I could perform because I'm in the IT field.


Description of the Job

My mom's friend ( let's call her Sara ), Sara, is starting a new business she's has wanted to do for many years. She told me it's an administrative position. This person is responsible for putting the website "out there" on the Internet, attracting customers from my understanding. The main purpose of the website is to act as an interface between the customers and suppliers. She talked about marketing on Facebook and about using Blogs on the website. One of my roles involves carefully crafting and producing the content for the website. Sara mentioned a "sharp young mind a few times".


Now to me

I feel I am capable of fulfilling all her requirements. I know how to create and maintain a website and I will be familiarizing myself with CMS over the coming days. I've never held a job in the IT field before so I'm lacking in experience but I can teach myself quickly. Tonight I'm going to download Drupal just to familiarize myself with CMS. This is the most I believe I can do because she's going to use specialized software.

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ …

knight fyre 1 Junior Poster in Training

My ideal career choice is to be a web developer - creating web sites with powerful functionality.

So far I've learnt:

Front-End
xhtml, css, javascript

General
SQL, C, C++, and Java

Back-End
php ( just started learning )

Applications
Dreamweaver, mySQL, Visual Studio, Eclipse, Borland, Apache


What language/application do you think I should learn next and why?

knight fyre 1 Junior Poster in Training

No need, I just dropped my php.ini in C:\WINDOWS directory and it worked.

knight fyre 1 Junior Poster in Training

I'm trying to install php5 but I need to copy the php.ini file to the %SYSTEMROOT% folder. The problem is that I don't see this folder in my C:/WINDOWS directory.

Where is it or am I suppose to copy the file to another location?

I'm using Windows XP.

knight fyre 1 Junior Poster in Training

Do I have a virus or is there some sort of conflict on my system? I was simply browsing the net and I noticed my usage maxing out at a 100%. This is the third time I've noticed a number of these processes running at the same time. I took some screen shots.

knight fyre 1 Junior Poster in Training

I'm trying to step-up a simple servlet that processes a get action from a form.

When I click on the submit button I get the message.

HTTP Status 404 - /jhtp6/welcome1

type Status report

message /jhtp6/welcome1

description The requested resource (/jhtp6/welcome1) is not available.

Apache Tomcat/5.0.25

I also included an image of my file structure.

Here's the java code

3  import javax.servlet.ServletException;        
 4  import javax.servlet.http.HttpServlet;        
 5  import javax.servlet.http.HttpServletRequest; 
 6  import javax.servlet.http.HttpServletResponse;
 7  import java.io.IOException;
 8  import java.io.PrintWriter;
 9
10  public class WelcomeServlet extends HttpServlet
11  {
12     // process "get" requests from clients           
13     protected void doGet( HttpServletRequest request,
14        HttpServletResponse response )                
15           throws ServletException, IOException       
16     {
17        response.setContentType( "text/html" );
18        PrintWriter out = response.getWriter();
19
20        // send XHTML page to client
21
22        // start XHTML document                    
23        out.println( "<?xml version = \"1.0\"?>" );
24
25        out.printf( "%s%s%s" , "<!DOCTYPE html PUBLIC",
26           " \"-//W3C//DTD XHTML 1.0 Strict//EN\"",
27           " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" );
28
29        out.println( "<html xmlns = \"http://www.w3.org/1999/xhtml\">" );
30
31        // head section of document
32        out.println( "<head>" );
33        out.println( "<title>A Simple Servlet Example</title>" );
34        out.println( "</head>" );
35
36        // body section of document
37        out.println( "<body>" );
38        out.println( "<h1>Welcome to Servlets!</h1>" );
39        out.println( "</body>" );
40
41        // end XHTML document
42        out.println( "</html>" );
43        out.close();  // close stream to complete the page
44     } // end method doGet
45  } // end class WelcomeServlet

Here's the xml …

knight fyre 1 Junior Poster in Training

I found the jar file with the packages. Problem solved.

knight fyre 1 Junior Poster in Training

I'm using Tomcat 5.0.

There are multiple lib folders and none of the jar files match exactly. Which folder should I look into? Even if I choose the right folder how exactly should I add it the built path? I attached the search result of "lib".

What is the other method of installing the servlet package?

knight fyre 1 Junior Poster in Training

I'm trying to learn Java Servlets on my own but I'm having some very basic problems.

The code

"import javax.servlet.ServletException;"

produces a compiler error, "the import javax.servlet cannot be resolved".

I'm using version 3.2.2. Why am I having this problem?

knight fyre 1 Junior Poster in Training

...bump

knight fyre 1 Junior Poster in Training

A little help would be much appreciated.

knight fyre 1 Junior Poster in Training

I'm trying to create a client/server setup that allows two clients to communicate with each other. The problem is that when I run the application the the message does not go to the send client, only to the server. Here is the source code.

Class MorseServer

import javax.swing.JTextArea;
import javax.swing.JFrame;
import javax.swing.JScrollPane;

import java.net.ServerSocket;
import java.net.Socket;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.Condition;

import java.io.IOException;

import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import javax.swing.SwingUtilities;


public class MorseServer extends JFrame
{
	private JTextArea serverDisplay;
	private ServerSocket server; // server socket to connect with users
	private ExecutorService messageExchange;
	private Lock messageLock;
	private Condition userTwoConnect;
	private Client[] client;
	private boolean twoUserConnected = false;
	private static String messageBuffer;
	
	public MorseServer()
	{
		super("Morse Code Server");
		
		serverDisplay = new JTextArea( "Waiting for connection\n" );
		serverDisplay.setEditable( false );
		add( new JScrollPane( serverDisplay ) );
		
		messageExchange = Executors.newFixedThreadPool(2);
		messageLock = new ReentrantLock();
		
		userTwoConnect = messageLock.newCondition();
		
		client = new Client[ 2 ];
	}
	
	public void execute()
	{
		try
		{
			server = new ServerSocket( 22222, 2 );
		}
		catch( IOException ioException )
		{
			ioException.printStackTrace();
			System.exit(1);
		}
		
		waitForConnection();
		
		messageExchange.execute( client[0] );
		messageExchange.execute( client[1] );
		
		messageLock.lock();
		
		try
		{
			client[ 0 ].setSuspended(false);
			userTwoConnect.signal();
		}
		finally
		{
			messageLock.unlock();
		}
	}
	
	public void waitForConnection()
	{
		messageBuffer = new String();
		
		for( int i = 0; i < client.length; i++ )
		{
			try
			{
				client[ i ] = new Client( server.accept(), i, messageBuffer ); // waits for connection
				messageExchange.execute( client[ i ] );
			}
			catch( IOException ioException )
			{
				ioException.printStackTrace();
				System.exit(1);
			} // end catch …
knight fyre 1 Junior Poster in Training

It's kind of long in my view. That's why I didn't post it up in the first place but here it is:

/* South Coast Serenity Inn (SSI) Automated Reservation and Booking System */

/*
FILE NAME:	SSI_SYSTEM.c
COMPILER:	Borland C++ 5.02

AUTHOR:		knight fyre

DATE:			April, 2008
COURSE:		Programming Using C
TITLE:		Class Project

GROUP:		PBCMS 1
FACULTY:		SCIT			*/


// INCLUDED LIBRARIES
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <time.h>   // needed for time function
#include <string.h> // needed for string compare function
#include <dos.h>    // needed for sleep function
#include <ctype.h>  // needed for tolower function

// MACROS - Used in the local room_assigner function
#define TRUE 1
#define FALSE 0



/* ----------GLOBAL DATA----------- */

// STRUCTURES

// Structure for storing information about the rooms (ROOM_DATA)
typedef struct{
	int room_num;      // room number must be between 1 - 50 inclusively
   int room_type;     //1- smoking 2- non-smoking
   float room_rate;
   int room_status;   //9-reserve 10-vacant 12-occupied
	} ROOM_DATA;

// Structure for storing information about the guests (ADMISSION_DATA)
typedef struct{
	int reservation_num;
	int guest_num;
   char first_name[20];
   char MI[2];            // middle initial
   char last_name[20];
   int credit_card;       // credit card number
   int telephone;
   float charge;          // (bill) charge = room_rate * lengh_stay
	int cancel;            // 1 - no ,  2 - yes
   int length_stay;       // during of visit in days
   ROOM_DATA room_connec; // ROOM_DATA is a member of ADMISSION_DATA
   } 	ADMISSION_DATA;


// STRUCT NAME ASSIGNMENT - Initialization with blank data
static ADMISSION_DATA section={NULL,NULL,"","","",0,999,0.00,1,0};
static ROOM_DATA room={NULL,1,0.00,10};


// FUNCTIONS
void menu();
void addReserve(); …
knight fyre 1 Junior Poster in Training

Ok, check out my source code file too.

knight fyre 1 Junior Poster in Training

I just finished up the final touches on my C Project (at least I hope that's the last of them). Anyway, it's due Friday (10% of my overall grade) and I'd like to have some quick feedback (constructive criticisms and complements) before I had it in. It was suppose to be a group project but my group members weren't on top of their game so I had to push and do all the work myself. A blessing in disguise I guess.

Enough of my chatter, evaluate my presumable complete hotel reservation and booking system.

knight fyre 1 Junior Poster in Training

No worries, I solved the problem.

knight fyre 1 Junior Poster in Training

I recoded my insertion sort function. With almost a full day between my first post it now works but it doesn't work perfectly. The issue is that the sorting function will partially sort the guest names and display the report. For example, if I have


Unsorted Data

Alice
Zebra
Cat
Apple

Clicks the report function once

Cat
Apple
Alice
Zebra


Clicks the report function a second time

Alice
Apple
Cat
Zebra

Why isn't the data being sorted correctly sorted the first time the report is displayed and how do I get it only display when the list is fully sorted?

/* +++++++++INSERTION SORT FUNCTION +++++++++++ */
void insertion_sort()
{
	FILE *guest_Ptr;
   int size=0;
   int outer_run;
   int inner_run;

   ADMISSION_DATA small = {NULL,NULL,"","","",0,999,0.00,1,0};


   if( (guest_Ptr = fopen("guest_history.txt", "rb+")) == NULL )
   {
   	textcolor(12); cprintf("\nERROR!! HISTORY FILE COULD NOT BE OPENED!"); sleep(3);
   }
   else
   {
      // counts the number of guest records in the file
      while ( fread( &section, sizeof (ADMISSION_DATA), 1, guest_Ptr ) == 1 )
      {
      	size++;
      }

      rewind( guest_Ptr );
      //printf("Count: %d", size); _getch();

      for(outer_run = 1; outer_run < size; outer_run++)
      {
      	fseek( guest_Ptr, ( outer_run ) * sizeof( ADMISSION_DATA ), SEEK_SET );
         fread( &section, sizeof( ADMISSION_DATA ), 1, guest_Ptr );
         small = section;

         rewind ( guest_Ptr );

         inner_run = outer_run - 1;

         fseek( guest_Ptr, ( inner_run ) * sizeof( ADMISSION_DATA ), SEEK_SET );
         fread( &section, sizeof( ADMISSION_DATA ), 1, guest_Ptr );
         rewind ( guest_Ptr ); …
knight fyre 1 Junior Poster in Training

There's a different set of forums and a different culture.

Most of the forums I see there are on Daniweb. How's the culture different there than here in Daniweb's programming sub-forums?

PFO is strictly for programming while Daniweb is geared more toward general IT.

True but I could say PFO is the same as Daniweb's programming sub-forum.

knight fyre 1 Junior Poster in Training

Could someone tell me what the big difference(s) is between and Daniweb and is so-called sister site programmingforums. The only difference I see is a slightly different layout and a change of colours.

knight fyre 1 Junior Poster in Training

I'm trying to create a function that will sort the contents of a file in alphabetical order. The problem I'm having is that the code doesn't seem to do anything. The only examples I could find have to do with arrays which I am not using but I tried to apply the same principle to structs and files. The file I need to sort is a log file and the size of it's contents will be forever increasing. Here's the ineffective code:

NB: Basically I'm trying to display a report sorted alphabetically. If there's a simple way that doesn't involve modifying the file that would be great.

void insertion_sort(int category)
{
	FILE *seeker;
   int size=0, total=0, runner=0;
   int k;
   int i;
   ADMISSION_DATA small = {NULL,NULL,"","","",0,999,0.00,1,0};
   ADMISSION_DATA temp = {NULL,NULL,"","","",0,999,0.00,1,0};

   if( (seeker = fopen("guest_history.txt", "rb+")) == NULL )
   {
   	printf("\nGuest history file could not be opened");
   	_getch();
   }
   else
   {
      // counts the number of cancellations in the file
      while ( fread( &section, sizeof (ADMISSION_DATA), 1, seeker ) == 1 )
      {
         total++;
      	if( section.cancel == category )
         	size++;

      }
      rewind( seeker );
      //printf("Count: %d", size); _getch(); size = 0;

      while ( fread( &section, sizeof (ADMISSION_DATA), 1, seeker ) == 1 )
      {
      	if( section.cancel == category )
         {
      		for (k = 1; k < size; k++)
      		{
      			// sets the first row as the smallest
      			//fseek( seeker, ( section.reservation_num - k ) * sizeof( ADMISSION_DATA ), SEEK_SET );
      			fread( &small, sizeof (ADMISSION_DATA), 1, seeker );
      			//rewind( seeker ); …
knight fyre 1 Junior Poster in Training

After reading that website you posted I realized that by freading it twice in the loop I'd would always be missing one. The problem is now solved. Thanks.

knight fyre 1 Junior Poster in Training

The code you suggested doesn't work and has bugs similar to my first. With yours, some of rows that are in the file are left off (with yours the first row in each category) which lowers the grand total for my income report.

knight fyre 1 Junior Poster in Training

I've created a program that writes info to a specific file and reading from it to generate an income report. The problem I'm having is that when I geerate my report, the last person that was entered is repeated twice, hence throwing off the grand total. Here's the bit of code:

This is how info gets to the file.

rm_num = section.room_connec.room_num;

                  fseek ( roomPtr, ( rm_num - 1 ) * sizeof( ROOM_DATA ), SEEK_SET );
         			fread ( &room, sizeof( ROOM_DATA ), 1, roomPtr );

                  // Writes to guest_history file
            		fseek( logger, ( NULL ) * sizeof( ADMISSION_DATA ), SEEK_SET );  // &&&&&&&& END
               	fread( &section, sizeof ( ADMISSION_DATA ), 1, logger );
               	section.cancel = 1; // 1 = reservation was NOT cancelled
               	section.charge = room.room_rate * .01;
               	fseek( logger, ( NULL ) * sizeof( ADMISSION_DATA ), SEEK_SET );  // &&&&&&&&  END
               	fwrite( &section, sizeof( ADMISSION_DATA ), 1, logger );
if((logger = fopen("guest_history.txt", "ab")) == NULL )
            {
            	printf("\nGuest history file could not be creted");
            }
            else
            {
            	rm_num = section.room_connec.room_num;
              	fseek ( roomPtr, ( rm_num - 1 ) * sizeof( ROOM_DATA ), SEEK_SET );
         		fread ( &room, sizeof( ROOM_DATA ), 1, roomPtr );

             	// Writes to guest_history file
            	fseek( logger, ( NULL ) * sizeof( ADMISSION_DATA ), SEEK_SET );  // &&&&&&&& END
               fread( &section, sizeof ( ADMISSION_DATA ), 1, logger );
               section.cancel = 2; // 2 = reservation was cancelled
               section.charge = room.room_rate * .01;
               fseek( logger, ( NULL ) * sizeof( ADMISSION_DATA ), SEEK_SET ); …
knight fyre 1 Junior Poster in Training

Yep that's exactly how I did it but nothing happened...

knight fyre 1 Junior Poster in Training

Wrong unfortunately.:(

The code still works perfectly in FF but Nothing is displayed in IE 6.

knight fyre 1 Junior Poster in Training

Well there's all the code.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head> 
		<title>Chi-Nuh::Ebooks</title>
		<link type="text/css" rel="stylesheet" href="ebook.css" />
	</head>

	<body>
			<div id="container">

				<div id="outer_side_bar">
					<div id="inner_side_bar">
						<ul> 
							<li onmouseover="style.backgroundColor='#003333';" onmouseout="style.backgroundColor='#000'"><a id="hellgate" href="javascript:ebooks('Hellgate')">Hellgate</a></li>
							<li onmouseover="style.backgroundColor='#003333';" onmouseout="style.backgroundColor='#000'"><a id="diablo" href="javascript:ebooks('Diablo: Demonsbane')">Diablo: Demonsbane</a></li>
							<li onmouseover="style.backgroundColor='#003333';" onmouseout="style.backgroundColor='#000'"><a id="wow" href="javascript:ebooks('World of Warcraft')">World of Warcraft</a></li>
							<li onmouseover="style.backgroundColor='#003333';" onmouseout="style.backgroundColor='#000'"><a id="birthright" href="javascript:ebooks('Birthright')">Birthright</a></li>

							<li onmouseover="style.backgroundColor='#003333';" onmouseout="style.backgroundColor='#000'"><a id="queen_of_blades" href="javascript:ebooks('Queen of Blades')">Queen of Blades</a></li>
							<li onmouseover="style.backgroundColor='#003333';" onmouseout="style.backgroundColor='#000'"><a id="artificial_intelligence" href="javascript:ebooks('Artificial Intelligence')">Artificial Intelligence</a></li>
							<li onmouseover="style.backgroundColor='#003333';" onmouseout="style.backgroundColor='#000'"><a id="quake_4tm_mods_for_dummies" href="javascript:ebooks('Quake 4TM Mods for Dummies')">Quake 4TM Mods For Dummies</a></li>
							<li onmouseover="style.backgroundColor='#003333';" onmouseout="style.backgroundColor='#000'"><a id="resident_evil" href="javascript:ebooks('Resident Evil')">Resident Evil</a></li>
							<li onmouseover="style.backgroundColor='#003333';" onmouseout="style.backgroundColor='#000'"><a id="warcraft" href="javascript:ebooks('Warcraft')">WarCraft</a></li>
							<li onmouseover="style.backgroundColor='#003333';" onmouseout="style.backgroundColor='#000'"><a id="starcraft_ghost_nova" href="javascript:ebooks('Starcraft Ghost - Nova')">Starcraft Ghost - Nova</a></li>

						</ul>
					</div>
				</div>
				<div id="outer_main_content">
					<div id="inner_main_content">
						<div id="outer_main_title">
							<div id="inner_main_title">
								<h3 id="ebook_title"></h3>
							</div>

						</div>
						<div id="outer_main_info">
							<div id="inner_main_info">
								<p id="ebook_description"></p>		
							</div>
						</div>
						<div id="outer_main_links">
							<div id="inner_main_links">
								LINKS HERE							
							</div>

						</div>
					</div>
				</div>
				<div id="promo">
					<div id="inner_promo">					
					</div>
				</div> 
			</div> <!-- End of container div -->
			
			<script type="text/javascript">
			<!--
				function ebooks(name)
				{ 
					// Sets the title using the function arguments
					document.getElementById("ebook_title").innerHTML = name;
					
					// Determines what is displayed in the main content area of the page
					switch (name)
					{
						case "Hellgate":
							document.getElementById("ebook_description").innerHTML = "<p>2024: Four years after the Demons opened the planar rift known as the Hellgate, mankind's desperate struggle to survive continues. Simon Cross, expatriate of the secret Templar order, works to find and transport survivors out of the ruined city. Hiding within London's Underground system, Simon is raising an …
knight fyre 1 Junior Poster in Training

I tried using semi-colons where applicable but it still doesn't work. Also, for some strange reason only the World of Warcraft link works. NB, It was the only one working before I posted here.

knight fyre 1 Junior Poster in Training

I'm using javascript to display text with a sidebar. It works fine in FF 2.0.0.13 but in IE 6 the links do not work and nothing is displayed. Could someone tell me how to solve this problem?

webpage

knight fyre 1 Junior Poster in Training

What method would be most suitable for a logging file? The data would be of the same length and the program would be reading from the file on a moments notice to generate a report but the file would be constantly appended with information at the end as the user performs certain functions with the program.

knight fyre 1 Junior Poster in Training

That's what it saw in Deitel and Deitel C How to Program. Said C99 provides the header file.

I have another problem; line 32 doesn't work. When the data is being written back to the file. The status is suppose to change to reserved (or the integer 9) but when I check the file, I see available (or the integer 10) is still in it's place.

knight fyre 1 Junior Poster in Training

I get the following errors with bool and it still doesn't work when I include <stdbool.h>...

Error: c-project_.c(313,14):Undefined symbol 'bool'
Error: c-project_.c(313,14):Statement missing ;
Error: c-project_.c(329,18):Undefined symbol 'found'
Error: c-project_.c(329,24):Undefined symbol 'true'
Error: c-project_.c(348,28):Undefined symbol 'false'

Error: c-project_.c(7,2):Unable to open include file 'stdbool.h'

I resorted to

int found = 0;
do
{
   <snip>
    found = 1;
    // line 30 here
    <snip>
} while( found == 0 && !feof(roomPtr) );

but the I ave another problem; line 32 doesn't work. When the data is being written back to the file. The status is suppose to change to reserved (or the integer 9) but when I check the file, available (or the integer 10) is still in it's place.

knight fyre 1 Junior Poster in Training

I'm trying to create a function that searches through all the beds in a hotel until it finds one that is available or just ends when all the records are searched. When it finds that bed, it updates that bed record with new information (marking it as reserved or occupied). The problem is that my function keeps on looping just above the fseek. I know this because I placed a simple print statement above it. At the end of it's run the function is suppose to return the room number that's available to the caller.

// ROOM ASSIGNMENT FUNCTION
int room_assigner(int type, int status) // type (1- smoking 2- non-smoking); status (9-reserve 10-vacant 12-occupied)
{
   FILE *roomPtr;
	int r_num = 0; // room number
   int seeker = 1;  // use to traverse through each record

   if((roomPtr = fopen("rooms.txt", "rb+")) == NULL)
   {
   	printf("\nError in opening file");
   }
   else
   {
   	do
      {  // if seeker = 1 then record 1 field room_status should be checked by the if function
      	fseek( roomPtr, ( seeker - 1) * sizeof( ROOM_DATA ), SEEK_SET);
         // read the info. from the file
         fread( &room, sizeof( ROOM_DATA ), 1, roomPtr );

         if( room.room_status == 10 )
         {
         	if( type == 1 )      // smoking
            {
            	room.room_rate = 4000;
            }
            else                         // non-smoking
            {
             	room.room_rate = 3000;
            }
            room.room_num = room.room_num;
            room.room_type = room.room_type;
            room.room_status = status;
            r_num = room.room_num;           // assigns the chosen room
            fwrite( &room, sizeof( ROOM_DATA ), 1, roomPtr );
         }
         else
         {
         	seeker++; …
knight fyre 1 Junior Poster in Training

I'm having a problem maintaining the data in the file. Everytime I enter a person's data the display code I have only displays the first one I entered. I'm not sure if there's somethin wrong with the creating or populating or just the display code I'm using

void addReserve()
{
   char uoption;
   int option=0;
   int i=0;
   int count = 1;
   int res_num;
   FILE *reserver;
   srand(time(NULL));

   if((reserver=fopen("reservations.txt", "rb+"))==NULL)
   {
   	printf("\nFile could not be opened, file is now be created");
   	if((reserver=fopen("reservations.txt", "wb+"))==NULL)
      {
   		printf("Error in creatiing/opening file");
      	_getch();
      }
      else
      {
      	for (; i < 100; i++)
         {
         	fwrite( &section, sizeof( ADMISSION_DATA ), 1, reserver );
            printf("\nRecord # %d", count);
            count++;
         }
         fclose( reserver );
      }
   }
   fclose ( reserver );

   if((reserver=fopen("reservations.txt", "rb+"))==NULL)
   {
    	printf("Error in creatiing/opening file");
   }
   else
   {
		printf("\nWelcome to the Reservation Section!");

		do{
            printf("\nEnter a reservation number: ");
            scanf("%d", &res_num);

            fseek( reserver, (res_num - 1) * sizeof ( ADMISSION_DATA ), SEEK_SET );

            fread( &section, sizeof( ADMISSION_DATA ), 1, reserver );

            if(section.reservation_num != 0)
            {
            	printf("\nA reservation already exits in this slot");
            }
            else
            {
            section.reservation_num = res_num;

   			section.guest_num = rand()% (30000 - 1 + 1) + 1;
  				
				printf("\nEnter First Name: ");
   			scanf("%s",&section.first_name);

         	printf("\nEnter Middle Initial: %c");
         	scanf("%s", &section.MI);

         	printf("\nEnter Last Name: ");
   			scanf("%s",&section.last_name);

            printf("\nEnter credit card number: ");
  				scanf("%d",&section.credit_card);

   	 		printf("\nContact's Cell/Home/Work #: ");
   			scanf("%d", &section.telephone);

            printf("\nEnter room number: ");
            scanf("%d", &section.room_connec.room_num);

            printf("\nEnter room type (1 for smoking and 0 non-smoking): ");
         	scanf("%d", &section.room_connec.room_type);   //1-smoking 0-non-smoking

            room.room_status=9;//9-reserve 10-vacant 12-occupied

            fseek( reserver, ( section.guest_num - 1 ) * sizeof( …
knight fyre 1 Junior Poster in Training

When is it better to use random-access ? When is it not?

When is it better to use sequential-access? When is it not?

So far I'm only sure to use random access in a situation where I'm dealing with a fixed number of records. For example a record of rooms in a hotel.

knight fyre 1 Junior Poster in Training
<html>
	<head><title>Tables with CSS</title>

<!-- Used to create the outer borders of the table and setting the size -->
<style type="text/css"> #outer_table {border: solid red; width: 60px; height:60px;} </style>

<!-- Used to highlight the low border of the first div to create the illustion of a table row -->
<style type="text/css"> #first_row {border-bottom: solid blue; height:50%;} </style>
       </head>
	<body>
		<div id="outer_table">
			<div id="first_row">
			</div>
			<div id="second_row">
			</div>
	</body>
</html>
knight fyre 1 Junior Poster in Training

I did something like that to correct the code (float and relative) except without the use of breaks.

Looks rather nasty (no offense)

I normally do this kind of layout like this:

<div style="position:relative; width:100%">
  <div style="width:33%; float:left; text-align:center;"><img src="my_image.gif" /><br />Text</div>
  <div style="width:33%; float:left; text-align:center;"><img src="my_image.gif" /><br />Text</div>
  <div style="width:33%; float:left; text-align:center;"><img src="my_image.gif" /><br />Text</div>
</div>

Matti Ressler
Suomedia

knight fyre 1 Junior Poster in Training

I have firebug and the web dev toolbar. A very useful combination!

knight fyre 1 Junior Poster in Training

I like coding aspects of css and xhtml and I can use Photoshop to save to my life. I haven't learnt any languages yet like C# or php but I want to and I'm familiar with the theoretical concepts of database.

Where does that description put me?

knight fyre 1 Junior Poster in Training

Is there any way to make a form so that it sends the information to my email with just xhtml and css when submit button is used. A colleague suggested using "mailto:myemailaddy@hotmail.com" in the action attribute but that did not work.

knight fyre 1 Junior Poster in Training

In IE 6 my site has the layout I want it to have but when I view it with FF2.0.0.12 the pictures and text is out of alignment. :(

Another problem that I'm having is that when I resize my browser window the images move and everything falls out of alignment. I want it to be that when I resize everything stays organized and readable.

Some please take a look at my code: Project

Yes I know it's bare but I don't want to put in the bells and whistles before I have the structure and layout straighted out.

knight fyre 1 Junior Poster in Training

I'm trying to create a parking lot system where users can enter and exit a lot. This lot should be kept on a file(s). My code compiles but my data doesn't write to the actual file.

void SYSTEM::parkProcess()
{
	CARD IDcard;
	char lot;
	int id;
	string type;
	cout<<"Enter Parking Lot: ";
	cin>>lot;
	cout<<"Enter ID #: ";
	cin>>id;
	cout<<"Enter type: ";
	cin>>type;

	IDcard.setIdNo(id);
	IDcard.setType(type);
	ofstream newOccupant;

	if(AuthorizeEntry(IDcard,lot))
	{
		cout<<"Lot Accessed." <<endl;
		
		if(lot == 'A')
			ofstream newOccupant("lot_A.txt", ios::out);
		if(lot == 'B')
			ofstream newOccupant("lot_B.txt",  ios::out);
		if(lot == 'C')
			ofstream newOccupant("lot_C.txt",  ios::out);
		if(lot == 'D')
			ofstream newOccupant("lot_D.txt",  ios::out);
		if(lot == 'E')
			ofstream newOccupant("lot_E.txt",  ios::out);
		
		if(!newOccupant)
			cout << "Unable to create active lot file";
		else
			addToLot(newOccupant);
	}
	else
	{
		cout<<"You are not allowed to park in this parking lot." <<endl;	
	}
}

void SYSTEM::addToLot(ofstream &newOccupant)
{
	int dd, mm, yy;

	cout << "Enter the Current Date" << endl << "Day";
	cin >> dd;
	cout << "Month";
	cin >> mm;
	cout << "Year";
	cin >> yy;
	
	newOccupant << dd << mm << yy;
}
knight fyre 1 Junior Poster in Training

Problem solved, no worries.

knight fyre 1 Junior Poster in Training

I'm trying to use composition. I included the header file and made a type of the class that is contained within the owner class but I keep getting errors like this:

c:\documents and settings\cheryl\desktop\parking lot system\person.cpp(7) : error C2614: 'PERSON' : illegal member initialization: 'DATE' is not a base or member
c:\documents and settings\cheryl\desktop\parking lot system\person.cpp(7) : error C2614: 'PERSON' : illegal member initialization: 'DATE' is not a base or member
c:\documents and settings\cheryl\desktop\parking lot system\person.cpp(7) : error C2614: 'PERSON' : illegal member initialization: 'CARD' is not a base or member

What am I missing? Here's the code:

PERSON HAS DATE AND CARD

#ifndef PERSON_H
#define PERSON_H

#include <iostream>
#include <string>
#include "date.h"
#include "card.h"

using std::string;
using std::cout;
using std::endl;

class PERSON
{
protected:
	CARD DETAILS;
	DATE DOB;
	DATE DOR;

private:
	string FirstName;
	string LastName;
	string MI;
	string Gender;

public:
	PERSON();
	PERSON(CARD &, string, string, string, string, DATE &, DATE &);

	PERSON(const PERSON &);
	~PERSON();
	

	
	void setID(int);
	void setFname(string );
	void setLname(string );
	void setMi(string);

	void setGender(string );


	inline string getFname() const;
	inline string getLname() const;
	inline string getMi() const;
	

	string getGender() const;

	virtual void Show() const;
};
#endif

PERSON IMPLEMENTATION

#include "person.h"
#include "date.h"


PERSON::PERSON()
: CARD(123456, "Staff"), DATE(01,01,2000), DATE(01,01,2008)
{
	FirstName = "John";
	LastName = "Doe";
	MI = "D";
	Gender = "Male";
}

PERSON::PERSON(CARD &DETAILS, string fName, string lName, string mi, string sex, DATE &DOB, DATE &DOR)
: CARD(DETAILS), DATE(DOB), DATE(DOR)
{
	FirstName = fName;
	LastName = lName;
	MI = mi; …
knight fyre 1 Junior Poster in Training

I'm new to Javascript but not new to programming.

I find JS more time consuming because I have to manually search line by line for a single error. In C++ or C the compiler tells me the exact line number of the error or at least what the error is so I can research it.

With JS, notepad or Firefox's source viewer doesn't indicate anything. Is there any software available that will error check JS codes?

knight fyre 1 Junior Poster in Training

The problem was actually in my uppercase function. The length of the returning string was always +1 than what it should be or at the array limit depending on what the user entered. In my case if I entered "yes" in my char progress[4] array the length would be three + the null character but when I entered no the size of the modified array would be three, hence different from "NO" which is only two characters.

I settled with using a simple "y" for yes and "n" for no combined with the toupper() function in the ctype.h file.

knight fyre 1 Junior Poster in Training

I downloaded BitMeter a few hours ago to check if my bandwidth was being used without my knowledge. To my unpleasant surprise it was. I turned off my web browser and I started no programs yet DL rates fluctuated between 5 - 15 kb/s per second and upload rates with half that. I restarted my computer and logged in, left it running for 90 minutes and when I got back it said I DL'ed 45 mbs and uploaded about 15 mbs!!

Is it possible that I'm mistaken and this is a natural occurrence? How do I locate what files are actually being sent and received and what program is using them?

PS: There is only one machine in my house with one modem and no wireless router. I'm using a 5mb cable dsl connection.

knight fyre 1 Junior Poster in Training

Why doesn't it work when I enter "NO"?

do{
      	printf("\n\nDo you wish to continue (yes or no): ");
	   	uppercase(fgets(progress, sizeof progress, stdin));
         fflush(stdin);

         ((strcmp(progress,"YES")!= 0 && strcmp(progress,"NO")!= 0)?printf("\nOnly 'yes' or 'no' will be accepted!\n"):printf("\n"));

      }while(strcmp(progress,"YES")!= 0 && strcmp(progress,"NO")!= 0);
knight fyre 1 Junior Poster in Training

Okay thanks, with the getchar() function there's no need for the fflush(stdin).

knight fyre 1 Junior Poster in Training

When I use stdout the program does not allow me to enter the Patient's Name but simply moves on...

I know those two methods will work but I want to understand what the real difference between them is and how it affects to overall program in terms of efficient coding.