Click here to Skip to main content
15,900,907 members
Home / Discussions / C#
   

C#

 
GeneralRe: Disposing of object used in a UserControl... Pin
Luc Pattyn20-May-10 4:05
sitebuilderLuc Pattyn20-May-10 4:05 
GeneralRe: Disposing of object used in a UserControl... Pin
Pete O'Hanlon20-May-10 4:17
mvePete O'Hanlon20-May-10 4:17 
GeneralRe: Disposing of object used in a UserControl... Pin
Pete O'Hanlon21-May-10 11:40
mvePete O'Hanlon21-May-10 11:40 
GeneralRe: Disposing of object used in a UserControl... Pin
Luc Pattyn21-May-10 11:56
sitebuilderLuc Pattyn21-May-10 11:56 
GeneralRe: Disposing of object used in a UserControl... Pin
Pete O'Hanlon21-May-10 12:51
mvePete O'Hanlon21-May-10 12:51 
GeneralRe: Disposing of object used in a UserControl... Pin
Luc Pattyn21-May-10 13:05
sitebuilderLuc Pattyn21-May-10 13:05 
AnswerRe: Disposing of object used in a UserControl... Pin
Pete O'Hanlon21-May-10 12:53
mvePete O'Hanlon21-May-10 12:53 
QuestionDistribute values Pin
Bart Van Eyndhoven19-May-10 21:19
Bart Van Eyndhoven19-May-10 21:19 
Hey guys,

You've helped me a lot before, but once again, I need some hints about how to program something.

Suppose that my application generated 2 arrays of int values:
ModulesOnSurface = {14, 12, 46}
ModulesConnected = {24, 14, 10, 18, 6}

This is only an example. The lengths could be different and so could the values. The sum of the items in ModulesOnSurface is always equal to the sum of the items in ModulesConnected (72 in this case).

The items of ModulesConnected should automatically be assigned to ModulesOnSurface. An item in ModulesConnected can be split and multiple items can be put together. This means there is always a solution, but I need just the one with as few splits as possible.

A possibility in this case is (1 split: 24 to 12+12):
14 = 14
12 = 12 (from 24)
46 = 12 (from 24) + 10 + 18 + 6

This would also be possible but less optimal (2 splits: 24 to 22+2 and 18 to 10+8), so I would like to avoid it as much as possible:
14 = 6 + 8 (from 18)
12 = 10 + 2 (from 24)
46 = 22 (from 24) + 14 + 10 (from 18).

Afterwards, I need to know how everything is assigned. So in the first example I need to know:
24: 12 to surface B and 12 to surface C
14: 14 to surface A
10: 10 to surface C
18: 18 to surface C
6: 6 to surface C

This is a brain breaker. I know how to get the assigning done without the possible splits but now that I can split and need the optimal solution, I'm kind of stuck...

Could someone help me out?

Thanks in advance!
QuestionMessage Removed Pin
19-May-10 19:30
EthicsGradient19-May-10 19:30 
AnswerRe: How to clear FileSystemWatcher.Path ? [modified] Pin
Johnny J.19-May-10 22:39
professionalJohnny J.19-May-10 22:39 
GeneralMessage Removed Pin
20-May-10 14:33
EthicsGradient20-May-10 14:33 
GeneralRe: How to clear FileSystemWatcher.Path ? Pin
Johnny J.20-May-10 19:55
professionalJohnny J.20-May-10 19:55 
GeneralMessage Removed Pin
21-May-10 3:34
EthicsGradient21-May-10 3:34 
GeneralRe: How to clear FileSystemWatcher.Path ? Pin
Johnny J.21-May-10 3:38
professionalJohnny J.21-May-10 3:38 
GeneralMessage Removed Pin
21-May-10 13:58
EthicsGradient21-May-10 13:58 
GeneralRe: How to clear FileSystemWatcher.Path ? Pin
Pete O'Hanlon23-May-10 9:11
mvePete O'Hanlon23-May-10 9:11 
QuestionWM_PAINT makes textbox non-unicode Pin
thomus0719-May-10 18:27
thomus0719-May-10 18:27 
AnswerRe: WM_PAINT makes textbox non-unicode Pin
thomus0719-May-10 18:53
thomus0719-May-10 18:53 
QuestionI Find This Baffling Pin
Roger Wright19-May-10 18:16
professionalRoger Wright19-May-10 18:16 
AnswerRe: I Find This Baffling Pin
Luc Pattyn19-May-10 18:42
sitebuilderLuc Pattyn19-May-10 18:42 
GeneralRe: I Find This Baffling Pin
Roger Wright20-May-10 3:00
professionalRoger Wright20-May-10 3:00 
GeneralRe: I Find This Baffling Pin
Luc Pattyn20-May-10 3:34
sitebuilderLuc Pattyn20-May-10 3:34 
GeneralRe: I Find This Baffling Pin
Roger Wright20-May-10 5:11
professionalRoger Wright20-May-10 5:11 
GeneralRe: I Find This Baffling Pin
Luc Pattyn20-May-10 5:20
sitebuilderLuc Pattyn20-May-10 5:20 
GeneralRe: I Find This Baffling Pin
Roger Wright20-May-10 16:10
professionalRoger Wright20-May-10 16:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.