Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - QwazyWabbit

Pages: 1 ... 62 63 64 65 66 67 68 69 70 71 [72] 73 74 75 76 77 78 79 80 81 82 ... 85
1066
Quake / Re: to console (dos prompt)
« on: February 01, 2009, 02:17:16 PM »
If it's a true quote all parts of it are important since they are a whole. You might shorten it to one sentence but G.C. was pretty succinct as it was. You might find something shorter if you look.

1067
Trouble Shooting / Re: Need help with a C++ program...
« on: February 01, 2009, 09:45:21 AM »

As for quadz.. wtf is ruby? lol


"Ruby, don't take your love to town."

1068
Trouble Shooting / Re: Need help with a C++ program...
« on: February 01, 2009, 08:40:56 AM »
In that case an arrayless version might be:

Code: [Select]
int main (int argc, char * const argv[])
{
string number;

cout << "Enter exactly 7 digits" << endl;
cin >> number;
if (number.length() > 7)
cout << "Too many digits!" << endl;
else
cout << number << endl;
}

The cin class only returns once the stream is filled by the user and the termination key is pressed. I have never used it to capture chars, but there may be a member of that class that can do that for you.  If that is the case you can copy char into the string array and loop while char is not "\n". Then evaluate the length of the filled string. Making the string number into an int number is left as an exercise for the student. :)

1069
Trouble Shooting / Re: Need help with a C++ program...
« on: January 31, 2009, 12:59:39 PM »
Reaper, it looks like you never tested your sample. It won't compile as-is and the digit test always fails.

Here is a new program in valid C++ that does what Nautica described. It uses isdigit() from the C runtime.
Code: [Select]
#include <iostream>
#include <cstdlib>
#include <string>

using namespace std;

// this function receives user input as a string and checks
// for valid digits. If all valid decimal digits, return the string,
// else return an empty string.
string getnumber(void)
{
string number; //declares string
int i; //declares int for the loop

cin>>number;    // input a string

i = 0; // initialize loop variables close to top of the loop
while(i < number.length()) //go through all the letters except the termination character
{
if(!isdigit(number[i])) // are all valid digits 0 thru 9?
return "\0"; // invalid digit found, return empty string
i++;
}
return number; // return a valid number string
}

// call the getnumber function 7 times and print the results
int main(int argc, char *argv[])
{
int i;
const int maxnum = 7;
int count; //count the valid numbers returned
string number[maxnum];

count = 0;
for(i = 0; i < maxnum; i++)
{
cout << "Enter a number : ";
number[i] = getnumber();
if(number[i] == "\0")
{
cout << "That isn't a decimal number!!\n";
break;
}
count++;
}
cout<<"\n"<<i<<" valid numbers received:\n";
for (i = 0; i < count; i++)
cout<<number[i]; // print the numbers
cout<<"\n";
return 0;
}

This code is tested and works in OS/X, Windows and Linux.

1070
Trouble Shooting / Re: Need help with a C++ program...
« on: January 29, 2009, 09:47:43 PM »
Hey hows everyone been..?

Haven't been around the Q2 community for awhile and what better way
to come back then to ask for help  ;D

Anyway, I'm having a bit of trouble with the following code.

You are to input 7 numbers then print, however if you input anything other than a number
higher than 7 it says it's to high. I need user input to type in any 7 numbers from 0-9
then print all 7 on one line. If they input more than 7, it's to give an error then exit.

Heres what I have thus far.

Code: [Select]
#include <iostream.h>

int main()
{
   const int x = 7;
   int count[x];
   int num;
   for (int num=0; num<7; num++)
   {
                     cout << "Enter exactly 7 numbers" << endl;
                     cin>>count[num];

                     if(count[num]>x)
                     cout<<"Too many numbers entered "<<endl;
                     else
                     cout << "\nThats it."<<endl;
                     cout<<"\ninputs: " << count[num] <<"\n";
                   
                   
                         
                   
        system("PAUSE");
    return(0);
}
}


Any help would be greatly appreciated.

p.s. hey console.. ltns :)



It's a bit unclear to me what you are really trying to accomplish. You are initializing an array of 7 ints, (count[ x ], where x = 7, arrays always begin with index 0) and then you are accepting inputs to num but then your loop breaks on the first entry. You are also redefining num as int num in the loop after it was already defined as int in the local variables. Redefining variables this way is a Bad Practice at best and a fatal error to a proper C++ compiler.

Are you inputting 7 NUMBERS in 7 lines or are you inputting 7 digits on a line? If the latter, you don't really need the array. Also, the variable x is not needed unless you are intending to parameterize that value as a non-constant. You also put the prompt for 7 numbers inside the loop, causing it to be sent 7 times if the loop executes that many times, I am not sure that is your intent. Your return(0) is also in the wrong place, it should come after the closing brace of the for() loop.

You also have a potential buffer overflow: you cin>>count[num] and then test to see if num is greater than 7. If num were greater than 7 at that point, you would already have written user input outside the space allocated for the count array, clobbering any data nearby. Potentially fatal to your program or an intermittent bug to say the least.

All the solutions offered so far, while requiring C++ to implement, are not strictly C++ nor good examples of what you have described but failed to code. Kren.Z' solution covers the buffer overflow issue but prompts for corrections not described in your "specification" of what the module is supposed to do. Reaper's solution pulls in string.h (not proper C++) It should be <string>. Reaper also calls istream::getline without proper argument specifying the size of the buffer, leading to a potiential buffer overflow. Reaper's code also uses "ASCII" constants and modern C++ is Unicode or ought to be and strings are of type _T and you should forget all about ASCII and char arrays when writing C++ for portability.

Your choice of count, to receive the "numbers" but use of num to count the numbers left me feeling upside down.

All in all the whole thing left me a little confused about what you are really trying to accomplish. :)



1071
/dev/random / Re: Another Rodney King?
« on: January 22, 2009, 02:21:29 PM »
Accidental killing of a human being involving reckless disregard in California is manslaughter. Probably a 3 to 5 year sentence. Not sure, might be less. It is not murder unless the D.A. charges it as such but then he has to prove forethought to get 1st degree or heat of passion to get 2nd degree. My guess is manslaughter charge and upon conviction, a light sentence or probation. Probably a nice civil suit in there as well.

1072
Politics / Re: Jews attacking Gaza
« on: January 15, 2009, 06:10:54 PM »
Arafat. :)

1073
Trouble Shooting / Re: Coders Please Read...
« on: January 06, 2009, 09:37:48 PM »
Is there an advantage to that vs. just doing a block of xxx.xxx.xxx.000/24 or xxx.xxx.000.000/16? I suppose you don't end up chasing every block he appears on but grabbing whole groups like that could grab some collateral innocents, yes?

1074
/dev/random / Re: Amazing Facts.
« on: January 01, 2009, 01:09:28 AM »
Did you know 74% of all statistics are made up on the spot?
Only 2% of individuals are able to discern which ones are not.

1075
Tech Junkie Lounge / Re: windows vs. linux system call complexity
« on: December 18, 2008, 03:53:06 PM »
SYSTEM calls or FUNCTION calls? The images are too small to be useful.
Yep, one diagram has more lines and bubbles than the other but what are the functions in the bubbles?
What percentage of the total functions called are critical to serving the page vs. simply logging the activity?
What proportion of the total take "untrustworthy" user input?
If you can't control the input to the functions then you cannot exploit them.

Is it easier to analyze 50 functions for exploitation or 200 functions? Yes, if one assigns some "probability" to a function's exploitability then as a system 200 calls of any type can be less secure but one can also assign a zero probability to some of them (knowing they are not vulnerable) but an attacker may not be able to "know" that, he would have to spend time looking for vulnerabilities in more functions, not just randomly pick one. He has more cherries in the basket but he doesn't know which ones are sweetest until he tries them.

I also see a lot of cascade lines in the Apache diagram where there is a series of calls (10+) in a row before some terminus, would it be possible to pass arguments into the initial function in that chain such as to cause a failure in the 7th function that could allow an attacker some advantage that looking at the individual functions would not reveal?

Simply counting "calls" is not a valid metric for assessing the securability or stability of a system. It makes it hard to TEST the system but it doesn't invalidate the quality of the system if it is properly tested. If such were the case, the F-117A wouldn't fly.

1076
Jokes / Re: Funny videos
« on: December 09, 2008, 03:40:35 AM »
Video on the cheater. Has to be a setup.

"I think we got a cheater, man."

Tried, convicted, sentenced, expelled in 10 seconds on "I think". Where's the evidence? On the parking lot pavement.

Laying hands on the player and tossing him on the ground: Assault and Battery. At least 4 counts.
Laying hands on his equipment: Theft. Grand theft.
Picking him up and expelling him from the building by force or threat of force: Kidnapping.
Destroying his computer on the parking lot pavement: Vandalism, willful destruction of property.
Instigation of group assault on an individual: Disorderly conduct. Criminal conspiracy.
Keeping his gear after the fact: Unlawful conversion, theft.

3 Felonies and at least two misdemeanors in real life for a game.
Mob rule at it's finest.

The kid had grounds for suing the host organization, the individuals and the owner of the property for loss of his gear plus punitive damages. The complete absence of uniformed security on the premises to prevent the organizers from doing exactly what they did shows negligence on the part of the organization and its members and the owners of the site.

1077
That would seem to imply you also doubt there's anything genetic responsible for heterosexual attraction?

True. Maybe there is, maybe there isn't. I've yet to see anyone pinpoint where any animals instinctual actions reside. Speaking in terms of an animals instincts, that would make homosexuals genetically deficient since their natural instincts prevent them from propagating their own genes, wouldn't it? That's the same thing the Nazi's said about jews, homosexuals, and various other races anyway... so I'm going to go ahead and use this twisted brand of logic to call you a Nazi. :dohdohdoh: God damn, I should be a criminal defense lawyer!

Godwin's Law.

Thread is officially dead. :)
Zeig Heil!

1078
/dev/random / Re: 10 Lies that Apple makes...
« on: December 03, 2008, 04:07:19 PM »
Amusing. My iMac 20 inch came with Tiger (I think it was Tiger, 10.4 something, not the new one) and a TRIAL copy of Microsoft Office for Mac and a TRIAL copy of Intuit Quicken for Mac. Hmm.... no trialware eh?


1079
Quake / Re: Vanilla mymap :(
« on: November 17, 2008, 02:52:50 PM »
Unreal Tournament '99 has a popup menu at then end of a game that allows users to scroll through the maplist or somehow select one they like, other users vote accordingly and a realtime display of the maps being voted on and the vote count per map is shown. One can go with the majority or make another selection, I think the whole time period is 20 or 30 seconds.

Not sure how one could implement that in Q2's menu. It's such a tiny box and doesn't have a very good scroll feature. 2000 maps on a server can be hard to scroll client-side, ya think? :) Maybe a way to track most frequently voted maps and put them at the top?


1080
Quake / Re: Vanilla mymap :(
« on: November 17, 2008, 04:36:11 AM »
I wrote two modules for LOX, a voting system and a map selection system that go hand in hand. They are in-mod code so they are not useful for mods who's source is long gone but it might serve as a model for an external system.

The vote code allows a player to initiate only two votes per map, if he can't get it passed in two tries, he's done until the next map. A cvar controls how many tries he gets. It also has built in timers for duration of the vote and how often it announces a vote in progress. The configuration is parameterized so admins can change the spammyness of the announcements and the number of votes a player can initiate.

The map list module allows admins to configure a maplist.txt file for map rotation instead of an array of names. There's also a load-sensitive map rotation that chooses families of custom maps according to how many players are on the server but this has proved to be less useful.

http://www.clanwos.org/forums/viewforum.php?f=1

Maplist Management Module for Quake 2 Servers
and
A Modular Voting System for Q2 Servers

Pages: 1 ... 62 63 64 65 66 67 68 69 70 71 [72] 73 74 75 76 77 78 79 80 81 82 ... 85