death_oclock 103 Posting Whiz

Why don't you explain why you need to do this? It is likely there are much better ways of doing whatever it is, unless you are trying to provide a very low level service.

death_oclock 103 Posting Whiz

Then instead of setting the input variable to "18-2-21" (obviously not what csurfer intended), use fgets to get a line of user input. Also you could use sscanf() as long as you make sure to check its return value!

death_oclock 103 Posting Whiz

Really, Notepad++ didn't display the hyphen? That's very strange.

death_oclock 103 Posting Whiz

You can use a tm structure for the date of birth, convert it with mktime(), and subtract that from time(). Then convert your answer back into a tm struct.

death_oclock 103 Posting Whiz

You're not going to learn anything by having me give you code. Find a good tutorial. Besides, i'm sure there's examples of this game all over the web anyway.

death_oclock 103 Posting Whiz

Sorry, wrong forum! I'm sorta out of it.

death_oclock 103 Posting Whiz

Where exactly are you calling session_start()? And that error just means you have some sort of output (check for spaces, newlines before your <?php tags) before you have called session_start(). If you have to do this, consider output buffering.

death_oclock 103 Posting Whiz

A bubble sort but with the comparison flipped.

death_oclock 103 Posting Whiz

Compress the sound beforehand, then apply the gain. Try here for some info on dynamic range compression.

StuXYZ commented: couple of nice pointers to stuff. +4
death_oclock 103 Posting Whiz

Your post describes each step perfectly. Computer generates a number, user makes a guess, computer tells what range the number it is in, and so on. If you're problem is writing the code, learn some c++ first.

death_oclock 103 Posting Whiz

Definitely consider using a compression technique. Otherwise, scaling up can cause distortion. Its gross.

death_oclock 103 Posting Whiz

You could probably pull it off with some clever javascript. That solution would be more inline and portable than a mandatory plugin anyway.

death_oclock 103 Posting Whiz

Create a counter of how many "levels" of braces you are in. What do you mean by reposition? To see if they are part of a block, look at the statement before the opening brace. If it is a for loop, if statement, etc. then it is valid.

death_oclock 103 Posting Whiz

That looks like a good implementation to me, and without the comments its really quite short and sweet.

death_oclock 103 Posting Whiz

Have an array for each possible number, have each element be a flag as to whether the number at that index has been generated.

death_oclock 103 Posting Whiz

If you can't find it, make it yourself. It's not too difficult. Use an existing image library (DevIL works well, covers almost any format). Then get the image data and apply a rotation. Google/Wikipedia will have the math you need for rotation.

death_oclock 103 Posting Whiz

I don't know whether DevIL would work with your compiler, you're welcome to try it, but TurboC++ is terribly outdated.

death_oclock 103 Posting Whiz

A simple solution (but will give more flexibility): define two arrays, one with source characters and the other with destination characters to replace those with. Arrays are matched by indices. Just make sure there are no repeats or decryption may not work correctly.

death_oclock 103 Posting Whiz

1. Get a more recent compiler
2. DevIL works well (you may need to learn some WinAPI stuff depending on how much control you really want)

death_oclock 103 Posting Whiz

Sounds like edge detection would help.

death_oclock 103 Posting Whiz

They should be put in .c files? I never learned great project design.

death_oclock 103 Posting Whiz

As I said, take a look at the sample architecture for download. It will give you something to model your own code after.

death_oclock 103 Posting Whiz

in the source file..u can just go..

#include<string>
#include...
#include"someheader.h"
#include"anotherheader.h"

and remove #include<string> in the "someheader.h"

If you had read any of the previous posts, you would have seen this point:

So, my question is: why would you want to require people to follow extra instructions just to use your header file?

death_oclock 103 Posting Whiz

Wow, I was just refencing things by all the wrong names. I knew it was something stupid like that! Thanks for the catch, me_ansh.

death_oclock 103 Posting Whiz

Use code tags, tell which line is producing that error.

death_oclock 103 Posting Whiz

Visual C (2008) is acting as if I never included a header file (wave.h) that I am using, but the #include statement is definitely there. Here's my main (BPM analyze.c):

#include "stdafx.h"

#include "common.h"
#include "sound.h"
#include "wave.h"

int main(int argc, char* argv[])
{
	SAMPLE samples[2];
	unsigned int i, j;
	WAV_FILE file;
	FRAME *frames;

	getWaveFile(&file, "Lobby.wav");
	extractFrames(frames, &file, 0, 1);

	//printf("32 bit: ");
	for(i = 0; i <= 1; i++)
	{
		for(j = 0; j < file->info->numChannels; j++)
		{
			printf("%d ", frames[i][j]);
		}
	}

	getchar();
	return 0;
}

Common.h (probably not the issue):

