|
As I said before you can go through the MSDN Documentation[^]. If you want to get familiar with Microsoft technology you need to use MSDN as your prime source of information.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Does anybody know how to do this with the information entered in
this format? ##.####
I thought it might be in the Math class but isn't.
Thanks for any help.
|
|
|
|
|
Darrall wrote: I thought it might be in the Math class but isn't.
Wikipedia does http://en.wikipedia.org/wiki/Geographic_coordinate_conversion[^].
Tarakeshwar Reddy
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|
|
It's not a built-in function, but it's certainly not hard to do the arithmetic.
Subtract the int part of ##.#### from the original. The remainder will be .####. Multiply that by 60 and again take the int part of the result - that's the minutes. Subtract the minutes from the result of the first multiplication, then multiply the result by 60 again. The result is the seconds, though there may be a decimal part in the result if the original datum wasn't an integral number of seconds. You can remove that if you don't want it by again taking only the int part of the result.
I don't yet have enough experience with the language to suggest the syntax - for all I know, Convert.ToInt() might round, rather than truncate real values. If so you'll have to try another dodge. But it shouldn't be too difficult to manage. It's such a frequent problem, though, that I'm rather surprised that MS didn't include it as a stock function.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Thanks Roger. I know the conversion itself is simple if you're sitting there doing it on a calculator. It becomes fairly complicated using C# code though which is why I was surprised there wasn't already a Math function for it. They have sin, cos and tan which all work in angles and in the real world - surveying, mapping, navigation, etc. - angles come in degrees, minutes and seconds.
I will pass my method along once I have finished it in case anybody else wants it.
Thanks for your feedback.
|
|
|
|
|
Hi,
I'm looking for some help implementing an issue i have.
main purpose is aggregating information from DB
I get data from a DB, and that table has 2 primary keys.
for each pair (primary key) i create an object that holds all the information, and after all the DB is read, i take each object and put its information in a different DB table.
I need to clarify that performance is very important, dealing with about 1milion rows every time.
The issue im having is how to hold that info. I tried using a Dictionary, the key being Pair<T,U> (simple object i created).
however, when using Dictionary.contains() didnt recognize 2 similar Pairs, and created a new 'similar' object instead of returning the one already existing.
I am not sure if I should implement Icomparable,
or maybe there is a different way altogether that might be better.
Thanks for your help
|
|
|
|
|
If the fields are primary keys in the DB, shouldn't they be guaranteed unique?
But anyway, IComparable isn't what you're looking for... That's to determine magnitudes, not equality. You want to implement IEquatable<T> ... Just try to make the implementation of that as efficient as possible.
|
|
|
|
|
Hi, sorry about the mixup, the fields are primary key in the table i'm putting the data in, not where im taking it from.
used: Dictionary<Pair<enum1,enum2>, myObj> _obj = new...
and in Pair<T,U> i implemented:' public override bool Equals(object obj)'.
will implementing IEquatable<T> be different from the Equals method?
Thanks for help
Edan
|
|
|
|
|
It's my understanding that the Dictionary looks first at the IEquatable<> interface... But I thought it looked at the basic Equals() too... Still, I would assume the generic version would be a bit faster, as it doesn't need to do any unboxing.
And you're using ContainsKey(), not Contains(), right?
|
|
|
|
|
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);
|
|
|
|