IRC Networks
Irc Logs Stats
Start date: 2007-09-27 02:48:27
Last update: 2008-10-24 20:19:38
Channels: 41
Logged Lines: 6230436
Size: 1822.24 MB
Powered by
Channel Info
Network: freenodeChannel: #csharp |
Search in www.irclog.org
Log from #csharp at freenode 2006-07-04
[23:06]<mjzymygo>can someone PM dmh|afk this URL: http://www.nomorepasting.com/paste.php?pasteID=64760
[23:07]<mjzymygo>?
[23:09]<mjzymygo>orbatron: TO explain would take a little too long. RTFM?
[23:10]<jz2zvzjg>Moridin8, I have done, as far as I can tell it is exactly as I read in a guide, I'm sure if the solution is so apparent to you you could point me in the right direction to what is wrong with my code.
[23:11]<mjzymygo>orbatron: http://msdn2.microsoft.com/en-us/library/system.collections.ienumerator.aspx
[23:11]<mjzymygo>orbatron: I would suggest that either you have misread the guide, or the guide is dumb
[23:12]<mjzymygo>staz:... sorry... ASP.NET or WinForms?
[23:12]<svzz[wjzc]>winforms
[23:13]<jz2zvzjg>I cannot see anything different in that example to what I have in my code, have you looked at the pastebin?
[23:13]<svzz[wjzc]>got a datagridview with a combobox column each of em having the same datasource of ~2500 items
[23:13]<mjzymygo>orbatron: yes I have,... look harder
[23:13]<mjzymygo>Staz: so each time your loading a combo, you are hitting the DB?
[23:13]<svzz[wjzc]>and it seems to load the 2500 items each time i click the arrow of a combobox which takes about 1.5 seconds
[23:13]<jz2zvzjg>Moridin8, don;t be an ass, if you see something just point it out. I have spend hours on this, so either I am missing something obvious, or you do not understand the problem. Stating your thought would help resolve that.
[23:14]<svzz[wjzc]>huh no, i make my datatable in the class constructor and set it to the clListing (private System.Windows.Forms.DataGridViewComboBoxColumn clListing;) which is aded to the gridview
[23:15]<mjzymygo>orbatron: Lines 3 6 and 10 are wrong
[23:15]<mjzymygo>(for a start)
[23:15]<txnjzd>orbatron: an object should not be its own enumerator
[23:15]<mjzymygo>Staz... pm...
[23:16]<jz2zvzjg>3 is just a different array, that should not cause the problem, 6 is just an empty constructor, again nothing to do with the issue I am having, 10, that could be the solution, thank-you.
[23:16]<mjzymygo>orbatron: the enumerator needs to know what to enumerate. you need to feed it the array to enumerate through in the constructor
[23:17]<mjzymygo>yeh... waiting
[23:17]<jz2zvzjg>Moridin8, I don;t think that is right - if that is so, then what does it work for the first loop?
[23:18]<svzz[wjzc]>not sure this can work
[23:18]<mjzymygo>staz... np
[23:18]<jz2zvzjg>*what = why
[23:19]<mjzymygo>StaZ[work]: I don't know how you have set up the app, so forgive some of my possible DUMB questions
[23:20]<mjzymygo>orbatron: if you willing to wait a few minutes and no-one else here will help, i'll give you some assistance
[23:24]<jz2zvzjg>Moridin8, The example you sent me is doing something different than what I am trying to achieve, it used two seperate claesses to achieve its goals. It may be the solution to my problem, but I still don;t understand why my way does not work, I see no obvious reason why it shouldn't.
[23:25]<txnjzd>I would help, but I am afraid if I tell you why it is not working you will make it work and carry on using the object as its own enumerator
[23:25]<txnjzd>which is a bad thing to do
[23:26]<jz2zvzjg>You should name this channel 'give us a clue', lots of people know the answer but not willing to give it. why is it a bad thing to do?
[23:27]<txnjzd>orbatron: because if you have two enumerators at once
[23:27]<txnjzd>they will intefer
[23:27]<txnjzd>and records will be skipped
[23:27]<jz2zvzjg>as in a nested foreach loop on the same class?
[23:27]<txnjzd>yes
[23:28]<jz2zvzjg>that makes sence, but surely it would apply equally to a nested foreach loop on a member class.
[23:28]<txnjzd>orbatron: normally you create a new instance of your enumerator class with each call to GetEnumerator
[23:29]<sdnffdxdlld>wow going back to VS2k3 sucks!
[23:30]<jz2zvzjg>basically just make a copy of it to loop through?
[23:30]<-- svgvsdyzgjvr_ xrs>/dev/null")
[23:30]<txnjzd>orbatron: one copy of the class for each loop, yes
[23:30]<ycnr_>smellyhippy: heey.
[23:31]<ycnr_>anybody catch the shuttle launch?
[23:31]<jz2zvzjg>Theory, surely that can be accomplished while still using the one class?
[23:32]<txnjzd>orbatron: well yes, but normally the object being iterated over has lots of data
[23:32]<txnjzd>so creating copies of it is expensive
[23:32]<txnjzd>whilst creating a tiny iterator class is comparatively cheap
[23:32]<afd>ikea_!!!!!
[23:33]<mjzymygo>orbatron: http://pastebin.ca/79031
[23:33]<jz2zvzjg>Theory, in the scenrio I will have, it is an array of lots of other objects, so it is going to be pretty big. I cannot think of any scenario where I would need nested for loops,
[23:34]<txnjzd>orbatron: still, the definition of GetEnumerator says you should support multiple ones at once
[23:34]<txnjzd>deviating from that definition probably isn't smart
[23:34]<txnjzd>people who read/modify your code will have expectations
[23:35]<mjzymygo>orbatron: the solution to your problem is at http://pastebin.ca/79031
[23:36]<jz2zvzjg>Theory, well I don;t have enough c# experience to debate that one, and if the alternative works then that will do me, though it does seem wastreful to have to have another class - I will end up with three classes for each (i.e. the class itself, the enumetator, and the collection). Thanks Moridin8, I will give it a go.
[23:36]<txnjzd>classes are cheap :-)
[23:37]<jz2zvzjg>Theory, yeah, I just like to minimise my code. Old timer C programmer :)
[23:37]<txnjzd>it's the same idea as having an array, and a pointer into that array
[23:38]<jz2zvzjg>Theory, but you can have two pointers into the one array, this way you need to have two copies of the array.
[23:38]<sdnffdxdlld>how did I ever live without generics
[23:38]<txnjzd>orbatron: the IEnumerator implementation is like the pointer
[23:39]<txnjzd>you just pass it a reference to your object, and it asks the object for the actual values
[23:39]<jz2zvzjg>Theory, ok, I'm getting it now.
[23:40]<txnjzd>remember in c# = is usually just assigning a reference
[23:41]<jz2zvzjg>what about as an alternative, going back to the code I had, position is an array, another variable 'nest' - each call to getenumerator increases nest, it is used as the offset, each call to rest decreases the nest value. That way it will support nesting without the need for another class?
[23:42]<jz2zvzjg>*rest=Reset
[23:44]<mjzymygo>orbatron: have you tried the solution yet?
[23:44]<mjzymygo>smellyhippy: I don't know either... =) painfully
[23:45]<jz2zvzjg>Moridin8, no can do, development system is at work - on BSD system here, so can't test it :) It does look like it will work though, gives me enough to go on anyway. Thanks for your help.
[23:45]<eg-->when you load a file in IE from the filesystem this is called local zone, if you load it from a website is it proper to say remote zone?
[23:45]<sdnffdxdlld>I'm having to use ... arraylists :S its involving lots of casting and stuff :/
[23:45]<mjzymygo>orbatron: well, thats the most basic custom enumerator you can do... ;)
[23:46]<ycnr_>AqD: hey
[23:46]<jz2zvzjg>Moridin8, it was driving me insane - I have about a dozen collections programmed the way I had them, all working fine, couldn;t figure out why one of them didn;t work, until I realised it was always when a second foreach was used on it.
[23:47]<txnjzd>orbatron: seriously, use a separate class dude
[23:47]<jz2zvzjg>Still getting to grips with c#, and OO programming in general. I'm more comfortable with php, but needs must :)
[23:47]<txnjzd>or better if using .net 2.0, use generics
[23:47]<jz2zvzjg>Thoery, I likely will, just thinking aload :)
[23:48]<jz2zvzjg>Theory, never heard of generics. I will look them up.
[23:49]<mjzymygo>theory: check solution: http://pastebin.ca/79031
[23:50]<txnjzd>Moridin8: yup, that looks like the right way to do it :-)
[23:50]<txnjzd>although some people might be slightly confused by using Enum as an abbreviator for Enumerator
[23:50]<ycnr_>Moridin8: Do remember that he has blue hair.
[23:51]<mjzymygo>Theory: yeh... but I don't care ;)
[23:51]<mjzymygo>ikea: how could I forget...
[23:51]<sdnffdxdlld>muwahahahaha
[23:51]<jz2zvzjg>hmm, generics does intriging. I will look into that at work tommorrow. I'm off to the pub for now. Cheers for all the help.
[23:51]<txnjzd>mmm pub :-)
[23:52]<sdnffdxdlld>cya dude :)
[23:52]<fyfuym-syfggag>fark I am going to bed
[23:52]<mjzymygo>ciao
[23:53]<fyfuym-syfggag>later Moridin8
[23:53]<mjzymygo>... need drink... bbiam
[23:53]<mjzymygo>seeya Liquid-Silence.... have fun with tubgirl ;)
[23:53]<fyfuym-syfggag>ok quick request
[23:53]<afd>me too
[23:53]<afd>:)