#ifndef COMMON_H
#define COMMON_H

#define MAX(a, b) ((a > b) ? a : b)

typedef enum{false, true} bool;

#endif

Sound.h:

#ifndef SOUND_H
#define SOUND_H

typedef unsigned int SAMPLE_32BIT;
typedef unsigned int SAMPLE_24BIT;
typedef unsigned short SAMPLE_16BIT;
typedef unsigned char SAMPLE_8BIT;
typedef union
{
	SAMPLE_32BIT _32bit;
	SAMPLE_24BIT _24bit;
	SAMPLE_16BIT _16bit;
	SAMPLE_8BIT _8bit;
} SAMPLE;
typedef SAMPLE **FRAME;

#endif

Wave.h:

#ifndef WAVE_H
#define WAVE_H

typedef struct
{
	unsigned short formatTag;
	unsigned short numChannels;
	unsigned int samplesPerSec;
	unsigned int bytesPerSec;
	unsigned short blockAlign;
} WAVE_INFO;
typedef struct
{
	WAVE_INFO *info;
	SAMPLE *data;
} WAVE_FILE;

bool getWaveData(WAVE_FILE *file, char *filename)
{
	// function body, not important
}

void extractWaveFrames(FRAME *frames, WAVE_FILE *file, unsigned int startFrame, unsigned int endFrame)
{
	// function body, not important
}

#endif

And here's Visual C's complaints:

bpm analyze.c(11) : error C2065: 'WAV_FILE' : undeclared identifier
bpm analyze.c(11) : error C2146: syntax error : missing ';' before identifier 'file'
bpm analyze.c(11) : …
death_oclock 103 Posting Whiz

I was just wondering what your "wrong" comment was in response to. If you were saying that standard c++ headers in fact do not use #ifndef statements, that would be important. I see that is not the case.

death_oclock 103 Posting Whiz

For the sake of information, are you saying I am wrong about headers, or just spouting your opinion on C++?

death_oclock 103 Posting Whiz

Use fgets to read one line, strtok to split each line between spaces, sscanf to break apart each value. Do this all in a loop to read multiple lines.

death_oclock 103 Posting Whiz

Good point. With both under your belt, not only will it strengthen your overall programming knowledge, the flexibility it would give you would be more impressive on a resume.

death_oclock 103 Posting Whiz

The first article you posted has a very concise description of this layout. It describes the class architecture you will use (study object oriented programming in PHP), including the use of abstract, super, and sub classes. It also defines the most common and most helpful methods to define for each class. For the purpose of actual coding, these are the basic things you need to know:

Model: SQL functions. Learn SQL itself and the PHP functions for working with your database of choice (ie. MySQL, Oracle, whatever).

View: Templates, optionally

Controller: OOP concepts should cover it as this just connects the other two classes in a logical manner.

And definitely look at the sample architecture for download at the bottom of that page.

death_oclock 103 Posting Whiz

And your origional question seemed to be about whether or not you could include <string> multiples: well all the standard headers use #ifndef too! Cool, right?

death_oclock 103 Posting Whiz

That would be the correct way to call it. The function would still not work as planned, as you set hours to zero inside calctotal. The function itself should be something like:

float calctotal(float hours)
{
	
	// got rid of: int hours=0;
	
	

	if (hours < 3 && hours > 0)
		total = 2;
	else
		if (hours >= 19 && hours <= 24)
			total = 10;
		else
			if (hours>3 && hours < 19)
				total = (hours-3) * .5 + 2;
			else
				if (hours > 24){
				printf("invalid input......try again!\n");
				scanf("%d",&hours);
				
	}
				return total;
				
}
death_oclock 103 Posting Whiz

Use fgets to read one line, strtok to split it on spaces, '=', etc.

death_oclock 103 Posting Whiz

If you don't know how to open the file, read about fopen, fclose, etc. If you don't know how to read the information, read about fgets, fread, sscanf, etc.

death_oclock 103 Posting Whiz

Even if you could use scanf for your purposes, it is better to use fgets anyway.

death_oclock 103 Posting Whiz

What is the problem with using || ? It is a completely valid part of the C language. There might be some obscure way of doing the same comparison without it, but it would be useless to even try it.

death_oclock 103 Posting Whiz

Open your php.ini file, look for the values of SMTP and smtp_port. Change these to the appropriate server and port. If you can't access php.ini (hosted site) use ini_set() like the error suggested.

death_oclock 103 Posting Whiz

I haven't worked with Open-Realty so I really can't tell you. All I suggest is learn PHP and SQL thoroughly and study the code you already have thoroughly. This is not exactly a simple fix. Or, you might want to google to see if anyone else has done this and provided code.

death_oclock 103 Posting Whiz

