conversion

C# Extension Method for String Data Type

My web application deals with strings that need to be converted to numbers alot - users often put commas, units (like cm, m, g, kg) and currency symbols in these fields so what I want to do is create a string extension method that cleans the field up and converts it to a decimal. For example: decimal myNumber = "15 cm".ToDecimal(); ...

How can I convert BASE64 encoded HTML to GIF using ColdFusion?

I am receiving a BASE64 encoded string from a WebService. The string represents an HTML page, and I can use built-in ColdFusion functions to convert and display it. However, I need a GIF representation of the HTML page, and I'm wondering if there's any way to do this using ColdFusion. NOTE: The website I'm working on is ColdFusion 8. U...

Syntax error converting the nvarchar value to a column of data type int.

I have 1,2,3,4,5,6,7,8,9 stored as nvarchar inside Level in my db. I then have a dropdownlist with values 1,2,3,4,5,6,7,8,9. When a user makes a selection (i.e 1) (Level.SelectedValue.ToString). This builds an sql query via a param like this: "Select things From MBA_EOI Where level = 1" When I run the select I get the following erro...

Add and Subtract Time

I have always had a problem with adding and subtracting time like for an example: 10h:34min + 07h:46min ----------- XX:XX ...

Accessing "Mapi32.dll" with C#. [not solved]

Hello, I am using VS 2008 C# Windows Application. I have this DLL Import I am trying to use. [DllImport("Mapi32.dll", PreserveSig = true)] private static extern void WrapCompressedRTFStream( [MarshalAs(UnmanagedType.Interface)] UCOMIStream lpCompressedRTFStream, uint ulflags, [MarshalAs(UnmanagedType.Interface)] out UCOMIStream lpUnco...

[C] Signed Hexadecimal string to long int function

I need a function to convert a 32bit or 24bit signed (in two's complement) hexadecimal string into a long int. Needs to work on both 32bit and 64bit machines (regardless of the size of long int) and work regardless of whether the machine is a two's complement machine or not. SOLUTION: long int hex2li (char hexStr[], int signedHex) { ...

I need to convert my Mysql database to SQL Server 2005 database

I need to convert my Mysql database to SQL Server 2005 database, Is there any tools available for this conversion. ...

Converting raw bytes into audio sound

In my application I inherit a javastreamingaudio class from the freeTTS package then bypass the write method which sends an array of bytes to the SourceDataLine for audio processing. Instead of writing to the data line, I write this and subsequent byte arrays into a buffer which I then bring into my class and try to process into sound. M...

C# To VB.Net Conversion - array of class objects with initialisation

can someone help me pls, im new to vb.net and im trying to work through the nhibernate firstsolution sample (written in c# re-posted here http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/04/01/your-first-nhibernate-based-application.aspx as thier site is down again) and im struggling to convert this one bit. ive tried numerous ...

XML::XML2JSON "0" Element

I'm using XML::XML2JSON in Perl to convert JSON data to XML, I am passing through the following data (snippet): {"question":{"isrequired":{"$t":"0"}}} and when I use the XML:XML2JSON->json2xml function to convert the JSON data into XML, I get the following (snippet): <isrequired/> I need to retain the "0" element in the "isrequired...

convert string to double

I have string value in that I need to convert to double in VB.Net. Conditions are like below string = "12345.00232232" if condition is 3 (2 digits after decimal and comma) display = 12,345.00 if condition is 5 (5 digits after decimal and comma) display = 12,345.00232 If Condition is 7 ( 5 digits after decimal and no comma) dis...

Units of measurement conversion logic in C#

I am adding a feature to my program in which the user will have the ability to change their unit of measurement at any time, and have the program recalculate their input and output. If the user inputs say, 20lbs for an item, then decides he wants to work in kilograms instead, he can select an option to do so at any time, and the program...

Transform PDF to HTML, keep layout

What methods are there to transform a PDF to HTML? It could be anything - online service, software, library. (Opensource preferred. In the last case, php or python would be preferred.) It has to keep the original layout (including page numbers, footnotes and such), keep the images (combining them to one single background image per page i...

How to convert AVI to 3gp in C# ?

Hi, Is it possible to convert an AVI file to 3gp in C# ? If so how could I do this? Any ideas will be appreciated, thanks in advance. ...

How to convert c# winforms application to an assembly?

I have a c# winforms application which is running fine... Now i want to convert it to an assembly and use it in an asp.net web application..... WHich dll i have to refernce? http://img265.imageshack.us/img265/2272/dlls.jpg ...

How would I convert decimal into binary?

All I really know is PHP and I used the decbin function etc, It was fairly easy to do. In this C++ program I want to do the same thing, just a simple number or string how would I do this? ...

Programmatically clean Word-generated HTML while preserving styles?

In my current company, we have this decade old...let's call it a "Hello World" application. While wanting to create a newer version of it, we also want to preserve older entries. These older entries contain hideous Word-generated HTML which was never filtered before. If and when we move to a newer system, I'd prefer to have that HTML c...

Why do I need an intermediate conversion to go from struct to decimal, but not struct to int?

I have a struct like this, with an explicit conversion to float: struct TwFix32 { public static explicit operator float(TwFix32 x) { ... } } I can convert a TwFix32 to int with a single explicit cast: (int)fix32 But to convert it to decimal, I have to use two casts: (decimal)(float)fix32 There is no implicit conversion from floa...

explain this macro

#define __T(x) L ## x Found in code from one of the MFC source header file. It is mostly used for converting strings to ........ (I don't know what). If I am correct it converts strings to LPCTSTR...don't know what that type is either... I can't seem to convert char* into LPCTSTR. While MFC file handling, the following code will ...

How do I create a method that converts a DataRowCollection to an array of objects of a generic type in C#?

Hi, I am trying to create a method that takes a DataTable or a DataRowCollection and converts it to an array of a generic type. Something like this: public static T[] ConvertToArray<T>(DataTable dataTable) { List<T> result = new List<T>(); foreach (DataRow dataRow in dataTable.Rows) result.Add((T)dat...