|
or u , can tell about some resurces that i can use to reach my point.
plz
|
|
|
|
|
HEllo there!
So you need to convert the char 'A' into byte Array. Quite strange.
Try this line of code...
byte[] b = System.Text.UTF8Encoding.UTF8.GetBytes(new char[] { 'A' });
Actually it takes a char array and return respective byte array.
Hope it helps
regards
Mubashir
|
|
|
|
|
thx alot mubashir , and i want to ask u another question .
how can i get the size of this stream of byte after i convert the char "a" or after i convert any stream of character. :->
regards
abdallah
|
|
|
|
|
b.Length
---
b { font-weight: normal; }
|
|
|
|
|
Hi again Abdallah
I think I understand what you want to do - and I've created a utilityclass for you that will do this.
You can see it in action at: http://sweetsilence.dk/codeprojectprojects/CodeProjectSample_BinaryEncoding[^]
You can get the file here: http://sweetsilence.dk/codeprojectprojects/CodeProjectSample%5FBinaryEncoding/binaryencoder.zip[^]
And you can see the code here:
public class BinaryEncoder
{
public static int[] bitValues = new int[8]{128,64,32,16,8,4,2,1};
public static byte[] StringToBinary(string stringToEncode)
{
byte[] bytes = new byte[stringToEncode.Length * 8];
int byteOffset = 0;
int byteIndex = 0;
for(int charCounter = 0; charCounter< stringToEncode.Length; charCounter++)
{
byteOffset = charCounter*8;
for (int bitCounter = 0; bitCounter < 8; bitCounter++)
{
byteIndex = byteOffset + bitCounter;
if((stringToEncode[charCounter] & bitValues[bitCounter]) != 0)
bytes[byteIndex] = 1;
else
bytes[byteIndex] = 0;
}
}
return bytes;
}
}
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
thx alot , you give so much helpfull guide to cod the project that i gonna to write i hope i will help you in any thing that i can do........
thx
kind regards
abdallah
|
|
|
|
|
Hi Abdallah
I am very glad the code sample was of use to you!
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
Dear members
I need some help here to solve a problem , maybe i don't know if i have done the right thing
protected override void OnStart(string[] args)
{
// TODO: Add code here to start your service.
Process p = Process.Start("C:\\Boot.ini");
}
this is a windows service and i have instaled it as the books says and it works fine and i see the notepad process in the task manager BUT i need it to show me the notepad to be visible to me, just to know that it is working
thanks a lot
Mohamed
|
|
|
|
|
You need to make sure your service is configured to 'allow service to interact with the desktop'
Michael
CP Blog [^] Development Blog [^]
-- modified at 7:57 Wednesday 12th April, 2006
|
|
|
|
|
Thanks a lot Mr/ Michael for ur concern
although all the forum laughed at me , but I don't care.
but here is the problem : i have a program on my server and i don't want to deploy it at the clients because it is a windows application and the application in my company is web application ; so my idea is : i will create a web service to call the windows service that will run on the server like Microsoft do when the asp.net launch it's application .
Is it a crazy idea ? or it is impossible?. If not can anyoine show me the way , also how to make the program to run and be visible to me on the server,when the client call the web service
thanks a lot for the help again
|
|
|
|
|
Everyone who posts a question "needs some help here" - please try to use descriptive subjects!
|
|
|
|
|
Perhaps disallowing certain words in the subject would be an idea... like please, problem, help, urgent...
---
b { font-weight: normal; }
|
|
|
|
|
We can dream.... you get my 5!!
|
|
|
|
|
I got a laugh out the "Immediately" a few posts up. That just screams "Please, ignore my post!"
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I want use LDAP in C# get all user
Add, Edit, Delete Acount in LDAP
can u help me
|
|
|
|
|
I want Get all user , add , edit , delete on Winform
can u help me
|
|
|
|
|
|
hi,
i m using tapi3.0 in c#, i want to know how to detect disconnect event when other party drop the call....i try call_state.disconnect.dc_normal this code is working but on button click event not when person actually drop the call....
Is it required some special modem or simple voice modem is work...
plz send the reply as soon as possible
|
|
|
|
|
I'd recommend using the TAPI browser app[^] to see what events are being sent from your modem.
That's the easiest way of finding out which event your modem is sending when a person hangs up.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
i am developing a pocket pc applicatoin using vs.net 2003 with C#. Now i am stuck with a problem ...
Actually i want to intercept an incoming call and check to see if that number is already blocked by the user.Incase it is blocked the call will be disconnected otherwise the call will be allowed to make the bell from the phone.
Can anyone help in that ???
rohit@graycelltech.com
|
|
|
|
|
Hi,
I have a class hierarchy of objects representing typical stuff like employees, users, addresses and so on. I've defined the relationships, created a database and now want to add serialization. The top-most class is an abstract one, kind of like CObject I suppose and my objects may exist on a desktop or mobile platform.
I started to implement custom serialization but the Compact Framework doesn't support it so now I have to write my own stuff. What I'm looking for is some ideas as to how best to implement serialization for my system. Typically, each object will need to be serialized to/from my database and to/from a web service so I'm guessing I just need to write some methods to serialize to XML and/or to a MemoryStream object.
OK, assuming that's the way to implement the actual serialization, how best to define it within my hierarchy? I was thinking of two virtual methods, toXML() and fromXML() defined withing my top-most class and an abstract method called getObjectData() which all descendents *must* implement.
toXML();
toMS();
getObjectData();
Within toXML() and toMS() , there's a call to getObjectData() which gets the object data ready to be formatted into a MemoryStream object or XML.
Each object would also implement a constructor accepting an XML or MemoryStream object but I'm very new to C# so I don't know if there's a way of forcing derived classes to implement these constructors or whether I "should" or not.
What do you think? Any help much appreciated including book/article suggestions ![Smile | :)](https://www.codeproject.com/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Hello gurus,
I'd like to know how can I compress and decompress a byte array with the GZipStream class...
I'd like to have similar functions to do the following:
byte[] Compress(byte[] bytesToCompress)
byte[] Decompress(byte[] bytesToDecompress)
Can someone show me how to do that?
Best regards.
Thanks.
There is no spoon.
|
|
|
|
|
|
Where can i find an e-book version of "Practical Cryptography"
Thanks !
|
|
|
|
|
Hi, I'm trying to use the character "&" in a label control but it turns out to be an underscore under the character next to the "&". For example, i set text as "&ABC", it turns out to be "ABC". Any idea on how to use this character to make it appear as it is?
Best Regards.
KiT
|
|
|
|