conversion

Getting null terminated string from System.Text.Encoding.Unicode.GetString

I have an array of bytes that I receive from an external entity. It is a fixed size. The bytes contain a unicode string, with 0 values to pad out the rest of the buffer: So the bytes might be: H \0 E \0 L \0 L \0 \0 \0 \0 \0 \0 ... etc I'm getting that buffer and converting it to a string like so: byte[] buffer = new byte[buffSize...

[JavaScript] Unit of Measure Conversion Library

What is the best/most elegant way to abstract out the conversion of units of measures in the client, based on a user-preferred unit of measure setting? For example, let's say user A's preferred unit of measure is "metric", while user's B's preference is "imperial". Now lets say I've calculated the area of something in meters squared. W...

XPS to text conversion?

I am working with a series of programs that export pure textual data as XPS files. I want to get at this text data in order to some post-processing. Currently I am using a windows based commercial product to convert the files to a text format, but this is a full blown windows app. What I am after is a command line program that can ext...

How to convert char to integer in C?

Possible Duplicates: How to convert a single char into an int Character to integer in C Can any body tell me how to convert a char to int? char c[]={'1',':','3'}; int i=int(c[0]); printf("%d",i); When I try this it gives 49. ...

c# to vb conversion object initalization

I am trying to pick up on VB.net and have been programming in c# for a while. I have grasped pretty much most of vb.net but running into some issues with this conversion for object initialization: CustomerParameters customerParameters = new CustomerParameters { ...

Failsafe conversion between different character encodings

Hello! I need to convert strings from one encoding (UTF-8) to another. The problem is that in the target encoding we do not have all characters from the source encoding and libc iconv(3) function fails in such situation. What I want is to be able to perform conversion but in output string have this problematic characters been replaced w...

Prettifying a conversion from m(metres) to feet(') and inches ('')

I'm creating table for defining an individual's BMI. The chart (as yet) doesn't take input (because I want to make the thing work stand-alone, first), but it does show (on parallel axes) the height in both metres and feet/inches. In order to do this I'm defining the metres' start point and range and then converting the defined metres va...

Conversions and Promotions

I just wondering why this works (in Java): byte b = 27; but being method declared like this: public void method(byte b){ System.out.println(b); } This doesn't work: a.method(27); Gives a Compiler error as follows: `The method method(byte) in the type App is not applicable for the arguments (int)` Reading this doesn't give...

Convert array of char[] to byte[] and vice versa? C++

What is the best way to convert an array of chars to bytes and vice versa? Solution: void CharToByte(char* chars, byte* bytes, unsigned int count){ for(unsigned int i = 0; i < count; i++) bytes[i] = (byte)chars[i]; } void ByteToChar(byte* bytes, char* chars, unsigned int count){ for(unsigned int i = 0; i < count; i++) ...

suggestion for a couple of pdf tools

Hi I need a quick advice. I'm looking for a couple of tools to do these tasks take some images and combine them into a multipage pdf take a pdf and output each page as a separate image I can't find anything free on google, apart from suggestions like "open an openoffice doc, add each image on a page and print to a pdf file" ... Any...

How can I convert a binary number into a string character using Perl script?

Hi, How can I convert a binary number into a string character using Perl script? thanks in advance. ...

Git interoperability with a Mercurial Repository

I use GIT on a Mac. Enough said. I have the tools, I have the experience. And I want to continue to use it. No wars here... The problem is always with interoperability. Most people use SVN, which is great for me. Git SVN works out of the box, and is a no frills solution. People can continue happily use SVN and I don't loose my workflow ...

Documentation on Apple Mail's .emlx data structure(s) (for conversion purposes)?

This appears to be a rare gem: where to find documentation on the structure of Apple Mail's .emlx files (and their partial variants, and the meaning of the directory structures). The docs do not appear to exist on Apple's site, nor can I find any reasonable mention of it via Google. The point of this is the creation of a bash/ruby/pyth...

Convert string to integer

I need help in my code. I would like to write only numbers/integer in my textbox and would like to display that in my listbox. Could someone please check my code below. This seems to give an error. int yourInteger; string newItem; newItem = textBox1.Text.Trim(); if ( newItem == Convert.ToInt32(textBox1.Text)) { ...

cannot convert type 'string' to 'int?' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion or null type conversion

Hi, I'm going to try to make myself clearer. Why does C# accept the following: object o = "hello"; int? i = o as int?; if (i == null) { // o was not a boxed int } else { // Can use i.Value to recover the original boxed value } and not String = "hello"; int? i = o as int?; if (i == null) { // o was not a boxed int } else { // Can u...

.Net List to a SOAP Array and back to a .Net List

Within a Web Service CarService, - I have a class called Car. - Car has a bunch of properties i.e. Car.Color. - CarService has a method called GetCars(). - Within GetCar, I have a loop that appends a List of, you guessed it.. Cars. Dim carList As New List(Of Car) Do While rdr.Read() If rdr.GetValue(1).ToString().Length > 0...

Is there a way to change the following VBScript into javascript?

I'm attempting to convert some VBScript to javascript, but I doubt it's possible because it seems to be specific to MS apps and code. I'd like help with either of the two possible outcomes: a) actually converting the code to javascript, or b) demonstrating that converting it to javascript is currently not possible. The specific VBScript...

Encoding of ... some sort?

Forgive me if this has been asked before, but I assure you I've scoured the internet and have turned up nothing, probably because I don't have the right terminology. I would like to take an integer and convert it to a little-endian(?) hex representation like this: 303 -> 0x2f010000 I can see that the bytes are packed such that the 16'...

What do sites like Google Docs and Zoho Writer use to generate MS Office documents

I realise this may just be speculation, but I'd appreciate comments from anyone who has some insight into this. Something like MS Word COM add-in, or an OO bridge, or a custom implementation. The reason I want to know is that I want to provide basic online document editing (really basic, basically just rich text at this point) for a ph...

Convert ADC Bins into Voltage

Let's say I have a 12-bit Analog to Digital Converter (4096 bins). And let's say I have a signal from 0 to 5 Volts. What is the proper conversion formula to convert ADC bins into Volts? V = ADC / 4096 * 5 or V = ADC / 4095 * 5 Do I divide by 4096 because there are 4096 bins in the ADC? Or do I divide by 4095 because that is the h...