conversion

Why can't I const_cast the return of the conversion operator?

I've got a conversion operator that returns a const pointer, and I need to const_cast it. However, that doesn't work, at least under MSVC8. The following code reproduces my problem: class MyClass { public: operator const int* () { return 0; } }; int main() { MyClass obj; int* myPtr; // compiles const int...

Need help on BMP to JPEG conversion

I'm writing a C++ program to convert a BMP image into a JPEG. Here's the basic algorithm I'm trying to follow: Convert RGB color space to Y,Cb,Cr.. Down sample Cb and Cr by 2 (that means for each square block of 2*2 there is 4 different Y value but 1 Cb and 1 Cr value Apply DCT to data units of each 8*8 pixels... Then apply quantizati...

Dynamic Type Conversion C#

I have the following method public static void SerializeToXMLFile(Object obj,Type type, string fileName) { XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ns.Add("", ""); XmlSerializer serializer = new XmlSerializer(type); TextWriter tw = new StreamWriter(fileName); serializer.Serialize(tw, obj, ns); ...

CVS to SVN conversion -- How to replace CVS TAGS functionalities

Hi, we are planing to move away from CVS and to SVN. Everything looks good expect that our developers do a pre/post tags on each submission. So, in CVS we don't have a problem as TAGS are intuitive and cheap. However, in SVN, Tag is a copy right? With that said, I am wondering if there is a way for me to do a before and after tag base...

How do I Convert a String into an Integer in JavaScript?

How do I convert a string into an integer in JavaScript? Is it possible to do this automatically, or do I have to write a subroutine to do it manually? ...

C#: How can I safely convert a byte array into a string and back?

I don't really care about encoding and stuff, as long as I get back the exact same byte array. So to sum up: How do I convert a byte array into a string, and then that string back into the same byte array I started with? ...

C#: Convert AS/400 date into DateTime

Dates in DB2 AS/400 are an integer, containing the number of days since sometime around the turn of the 20th century. Question 1: Does anyone know the IBM DB2/AS400 "zero" date? e.g.: 12/30/1899 12/31/1899 1/1/1900 Question 2: Given an "AS/400" date (e.g. 40010) how can you convert that to a CLR DateTime? DateTime d = new DateTime(...

How to convert array of bytes into Image in Java SE

Hi, What is the right way to convert raw array of bytes into Image in Java SE. array consist of bytes, where each three bytes represent one pixel, with each byte for corresponding RGB component. Can anybody suggest a code sample? Thanks, Mike ...

ASP Experts - Need help converting this PHP code to ASP

Hi, I am facing some problems converting the PHP SQL insertion code below to ASP, I want to use the same concept in ASP, because it is more flexible, not tied to ASP owned keywords. Wonder if anyone can help ASP newbie here. $table = 'tbluser'; $array = array ( 'name' => $name, 'email' => $email, 'ip' => $remoteIP ...

Tool for converting C header files (.h) to VB?

I can see that there are tools for converting .h to Python, Perl, D, Pascal etc. Are there any for VB6 or any other VB-alike tool (like Jabaco for instance)? ...

Using reflection with generic types and implicit conversions

I'm trying to use reflection to set properties on some OpenXML types (e.g. Justification). Assigning a value by enumerating all possibilities is straight-forward: // attr is an XmlAttribute, so .Name and .Value are Strings if (attr.Name == "Val") { if (element is Justification) { ((Justification)element).Val = (Justific...

How to convert PowerBASIC Types to VB6 Types?

These types come from the demos for FastCGI Dll Library (with SIGTERM handler) for Windows Web Servers and are written in PowerBASIC. I'm trying to convert them to VB6 (having also discovered how to call a CDECL DLL from VB6). ' Structures TYPE FCGX_STREAM pData AS DWORD ' Pointer to the first byte of ...

how can i convert a pdf file to other formats such as image format?

how can i convert a pdf file to other formats such as image format? ...

Converting between timezones in C

Hello All, I need to convert time between timezones in C (on linux, so anything specific would do too). I know my current time, local and UTC, I have the offset of the target time. I am trying to use mktime, gmtime, localtime and similar set of functions but still can't figure it out. Thanks in advance. ...

Convert VB to C# - My.Application.Info.DirectoryPath

What are the best C# (csharp) equivalents for the following VB (VB.NET, VisualBasic) statements: My.Application.Info.DirectoryPath My.Computer.Clipboard My.Computer.Audio.PlaySystemSound() My.Application.Shutdown() ...

Does the python standard library have function to convert CamelCase to camel_case?

Example: >>> convert('CamelCase') camel_case ...

any code conversion tool for converting borland c++ to visual studio C++

I have a old windows application written in borland C++ 5.0. this uses the OWL library very much in it's code. this has to be ported to Visual studio 2005/2008 (C++ or C#). search in google shows lot of links but nothing quite concrete or useful. can anyone show the correct direction to start this? also share any pitfalls or best practic...

Converting a 32bpp image to a 16bpp image in Java

How could a 32bpp image ( ARGB ) could be converted to a 16bpp image ( ARGB ) using Java's libraries? For my curiosity, at pixel level, what does this conversion do? If I have an int value that holds the value of a pixel ( with all the channels ), how would that int be different after the conversion had happened? ...

String to enum conversion in C#

I have a combo box where I am displaying some entries like: Equals Not Equals Less Than Greater Than Notice that these strings contain spaces. I have a enum defined which matches to these entries like: enum Operation{Equals, Not_Equals, Less_Than, Greater_Than}; Since space is not allowed, I have used _ character. Now, is there a...

C# non-boxing conversion of generic enum to int?

Given a generic parameter TEnum which always will be an enum type, is there any way to cast from TEnum to int without boxing/unboxing? See this example code. This will box/unbox the value unnecessarily. private int Foo<TEnum>(TEnum value) where TEnum : struct // C# does not allow enum constraint { return (int) (ValueType) val...