conversion

Mapping integers onto the entire range

I'm using a hash table (DotNET Dictionary object) as part of a sparse two-dimensional data set. Most of the entries in the hash table will be close together. I'll probably end up with 100 ~ 10,000 entries, all of them clustered near zero. I've read that a Hash table performs better when the hashes are spread across the entire integer(32 ...

How do I fix inconsistencies when converting file dates to/from TDateTime

I'm caching files locally in my 3 tier app. To check whether to read the file from the local cache or from the server I compare file dates. I've found that there when converting file dates to TDateTime and viceversa there are inconsistencies and values that should match rarely do. Here's some code that demostrates the problem procedure ...

How to convert an NSString into an NSNumber

Hello, How can I convert an NSString containing a number of any primitive data type (e.g. int, float, char, unsigned int, etc.)? The problem is, I don't know which number type the string will contains at runtime. I have an idea how to do it, but I'm not sure if this works with any type, also unsigned and floating point values: long lo...

How to convert an NSDictionary to a Python dict?

I have a plugin written entirely in Python using PyObjC whose core classes I need to convert to Objective-C. One of them basically just loads up a Python module and executes a specific function, passing it keyword arguments. In PyObjC, this was extremely. However, I'm having difficulty figuring out how to do the same thing using the P...

How to convert text to images on the fly?

I have seen in a couple of cases like: Facebook Profile: The E-mail address comes as a jpeg pic and not as text Google Forms Summary: Different Sized, Different Coloured Interactive Barcharts are made on the fly using the data you have. How does it happen? What do I do? ...

implicit conversion - strongly typed datatable to datatable ???

Not sure why I'm getting this error. Project is converted from VS 2005, to VS 2008, but remains with 2.0 framework.. image of the error message Here is the interface with my generic type and constraint.... public interface ITableAdapter<DT> where DT:System.Data.DataTable { /// <summary> /// Must be called immediately after...

What is the fastest int to float conversion on the iPhone?

i am converting some Int16's to float and then back again. and some int32 's to float and back again im just using a straight cast, but doing this quite a few times per second. (44100 any guesses what its for? :) ) is a cast efficient, can it be done any faster? ps compile for thumb is turned off ...

Is there a C# equivalent to Python's unhexlify?

Possible Duplicate: How to convert hex to a byte array? I'm searching for a python compatible method in C# to convert hex to binary. I've reversed a hash in Python by doing this: import sha import base64 import binascii hexvalue = "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8" binaryval = binascii.unhexlify(hexvalue) print base64...

HTML encoding issues - "Â" character showing up instead of "&nbsp;"

Hey everyone, I've got a legacy app just starting to misbehave, for whatever reason I'm not sure. It generates a bunch of HTML that gets turned into PDF reports by ActivePDF. The process works like this: Pull an HTML template from a DB with tokens in it to be replaced (e.g. "~CompanyName~", "~CustomerName~", etc.) Replace the tokens...

C program showing a square instead of string

I have done a lot with Java but I am currently trying to learn c. I am trying to make a program to convert a number from decimal to binary. Here is what I have: #include <stdio.h> #define LENGTH 33 int main( int argc, char*argv[ ] ) { unsigned int number, base, remainder, x, i; char result[LENGTH]; puts( "Enter a decimal value, a...

Why is implicit conversion allowed from superclass to subclass?

Can someone tell me why the line with "//Compiles" compiles, and why the line with "//Doesn't Compile" does not? I don't understand why A would be implicitly convertible to B, not the other way round. public class SomeClass { static public void Test() { AClass a = new AClass(); BClass b = new BClass(); a = b; // Compiles b...

Converting legacy SGM to XML

I have a task at work that involves converting legacy SGM files into XML. The SGM files were created using 5 separate high level tags, the new DTD has about 8-12 top level tags that the old ones would need to be mapped to. There are some common tags between the 2 DTDs but there are enough differences that it doesn't make sense to just do...

Convert BitmapImage to grayscale, and keep alpha channel

I'm having an issue with converting a BitmapImage (WPF) to grayscale, whilst keeping the alpha channel. The source image is a PNG. The MSDN article here works fine, but it removes the alpha channel. Is there any quick and effective way of converting a BitmapImage to a grayscale? ...

Any java library for ppt to jpg conversion?

Hi, Do you know any java library for ppt to jpg conversion? I've tried openoffice3 and POI (http://poi.apache.org/slideshow/quick-guide.html). OpenOffice takes quite long to load (full startup), even though I want to convert the slides only. POI-HSLF only generates images for simple slides (created by myself). all the test slides get...

Binary stdin and stdout

I'm looking to write a pair of utilities that read in a newline separated list of integers on stdin and output their binary (4 byte) equivalent to stdout, and vice versa. My first thought was a simple bash/linux command that would do this, but I was unable to find one. My second thought was to do this in C++, but I can't figure out how...

Microsoft SQL Server to Oracle Data Migration (Conversion) (Other RDBMS ok, too)

Hi all, Can you please give some tips or guidelines, best practices for MicroSoft SQL server to Oracle Data Migration? IMHO, it is something that comes best with experience. So I would like to benefit from your experience. Please share any insights that you have into design, modeling, testing or tuning for a data migration project. I wo...

Convert Difference between 2 times into Milliseconds?

I have two masked TextBox controls and was wondering how I'd go about getting the time in each one and then converting the difference into milliseconds. Like, say in tb1 I write "12:01" and in tb2 I write "12:02", and then click a button. Once the button's clicked it starts a timer and at 12:02 a messagebox will be displayed. I know how ...

Microsoft Azure based Audio conversion?

Does anyone know if its feasible to convert PCM/FLAC files to some compressed format (mp3/wma/ogg, not picky), with the conversion process running on Azure? An Amazon EC2 based solution would be trivial, as 3rd party libraries could be installed; but what about Azure? ...

Implicit Type cast in C#

Hi I have a question about the implicit type conversion Why does this implicit type conversion work in C#? I've learned that implicit code usually don't work. I have a code sample here about implicit type conversion char c = 'a'; int x = c; int n = 5; int answer = n * c; Console.WriteLine(answer); ...

Java SGML to XML conversion?

Hi, Does anyone know of a method, or library, to convert SGML into XML? EDIT: For clarification, I have to do the conversion in Java, and I cannot use the SP parser or the related SX tool. ...