|
it seems to me there is no difference between generics Dictionary<> and
SortedList<>.
but since they are defined, there should be some difference.
then what is the difference then?
thanks.
|
|
|
|
|
|
It wouldn't hurt to read some of the MSDN documentation; they state:
The Dictionary< (Of < (TKey, TValue> )> ) generic class provides a mapping from a set of keys to a set of values. Each addition to the dictionary consists of a value and its associated key. Retrieving a value by using its key is very fast, close to O(1), because the Dictionary< (Of < (TKey, TValue> )> ) class is implemented as a hash table.
The SortedList< (Of < (TKey, TValue> )> ) generic class is a binary search tree with O(log n) retrieval, where n is the number of elements in the dictionary. In this, it is similar to the SortedDictionary< (Of < (TKey, TValue> )> ) generic class. The two classes have similar object models, and both have O(log n) retrieval. Where the two classes differ is in memory use and speed of insertion and removal: ...
hence performance is the key; you choose based on (1) the need for having things sorted, and (2) the balance between insertions and lookups.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Luc Pattyn wrote: It wouldn't hurt to read some of the MSDN documentation
Yes
Luc Pattyn wrote: you choose based on
Reading the documentation or reading what someone in a forum writes. Of course if you choose to read the documentation you don't get to tweet.
|
|
|
|
|
Hi All. In my rich text editor everything's finished except for one thing. I want the user to be able to save the file as EITHER RTF or TXT. But when I use this:
Rtb.SaveFile(Sf.FileName, RichTextBoxStreamType.PlainText);
... It never works. The next time they open the TXT file it opens but with all the RTF formatting codes in it which makes the file ugly and unreadable and unacceptable. Does anybody know how I can fix this, or know of any other ways to do this.
I have tried doing this also, but doesn't always work:
string text = Rtb.Text;
File.WriteAllText(Sf.FileName, text);
I have been to MSDN and Google and there's a whole lot of junk on Google with no solutions. (Btw, I'm beginning to favor Microsoft's new search: Bing over Google nowadays). I'm completely baffled as to why the PlainText option does not work.
Any thoughts? Anyone?
regards,
jase
|
|
|
|
|
Never mind, I'm going to begin looking into making my own input control. Wish me luck!
|
|
|
|
|
Hi,
I have a WinForm that hosts a WebControl. Is there any way to disable all java scripts in that webControl?
thanx
|
|
|
|
|
I tried injecting a script that would prevent the control to popup other windows, but it did not work
In the webBrowser1_Navigated handler:
HtmlElement head = webBrowser1.Document.GetElementsByTagName("head")[0];
HtmlElement scriptEl = webBrowser1.Document.CreateElement("script");
IHTMLScriptElement element = (IHTMLScriptElement)scriptEl.DomElement;
string alertBlocker = "window.alert = function () { }";
element.text = alertBlocker;
head.AppendChild(scriptEl);
Also, when I right-click 'view page source' I don't see the script I injected.
|
|
|
|
|
Can anybody help out with this?
|
|
|
|
|
I'm trying to add spacing to the beginning of some text so that I can put small symbols before specific lines of text. The size of the symbols is always the same, 10x10 pixels, however the number of symbols can range from none to half a dozen.
The problem I'm running in to is figuring out the number of spaces to indent the text. Normally I'd simply move the bounding box over by the size of the bullets, but in this case, the next line of text needs to wrap under the graphics I'm inserting, so moving the bounding box cuts down on the space available for text.
Right now I'm just adding in 3 * the number of spaces as there are symbols in hopes of getting close, but it's a bit off. I've tried using MeasureString to get the size of a space, then adding enough spaces to move the text, but it comes out too little with only 1 symbol and not nearly enough by the time there are 4 or more symbols.
Any suggestions?
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
Why not always start the text with a symbol? Use a blank one instead of your spaces and off you go. I don't think spaces are a good way to go; the width of a space can vary depending on the font - start a reply to this and compare the width of a space in the "Subject" and "Text" areas. The font size is the same, but the space width is different.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
That's why I was using measurestring to check the size of the space in whatever font was being used at that moment. As for always using a symbol, that would be simple, except the number of symbols changes.
What would be nice is if there were a way to indent text within a bounding box, by a set number of pixels. Just like in a text editor where if you go to the beginning of a paragraph and insert tab, everything indents and the word wrap updates to fit each following line.
The only other thing I've thought of so far would be doing the word wrap manually by measuring each line and breaking up the string until it fit. I've just hoped to avoid that since it's going to involve rounding between lines, making the line spacing squirrely.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
But if your symbols are always the same size (as you said) just use the appropriate number of blank symbols. You cannot guarentee to get the same size with spaces - there may not be a neat multiple to ten, twenty and so on pixels.
Avoid manual word wrap - I had to do it yonks ago (pre windows) and it is a PITA.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Each Symbol is the same size, however if there's only 1 symbol and I leave room for 6 of them, then I've lost half of that line of text. The print out is about 2.25" x 2.25" a little smaller than half a playing card. So each bit of space is a premium.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
Sadly, doing my own word wrap ended up being the solution. For now it's only the first line, I'm going to end up having to do the rest of it though. There are going to end up being symbols in the middle of the text later on. The bugger I'm just realizing is that I can't even cheat and make my own font since the text around the symbols would be in a different (varying size) font, requiring separate calls to Drawstring.
On the bright side, the output is a printed label, so at least I don't have to worry about keeping up a frame rate.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
I am trying to populate a toolstripcombobox with an arraylist. I tried :
toolstripcombobox1.combobox.datasource = arraylist,
but nothing shows up in the combobox
any suggestions on how to do this?
Tom
|
|
|
|
|
hehe I found the solution hehe
foreach (var item in arraylist)
{
toolstripcombobox1.items.add(item)
}
|
|
|
|
|
I would extend the toolstripcombobox to a new control that can have a new DataSource property which accepts type arraylist and then parse that internally to compartmentalize your controls better to split up your logic more efficiently.
|
|
|
|
|
does any one have an idea about audio and vedio capturing and playbaking it ?
if so plz put ya ideas on how to do it ?
thanx
|
|
|
|
|
One word - DirectShow.
Does all you need, and more...
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
can u gimme a short brief abt it ?
THANX
|
|
|
|
|
Google it, do some research for &%*^s sake.
|
|
|
|
|
As mentioned above, you can find hundreds of examples on the net (hey, even on Code Project! ) with a bit of searching, but to get you started, here's the official documentation for it[^]...
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
It is unclear from your post if you are wanting to do capturing of your computer's screen and the computer's audio or the audio and video from an external mic and a camera.
Taverso DAW[^] is an open source utility and can do audio recording and processing.
CamStudio[^] is an open source utility that can capture audio and video simultaneously (from the board display and board audio card).
I am not sure if that could possibly help you. But that's all I can give you with the information available on your post. Also, they may not be C# applications (even though I'm pretty sure there are C# wrappers around these at CodePlex).
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
The guys that are the gurus today started with just a pixel. It changed color as the sensor moved to a light environment to a dark environment. Then they got the opportuntity to mess around with two pixels, then three.. then 25. As the number of pixels they were recording over time increased, they had different techniques to capture the video, and different techniques to play back the video.
Now we have very high resolution, but many of the same tecniques still apply to the single pixel screen. If you are thinking about creating your own video capture utility I would strongly recommend that you review the history of the video recording and capture technology as you learn to spell.
Life is too short to program in Visual Basic.
|
|
|
|