I'm going to be rich! Anyone else want to help me for a cut?

Page 4 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

Ameesh

Lifer
Apr 3, 2001
23,686
0
0
using System;
using System.IO;
using System.Text;
using System.Collections;

namespace DocSplitter
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
string inputPath = @"c:\temp\input.txt";
string outputPath = @"c:\temp\output.txt";

// if file doesn't exist bale.
if (!File.Exists(inputPath))
{
Console.WriteLine("You are stupid, put a file at location: " + inputPath + " or this program wont work!\n");
return;
}

// Open the stream and read it back.
using (StreamReader srIn = new StreamReader(inputPath))
{
ArrayList words = new ArrayList();

try
{
string line;
while((line = srIn.ReadLine()) != null)
{
foreach (string word in line.Split())
{
// adding words to list so i can iterate over it.
words.Add(word);
}
}

while(words.Contains(""))
{
words.Remove("");
}

words.TrimToSize();

using(StreamWriter srOut = new StreamWriter(outputPath))
{
int index = 0;

while(words.Count != 0)
{
if(words.Count > 70)
{
index = 70;
srOut.Write(((string)words[index]) + " ");
words.RemoveAt(index);
words.TrimToSize();
}
else
{
index = 71 % words.Count;
srOut.Write(((string)words[index]) + " ");
words.RemoveAt(index);
words.TrimToSize();
}


}
srOut.Flush();
}
}
catch (Exception e)
{
Console.Write("Something bad happened OMGWTFBBQ\n");
}

}

return;
}
}
}
 

Evadman

Administrator Emeritus<br>Elite Member
Feb 18, 2001
30,990
5
81
Originally posted by: 540mb
Why not??
Did you try it? There are a few things wrong with it. For one thing, the Split function is not available unless you are programming with VB6 or later, So VBA &amp; VB5 and less are SOL with it. second, That will not return the 71st character because apparently, you are bad at basic math such as subtraction. I suggest a refersher in 2nd grade. 3rd, you hardcoded in the numbers, so there is zero modularity in it. 4th, I don't see a function that returns every Nth character.

Yes, I am a d!ck, just like Nik. We get along well. I hope with me making fun of your subtraction skills, Nik will let me into his bed tonight :heart:
 

NikPreviousAcct

No Lifer
Aug 15, 2000
52,763
1
0
Originally posted by: Evadman
Originally posted by: 540mb
Why not??
Did you try it? There are a few things wrong with it. For one thing, the Split function is not available unless you are programming with VB6 or later, So VBA &amp; VB5 and less are SOL with it. second, That will not return the 71st character because apparently, you are bad at basic math such as subtraction. I suggest a refersher in 2nd grade. 3rd, you hardcoded in the numbers, so there is zero modularity in it. 4th, I don't see a function that returns every Nth character.

Yes, I am a d!ck, just like Nik. We get along well. I hope with me making fun of your subtraction skills, Nik will let me into his bed tonight :heart:

:heart:
 

jman19

Lifer
Nov 3, 2000
11,222
654
126
Originally posted by: Nik
Originally posted by: Evadman
Originally posted by: 540mb
Why not??
Did you try it? There are a few things wrong with it. For one thing, the Split function is not available unless you are programming with VB6 or later, So VBA &amp; VB5 and less are SOL with it. second, That will not return the 71st character because apparently, you are bad at basic math such as subtraction. I suggest a refersher in 2nd grade. 3rd, you hardcoded in the numbers, so there is zero modularity in it. 4th, I don't see a function that returns every Nth character.

Yes, I am a d!ck, just like Nik. We get along well. I hope with me making fun of your subtraction skills, Nik will let me into his bed tonight :heart:

:heart:

Does this explain the first line in Nik's sig?
 

ViRGE

Elite Member, Moderator Emeritus
Oct 9, 1999
31,516
167
106
Originally posted by: Nik
Originally posted by: ViRGE
Originally posted by: Nik
Some guy buried a shiotload of gold and silver. Roughly about 30 million worth. He left an incripted message with a best friend of his and said that if no one returned for it in 10 years (after the civil war was expected to be over) that he would be mailed a decription key. The guy never got it and has since died. I have a copy of the encrypted location.
I thought the Declaration of Independence was the decryption key, or am I thinking of something else?

