|
yes, I tried ContainsKey(),
then i tried TryGetValue(). Both don't work.
i'm implement both equals (for object, and for IEquatable).
|
|
|
|
|
Could you paste the code you're using for IEquatable? Could be a problem there.
|
|
|
|
|
Due to lack of time, I decided to go with the .Net class KeyValuePair, even though the pure definition isn't what i wanted, it works
thanks for the help
|
|
|
|
|
Hi,
I have created a C# ActiveX control and I am trying to access its properties and methods using javascript exactly as described in this mini article http://www.c-sharpcorner.com/UploadFile/dsandor/ActiveXInNet11102005040748AM/ActiveXInNet.aspx
However, I fail to access any properties/methods of the control and the javascript does not display an error msg
Any Ideas? Thank you
And ever has it been that love knows not its own depth until the hour of separation
Mohammad Gdeisat
|
|
|
|
|
Don't spam the forums Pick one and stick with it
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I am not spamming, it just has two candidate locations, that's all.
And ever has it been that love knows not its own depth until the hour of separation
Mohammad Gdeisat
|
|
|
|
|
|
This is often a difficult situation, but having two or more separate threads leads to a very fragmented site/knowledge base so pick the most suitable location for your question and leave it at that.
If, after a few days or more, it hasn't been answered (if it has then don't do this!) then by all means post in the other forum making it clear why you are cross posting and linking to the original thread so discussion can continue in the original location. This approach keeps things tidy and will avoid you getting flamed.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Hi all
I'm using this example Pretty IE Toolbar in C#[^] to make a toolbar that interface itself with an external validator.
I need to validate the page the user is currently viewing on the press of a button, but till now I was unable to get the original source of the file.
this code
HTMLDocument d = (HTMLDocument)this.Explorer.Document;<br />
d.documentElement.innerHTML;<br />
(where Explorer is WebBrowserClass) alters the source itself.
Is there a proper way to get the real downloaded source code (without the interference of javascript)
I cannot download the page using the url cause I would miss "form posts".
Thank you all
K.
|
|
|
|
|
I've also tried using a IPersistStreamInit, but the code i get is never the source code, for example an XML with an xsl return the transformed HTML code and not the xml source.
How can I get the raw source?
Thank You
K.
|
|
|
|
|
how to convert string to binary.
example a = 01100001
|
|
|
|
|
Your example is already binary; try rewording your question. Alternatively you could just use the Int32.TryParse()[^] method.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
String <-> Binary is easy:
Int to Binary String:
string s = Convert.ToString(myInt, 2);
Binary string to int:
int i = Convert.ToString(myString, 2);
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
i can some speak english...
i want to convert string to binary.
example;
string myString = stringToBinary("a"); //return value will be 01100001
string stringToBinary(string str)
{
.....
.....
.....
}
|
|
|
|
|
You can cast char s to int s, an other post tells you what to do with the resulting int
|
|
|
|
|
Hi,
let me put a couple of things straight first: there are no decimal numbers, no hexadecimal numbers, no binary numbers, there are just numbers. A number is a number, it does not have a base.
It is only when a number gets represented by a string (maybe because it gets shown to the user, or input by the user) that it becomes a decimal, hexadecimal, binary, or whatever representation of that number.
And here are some typical operations:
int num=20;
string decimal1=num.ToString();
string decimal2=num.ToString("D5");
Console.WriteLine("decimal representation: "+decimal1);
string hex4=num.ToString("X4");
Console.WriteLine("hexdecimal representation: "+hex4);
int val16;
int32.TryParse(hex4, NumberStyles.Hexadecimal, null, out val16);
Console.WriteLine("The value of hex "+hex4+" is "+val16);
string binary=Convert.ToString(num, 2);
int val2=Convert.ToInt32(binary, 2);
Console.WriteLine("The value of binary "+binary+" is "+val2);
string octal=Convert.ToString(num, 8);
int val8=Convert.ToInt32(binary, 8);
Console.WriteLine("The value of octal"+octal+" is "+val8);
|
|
|
|
|
i try your code
string binary = Convert.ToString(Encoding.UTF8.GetBytes("a")[0], 2);
--------------------
//binary value is "1100001"
//but "1100001" is 7 bits. its must be 8 bit. must be value of binary "01100001".
|
|
|
|
|
sure, when you mean "eight" do you write "0000000008" or "8"? it isn't because a 32-bit integer could hold up to 10 digits that you must prefix all those zeroes, is it? Not in decimal, not in hex, not in octal, not in binary.
If you want something prefixed, use string.PadLeft()
FYI: There is a shortcut for hexadecimal, the format specifier "X4" enforces at least four digits, prefixing zeroes as necessary. However there is no binary or octal format specifier in .NET
|
|
|
|
|
Having just seen his reply to you, I think you are going to have fun with this, Luc! He seems to be saying that leading zeros are significant...
Why do they let these people loose with a keyboard?
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
I do not know English fully. so I could not understand the full last message.
Thank you for your reply
|
|
|
|
|
Don't worry, it is Friday, for some people it is time for a spirit shift.
|
|
|
|
|
OriginalGriff wrote: leading zeros are significant
of course they are, you need them as soon as you want to perform shifts, rotates, concatenates, and all kinds of advanced bit fiddling. Come and see next week.
|
|
|
|
|
No, no, zero means "nothing". Therefore you can just delete them from your bit stream with impunity - it's an advance form of data compression.
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
OriginalGriff wrote: it's an advance form of data compression
Funny you mention that. It is how I explain the infinite power of compression:
1. look at your data in binary format
2. remove the zeroes
3. count the ones
4. write that down as a binary number
5. if zeroes in sight go to step 2
A more advanced scheme goes on by incrementing the remaining data, and repeating everything.
|
|
|
|
|
I prefer a single stage compression technique, which if used correctly is extremely compact and fast to decompress. It consists of finding the random number seed that re-generates the input stream. You then only have to transmit the seed, and you are there.
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|