conversion

How to perform unsigned to signed conversion in Java?

Say I read these bytes: "6F D4 06 40" from an input device. The number is a longitude reading in MilliArcSeconds format. The top bit (0x80000000) is basically always zero and is ignored for this question. I can easily convert the bytes to an unsigned integer: 1876166208 But how do I convert that unsigned value into its final form of 3...

How do I make a human-readable string out of a struct tm?

Hello, I am getting a struct tm and I want to convert it into a string with this specific output: dd-mm-yyyy hh:mm where everything is a number except for the month (mm), such as: 14-Oct-2010 10:35 This is my current code: struct stat sb; if (lstat(path, &sb) == 0) { struct tm *pmytm = gmtime(&sb.st_mtime); sprintf(arra...

What are the big major drawbacks porting a wpf LOB to silverlight 4

Hello folks, I am thinking about porting my alpha WPF MVVM application to silverlight. I do not use 3D its a LOB ;-) What I promise myself from the conversion is to get more customers in the end (Mac/nix user do not pay well ;P). 1.) At the moment I am using sqlite as database. Is it possible, that I can access the sqlite file on the...

Parse CFML tags in PHP

Background: I have been running a site on the blogger platform for the past 5 years. I was using the option of hosting the site on my own server, publishing via FTP. My server is running ColdFusion, so I decided to take advantage of that. I created Coldfusion custom tags that provided additional functionality and included those in ma...

C#: Manual bit conversion?

Is there a better way to write this than using BitConverter? public static class ByteArrayExtensions { public static int IntFromUInt24(this byte[] bytes) { if (bytes == null) { throw new ArgumentNullException(); } if (bytes.Length != 3) { throw new ArgumentOutOfRa...

Advice - How To Start Converting Video / Audio

I have been using C++ for the last five years now. During this time, I never had to work with audio nor video files. One thing I want to write is an application that will take a AVI/MPEG file and convert it to the OGG format. Are there any good books / tutorials out there where I can get my feet wet in this domain in general? I am aw...

What's the "java" way of converting chars (digits) to ints

Given the following code: char x = '5'; int a0 = x - '0'; // 0 int a1 = Integer.parseInt(x + ""); // 1 int a2 = Integer.parseInt(Character.toString(x)); // 2 int a3 = Character.digit(x, 10); // 3 int a4 = Character.getNumericValue(x); // 4 System.out.printf("%d %d %d %d %d", a0, a1, a2, a3, a4); (version 4 ...

lvalue-to-rvalue conversion of an array in ISO C

C++ ANSI ISO IEC 14882 2003 Annex C.1 (page 668): Change: The result of a conditional expression, an assignment expression, or a comma expression may bean lvalue Rationale: C + + is an object-oriented language, placing relatively more emphasis on lvalues. For example, functions may return lvalues. Effect on original feature: Change to s...

stringstream and french locale (French_France.1252)

std::stringstream stream_french; stream_french.imbue(std::locale("")); // French_France.1252 stream_french << 1000; std::string value_french = stream_french.str(); This code will convert 1000 to string "1 000" but the value of value_french[1] is -96 and not 32, why is that ? value_french[0] = 49 value_french[1] = -96 value_french[2] ...

How can I efficiently convert a large decimal array into a binary array in MATLAB?

Here's the code I am using now, where decimal1 is an array of decimal values, and B is the number of bits in binary for each value: for (i = 0:1:length(decimal1)-1) out = dec2binvec(decimal1(i+1),B); for (j = 0:B-1) bit_stream(B*i+j+1) = out(B-j); end end The code works, but it takes a long time if the length of th...

How to convert float number to Binary?

Hello, Can anyone please tell me how can I convert this float number: 12,25 to binary? I know how to convert the "12" but not the 0.25 Any help is much appreciated. Thanks ...

hexadecimals to integer.

I know how to convert hexadecimals to integers when i only have one hexadecimal character. but im getting a string of two characters. I'm converting both characters to hex with: String.Format("{0:x2}", (uint)System.Convert.ToUInt32(tmp.ToString())) so then lets say i have 01, and 3f as my two length characters. how am i supposed to ...

Conversion from decimal to binary in Ocaml

I am trying to convert a given decimal value its corresponding binary form. I am using Ocaml about which I don't know much and am quite confused. So far I have the following code let dec_to_bin_helper function 1->'T' | 0->'F' let dec_to_bin x = List.fold_left(fun a z -> z mod 2 dec_to_bin_helper a) [] a ;; I must include h...

How to convert en-gb to en-us (Arithmetic overflow error converting expression to data type datetime)

Arithmetic overflow error converting expression to data type datetime. The statement has been terminated. The culture of my site is en-gb (18/10/2010) The culture of my db server is en-us (10/18/2010) the date is stored in a param; command.Parameters.AddWithValue("@bookingdate", inputBookingDate.Text) Is there a way to convert this...

How To Scan A Document And Then Edit It?

How To Scan A Document And Then Edit It? ...

Convert.ToDatetime not adding timestamp

For example: Dim testdate As String = "29/10/2010" testdate = Convert.ToDateTime(testdate.ToString) Response.Write(testdate) expecting "29/10/2010 00:00:00" what I get is "29/10/2010" ...

Help getting GB - US date conversions working in asp.net vb

My site is set to en-GB in the web.config. I have a calendar extended textbox control on a page which lets the user select date, in GB format as string (DD/MM/YYYY). I need to convert this to a US datetime before inserting into db. solution: (MM/dd/yyyy hh:mm:ss) I do hate mondays. Overthinking as usual. ...

Cross-platform library for separating and converting PDFs to images?

I'm currently planning an application which involves manipulating PDFs. My goal is to have a program that i can pass in a PDF as an input which then saves separated grayscale images of the colour channels that the PDF consists of as an output. This is basically a simple RIP. I'm currently using a solution using GhostScript but i want to...

explicit require in Rails 3

I am converting my Rails 2 app to Rails 3. So far, I've been successful. However, there is this strange issue that I have to explicitly require any external files. Here is my original (i.e. Rails 2) ActiveRecord model: class Book < ActiveRecord::Base belongs_to :author has_many :translations, :dependent => :destroy include Freebas...

How can i convert XUL to XHTML?

Anyone know of any tools or techniques for converting xul to x/html? I've got a xul window I created for a Firefox addon that I now want to port over to html. Any tips, links, or tricks would be helpful. Thanks, -=Vin ...