code logs -> 2015 -> Fri, 27 Mar 2015< code.20150326.log - code.20150328.log >
--- Log opened Fri Mar 27 00:00:17 2015
00:34 thalass is now known as Thalass|gameses
01:41
<@Thalass|gameses>
augh such frustration. Turn on the pi, it doesn't broadcast its hostname, nor can I find what IP it's on - it won't show up on the connected devices list.
02:22
<&ToxicFrog>
Thalass|gameses: is it using DHCP?
02:25
<@Thalass|gameses>
It should be. It should also be doing that magic hostename.local thing that never bloody works. I pulled power and restarted it, and then it showed up.
02:34 Thalass|gameses [thalass@Nightstar-h1qmno.eastlink.ca] has quit [Operation timed out]
02:35 macdjord|wurk is now known as macdjord
03:15 Checkmate [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
03:18 Meatyhandbag [sebastianfe@Nightstar-dk0.5eb.224.136.IP] has joined #code
03:22
< [R]>
Hi
03:22
< Meatyhandbag>
hi
03:23
< [R]>
You had a C# question yeah?
03:24
< Meatyhandbag>
i do, but i started working on a different assignment, and visual studios only lets you keep one document open at a time
03:34
< Meatyhandbag>
https://github.com/deathbymanga/ProjectNoNameYet/blob/master/code
03:35
< Meatyhandbag>
DAMN I"M AN IDIOT. I post for help and immediately see the problem
03:35
<@celticminstrel>
...huh?
03:35
< [R]>
Rubberduck debugging
03:35
<@celticminstrel>
It only allows one document open at a time?
03:35
<@celticminstrel>
That doesn't sound right...
03:35
<@Namegduf>
Only one solution.
03:36
<@celticminstrel>
Ah, is that true, then?
03:36
<@Namegduf>
You can open more than one, though, you have to relaunch it.
03:36
<@Namegduf>
If you just pick to open it, it closes the old one.
03:36
<@celticminstrel>
I would've assumed that double-clicking a new solution would automatically launch a new instance.
03:36
<@Namegduf>
If you reopen VS you get a separate instance of VS you can open another solution in.
03:36
<@Namegduf>
I think it does.
03:36
< [R]>
Sounds quality.
03:36
<@celticminstrel>
So if you use the Open menuitem, it closes the open solution, then.
03:37
<@celticminstrel>
Okay.
03:37 * celticminstrel shrugs.
03:37
<@Namegduf>
It's Better Than Eclipse.
03:37
<@celticminstrel>
Definitely.
03:37
<@Namegduf>
XD
03:37
< [R]>
vim's still better.
03:37
<@celticminstrel>
Probably better than CodeBlocks too.
03:37
<@celticminstrel>
Not if you're me.
03:38
< Meatyhandbag>
if i put a parameter in a while loop, can i put the same parameter in the while inside it? like:
03:38
< Meatyhandbag>
while(i<1){while(i<1){}}
03:38
< Meatyhandbag>
?
03:39
<@celticminstrel>
Uh, of course?
03:39
<@celticminstrel>
By the way, the word you want is "variable", not "parameter".
03:39
< Meatyhandbag>
like, will it close them both at the same time if the parameter is met?
03:39
<@celticminstrel>
No.
03:39
<@celticminstrel>
The inner loop will terminate once the condition is met.
03:40
<@celticminstrel>
If there is anything between those two closing braces, that will then execute.
03:40
<@celticminstrel>
Then the outer loop will terminate, unless the condition is no longer met.
03:40
< Meatyhandbag>
so, what if i declare the variable at the end of the inner loop?
03:40
<@celticminstrel>
I have to wonder what would make you do this, though.
03:40
< [R]>
Why would you want to reuse `i` like that anyways? Why does C# actually spawn a second one?
03:40
<@celticminstrel>
Eh?
03:41 * celticminstrel meant the "eh" to be at Meatyhandbag's last comment, though it applies to [R]'s too.
03:41
< Meatyhandbag>
I like to reuse it because I don't want to waist lines of code defining every letter of the alphabet
03:41
<@celticminstrel>
You can define more than one per line...
03:41
< Meatyhandbag>
minstrel, like this: while(i<1){ while(i<1){} i=1}
03:42
< [R]>
int i, j; or: for (int i = 0; i < 5; ++i) { ... }
03:42
<@celticminstrel>
That's not "declaring" the variable. That's "assigning" the variable.
03:42
<@celticminstrel>
Also, have you heard of for-loops?
03:42
< [R]>
Does C# not support those constructs?
03:42
< Meatyhandbag>
i seriously hare gargon
03:42
< Meatyhandbag>
Minstrel, for loops have a set time limit
03:42
< [R]>
hate* jargon*?
03:42
< [R]>
No
03:42
<@celticminstrel>
Uh, what.
03:42
< Meatyhandbag>
it's got that i++ in it
03:43
< Meatyhandbag>
and yes R, thanks
03:43
<@celticminstrel>
That's not a time limit.
03:43
< [R]>
for (int i = 0; i < 0; ) { }
03:43
< [R]>
Perfectly valid
03:43
< Meatyhandbag>
oh, i can write a for loop without ++?
03:43
<@celticminstrel>
Yes.
03:43
<@celticminstrel>
If you need to.
03:43
<@celticminstrel>
In fact, you can put any statement there you want.
03:43
< [R]>
You can skip any of the three inner parts
03:43
< Meatyhandbag>
oh, ok
03:43
<@celticminstrel>
You could do for(int i = 1; i < 500; i = i * 2)
03:44
< [R]>
(If you leave out the middle part, it's an infinite loop)
03:44
<@celticminstrel>
You do need both semicolons no matter what.
03:44
< [R]>
Yes
03:46
< Meatyhandbag>
thanks
03:49 * Vornicus dislikes for loops with missing increments, personally
03:53
< Meatyhandbag>
ok, this is becoming a real issue in my code. I type something like Console.Write(anArrayList[x]) and I'm always getting these stupid error messages
03:54
< [R]>
Are you missing semi-colons? (hint: what error?)
03:55
< Meatyhandbag>
"Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
03:55
< Meatyhandbag>
OH!!!!!
03:55
< Meatyhandbag>
Just realized
03:56
< Meatyhandbag>
X in this example is the number of times i added something to the array (which should decide the size of it). but you need to be x-1 to be the last thing in the array
03:56
< [R]>
Yes
03:59
< Meatyhandbag>
how do i get out of the debugging mode in visual studio?
04:02
< Meatyhandbag>
had to just save my code and quit VS
04:08
<&McMartin>
There should be "Detach Debuggee" and "Stop Debugging" options under "DEBUG".
04:08
<&McMartin>
If VS was started explicitly as the debugger of course that might not be an option.
04:08
<&McMartin>
(Also, "Stop Debugging" will usually kill the attached process)
04:10 Derakon is now known as Derakon[AFK]
04:11 celticminstrel [celticminst@Nightstar-gmujup.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
04:58
< Meatyhandbag>
is there a way to create a multi-dimensional ArrayList?
04:58
< [R]>
Do you need an ArrayList specifically for this? Can an array work?
04:59
< Meatyhandbag>
arrays are fixed
04:59
< Meatyhandbag>
I need an adjustable one
04:59
< [R]>
ArrayList<ArrayList<X>> variable;
05:00 * [R] is assuming C++/Java style templates.
05:01
< Meatyhandbag>
X is the name of the ArrayList in the example right?
05:01
< [R]>
No.
05:02
< [R]>
Please don't tell me you're using untyped-generics or whatever Java was calling the things? (Or I guess whatever C# calls them)
05:02
< Meatyhandbag>
in c# you create an ArrayList like this: ArrayList name = new ArrayList();
05:02
< [R]>
You are.
05:03
< [R]>
What are you storing?
05:04
< Meatyhandbag>
I have to create a frequency distribution bar chart in c#. so i'm using a 2D string ArrayList to make it
05:04
< [R]>
Strings
05:04
< [R]>
k
05:04
< [R]>
ArrayList<ArrayList<String>> variable = new ArrayList<ArrayList<String>>(); // Does C# even need the () here?
05:05
< [R]>
That creates an ArrayList that stores ArrayLists that store Strings.
05:06
< Meatyhandbag>
c# doesn't use the <> when creating a normal ArrayList, so I have no idea
05:07
< [R]>
"normal"
05:07
< Meatyhandbag>
1D
05:07
< [R]>
It's an untyped template.
05:07
< [R]>
Don't do untyped templates.
05:07
< [R]>
ArrayList<String> is 1d.
05:07
< Meatyhandbag>
what are untyped templates
05:07
< [R]>
Templates that store any type.
05:08
< Meatyhandbag>
oh, i know that
05:08
< [R]>
Or rather, template instances that store any type.
05:08
< Meatyhandbag>
In c# the <> brackets aren't used
05:08
< Meatyhandbag>
So I'm pretty confused on what to write
05:08
< [R]>
Pretty damn sure that's false.
05:08
< Meatyhandbag>
I've been writing 1D arrays all day without <>
05:09
< [R]>
That's not an array
05:09
< [R]>
It's an ArrayList.
05:09
< [R]>
Stack<int> stack = new Stack<int>(); from the MSDN tutorial on Generics.
05:10
< [R]>
Which I'm not linking because they're being fucking retards and providing exmpales without the type at the start (had to scroll to the middle to get that)
05:10
< Meatyhandbag>
Sorry, I said array instead of arraylist
05:11
< [R]>
ArrayList. Case-sensitivity.
05:11
< Meatyhandbag>
case sensitive in the code, not in conversations
05:12
< [R]>
There's an Array type.
05:13
< [R]>
Not sure how sugary C# gets with arrays, but if it's like java, array != Array, and being case sentifve in a conversation is important.
05:14
< Meatyhandbag>
well, when I write ArrayList in c#, i haven't used a single <>
05:15
< [R]>
Because you're writting it like .NET 1.0 code.
05:15
< Meatyhandbag>
.NET 1.0?
05:15
< [R]>
Which you should be getting warnings about when it compiles.
05:16
< Meatyhandbag>
I'm not getting any warnings
05:16
< [R]>
That's even more depressing.
05:17
< [R]>
<Meatyhandbag> In c# the <> brackets aren't used <-- this isn't even correct anyways. They're supported from .NET 2.0 onwards.
05:17
< Meatyhandbag>
ok, well, in my visual studios, I am not getting any warnings and my code is operating just fine without any issues without <>
05:18
< [R]>
"I get no warnings" != "I am writting good code"
05:18
< Meatyhandbag>
"My code is operating in the manner I desire" == "My Code is good"
05:18
< [R]>
Java generates a warning for that situation, because it can, will and has cause errors.
05:19
< [R]>
It's a bug waiting to happen.
05:20 Kindamoody[zZz] is now known as Kindamoody
05:21
< Meatyhandbag>
when I write ArrayList<int> I get this warning "The non-generic type 'System.Collections.ArrayList' cannot be used with type arguments
05:22
< [R]>
It's not a generic? WTF?
05:23
< [R]>
"For a strongly-typed alternative to ArrayList, consider using List<T>. ArrayList may not always offer the best performance for a given task. See the "Performance Considerations" section in the List<T> reference topic for a discussion of the relative performance of these classes."
05:23
< [R]>
Ah
05:23
< [R]>
Yeah, use List instead.
05:24
< Meatyhandbag>
Error: The type of namespace name 'List' could not be found
05:24
< [R]>
System.Collections.Generic.List<T>
05:26
< [R]>
Ultimately though, if you want to continue using ArrayList, you just shove ArrayLists into your ArrayList
05:26
< [R]>
You'd have to do the same deal with List, just instead you're shoving Lists into the main List.
05:26
< Meatyhandbag>
Error: Using the generic type 'System.Collections.Generic.List<T>' requires 1 type arguments
05:26
< [R]>
Yes, good.
05:27
< [R]>
List<List<String>> variable = new List<List<String>>();
05:27
< [R]>
That's what you're doing right?
05:27
< Meatyhandbag>
Yes
05:28
< [R]>
On both sides?
05:28
< Meatyhandbag>
yes
05:28
< Meatyhandbag>
I'm seeing something labeled IList when I type
05:29 Vash [Vash@Nightstar-uhn82m.ct.comcast.net] has quit [[NS] Quit: Quit]
05:29
< [R]>
That's an interface, you can't instantialize those.
05:29
< [R]>
List implements IList.
05:29
< [R]>
https://msdn.microsoft.com/en-us/library/6sh2ey19%28v=vs.110%29.aspx
05:30
< [R]>
Can I see your line? I suspect you've got a typo there somewhere.
05:30 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
05:31
< Meatyhandbag>
https://github.com/deathbymanga/ProjectNoNameYet/blob/master/code
05:31
< Meatyhandbag>
I only got to change the Lists themselves, not the code that uses the Lists
05:32
< [R]>
47 is using ArrayList as a generic still
05:32
< [R]>
What line number is your error from?
05:32
< [R]>
19?
05:33
< Meatyhandbag>
The error I mentioned is on line 3
05:34
< [R]>
BTW: int k = 0, copy = 0, column = 0; // Merge lines 46,48,49 if you want.
05:34
< [R]>
using System.Collections.Generic;
05:36
< Meatyhandbag>
whenever i write a variable without a defined answer, it gives me errors
05:37
< Meatyhandbag>
Oh
05:37
< Meatyhandbag>
When I removed list<T> everything went fine
05:38
< Meatyhandbag>
does variable.Add() still work for Lists like it does for ArrayLists?
05:38
< [R]>
I linked you to the List documentation.
05:39
< Meatyhandbag>
ok
05:39
< [R]>
It has an Add method
05:40
< Meatyhandbag>
wait
05:40
< Meatyhandbag>
List<Part> parts = new List<Part>();
05:40
< Meatyhandbag>
This doesn't have Int or String or anything in it
05:40
< [R]>
Part is likely a custom type?
05:41
< [R]>
Or it's a type somewhere else in .NET.
05:41
< Meatyhandbag>
it then writes this
05:41
< Meatyhandbag>
parts.Add(new Part() {PartName="crank arm", PartId=1234});
05:41
< [R]>
Oh neat, .NET has named parameters.
05:41
< [R]>
At least that's what I'm guessing those are.
05:42
< Meatyhandbag>
named parameters?
05:43
< [R]>
Parmaters/arguments to a function that are not assigned to variables based on the order the caller provided, but rather by the name the caller provided.
05:44
< Meatyhandbag>
huh?
05:45
< [R]>
.add() of List takes on parameter: what to add, if it took a named parameter you could do this: thing.Add() {thing=x};
05:46 * [R] is also assuming here.
05:47
< Meatyhandbag>
what would saying "thing =x" do?
05:48
< Meatyhandbag>
I mean, couldn't you just say {x}?
05:48
< [R]>
thing.add(x)
05:48
< Meatyhandbag>
right, that's what i meant :P
05:48
< [R]>
Because it needs the name.
05:48
< [R]>
It's useless in that example
05:49
< [R]>
But when you have 4+ possible parameters, and many are optional...
05:49
< Meatyhandbag>
ok, can you give an example where a parameter is useful?
05:49
< [R]>
named+*
05:50
< Meatyhandbag>
huh? how can a single point in an Array or List have possible parameters?
05:51
< [R]>
Creating a socket, TCP listener doesn't need an address, or port, UDP listener doesn't need an address or port, UNIX listener needs a path, TCP/UDP client need a host and port, UNIX client needs a path. Since you don't always need path, port or host you can have them as named parameters and only give the ones needed.
05:51
< [R]>
They don't
05:52
< [R]>
The .Add /method/ is taking those parameters.
05:53
< [R]>
(Also to backlog readers: yes, the listener does not need a port number, the OS will assign a random one if there wasn't one provided. This is almost never useful though.)
05:55
< Meatyhandbag>
i seriously don't understand. So, if I write car.Add(new Car() {}) I am creating a new point. So I could write car[1] and it would equal what I just added, right?
05:56
< [R]>
Assuming that was the second thing added yes.
05:57
< [R]>
(Hint: Named parameters are entirely unrelated to what you are doing)
05:57
< [R]>
I have no idea where you got that example from, or why it did that instead of just .add(new Part())
05:58
< Meatyhandbag>
i really don't understand. Can I ignore Named Parameters. Stick to just object.add(variable) and be done with it?
05:58
< [R]>
Yes
06:00
< Meatyhandbag>
thanks
06:23
< Meatyhandbag>
Argument 1: cannot convert from 'string' to 'System.Collections.Generic.List<string>'
06:31
< Meatyhandbag>
https://github.com/deathbymanga/ProjectNoNameYet/blob/master/code
07:08 Kindamoody is now known as Kindamoody|afk
07:58 McMartin [mcmartin@Nightstar-rpcdbf.sntcca.sbcglobal.net] has quit [Ping timeout: 121 seconds]
08:03 McMartin [mcmartin@Nightstar-rpcdbf.sntcca.sbcglobal.net] has joined #code
08:03 mode/#code [+ao McMartin McMartin] by ChanServ
08:05 Derakon_ [chriswei@Nightstar-5fqf0m.ca.comcast.net] has joined #code
08:06 Derakon[AFK] [chriswei@Nightstar-5fqf0m.ca.comcast.net] has quit [Ping timeout: 121 seconds]
08:46 macdjord is now known as macdjord|slep
10:45 VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has joined #code
10:45 VirusJTG_ [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has quit [Connection closed]
11:02 Orthia [orthianz@Nightstar-rqv.1ee.224.119.IP] has joined #code
11:03 mode/#code [+o Orthia] by ChanServ
12:48 celticminstrel [celticminst@Nightstar-gmujup.dsl.bell.ca] has joined #code
12:48 mode/#code [+o celticminstrel] by ChanServ
12:54 Meatyhandbag [sebastianfe@Nightstar-dk0.5eb.224.136.IP] has quit [Client exited]
13:05 Vash [Vash@Nightstar-uhn82m.ct.comcast.net] has joined #code
13:05 mode/#code [+o Vash] by ChanServ
13:09 Thalass|gameses [thalass@Nightstar-h1qmno.eastlink.ca] has joined #code
13:29 Checkmate [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code
13:29 mode/#code [+o Checkmate] by ChanServ
14:27
<@Wizard>
When you spend all day fixing symptoms and getting closer to the real issue http://i.imgur.com/xWruDVC.webm
15:01 celticminstrel [celticminst@Nightstar-gmujup.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
15:03 Derakon_ is now known as Derakon
15:03 mode/#code [+ao Derakon Derakon] by ChanServ
15:04 Meatyhandbag [sebastianfe@Nightstar-dk0.5eb.224.136.IP] has joined #code
15:17
< Meatyhandbag>
https://github.com/deathbymanga/ProjectNoNameYet/blob/master/code
15:17
< Meatyhandbag>
I have no idea what's wrong with my code
15:20
<&ToxicFrog>
You're going to have to be more specific.
15:21
< Meatyhandbag>
Whenever I run this code (it's c#) the code crashes
15:24
<&ToxicFrog>
Your first step should be to look at the stack trace, then.
15:25
<&ToxicFrog>
I'm assuming that C#, as a modern language, gives you an actual error message and stack trace and not just 'segmentation fault'.
15:26 kourbou [holoirc@Nightstar-deqg8j.fbx.proxad.net] has joined #code
15:27
< Meatyhandbag>
it gives me an error message, , but i have no idea what stack trace is
15:29
<@TheWatcher>
rule number 1: it's Syloq's fault. rule number 2: when asking for assistance with code problems, it's a really good idea to quote any error messages when you have them (rule 2b: use pastebin if it's more than a line or so)
15:29 Irssi: #code: Total of 43 nicks [29 ops, 0 halfops, 0 voices, 14 normal]
15:30
<@TheWatcher>
>.>
15:30 Alek [omegaboot@Nightstar-03ja8q.il.comcast.net] has quit [Ping timeout: 121 seconds]
15:31
< Meatyhandbag>
Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection
15:31
<&McMartin>
ToxicFrog: I believe by default you have to hook up a debugger to get a .NET backtrace, unlike Java or Python which dumps it to the commandline.
15:32
<@TheWatcher>
(well, actually, rule number 1 is 'Do not act incautiously when confronting a little bald wrinkly smiling man', but hey)
15:32
<&McMartin>
Meatyhandbag: Well, like it says: you're walking off the end of a collection
15:32
<&McMartin>
Running under a debugger should give you the offending line and the variable being used as an index
15:33
< Meatyhandbag>
McMartin, whenever it runs the Debugger, i have no idea what's going on
15:33 kourbou [holoirc@Nightstar-deqg8j.fbx.proxad.net] has quit [NickServ (RECOVER command used by kourbou_)]
15:33 kourbou [kourbou@Nightstar-deqg8j.fbx.proxad.net] has joined #code
15:33 Alek [omegaboot@Nightstar-03ja8q.il.comcast.net] has joined #code
15:33 mode/#code [+o Alek] by ChanServ
15:34 kourbou|phone [holoirc@Nightstar-deqg8j.fbx.proxad.net] has joined #code
15:34
<&McMartin>
There should be tutorials; debugger operation and interpretation is a crucial skill
15:38 * TheWatcher eyes the code
15:38
<@TheWatcher>
My money's on line 70
15:38
<@TheWatcher>
Should be y - 1, not y
15:41
< Meatyhandbag>
thank you
15:47
< Meatyhandbag>
and this is another code i'm having issues with. it's the same error message, but i have no idea where the error is, since it seems to list the numbers out of order and crashes for a reason unexplained
15:47
< Meatyhandbag>
https://github.com/deathbymanga/ProjectNoNameYet/blob/master/code
15:48
<&ToxicFrog>
Learning to use the debugger will help a lot with these issues.
15:48
<@TheWatcher>
Indeed.
15:49
<@TheWatcher>
Hint though: think carefully about what you're doing on line 41.
15:49
<&ToxicFrog>
Also, if you're just using this as a way to paste code, which it seems that you are, that's what gist.github.com is for
15:50
< Meatyhandbag>
ok
16:02
< Meatyhandbag>
Watcher, what did you mean specifically about line 41?
16:12 Checkmate [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
16:36 macdjord|slep is now known as macdjord|wurk
16:43
<@TheWatcher>
Meatyhandbag: look at what the loop surrounding it is doing, and then look at what line 41 is doing.
16:45
<@TheWatcher>
i recomend actually writing out the english translation of the code, that'll hopefully let you see it
16:46
< Meatyhandbag>
shouldn't this loop just write out every element in the List, with a
16:46
< Meatyhandbag>
"|" on each side of each element?
16:47
<&Derakon>
What does "foreach (int element in grArrList)" do?
16:47
<&Derakon>
What value does "element" take on?
16:59
< Meatyhandbag>
Watcher, would it be preferable to do a For Loop instead of a Foreach loop?
17:01
<&ToxicFrog>
Meatyhandbag: for this I'd use a foreach loop, personally, but don't guess -- reason. Say the user enters '9 8 7 6'. What's the value of 'element' the first time through the list? The second time?
17:02
< Meatyhandbag>
the first time element should equal 9, the second, it should equal 8
17:02
<&ToxicFrog>
Right.
17:02
<&ToxicFrog>
So what's grArrList[element] the first time, then?
17:02
< Meatyhandbag>
whatever was the first number i typed
17:03
<&ToxicFrog>
Is it?
17:03
<&ToxicFrog>
grArrList contains (9 8 7 6).
17:04
<&ToxicFrog>
element is 9.
17:04 celticminstrel [celticminst@Nightstar-gmujup.dsl.bell.ca] has joined #code
17:04 mode/#code [+o celticminstrel] by ChanServ
17:04
<&ToxicFrog>
grArrList[9] is?
17:06
< Meatyhandbag>
if 9 is the first number i input. then grArrList[0] = 9
17:06
<&McMartin>
That wasn't the question. Check again.
17:06
<&McMartin>
You're replacing what it says with what you want it to say midsentence.
17:07
< Meatyhandbag>
huh?
17:07
< Meatyhandbag>
OH
17:08
< Meatyhandbag>
If only 4 elements were inputed into the List, then there can be no element 9
17:09
< Meatyhandbag>
my List would have to hold 9 separate inputs for there to be a 9th element. But even then, the 9th element would equal grArrList[8], since lists start at 0
17:12
<&ToxicFrog>
Yep
17:13
<&ToxicFrog>
You're talking the first element of the list, and then using that as an index into the list again, and then printing *that*
17:14
< Meatyhandbag>
yes
17:15
< Meatyhandbag>
Effectively it would be the same as using a For Loop, and replacing element with whatever variable is used in the condition statement
17:18
<&McMartin>
No, those aren't at all the same thing
17:20
< Meatyhandbag>
elaborate?
17:21
< Meatyhandbag>
Martin, what i mean is, in a for loop, I would write For(int i = 0; i<5; i++){grArrList[i];}
17:22 kourbou|phone [holoirc@Nightstar-deqg8j.fbx.proxad.net] has quit [Connection closed]
17:26
< [R]>
Yes, and that'll access elements 0, 1, 2, 3, 4
17:27
< [R]>
Martin is saying you're accessing elements 0, 9, AooR
17:27
<&McMartin>
Well
17:27
<&McMartin>
TF is saying that
17:27
<&McMartin>
I'm merely saying that those two things are not the same
17:27
< Meatyhandbag>
I thought I was saying Element 0 = 9, not element 9 itself
17:29
< [R]>
What line is giving that error BTW?
17:29
< [R]>
An exception is nice and all, but it's useless without a line number
17:31
< Meatyhandbag>
No line specifically. I compile a rebuild and the code comes out with no errors. but when i run the code, my code crashes
17:31
< [R]>
You should have a stacktrace that gives a file and line number.
17:31
< Meatyhandbag>
huh?
17:32
< [R]>
Oh, the heck are you trying to do there?
17:32
< [R]>
Line 58 to 71
17:32
< [R]>
That's definately going to be at least one of your AooRs
17:33
< Meatyhandbag>
AooRs?
17:33
< [R]>
<Meatyhandbag> Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection
17:34
< Meatyhandbag>
yes, that is the error that comes after the code Crashes in my Console
17:35
< [R]>
Try turning it into an acronym.
17:37
< Meatyhandbag>
oh
17:39
< Meatyhandbag>
That set of code was written to identify what values i inputted were identical. If I inputed any identical values, i was to make a note of it. I'm still pretty sure that's not written properly, but everyone was asleep when i wrote it
17:40
< [R]>
Well, the [element] part is what is AooR'ing
17:41
< Meatyhandbag>
for I replace the foreach with a for then?
17:44
< [R]>
You can do that a few ways, simplest way: sort the inputs, then check to see if any are identical to their neighbour.
17:44
< Meatyhandbag>
I thought i was checking for identical neighbors with lines 58-71
17:45
< [R]>
Other ways: 1) Count the occurance of each value into a Hash 2) Have nested for loops (2 deep) and iterate over the array with both.
17:45
< [R]>
You aren't
17:46
< [R]>
foreach doesn't work like a JS for-in loop, the "element" isn't the key, it's the value.
17:46
< [R]>
if (grArrList[n] == element)
17:48
< [R]>
Apparently MSDN has non-shitty documentation for C#, I suggest you use it.
17:48
< Meatyhandbag>
MSDN?
17:50
< [R]>
Google it
17:50
< Meatyhandbag>
My intention with the combo For loop and Foreach loop was to repeatedly loop over the array for any identicals. The first cycle of the for loop would be looking for any that matched the first point in the list. the second cycle would be checking the second point in the list
17:51
< [R]>
Look at the if I posted
17:51
< Meatyhandbag>
right, which did bring some changes in my head
17:52 gnolam [lenin@Nightstar-t1tbf0.cust.bahnhof.se] has quit [[NS] Quit: Reboot]
17:59 gnolam [lenin@Nightstar-t1tbf0.cust.bahnhof.se] has joined #code
17:59 mode/#code [+o gnolam] by ChanServ
18:03
< Meatyhandbag>
ok, I still have an AooRe, but it's different now
18:08
< Meatyhandbag>
OH!!!!
18:08
< Meatyhandbag>
Found the issue
18:08
< Meatyhandbag>
L never made it do that K would == count, so the for loop was going on indefinitely
18:28
< Meatyhandbag>
Damnit
18:28
< Meatyhandbag>
https://github.com/deathbymanga/ProjectNoNameYet/blob/master/code
18:28
< Meatyhandbag>
It still won't work
18:29
<&ToxicFrog>
Never say "won't work". Be specific.
18:30
<&ToxicFrog>
That said, this looks the same as the code you showed earlier.
18:30
< Meatyhandbag>
I got the same AooRe error message as before
18:30
<&ToxicFrog>
Yes, because you haven't fixed the problem.
18:30
< Meatyhandbag>
I was able to fix up the whole for and foreach loop situation, which was the believed target for this
18:30
<&ToxicFrog>
And if you ran it in the debugger like we keep suggesting, you'd see that it's blowing up at line 41, which is the problem we were discussing earlier and which I thought you understood.
18:32
< Meatyhandbag>
No, I thought you were discussing line 61 since the R specifically wrote grArrList[n] == element, which would only have worked in line 61, not 41
18:33
<&ToxicFrog>
TheWatcher mentioned line 41, and that's what he, McMartin, and I were all talking about
18:33
<&ToxicFrog>
[R] came in later and skipped over all of that.
18:33
<&ToxicFrog>
Perhaps this will help
18:33
<&ToxicFrog>
foreach(int val in collection) { ... }
18:33
<&ToxicFrog>
is equivalent to
18:34
<&ToxicFrog>
for(int index = 0; index < collection.Count; ++index) { int val = collection[index]; ... }
18:36
<&ToxicFrog>
It is likely that you have other issues after line 41, since I haven't read beyond that, and you really should use a debugger, but 41 is what I was talking about earlier.
18:39
< Meatyhandbag>
ok, i switched the foreach with a for that should fix the problem, but now the debugger is signaling an error on line 64
18:40
< Meatyhandbag>
And also Toxic. I have never used Visual Studios in my life until this semester, please don't treat me like i'm some rigid, ignorant mule who refuses to learn
18:40
< Meatyhandbag>
The only coding i have worked with have been pure java with no debuggers and only my wits and the wits of others to figure out the errors
18:46
<&ToxicFrog>
What's the error?
18:47
< Meatyhandbag>
it's another AooRe. I don't see anything different than line 41
18:47
< Meatyhandbag>
my guess is that it must have to do with the foreach loop again
18:47
< Meatyhandbag>
since i had one surrounding line 64
18:47
<&ToxicFrog>
No.
18:48
<&ToxicFrog>
Foreach loops are not the enemy.
18:48
<&ToxicFrog>
The code around line 41 would actually be best written with a foreach rather than a for.
18:48
<&ToxicFrog>
Looking around line 64 -- how many elements are in chart? What's n?
18:49
< Meatyhandbag>
there's no defined amount. everything in here is dependent on how much info i put in it.
18:50
< Meatyhandbag>
n = the number of times i need to repeatedly check for copies. During the first cycle of n I check if any are copies of the first point in the List
18:50
<&ToxicFrog>
Yes.
18:50
<&ToxicFrog>
Exactly.
18:50
<&ToxicFrog>
How many elements are in chart?
18:51
< Meatyhandbag>
currently 0 because the array has nothing in it
18:51
<&ToxicFrog>
It looks at line 48 like you'
18:51
<&ToxicFrog>
re initializing it with one element, actually.
18:52
<&ToxicFrog>
But in either case, what happens when you enter, say, three values and n gets incremented in that loop?
18:53
<&ToxicFrog>
I can't really help you with debugger operation -- I haven't used Visual Studio in something like a decade -- but if you can find the variable inspection commands, try looking at the value of n when it crashes; failing that, insert additional prints to print out, say, element and n each time around the loop.
18:53
< Meatyhandbag>
the value i added at line 48 was meant to say "Any point in this list I have not defined will be given this value as default"
18:54
< Meatyhandbag>
If I enter 3 values into the array, then the n should cycle 3 times
18:54
< Meatyhandbag>
once for every value so that i can check if anything is identical
18:54
< Meatyhandbag>
oh wait, just found a logic error in that
18:54
< Meatyhandbag>
If array[0] == array[1], then I
18:55
< Meatyhandbag>
d be adding +1 to copy, but as soon as I get to array[1] == array[0] it'll add another +1 to copy
18:55
< Meatyhandbag>
I'll have double the number of actual copies
18:56
<&ToxicFrog>
Re: "Any point in this list I have not defined will be given this value as default": is that how the ArrayList constructor works? The docs say that it just copies the given collection and has that length.
18:56
<&ToxicFrog>
https://msdn.microsoft.com/en-us/library/system.collections.arraylist%28v=vs.110 %29.aspx
18:57
< Meatyhandbag>
I don't know what i'm doing. This is my first semester using c#
19:02
<&ToxicFrog>
Ok. If I'm reading the docs right, you have three ways of initializing an ArrayList: empty, copy from collection, or specified capacity.
19:02
<&ToxicFrog>
When you do this: List<List<string>> chart = new List<List<string>>() {new List<string>() {"| |"}};
19:02
<&ToxicFrog>
(List has the same constructors: https://msdn.microsoft.com/en-us/library/6sh2ey19%28v=vs.110%29.aspx )
19:03
<&ToxicFrog>
When you do that, you're creating a 1-element list, holding a 1-element list, holding the string "| |".
19:03
<&ToxicFrog>
So the only valid index is 0, and you have to add items to it if you want more.
19:04
< Meatyhandbag>
ok
19:05
<&ToxicFrog>
BTW, the way you could have rewritten the loop around 41:
19:05
< Meatyhandbag>
ok, so, object.add(object.add("|*|")) ?
19:05
<&ToxicFrog>
foreach (int element in grArrList) { Console.Write("|" + element + "| "); }
19:05
<&ToxicFrog>
The "foreach" automatically does the lookup for you, so you don't need the grArrList[element], just element.
19:06
< Meatyhandbag>
um, that wouldn't work at all
19:07
< Meatyhandbag>
would it?
19:08 kourbou is now known as kourbou|foodz
19:09
<&ToxicFrog>
Why do you think it wouldn't?
19:09
<&ToxicFrog>
What happens when you try?
19:09
<&ToxicFrog>
My C# is pretty rusty, so I may be wrong, but I'm pretty sure that's correct.
19:10
<&ToxicFrog>
(I'm genuinely curious about the "why", btw, that's not snark.)
19:10
< Meatyhandbag>
i was just skeptical, but it should work
19:11
< Meatyhandbag>
but my concern now, is the doubling. it's not going to show every 3 i input in a single column, it's just going to show every time i inputed 3 in each element
19:11
< Meatyhandbag>
So If I put 3 in all five elements. then all 5 columns would have 5 marks in them
19:11
<&ToxicFrog>
The goal here is to produce a histogram?
19:12
< Meatyhandbag>
the goal is to produce a disturbed bar chart
19:14
<&ToxicFrog>
I'm using bar chart and histogram interchangeably here, but what makes it 'disturbed'?
19:14
< Meatyhandbag>
imagine this loop playing out
19:14
< Meatyhandbag>
if I inputed 5, five times
19:15
< Meatyhandbag>
the loop isn't recording how many times 5 is showing up
19:15
<&ToxicFrog>
Right, but what is it meant to do?
19:15
<&ToxicFrog>
This? https://gist.github.com/ToxicFrog/15428f10a6401a9cc872
19:15
< Meatyhandbag>
It's meant to record how many times I input it
19:16
< Meatyhandbag>
So if I inputed 5, five times, then there should be a single column that has 5 notches in it
19:16
< Meatyhandbag>
yes, that is correct
19:16
< Meatyhandbag>
That should be the desired result
19:16
< Meatyhandbag>
Though I'm not sure about the blank spots
19:22
<&ToxicFrog>
Blank spots?
19:22
<&ToxicFrog>
Maybe you should do up a gist with the output you expect from that input?
19:23
< Meatyhandbag>
the spots where nothing is there. like 0. there's no "0"s so 0 shouldn't be in the graph
19:24
< Meatyhandbag>
https://gist.github.com/deathbymanga/ea2a3d2be816546760e4
19:24
<&ToxicFrog>
So it should loook like https://gist.github.com/ToxicFrog/15428f10a6401a9cc872 instead?
19:24 * ToxicFrog nods
19:24
< Meatyhandbag>
that's just what I assume
19:24
<&ToxicFrog>
In that case, you don't need chart at all; you can print it out as you go.
19:24
< Meatyhandbag>
It probably won't matter if there's empty slots
19:25
<&ToxicFrog>
Oh, also, for future reference, C# has a break keyword
19:25
<&ToxicFrog>
So this:
19:25
<&ToxicFrog>
for (int g = 0; g < 1;) { ... if (...) { g = 1; } }
19:25
<&ToxicFrog>
Can be replaced with this:
19:25
<&ToxicFrog>
while (true) { ... if (...) { break; } }
19:27 Thalass|gameses [thalass@Nightstar-h1qmno.eastlink.ca] has quit [Ping timeout: 121 seconds]
19:27
< Meatyhandbag>
I really need to get some food
19:27
< Meatyhandbag>
I have a lion in my belly
19:27
< Meatyhandbag>
I'll be right back
19:36 Thalass|gameses [thalass@Nightstar-h1qmno.eastlink.ca] has joined #code
--- Log closed Fri Mar 27 19:42:03 2015
--- Log opened Fri Mar 27 19:42:16 2015
19:42 TheWatcher [chris@Nightstar-ksqup0.co.uk] has joined #code
19:42 Irssi: #code: Total of 42 nicks [22 ops, 0 halfops, 0 voices, 20 normal]
19:42 mode/#code [+o TheWatcher] by ChanServ
19:42 Reiver [quassel@Nightstar-ksqup0.co.uk] has joined #code
19:42 mode/#code [+ao Reiver Reiver] by ChanServ
19:42 Irssi: Join to #code was synced in 38 secs
19:44
< Meatyhandbag>
i am back
19:53 Thalass|gameses [thalass@Nightstar-h1qmno.eastlink.ca] has quit [Ping timeout: 121 seconds]
20:35
< Meatyhandbag>
https://gist.github.com/deathbymanga/d1ec380b870c9d700eb0 yep, my worries come true
20:55 kourbou|phone [holoirc@Nightstar-deqg8j.fbx.proxad.net] has joined #code
20:56 kourbou [kourbou@Nightstar-deqg8j.fbx.proxad.net] has quit [NickServ (RECOVER command used by kourbou|phone)]
20:56 kourbou|phone is now known as kourbou
20:56 kourbou_ [kourbou@Nightstar-deqg8j.fbx.proxad.net] has joined #code
20:56 kourbou_ [kourbou@Nightstar-deqg8j.fbx.proxad.net] has quit [[NS] Quit: Got to go. Bye.]
20:59 kourbou [holoirc@Nightstar-deqg8j.fbx.proxad.net] has quit [Connection closed]
20:59 kourbou [holoirc@Nightstar-deqg8j.fbx.proxad.net] has joined #code
21:05 Kindamoody|afk is now known as Kindamoody
21:30 kourbou [holoirc@Nightstar-deqg8j.fbx.proxad.net] has quit [Connection closed]
21:30 kourbou [kourbou@Nightstar-deqg8j.fbx.proxad.net] has joined #code
21:31
< kourbou>
Hi again! xD
21:31
< kourbou>
Oops wrong channel, sry. (Wears hat off shame)
21:39 Meatyhandbag [sebastianfe@Nightstar-dk0.5eb.224.136.IP] has quit [Client exited]
21:41 Vash [Vash@Nightstar-uhn82m.ct.comcast.net] has quit [[NS] Quit: Quit]
21:46 Checkmate [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code
21:46 mode/#code [+o Checkmate] by ChanServ
22:03 kourbou is now known as JamesBond
22:03 JamesBond is now known as kourbou
22:09 kourbou is now known as kourbou|zzz
22:24 Kindamoody is now known as Kindamoody[zZz]
22:25 * TheWatcher pokes at compiling his project codename list, and the list of MC moves for each tag
23:15 kourbou|zzz [kourbou@Nightstar-deqg8j.fbx.proxad.net] has quit [Connection closed]
23:16
<&McMartin>
MC?
23:16 kourbou [kourbou@Nightstar-deqg8j.fbx.proxad.net] has joined #code
23:16 kourbou is now known as kourbou|zzz
--- Log closed Sat Mar 28 00:00:33 2015
code logs -> 2015 -> Fri, 27 Mar 2015< code.20150326.log - code.20150328.log >

[ Latest log file ]