Bingo.

It's called the Beale Papers. Google it. More info can be found here. The upcoming movie National Treasure was based on this story.
Hell yeah! Something I learned in 3rd grade actually came in handy.
 

540mb

Senior member
Jun 2, 2003
207
0
0
Originally posted by: Evadman
Originally posted by: 540mb
Why not??
Did you try it? There are a few things wrong with it. For one thing, the Split function is not available unless you are programming with VB6 or later, So VBA &amp; VB5 and less are SOL with it. second, That will not return the 71st character because apparently, you are bad at basic math such as subtraction. I suggest a refersher in 2nd grade. 3rd, you hardcoded in the numbers, so there is zero modularity in it. 4th, I don't see a function that returns every Nth character.

Yes, I am a d!ck, just like Nik. We get along well. I hope with me making fun of your subtraction skills, Nik will let me into his bed tonight :heart:

HAHAHAH you are RETARDED. You need to learn how to code. I just ran my code and it works perfectly. So I think you need to shut up and learn how the MOD function works. Damn some people are just so stupid. And wow, you pointed out it doesn't work earlier than vb6....you want a cookie?
 

Evadman

Administrator Emeritus<br>Elite Member
Feb 18, 2001
30,990
5
81
Originally posted by: 540mb
HAHAHAH you are RETARDED. You need to learn how to code. I just ran my code and it works perfectly. So I think you need to shut up and learn how the MOD function works. Damn some people are just so stupid. And wow, you pointed out it doesn't work earlier than vb6....you want a cookie?
Really? I must be retarded. I know how Mod works, along with everyone else on the planet except you. The problem is you are using it incorrectly. it will not return every 71st character at all. Nope. That is why I said you had a subtraction problem.

If you can not tell that when debugging it, I pity you. You make a mistake I deal with other people doing all damn day. People who think they know how to use arrays in for/next loops. Your array has a lower limit of 0. ZERO. That means that you are returning the 72nd array element when x=71.

In addition, since you are using the Mod function incorrectly, you will always return the first character. Last i checked, the forst character is not the 71st character. The problem is "0 mod 0" is ALWAYS 0, so you get an incorrect true on the first character.

If you don't believe me, you can test it real easy. Change the 71 to 6 to return every 6th word. Then submit string "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"

The correct answer is "6 12"
the answer your code gives is "1 7 13 " Notice your program can not count, and adds a space at the end as well.

So, who needs to learn how to code?
 

Bigblades

Senior member
Mar 17, 2004
296
0
0
If this guy gets rich, he totally needs to have an ATOT party.

Where we all beat him to with our own deflated ego's.
 

540mb

Senior member
Jun 2, 2003
207
0
0
Originally posted by: Evadman
Originally posted by: 540mb
HAHAHAH you are RETARDED. You need to learn how to code. I just ran my code and it works perfectly. So I think you need to shut up and learn how the MOD function works. Damn some people are just so stupid. And wow, you pointed out it doesn't work earlier than vb6....you want a cookie?
Really? I must be retarded. I know how Mod works, along with everyone else on the planet except you. The problem is you are using it incorrectly. it will not return every 71st character at all. Nope. That is why I said you had a subtraction problem.

If you can not tell that when debugging it, I pity you. You make a mistake I deal with other people doing all damn day. People who think they know how to use arrays in for/next loops. Your array has a lower limit of 0. ZERO. That means that you are returning the 72nd array element when x=71.

In addition, since you are using the Mod function incorrectly, you will always return the first character. Last i checked, the forst character is not the 71st character. The problem is "0 mod 0" is ALWAYS 0, so you get an incorrect true on the first character.

If you don't believe me, you can test it real easy. Change the 71 to 6 to return every 6th word. Then submit string "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"

