conversion

How to convert standard IP address format string to hex and long?

Hi, Does anyone know how to get the IP address in decimal or hex from standard IP address format string ("xxx.xxx.xxx.xxx")? I've tried to use the inet_addr() function but didn't get the right result. I tested it on "84.52.184.224" the function returned 3770168404 which is not correct (the correct result is 1412741344). Thanks! ...

How do I convert a git repository to mercurial?

I've been developing a java application using git as source code repository. I'd like to share the project with other java developers and hg seems to be most used by them. My question is how do I convert a git repository to hg? If I tried googling "convert git to hg" and every search hit is about converting from git to hg. I'm also us...

How do I convert speech to text?

How could I take MP3 and convert the speech to text? I've got some recorded notes from a conference and from meetings (there is a single voice on the recording, which is my voice). I thought it would be easier and intellectually interesting to convert to text using speech to text tools rather than simply transcribe by hand. I know there...

C# Datastructure for multiple unit conversions

I have a c# app and I need to convert between 3 different units (say for example: litres, Gallons and Pints). The app needs to know about certain volumes of liquid say: 1 pint, 10 pints, 20 pints and 100 pints. I intend to do the calculations and hard code the values (not ideal but necessary), Im looking for a datastructure that will...

[C/C++] double to hex string & hex string to double

Hi, What I'm trying to do is to convert a double to hex string and then back to double. The following code does conversion double-to-hex string. char * double2HexString(double a) { char *buf = new char[17]; // double is 8-byte long, so we have 2*8 + terminating \0 char *d2c; d2c = (char *) &a; char *n = buf; int i; f...

DataListItem to DropDownList or TextBox VB.Net

I have a DataListItem which can potentially be a dropdownlist or a textbox. To get the value I would need to do: CType(item.FindControl("myControl"), TextBox).Text Or CType(item.FindControl("myControl"), DropDownList).SelectedValue.ToString() The problem is, if it's a dropdownlist I get.. Unable to cast object of type 'Syste...

Best way to convert an IEnumerable<T> to an T[]

What is the best way to convert from a generic IEnumerable object to an array of the same type? The current solution I have looks like the following: IEnumerable<string> foo = getFoo(); string[] bar = new List<string>(foo).ToArray(); The transfer through a List<T> seems unneccesary, but I haven't been able to find a better way to do ...

C# How do I convert a decimal to an int?

How do I convert a decimal to an int? Ta ...

Converting date between DD/MM/YYYY and YYYY-MM-DD?

Hello Using a Python script, I need to read a CVS file where dates are formated as DD/MM/YYYY, and convert them to YYYY-MM-DD before saving this into a SQLite database. This almost works, but fails because I don't provide time: from datetime import datetime lastconnection = datetime.strptime("21/12/2008", "%Y-%m-%d") #ValueError: ti...

C# int to enum conversion

If I have the following code: enum foo : int { option1 = 1, option2, ... } private foo convertIntToFoo(int value) { // Convert int to respective Foo value or throw exception } What would the conversion code look like? ...

What is the best way to change to a currency format?

I have a list of values such as "12000","12345","123456" that need to be converted to currency ("120.00", "123.45", "1234.56"). The only way I know is to convert the value to a string, copy the first strlen()-2 characters to one string (dollars) and the remainging two digits to another string(cents) and then write them as the following: ...

How to convert a float to a string regardless of regional settings?

My product is targeted to a Portuguese audience where the comma is the decimal symbol. I usually use CString::Format to input numbers into strings, and it takes into account the computer's regional settings. While in general this is a good approach, I'm having problems in formatting SQL queries, for instance: CString szInsert; szInsert....

How do I catch and present conversion errors during databinding?

WinForms has great databinding support, and the ErrorProvider makes it quiet easy to display business object errors. However, the conversion errors seems to be swallowed. If I type 'aaa' into a TextBox databound to an integer property, I get nothing from the ErrorProvider. So in this case my UI tells me everything is fine, when 'aaa' is...

Best method for Populating DataSet from a SQLDataReader

I am working on a DAL that is getting a DataReader Asynchronously. I would like to write a single method for transforming the DataReader into a DataSet. It needs to handle different schema so that this one method will handle all of my fetch needs. P.S. I am populating the SQLDataReader Asynchronously, please don't give answers that ...

convert an integer number into an array

Hi, I am trying to convert an integer number in C into an array containing each of that number's digits i.e. if I have int number = 5400 how can I get to int numberArray[4] where numberArray[0] = 0; numberArray[1] = 0; numberArray[2] = 4; numberArray[3] = 5; Any suggestions gratefully received --dave ...

EPS to JPG Converter

Anyone know of a good library to wrap via c# to convert EPS to JPG Files? ...

VS 2008 upgrade is changing my dataset designer namespaces

I've been upgrading our solutions from VS 2005 to VS 2008; still targeting the .net 2.0 framework. The conversion wizard is simple and I've never had a conversion failure. The only beef that I've had so far is that I can't immediately compile after the upgrade because VS has changed some of my namespaces causing naming collisions. For e...

How do I convert LaTeX to plain-text (ASCII)?

Scenario: I have a document I created using LaTeX (my resume in this case), it's compiling in pdflatex correctly and outputting exactly what I'd like. Now I need the same document to be converted to plain old ASCII. Example: I have seen this done (at least once) here, where the author has a PDF version and an ASCII version that matche...

How to get more involved in business critical decisions

I started a new job and we have a small IT department working for an insurance benefit. I was hired to help ensure the success of their conversion from a mainframe flat file system to a relational database with a client server setup. I want to get more involved in our decision making process. My question is how do you get yourself inclu...

What Linux/Unix software to use to convert html or pdf to doc?

I need to convert css styled (x)html or pdf to doc as accurately as possible and do it on Linux (and if possible also on Mac) from cli. Unfortunately OpenOffice can't handle the layout. Is there any such software or library, commercial of free? Thanks. ...