uint

What is the best way to combine two uints into a ulong in c#

What is the best way to combine two uints into a ulong in c#, setting the high/low uints. I know bitshifting can do it, but I don't know the syntax, or there maybe other APIs to help like BitConverter, but I don't see a method that does what I want. ...

How can I force subtraction to be signed in Python?

You can skip to the bottom line if you don't care about the background: I have the following code in Python: ratio = (point.threshold - self.points[0].value) / (self.points[1].value - self.points[0].value) Which is giving me wrong values. For instance, for: threshold: 25.0 self.points[0].value: 46 self.points[1].value: 21 I go...

Converting uint color to argb hexadecimal for kml color

Good day everyone, I am stuck trying to convert a uint color value into its equivalent argb hexadecimal format. Basically, I am trying to convert a color from Flex(AS3) into its appropriate kml color, which is in the argb hexadecimal format from what I gather. Below is my function as it stands now. Although it does convert into a val...

Send a NSString with \0

I am trying to send a string terminated with \0 to a tcp socket but it seems the \0 does never reach its destination. Using this code: NSString* s=@"<b/> \0_"; uint8_t *buf = (uint8_t *)[s UTF8String]; int resCode = [outputStream write:buf maxLength:strlen((char *)buf)]; I only seem to send @"<b/> ". Probably the \0 is seen as the ...

Variable length encoding of an integer

Whats the best way of doing variable length encoding of an unsigned integer value in C# ? "The actual intent is to append a variable length encoded integer (bytes) to a file header." For ex: "Content-Length" - Http Header public string somefunction(int data) { //returns the binary format of the data byte as a string string data_...