Why yes you can! (I suggest learning HTML more thoroughly)

die("File name is too long please rename your file shorter and then upload again: go <a href=\"previous.html\">back</a>\n");

Replace previous.html with the page you want to send the user to.

death_oclock 103 Posting Whiz

You're right, that's different from:

char sudoku[] = { '0', '0', '1', '0', '0', '0', '0', '0', '9',
                  '6', '0', '8', '7', '9', '4', '0', '2', '0',
                  '0', '0', '9', '1', '0', '5', '0', '0', '0',
                  '0', '0', '0', '6', '7', '0', '0', '0', '2',
                  '0', '8', '0', '0', '0', '0', '0', '6', '0',
                  '0', '9', '0', '4', '3', '0', '0', '5', '0',
                  '0', '0', '4', '0', '0', '0', '0', '1', '0',
                  '9', '3', '0', '0', '1', '0', '8', '4', '0',
                  '0', '0', '2', '0', '4', '3', '0', '0', '0' };

C will convert actual numbers into the ascii character at that index.
To get the char from a number:

char seven = 7 + '0';

Obviously that code is unecessary, but when working with variables it becomes useful.

death_oclock 103 Posting Whiz
struct termios chk_options;
tcgetattr(fd, &chk_options);
if(chk_options.c_cflag & CS8) printf("Eight bit mode\n");

A list of the other flags are here (11.2.4 Control Modes)

death_oclock 103 Posting Whiz

I found your site, Ezzaral, very helpful. Thank you.

death_oclock 103 Posting Whiz

What do you mean you can't make it work? Output/error messages are most helpful. And your statement would look like:

$save_name = date("d m y_s i H") . ".txt";

Check date for help formatting, pathinfo to properly get the file extension.

death_oclock 103 Posting Whiz

Sorry, I haven't tested these. The third one should be:

// Get file name from URL and remove any bad filename chars.
		$url_parts = explode('/', $url);
		$num = count($url_parts)-1;
		$file_name = $url_parts[$num];
		$badchararray = array(" ", "'", "\"", "$", "&", "%", "-", "#", "^", "*", "(", ")", "~", "@", "/", "?", "=");
		$file_name = str_replace($badchararray, "", $file_name);
		$file_name = stripslashes(strtolower($file_name));
		if(strlen($file_name) > 40)
			print("File name is too long please rename your file shorter and then upload again.\n");
		else {
			if ($append_file_name == true) {
				$save_name = $id . '_' . $file_name;
			}else {
				$save_name = $file_name;
			}
			// uploading code
		}
		// any finishing/cleaning up code you need to do

Just curious, what exactly happens with the second one?

death_oclock 103 Posting Whiz

It would seem what I need is an envelope follower. Google hasn't been much help, anyone know of any good links/tutorials?

death_oclock 103 Posting Whiz

Using system() commands is not a good idea, and windows specific functions are not a great solution either. You can use Clock() instead of sleep. Also, check out these special control characters as a way of clearing the screen.

death_oclock 103 Posting Whiz
// Get file name from URL and remove any bad filename chars.
		$url_parts = explode('/', $url);
		$num = count($url_parts)-1;
		$file_name = $url_parts[$num];
		$badchararray = array(" ", "'", "\"", "$", "&", "%", "-", "#", "^", "*", "(", ")", "~", "@", "/", "?", "=");
		$file_name = str_replace($badchararray, "", $file_name);
		$file_name = stripslashes(strtolower($file_name));
		if(strlen($file_name) > 40)
			die("File name is too long please rename your file shorter and then upload again.\n");
		else if ($append_file_name == true) {
			$save_name = $id . '_' . $file_name;
		}else {
			$save_name = $file_name;
		}

That would stop the rest of your code from executing, but it is a messy way to quit. Alternatively:

// Get file name from URL and remove any bad filename chars.
		$url_parts = explode('/', $url);
		$num = count($url_parts)-1;
		$file_name = $url_parts[$num];
		$badchararray = array(" ", "'", "\"", "$", "&", "%", "-", "#", "^", "*", "(", ")", "~", "@", "/", "?", "=");
		$file_name = str_replace($badchararray, "", $file_name);
		$file_name = stripslashes(strtolower($file_name));
		if(strlen($file_name) > 40)
			print("File name is too long please rename your file shorter and then upload again.\n");
		else {
			else if ($append_file_name == true) {
				$save_name = $id . '_' . $file_name;
			}else {
				$save_name = $file_name;
			}
			// uploading code
		}
		// any finishing/cleaning up code you need to do
death_oclock 103 Posting Whiz

How about GetAsyncKeyState? (windows specific function)

death_oclock 103 Posting Whiz

Can anyone else not stand the attitude of some people that the world owes them something and they should complain and make a scene until they get it?