conversion

Best way to 'convert' a shared base ?

-edit- Jason makes a good point that i could add both types to a list of A. But i cant use A due to reflections. Thus i want to know a way to convert the base data from one derive to another. I know in C++ in certain cases i could simply do *(A*)this = (A)that. I am hoping there is something just as simple in C#. I seriously do have the...

Python conversion from binary string to hexadecimal

how can I perform a conversion of a binary string to the corresponding hex value in python I have 0000 0100 1000 1101 and I want to get 048D I'm using python2.6 Thanks for the help ...

VB .frm files, can they be imported into a C# project?

Hi, I am supposed to be updating a piece of software for someone. Originally written in VB 6 I want to import it into a .net c# project. My question is, I don't want to have to lay out all the forms again and I am wondering if, or how, I could import them into c# project. They originally come with the .frm extension and c# forms are ...

How to track a Google Adwords conversion onclick?

Google Adwords offers no code to add to your page to count a conversion if somebody clicks on a link. But as it's Javascript, I am sure there is a way to do this. Here's the code (unaltered) Google gives you to include in the page, that should count as a conversion (most of the time a thank you page): <!-- Google Code for Klick Convers...

Convert date from yyyy-mm-dd to dd-mm-yy using xsl

HI all, I got a JavaScript function to convert the date, but I was wondering if there is any way to convert the date with xsl without using JavaScript. Thanks. ...

formatting double precision values in C#.

Hello Say I have a double variable initialized as double dValue = 5.156365 I would like to show this in a textbox as 5.16 i.e only two decimal places. How should I format? Is textbox.Text = dValue.ToString("F2", Culture.....) correct? When I tried it did give me the correct result. However, if dValue = 5 then I would like only...

Bitrate Calculation

Hi experts , (Excuse for My english it's freak i´m from LA) I'm trying to finish a trascoding process in VB6.0 , i'm working with ffmpeg , its a very good transcoder , to finish the project i want a progress bar for the trascoding process but it's so very hard , first i need to understand , how a program can calculate the time remaining ...

Are there any optimisations for retrieving of return value in Delphi?

I'm trying to find an elegant way to access the fields of some objects in some other part of my program through the use of a record that stores a byte and accesses fields of another record through the use of functions with the same name as the record's fields. TAilmentP = Record // actually a number but acts like a pointer private Ord...

Converting System::String to Const Char *

I am using Visual C++ 2008's GUI creator to make a user interface. When a button is clicked, the following function is called. The content is supposed to create a file and name the file after the contents of the textbox "Textbox' with '.txt' at the end. However, that leads me to a conversion error. Here is the code: private: System::Vo...

Convert Unicode to ASCII without changing the string length (in Java)

What is the best way to convert a string from Unicode to ASCII without changing it's length (that is very important in my case)? Also the characters without any conversion problems must be at the same positions as in the original string. So an "Ä" must be converted to "A" and not something cryptic that has more characters. Edit: @novali...

Linq conversion

I am using the following code to return an IList: public IList<string> FindCodesByCountry(string country) { var query = from q in session.Linq<Store>() where q.Country == country orderby q.Code select new {q.Code}; return (IList<stri...

convert very small double to a String

hi, I have a very small number and I want to convert it to a String with the full number, not abbreviated in any way. I don't know how small this number can be. for example, when I run: double d = 1E-10; System.out.println(d); it shows 1.0E-10 instead of 0.000000001. I've already tried NumberFormat.getNumberInstance() but it format...

Java String conversion to hex

hello all I am working on a tcp/ip socket listener which listens on port 80 for data that arrives from remote hosts. Now these incoming data are in unreadable format and so i have saved this incoming data as they are in a string initially and then converted this string to a character array and then for every index in the array , I have ...

Transform Ruby-on-Rails code to PHP

This may sound odd but a right answer might save me hours of coding. I have found a ruby-on-rails class (~10 files, ~1000 lines total) that serves a specific purpose (payment gateway integration). However, I am not familiar with ruby at all and need to use that class in a PHP application. I am wondering if there is a program that can per...

Automate conversion of text to PNG (or another file format with transparency)?

I need to take a list of words and create a PNG file of each, with a transparent background. I’d like my script to allow for adjustable opacity of the foreground, but I can probably also do it after the fact when the images get imported into Matlab. I imagine this is doable with ImageMagick and have installed that on my Mac. If someon...

How can one check for "safe" conversions between value types in .NET?

Back to the basics... For reference types, one can do this: SomeType someObject = firstObject as SomeType; if (someObject == null) { // Handle the situation gracefully } else { // Do stuff } For value types, my understanding is that we have implicit conve...

Implicit Operator Conversion and Generics

Why does this conversion not work? public interface IMyInterface { } public interface IMyInterface2 : IMyInterface { } public class MyContainer<T> where T : IMyInterface { public T MyImpl {get; private set;} public MyContainer() { MyImpl = Create<T>(); } public static implicit T (MyContainer<T> myCon...

Java: Convert String "\uFFFF" into char

Is there a standard method to convert a string like "\uFFFF" into character meaning that the string of six character contains a presentation of one unicode character? ...

Convert code from PHP to Ruby on Rails

I'm trying to use geoip's web service for a ruby on rails application. They don't give any ruby demos but this is what they give for PHP. I was wondering if anyone knew how to convert this to work on ruby on rails? I only need the city and the region from the data. More examples can be found at their site at $query = "http://geoip3...

how to code a condition: 'can this string be converted into a date type'? (ruby)

can I code this condition in ruby somehow? I need to know if a string can be converted into a date variable. The only way how to do it is Date.parse("my string") and exception. Is there any other way? date_scraped_from_the_net = "20 Dec 2009" or it could be "today" if date_scraped_from_the_net is not a date type needs_to_be_updated ...