|
Hi,
This should be the solution: (copied from MSDN)
txtFieldInBinary.Text = Convert.ToString(valueToDisplayAsBinary, 2);
|
|
|
|
|
You could write your own code to do this -
public class ShowBits {
public static void Main() {
int t;
byte val;
val = 123;
for(t=128; t > 0; t = t/2) {
if((val & t) != 0) Console.Write("1 ");
if((val & t) == 0) Console.Write("0 ");
}
}
}
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
public class ShowBits {
public static void Main() {
byte val;
val = 123;
for(int i = 7; i >= 0; i--) {
Console.Write(((val >> i) & 1) + " ");
}
}
}
|
|
|
|
|
Hi Thanks for answering.
I don't understand (val & t).
I will look it up
|
|
|
|
|
Here's[^] an older article of mine that has what you need and more.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
No need for explicit loops. I'd go for
string binary=Convert.ToString(myUnsignedByte, 2).PadLeft(8, '0');
which yields 8 binary digits.
|
|
|
|
|
Ok I found that there's a Convert.ToString for that
http://msdn.microsoft.com/en-us/library/14kwkz77.aspx
|
|
|
|
|
Hi All,
I am using the XYNTServices example I found here. If I start the Service with everything using local computer resources it works great. However, I want to be able to place the log file it creates on a server rather then the local computer. Does anyone out there know how to accomplish this? I have tried mapping the server resource to a drive letter, I have tried using the complete IP address to the resource folder and I have tried using the \\servername\folder\folder\logfile.log None of which have worked! So any information on how this can be made to work would be greatly appreciated. Oh almost forgot if I use the \\IPAddress\folder\folder\logfile.log in this case it does in fact create the log file on the server, but then the windows service won't start. I keep getting the "Could not start the MyWinService service on Local Computer."
"Error 1053: The service did not respond to the start or control request in a timely fashion." Both statements without quotes of course. So the only change is to the path of the log file. Again ANY help would be appreciated!
Thanks,
Charlie
Everything is Free... Until You Have to Pay for it...
Platforms Windows 2000/XP Professional using Visual C++ 6.0 Visual Studio 2005
|
|
|
|
|
Charlie Curtis wrote: XYNTServices example I found here
You might want to provide a link to this article. Or better still, you could post this question at the bottom of the article (in the messages section).
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Thanks for... Nothing
Everything is Free... Until You Have to Pay for it...
Platforms Windows 2000/XP Professional using Visual C++ 6.0 Visual Studio 2005
|
|
|
|
|
Charlie Curtis wrote: Everything is Free... Until You Have to Pay for it...
Charlie Curtis wrote: Thanks for... Nothing
Well you paid nothing, so you got nothing, I'm not sure what you expected.
What is expected is a decent question, and reasonable politeness, you have failed point one in your first post, and point two in your second.
We aren't having your problem, you are.
We aren't getting paid to sort your problem, you are.
We aren't getting paid to scrabble round for information to help you sort your problem, so the least you can do is try and give us all a clue.
Try reading the FAQs at the top of this forum, that way you are more likely to get help.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
If you're going to use non-local resources, i.e.: Network Share, from your service, you service has to run under a different account. The LocalSystem account used by default does not have any permissions to any network resources. The fix is to setup a user account that has the appropriate permissions to the network resources it needs and change the service in the Service Manager to logon using that account.
|
|
|
|
|
Hi Dave,
Thanks for the info I will give this a shot. Sounds like it might be what the problem is.
Charlie
Everything is Free... Until You Have to Pay for it...
Platforms Windows 2000/XP Professional using Visual C++ 6.0 Visual Studio 2005
|
|
|
|
|
If you put the log on a network drive, how do you log that you have a network outage?
I prefer to keep log files local.
|
|
|
|
|
PIEBALDconsult wrote: how do you log that you have a network outage?
email.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Correct.
Use the built-in speaker or buzzer to send a Morse message.
Don't forget to flash the screen too, so the hearing impaired can get the message also.
|
|
|
|
|
Luc Pattyn wrote: built-in speaker
Then they would interfere with my Westminster Chimes.
|
|
|
|
|
PIEBALDconsult wrote: they would interfere with my Westminster Chimes
We can't have that. Assuming your Westminster isn't an ancient one without any interface, you should plug it in a USB port; then download and install a little app that will temporarily stop the clock to keep exceptional alarms and regular time signals well apart.
|
|
|
|
|
Luc Pattyn wrote: Use the built-in speaker or buzzer to send a Morse message
Funny you should mention this.
About 3 years ago, at my previous job, we had a card printer that had a flaky power supply. I kid you not, when the power supply failed, it was very quietly tapping out "S O S" in one of the components. That was the most clever thing I've run into in a piece of hardware in 25 years.
|
|
|
|
|
I've seen many devices that emit a serial error code using a single LED (and a conversion table in the manual), however I've never seen one actually emit any Morse code. For internal subsystems such as a power supply, an audible signal makes perfect sense.
|
|
|
|
|
I don't have a built-in speaker on my machine. Can I just connect the mouse to the mains and send a gentle 240V message that way?
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
There is no such thing as a gentle 240V, so when you try that, make sure you go to defcon 3 and raise your shields.
|
|
|
|
|
Defination:
"Through inheritance, a class can be used as more than one type; it can be used as its own type, any base types, or any interface type if it implements interfaces. This is called polymorphism".
But does it mean changing a behaviour of a method in a drieved class also means polymorphism. e.g
public class BaseClass
{
public virtual void DoWork() { }
public virtual int WorkProperty
{
get { return 0; }
}
}
public class DerivedClass : BaseClass
{
public override void DoWork() { }
public override int WorkProperty
{
get { return 0; }
}
}
|
|
|
|
|
This is indeed a case of polymorphism based on the definition here.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
So, polymorphism process cannot happen without inheritance. Can it be done without it.
|
|
|
|