conversion

C++ type conversion

Where can I find an overview of type conversion, e.g. string to integer, etc.? Because of the comments so far, I'll clarify: I'm looking for a list /table that says: To convert a string to an int, use: ... And same for other data types (where possible): double to int, char to string, ... ...

VBScript implicit conversion in IF statement different from variable to literals ?

We are currently having an issue due to implicit conversion in an IF statement in VBScript (Classic ASP) that don't do implicit conversion the same way when dealing with a variable or a literal. Can someone explain this behavior to me, why do VBScript acts this way ? Here is a sample of what I mean : Const c_test = 3 Dim iId : iId = 3 ...

MODx Problem How to add google conversion code to specific pages

Hi I'm using modx cms, I'm trying to add my conversion code to my pages. I've tried creating chunks in modx but these don't seem to appear. Should I be using snippets for conversion code? Thanks for your help Regards Judi <!-- Google Code for Call Me Back Conversion Page --> <script type="text/javascript"> <!-- var google_conversio...

WPF definition of FontSize

I know that in WPF, FontSize = 1/96 of an inch (same as 1 pixel I think). Is the FontSize dimension the height, the width, or diagonal size of a character? I would guess it's the font height, but the Microsoft documentation doesn't really indicate what it is. Also, is there an easy way to get the height and width of a font size? Answ...

A simple way to convert to/from VARIANT types in C++

Are there any easy-to-use, high-level classes or libraries that let you interact with VARIANTs in Visual C++? More specifically, I'd like to convert between POD types (e.g. double, long), strings (e.g. CString), and containers (e.g. std::vector) and VARIANTs. For example: long val = 42; VARIANT var; if (ToVariant(val, var)) ... ...

C# - Linq to SQL , type conversion error

Hi folks, new to LINQ & would like to know why the error & best way to resolve. I am getting, 'Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to 'System.Collections.Generic.List'. An explicit conversion exists (are you missing a cast?)' error List<string> names = new List<string>(); names.Add("audi a2"); names....

Image conversion : RGBA to RGB

assuming i had RGBA (32 bits) output from frame-grabber, with alpha channel unused (values retained while filled by frame-grabbers), is there any effective conversion method to RGB (24 bits) ? I am dealing with 5 MegaPixels streaming images so speed does matter too. keep in mind that data in alpha channel can be discarded. ...

How to convert timestamps to dates in bash?

I need a shell command or script that converts a UNIX timestamp to a date. The input can come either from the first parameter or from stdin, allowing for the following usage patterns: ts2date 1267619929 and echo 1267619929 | ts2date Both commands should output "Wed Mar 3 13:38:49 2010". ...

Python Type Conversion

Whats the best way to convert int's, long's, double's to strings and vice versa in python. I am looping through a list and passing longs to a dict that should be turned into a unicode string. I do for n in l:     {'my_key':n[0],'my_other_key':n[1]} Why are some of the most obvious things so complicated? ...

Doing a Math.Round(x,2) on a decimal value, but need to ensure 2 numbers after decimal as its money

Some values are returning 2.0 but I need it to be 2.00 as this is a money value that is displayed to the web page. I am doing: Math.Round(value, 2); Is there a way to force it to 2 numbers after the decimal? ...

any file format to swf

Is there any opensource/commercial software that converts ppt, doc, pdf, video, audio into swf format? ...

Converting SVN to Mercurial on Mac with working python binding doesn't work

Hi, I try to convert a local SCN repository (with all its history) to Mercurial. I am working on a Mac (10.6.2). Therefore, I am using Macports as package management tool. I started the conversion with: hg convert file:// ´pwd´/calebsvn/ The result is, that it starts to work fine, but after a while, it stops. That is the output: in...

Convert textarea text into valid html

Hello all, So there are a few paragraphs separated by line feeds "\r\n" in a textarea, say Paragraph1 "\r\n" Paragraph2 "\r\n" Paragraph3 "\r\n" what i want to achieve is to process each paragraph into tag. How do you do that? (Need a server side solution) so it looks like <p> Paragraph 1 </p> <p> Paragraph 2 </p> <p> Paragraph 3...

MvcHtmlString MVC 2 Conversion Error

I converted my project from MVC 1 to MVC 2 and Visual Studio 2008 gives me the following error: Error 1 'System.Web.Mvc.MvcHtmlString' does not contain a definition for 'Substring' and no extension method 'Substring' accepting a first argument of type 'System.Web.Mvc.MvcHtmlString' could be found (are you missing a using directive o...

Using C++ hex and cin

If you have the following code: cout << hex << 10; The output is 'a', which means the decimal 10 is converted into its hexadecimal value. However, in the code below... int n; cin >> hex >> n; cout << n << endl; When input is 12, the output becomes 18. Can anyone explain the details of the conversion? How did it became a decimal va...

php mysql - spelling conversion?

Hi, I need to change UK spelling to US spelling for the content stored in the database(mysql). Is there any way to do this on the db itself? I found various software's(like a word add-ins) but to use these I need to have the data in a doc format, do the changes and export it back to mysql. Please let me know if there is a method using p...

Is this the best way to convert List<T> from models to ObservableCollection<T> in views?

In MVVM development I am constantly converting List<T> from my models to ObservableCollection<T> for my views. I looked around in .NET for a way to succinctly do this e.g. such as .ToList<> or .ToArray<> or .ToDictionary<> but couldn't find anything similar for ObservableCollection. Therefore I made the following extention method Conve...

Double to String keeping trailing zero...

I'm having this issue and i cant think for the best solution, i tried converting the double value into a string and Replace() the ',' to '.'. This works good but only when trailing digits are not zero, i need zeros in my string, even if the value is 1234.0. This worked good for the decimal values. Tried to convert the double to decimal b...

Java's "public static final Object" in C++

What would be the equivalent of this in C++ of the following snippet. I am in the process converting parts of an java application to C++. Here is that java class snippet: class container { Public static final Object CONTAINER_FULL = new Object { public boolean equals(Object other) { // ... } String toString() ...

HTML to XML conversion with C++

Is there a C++ code or library to convert a HTML document to a XML document? Thanks. ...