Click here to Skip to main content
16,011,538 members

Comments by electrowizard (Top 3 by date)

electrowizard 12-Feb-12 15:15pm View    
@Bill
Thanks for the link; yes jagged arrays are quite useful in certain applications.
In mine the number of images is known just before array creation, and the image dimensions are always identical - so I need a perfect rectangular prism of pixel values.

Fortunately for me, the pixels are only Shorts (truly 10 bit but I'm not sure I want to make my own packed datatype), so the almost 200M pixel entries are only a few hundred MB of memory - filling it from image files takes only half a minute.
It's a tad slower, but I've also run it on a 2GHz dual core AMD with only 2GB ram.


My layman's impression is the space overhead from the lists would be seriously detrimental to the performance (and to actually having enough RAM!), so I would also be really interested in seeing a superstar do an Array/Generic space and speed comparison, for small and HUGE datasets, in increasing number of dimensions - i.e. 1D, 2D, 3D, 4D.. probably as far as you need to go in most cases I would imagine.. I don't think I've ever had more than a 3 or maybe 4 dimension array.

Thanks for a great conversation! I program alone at work - I miss the teamwork, camaraderie and learning from better programmers than myself.
electrowizard 10-Feb-12 22:44pm View    
@Bill
Genuine laughter was produced.. I love how detailed you got, both on the technical side and your humour.
Thanks for that :)
Question for you now - do you eliminate arrays in every circumstance? I ask because I use Lists as often as possible (right now I'm coding a SortedDictionary of SortedDictionaries of Lists of Points so I'm with you) but what do you do when you have to load into memory over 100 images, over 1000x1000 pixels - and access them all quickly in every dimension? i.e. I access them both as 2d images, as well as linear arrays of one pixel across images.
What structure would you choose in this circumstance? Security is not a concern, only speed. [Let's just say it takes several minutes with my 8 core processor running at >3GHz, and my users won't nearly have as much.

If they load too many images my program runs out of memory :(
Were I a better programmer I would write something that could swap memory pages but in a managed language I'm not even sure how to approach that. Anyways I'm way off topic and don't expect answers to everything here.

Thanks again;
Will
electrowizard 10-Feb-12 13:17pm View    
@SAKryukov Thanks for your input, I'm glad you enjoyed my question format. Over at StackOverflow someone might have bitten my head off anyways; it's a much nicer environment here. Thanks for being nice :) (You too TRK3)
I have some questions about what you said, please give me your wisdom:

SAKryukov said:
"the names like "Form1", and those with underscore violate (good) Microsoft naming conventions. Auto-generated code is always invalid in this respect; you should always rename all auto-generated names to some semantic names; also, "cofd_FileOk" is redundant, I recommend using anonymous methods for handlers, as well as lambda syntax (for C# v>2)."

This started out well, but you lost me pretty quickly. For the purposes of the sample code I intentionally left the names as default so someone could copypasta the code into a new form easily. In production code I rename every Control I access from code (i.e. permanent text labels retain 'label1' etc.)

Can you explain why auto-generated could would violate naming conventions? - and consequently why this is a problem? I have always assumed the code it generates was a template that all my code should look like! Quite the opposite of what you indicate. Do you know of any good reading material on the subject you could recommend?

What makes "cofd_FileOk" redundant? The cofd has several events; this one is the FileOk event. I'm not sure how much more concise the event handler name could be..
I've never seen anonymous event handlers, so I looked them up. They look like this, right? item.OnKeyChanged += (o, k) => ChangeItemKey((T)o, k);
What is the benefit? It seems like much more typing, especially when writing many event handlers.

My application has no worries about portability, etc. In fact the only computers it will be installed on are ones we purchase specifically for running this program, installed in house, then shipped to the customer. This way we also guarantee Win7+ so the API Code Pack should be quite helpful, with no apparent drawbacks for us. Unless you have an alternative for handy Win7 integration I don't know about..?


@TRK3
Networking stuff sounds totally possible. I'm on a wireless network which has a file server attached.. I'll do some debugging with my networking disabled. I assume there's no way to disable attempting RPC or you would be doing it yourself :)
Yeah it's annoying when people use exceptions as flow control. I assume they had no choice for some reason - I guess I want to give them the benefit of the doubt.
I will also try avoiding the GC and see what happens.
Thanks for the suggestions



@all
1. Can anyone suggest a replacement Folder Picker? Other than the WinForms FolderBrowser of course - that thing is like garbage.
2. I'm using the "Have a Question or Comment" box below the comments and this thing is super tiny, like 6 lines tall. Is this common? I wish it had a preview like there was when I was submitting the question. Is there an alternative?