conversion

C++ long long manipulation

Given 2 32bit ints iMSB and iLSB int iMSB = 12345678; // Most Significant Bits of file size in Bytes int iLSB = 87654321; // Least Significant Bits of file size in Bytes the long long form would be... // Always positive so use 31 bts long long full_size = ((long long)iMSB << 31); full_size += (long long)(iLSB); Now.. I ...

How to Convert Type in Tuples

how to convert a String type to a Int i have a tuple and i want to convert it to a tuple which has different types tupletotuple :: (String,String,String) ->(String,Int,Int) tupletotuple (a,b,c) = (a,read(b),read(c)) i get this Error Msg Project> tupletotuple ("cha",4,3) ERROR - Cannot infer instance *** Instance : Num [Char] *** E...

How to convert a Mat variable type in an IplImage variable type in OpenCV 2.0 ?

Hi all, I am trying to rotate an image in OpenCV. I've used this code that I found here on StackOverflow Mat source(img); Point2f src_center(source.cols/2.0, source.rows/2.0); Mat rot_mat = getRotationMatrix2D(src_center, 40.0, 1.0); Mat dst; warpAffine(source, dst, rot_mat, source.size()); Once I have my dst Mat variable type fille...

How can I convert between scientific and decimal notation in Perl?

I know this is a total newbie question, but the answer may not be obvious to many new programmers. It wasn't initially obvious to me so I scoured the Internet looking for Perl modules to do this simple task. ...

Open Source Java/Groovy library for picture file format conversion?

I need to convert tons of pictures, coming from all kinds of sources, in all kind of file formats. I want to store them all in the PNG file format (even if it means losing e.g. layer data from ESP's). I'm looking for a library that is preferably open source and has a Java or Groovy API (on top of JNI/JNA, if necessary). ...

entity framework, loadproperty not working - The selector expression for LoadProperty must be a MemberAccess for the property.

The selector expression for LoadProperty must be a MemberAccess for the property. I'm converting some C# to VB, this is the C# line: entities.LoadProperty((MyType)MyTargetObject, c => c.MyProperty); I convert it to VB like so: entities.LoadProperty(DirectCast(MyTargetObject, MyType), Function(c) c.MyProperty) However I get the err...

Converting date to day of week

Hello, is there any ready to go solution within the microsoft framework, regarding conversion of date to day? For example, i would like to convert this string 21/03/2010 (dd/mm/yyyy) to Sunday ...

Image File In Text Editor - What Are The Characters? What's the Process?

i'm currently in the process of conceptualizing an art piece for a gallery show next year, so this bizarre question of mine is more than just simple curiosity. if i open up an image file (a .PNG) with Text Edit or Note Pad, the file is presented in textual characters. here's an excerpt: ˇflG¿§vÑ$BaçC$ èœ≥à-ƒ…åGj!mëA»T‰dÚ%ryǬF1¢ƒQ∑P®...

Pitfalls when converting C++/CLI to C++

I have a library written in C++/CLI and I want to open it up. I want it to be as cross-platform as possible and be able to write bindings to it for other languages to use (Java, Python, etc, etc). To do this, the library needs to be in plain C++ for maximum flexibility. I figure that the logical structures are already there, I just need ...

How to convert an ASCII HEX character to it's value (0-15)?

I am writing a string parser and the thought occurred to me that there might be some really interesting ways to convert an ASCII hexadecimal character [0-9A-Fa-f] to it's numeric value. What are the quickest, shortest, most elegant or most obscure ways to convert [0-9A-Fa-f] to it's value between 0 and 15? Assume, if you like, that the...

strtod() and sprintf() inconsistency under GCC and MSVC

I'm working on a cross-platform app for Windows and Mac OS X, and I have a problem with two standard C library functions: strtod() - string-to-double conversion sprintf() - when used for outputting double-precision floating point numbers) Their GCC and MSVC versions return different results, in some digits of mantissa. But it plays a...

Convert a code from FORTRAN to C

Hello, I have the following FORTRAN code which I need to convert to C or C++. I already tried using f2c, but it didn't work out. It has something to do with conversion from Lambert Conformal wind vector to a True-North oriented vector. Is anyone experienced in FORTRAN who could possibly help? PARAMETER ( ROTCON_P = 0.422618 )...

How are integers converted to strings under the hood?

I suppose the real question is how to convert base2/binary to base10. The most common application of this would probably be in creating strings for output: turning a chunk of binary numerical data into an array of characters. How exactly is this done? my guess: Seeing as there probably isn't a string predefined for each numerical value...

Is concatenating with an empty string to do a string conversion really that bad?

Let's say I have two char variables, and later on I want to concatenate them into a string. This is how I would do it: char c1, c2; // ... String s = "" + c1 + c2; I've seen people who say that the "" + "trick" is "ugly", etc, and that you should use String.valueOf or Character.toString instead. I prefer this construct because: I p...

Converting unmanaged C++ code from 32 bit to 64 bit

Hi, I have an unmanaged C++ 32 bit application that produces a dll. Now, I want to build it for 64 bit system. My development system is 32 bit. It uses oledb.lib activeds.lib adsiid.lib ws2_32.lib libraries to build the dll. What I have done so far is : Changed the configuration settings and set the Active solution platform to x64. It b...

Convert arbitrary size of byte[] to BigInteger[] and then safely convert back to exactly the same byte[], any clues?

I believe conversion exactly to BigInteger[] would be optimal in my case. Anyone had done or found this written in Java and willing to share? So imagine I have arbitrary size byte[] = {0xff,0x3e,0x12,0x45,0x1d,0x11,0x2a,0x80,0x81,0x45,0x1d,0x11,0x2a,0x80,0x81} How do I convert it to array of BigInteger's and then be able to recover it b...

Convert.ToInt or String.Split : which is more efficient?

Which way is better for removing float decimals places or is there a more efficient way? Rounding is not important, i am interested in displaying the number Float number; 1- int wholeNumber= Convert.ToInt(number); string display=wholeNumber.ToString(); 2- string [] splitNumber= number.ToString()....

Table borders don't display properly when converted from HTML page into MS Word 2003

Hello everyone, I've got a bit of a complicated set up. I specialise in XSLT which I write for 3rd party system. All CSS looks fine in the browser. Now that system provides a button that converts my generated HTML into MS Word 2003. However, table borders don't convert as they appear in a Browser. There are lots of tables and they have...

Convert XML file to CSV

After having converted a messed up XML using regex, I now need to change it yet again. This source file <product> <sku>SP00001</sku> <PID_OWNER_SellerID>StoreName</PID_OWNER_SellerID> <EANCode>8711983489813</EANCode> <DeliveryDays>2</DeliveryDays> </product> Has to become a CSV file, but like this: sku field ...

How to convert an UTF string with scandinavian characters to ASCII?

I would like to convert this string foo_utf = u'nästy chäräctörs with å and co.' # unicode into this foo_ascii = 'nästy chäräctörs with å and co.' # ASCII . Any idea how to do this in Python (2.6)? I found unicodedata module but I have no idea how to do the transformation. ...