The correct answer is "6 12"
the answer your code gives is "1 7 13 " Notice your program can not count, and adds a space at the end as well.

So, who needs to learn how to code?


Yes you are right on the 71. I meant to put in 70 (hit the wrong key, they are right next to each other). And I left the first one in (0 mod 0) because I was lazy. The code was mean to be very simple and show an easy way to do it.
 

DAGTA

Diamond Member
Oct 9, 1999
8,175
1
0
I think the retarded part is that you people just got suckered into doing Nik's homework for him. Really, this would have been SIMPLE to do by hand for 2000 words... but he wanted a program.
 

jman19

Lifer
Nov 3, 2000
11,222
654
126
Originally posted by: 540mb
Originally posted by: Evadman
Originally posted by: 540mb
HAHAHAH you are RETARDED. You need to learn how to code. I just ran my code and it works perfectly. So I think you need to shut up and learn how the MOD function works. Damn some people are just so stupid. And wow, you pointed out it doesn't work earlier than vb6....you want a cookie?
Really? I must be retarded. I know how Mod works, along with everyone else on the planet except you. The problem is you are using it incorrectly. it will not return every 71st character at all. Nope. That is why I said you had a subtraction problem.

If you can not tell that when debugging it, I pity you. You make a mistake I deal with other people doing all damn day. People who think they know how to use arrays in for/next loops. Your array has a lower limit of 0. ZERO. That means that you are returning the 72nd array element when x=71.

In addition, since you are using the Mod function incorrectly, you will always return the first character. Last i checked, the forst character is not the 71st character. The problem is "0 mod 0" is ALWAYS 0, so you get an incorrect true on the first character.

If you don't believe me, you can test it real easy. Change the 71 to 6 to return every 6th word. Then submit string "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"

The correct answer is "6 12"
the answer your code gives is "1 7 13 " Notice your program can not count, and adds a space at the end as well.

So, who needs to learn how to code?


Yes you are right on the 71. I meant to put in 70 (hit the wrong key, they are right next to each other). And I left the first one in (0 mod 0) because I was lazy. The code was mean to be very simple and show an easy way to do it.

Bwahahha nice backpeddling. You got owned, admit it.
 

Mean MrMustard

Diamond Member
Jan 5, 2001
3,144
10
81
Originally posted by: Tremulant
That shouldn't be too hard. I haven't written anything in ~2.5 years, but I did enough to know that's doable. I'd take a shot at it if I had C++ installed, although it's probably also doable in BASIC.

WTF???

Damn guys!

This should easily be done in VBA.

I'm disappointed in you, Nik.
 

Evadman

Administrator Emeritus<br>Elite Member
Feb 18, 2001
30,990
5
81
Originally posted by: 540mb
HAHAHAH you are RETARDED. You need to learn how to code. I just ran my code and it works perfectly. So I think you need to shut up and learn how the MOD function works. Damn some people are just so stupid. And wow, you pointed out it doesn't work earlier than vb6....you want a cookie?

Originally posted by: 540mb
Yes you are right on the 71. I meant to put in 70 (hit the wrong key, they are right next to each other). And I left the first one in (0 mod 0) because I was lazy. The code was mean to be very simple and show an easy way to do it.

Wait a sec, I am confused now. You said it worked perfectly. Forgive me for saying so, but your code is so fubared that it returned exactly ZERO correct words out of ANY possible set, exactly as I pointed out after you called me a retard and saying it works perfectly. It didn't even get ONE correct. So you went from you saying it was PERFECT, to you saying "I hit the wrong key". Well, you said you ran it, so you should have noticed INSTANTLY that it was wrong. Guess your reading comprehension skills are a little lacking too. Better add a 4th grade refresher to the 2nd grade subtraction refresher while you are at it.

In addition, You said I "You need to learn how to code" and "need to shut up and learn how the MOD function works", but you must have forgotten how it works because it incorrectly returns the first character, and didn't remember until I pointed it out to you.

So, in reply to your first reply, I have 4 questions for you.

