Click here to Skip to main content
15,559,619 members
Home / Discussions / C#
   

C#

 
QuestionIssues with RemoveChild() Pin
csharpk0der1236-Jan-07 18:23
csharpk0der1236-Jan-07 18:23 
AnswerRe: Issues with RemoveChild() Pin
Christian Graus6-Jan-07 21:07
mveChristian Graus6-Jan-07 21:07 
AnswerRe: Issues with RemoveChild() Pin
Luc Pattyn7-Jan-07 10:15
sitebuilderLuc Pattyn7-Jan-07 10:15 
QuestionI cant seem to think today. Pin
Captain See Sharp6-Jan-07 17:56
Captain See Sharp6-Jan-07 17:56 
AnswerRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 19:18
sitebuilderLuc Pattyn6-Jan-07 19:18 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 19:43
Captain See Sharp6-Jan-07 19:43 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 20:02
sitebuilderLuc Pattyn6-Jan-07 20:02 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 20:34
Captain See Sharp6-Jan-07 20:34 
Luc Pattyn wrote:
- what can you tell about expected average range length ?


The average range length will be the length of the text you select in Word or notepad, this is going into a hex editor.

Luc Pattyn wrote:
- is er an absolute max range length (or an extremely unlikely range length) ?


If you mean the length between the range's minvalue and maxvalue then it would be long.MaxValue + 1.

Luc Pattyn wrote:
- do you need ranges in sequential order ?


Yes, if they are not in order then a copy and paste operation would be a impossible with multiple selections.

Luc Pattyn wrote:
- how harmful would it be to have a result array with a known length
(=useful data) but an exagerated "capacity" ?


I would have to set the unused ranges values to -1 to signify that it is not needed. Why would I need to set it to a known length?


Luc Pattyn wrote:
I am not familiar with Array.Resize() but am very suspicious about it.
Please run similar code with an ArrayList or so, something that can
grow in chunks much larger than 1. I am afraid right now your CPU spends
a lot of time in growing an array !


Well unless the user selects many items and that are separated(which would cause more than one range to be created) then it could become a performance killer. This is unlikely since FindIndexRanges is not used in the main algorithms, it is a programmer's convenience than can become very useful when using the public API around my hex editor control. I could only imagine a search selecting a million or few hundred thousand items (which are separated like [....] ... [..] ..... [.......]) in a large file and then the user/programmer somehow creating indexes for his needs and then needing to convert them back to ranges.

[you said]
"I forgot one question: what is the source of your array ?
I mean, if there already is something that performs the task
of ordering a lot of numbers and then putting them in an array, seems like
your range-finding requirement performance-wise should be integrated with it !"

When a user selects an a range of data the range will be added to a List<range>. When adding them range it will determan the position to insert using a binaryseach and a bitwise compliment operation. They will always be sorted from the start. No sort methods will need to be called. The source of the array may come from a method long[]GetSelectedIndexes which converted the ranges into an array of indexes. Although I do also have a method called Range[]GetSelectedIndexeRanges which is more likely to be called more than the index array version. Also the indexes could come from anywhere as FindIndexRanges will be exposed to the programmer using the control. If GetSelectedIndexes is called it will return the sorted indexes that are selected. They are already sorted as I said, GetSelectedIndexes uses the Ranges to create the index array.




█▒▒▒▒▒██▒█▒██
█▒█████▒▒▒▒▒█
█▒██████▒█▒██
█▒█████▒▒▒▒▒█
█▒▒▒▒▒██▒█▒██

GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 21:04
sitebuilderLuc Pattyn6-Jan-07 21:04 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 21:23
Captain See Sharp6-Jan-07 21:23 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 21:27
sitebuilderLuc Pattyn6-Jan-07 21:27 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 21:32
Captain See Sharp6-Jan-07 21:32 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 21:53
sitebuilderLuc Pattyn6-Jan-07 21:53 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp6-Jan-07 22:04
Captain See Sharp6-Jan-07 22:04 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 8:20
sitebuilderLuc Pattyn7-Jan-07 8:20 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 8:25
Captain See Sharp7-Jan-07 8:25 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 8:34
Captain See Sharp7-Jan-07 8:34 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 8:43
sitebuilderLuc Pattyn7-Jan-07 8:43 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 8:59
Captain See Sharp7-Jan-07 8:59 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 9:51
sitebuilderLuc Pattyn7-Jan-07 9:51 
GeneralRe: I cant seem to think today. Pin
Captain See Sharp7-Jan-07 10:29
Captain See Sharp7-Jan-07 10:29 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn7-Jan-07 10:48
sitebuilderLuc Pattyn7-Jan-07 10:48 
GeneralRe: I cant seem to think today. Pin
Luc Pattyn6-Jan-07 20:11
sitebuilderLuc Pattyn6-Jan-07 20:11 
QuestionHow to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
new_era886-Jan-07 15:08
new_era886-Jan-07 15:08 
AnswerRe: How to set a System.Timers.Timer to Single Thread Apartmentstate (STA)? Pin
Captain See Sharp6-Jan-07 18:05
Captain See Sharp6-Jan-07 18:05 

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.