1. Who is retarded?
2. Who needs to learn how to code?
3. Who needs to shut up and learn how the Mod function works?
4. What people are just so stupid?

As for your last question, "And wow, you pointed out it doesn't work earlier than vb6....you want a cookie?" Absolutely. I love cookies. :heart:
 

NikPreviousAcct

No Lifer
Aug 15, 2000
52,763
1
0
Originally posted by: ELP
Originally posted by: Tremulant
That shouldn't be too hard. I haven't written anything in ~2.5 years, but I did enough to know that's doable. I'd take a shot at it if I had C++ installed, although it's probably also doable in BASIC.

WTF???

Damn guys!

This should easily be done in VBA.

I'm disappointed in you, Nik.

I haven't done VB in years. I have a VB book sitting in the cubby hole of my desk, to my right. But it would have taken me days to dig up a new HDD from my room somewhere, install WinXP, install VisualStudio.NET (the only edition I have left) and learn to use VB again.
 

Ameesh

Lifer
Apr 3, 2001
23,686
0
0
Originally posted by: Nik
Originally posted by: ELP
Originally posted by: Tremulant
That shouldn't be too hard. I haven't written anything in ~2.5 years, but I did enough to know that's doable. I'd take a shot at it if I had C++ installed, although it's probably also doable in BASIC.

WTF???

Damn guys!

This should easily be done in VBA.

I'm disappointed in you, Nik.

I haven't done VB in years. I have a VB book sitting in the cubby hole of my desk, to my right. But it would have taken me days to dig up a new HDD from my room somewhere, install WinXP, install VisualStudio.NET (the only edition I have left) and learn to use VB again.

you could have done it easily in perl too on your linux machine
 

NikPreviousAcct

No Lifer
Aug 15, 2000
52,763
1
0
Yeah, I realize that. However, I didn't have the umph to attempt learning Perl. Easy to learn? Maybe I should. I need some proggies to do some simple tasks automatically on my box. I used to build things here and there in VB to automate simple tasks in XP. I need to start doing the same thing here.
 

Ameesh

Lifer
Apr 3, 2001
23,686
0
0
Originally posted by: Nik
Yeah, I realize that. However, I didn't have the umph to attempt learning Perl. Easy to learn? Maybe I should. I need some proggies to do some simple tasks automatically on my box. I used to build things here and there in VB to automate simple tasks in XP. I need to start doing the same thing here.

if you are gonna continue using a *nix box you need to either learn shell scripting or perl, i'd say perl as its a little more versatile. ive been using perl on linux for the last ~1.5 years. its useful but ugly
 

NikPreviousAcct

No Lifer
Aug 15, 2000
52,763
1
0
I'm fairly adept with using the shell. I can do really easy things like FTPing, chmodding files, and I've done a few ./configure / make install / install things for a couple other proggies. I learn as I go, I guess.
 

ragazzo

Golden Member
Jan 9, 2002
1,759
0
0
Originally posted by: Ameesh
Originally posted by: Nik
Yeah, I realize that. However, I didn't have the umph to attempt learning Perl. Easy to learn? Maybe I should. I need some proggies to do some simple tasks automatically on my box. I used to build things here and there in VB to automate simple tasks in XP. I need to start doing the same thing here.

if you are gonna continue using a *nix box you need to either learn shell scripting or perl, i'd say perl as its a little more versatile. ive been using perl on linux for the last ~1.5 years. its useful but ugly


ActivePerl works nicely on Windows.

 

DAGTA

Diamond Member
Oct 9, 1999
8,175
1
0
Originally posted by: Nik
I'm fairly adept with using the shell. I can do really easy things like FTPing, chmodding files, and I've done a few ./configure / make install / install things for a couple other proggies. I learn as I go, I guess.

Learn grep and sed, too, if you aren't familiar with them.
 

NikPreviousAcct

No Lifer
Aug 15, 2000
52,763
1
0
I should sit down and read through Unix in a Nutshell which is also sitting in my desk cubby. I've got a practical guide to Java, too. I took a unix class in college and vaguely remember grep, but I've never heard of sed.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |