conversion

How can I convert text with a localized number format into a number in MS SQL Server?

Let's say I have a number in the german number format "1,00" which is equal to 1.0 in the en-US locale. Is there a built-in way to convert this text in T-SQL to the corresponding number? It seems like CONVERT and CAST accept only numbers with '.' as the decimal separator and I see no way to tell them otherwise. I was thinking about sim...

using imagemagick or ghostscript (or something) to scale PDF to fit page?

I've been bashing my head against this to no avail. I need to shrink some large PDFs to print on an 8.5x11 inch (standard letter) page. Can imagemagick/ghostscript handle this sort of thing, or am I having so much trouble because I'm using the wrong tool for the job? Just relying on the 'shrink to page' option in client-side print dial...

Querying a timestamp column from LINQ to SQL

My table has a timestamp column named "RowVer" which LINQ maps to type System.Data.Linq.Binary. This data type seems useless to me because (unless I'm missing something) I can't do things like this: // Select all records that changed since the last time we inserted/updated. IEnumerable<UserSession> rows = db.UserSessions.Where ( usr => ...

How can I convert an integer into its verbal representation?

Is there a library or a class/function that I can use to convert an integer to it's verbal representation? Example input: 4,567,788 Example output: Four million, Five hundred sixty-seven thousand, seven hundred eighty-eight For reference, I am using C# and .NET 3.5. ...

Java to C++ converter/tool

Hi I always asked myself if it would be possible to make a Java2C++ Converter. Maybe a Tool that converts the Java Syntax to the C++ Syntax.. i am aware that the languages differ .. but simple things like loops where the semantic matches 1 on 1 .. is there such a tool . or is it possible to make one ? ...

php: convert milliseconds to date

I Have a string that is equal to a date, represented as the number of milliseconds since the Unix epoch. I am trying to output it into d-m-Y. The string I was given was "1227643821310", and I am told that the result should be equal to 2-12-2008, but I keep getting a result of 25-11-2008 My code is as follows: $mil = 1227643821310; $s...

Byte width of a value type

I'd like to pass a value type to a function and set it to a repeating bit pattern (FF, AA, etc.) across the entire width of the variable. Right now, I'm passing the value with void foo(T val) where T : struct so I can use any value type. The problem is, the compiler won't let me use sizeof(T), because T could be a reference type (exc...

SQL 2005 Select data where conversion fails

Is there any way for me to test a data conversion in a select statement and only return rows where the conversion fails? IE: SELECT * FROM my_table WHERE CONVERT(datetime, [colA]) = NULL I'm open to any SQL hacks/trickery. ...

Converting an array of objects to an array of their primitive types.

If you have an array of java objects which have a primitive type (for example Byte, Integer, Char, etc). Is there a neat way I can convert it into an array of the primitive type? In particular can this be done without having to create a new array and loop through the contents. So for example, given Integer[] array what is the neate...

.NET PDF to SVG conversion Library

Hello there, does anyone know any good (as in native (not wrapping any external .exe etc), supported, documented and maintained) .Net library that allows me to transform single page .pdf files (1.4, non pdf/a) to .svg files? Google spits out a gazillion results, but none of them are really promising from a real-life experience perspect...

How to convert between "#,##0" and "{0:n2}" style format string representations?

.NET supports two types of string formatting. I'm in a situation where existing configuration data has #,##0 style formatting. A new feature requires formatting to the same output, but the API needed for this feature only accepts formatting of type {0:n2}. Does anyone know of a means to convert between these two representations for nu...

How can I convert javascript to vbscript?

HI, How can I convert javascript in to vbscript? I am making a script entriely using vbscript. But for some sections i got code in javascript. ...

ObjC/Cocoa class for converting size to human-readable string?

Is there a simple way to do something like.. [NSMagicDataConverter humanStringWithBytes:20000000] ..which would return "19.1MB"? ...

What's the equivalent C# method to this basic Java method?

Hi folks, really simple question here (more to confirm my thoughts, than anything)... Java method : [StringBuffer.Delete]1; [1]: http://java.sun.com/j2se/1.4.2/docs/api/java/lang/StringBuffer.html#delete(int, int) Java Code: sb.delete(sb.length()-2, sb.length()); C# (not sure if this is right): StringBuilder sb = new StringBuild...

Convert NSDate to NSString

How do I convert an NSDate to an NSString so that only the year in @"yyyy" format is output to the string? ...

Which is better code for converting BSTR parameters to ANSI in C/C++?

So far I've discovered I can convert incoming BSTRs to ANSI in two (of many?) ways, and I'm curious to know whether one is "better" than the other with respect to speed / efficiency etc. The way I've been using for a while is use the USES_CONVERSION and W2A macros, e.g. BSTR __stdcall F(BSTR p1, BSTR p2 ) { USES_CONVERSION; LP...

How can I change a huge file into csv in python

I'm a beginner in python. I have a huge text file (hundreds of GB) and I want to convert the file into csv file. In my text file, I know the row delimiter is a string "<><><><><><><>". If a line contains that string, I want to replace it with ". Is there a way to do it without having to read the old file and rewriting a new file. Normal...

Convert from Codepage 1252 (Windows) to Java, in Java

Hi! I have some strings in Java (originally from an Excel sheet) that I presume are in Windows 1252 codepage. I want them converted to Javas own unicode format. The Excel file was parsed using the JXL package, in case that matter. I will clarify: apparently the strings gotten from the Excel file look pretty much like it already is some...

Alias in Function Declaration overloaded?

I have some VB6 code that I am converting to VB.net and came across this section Declare Function TmSendByLen Lib "tmctl.dll" Alias "TmSendByLength"(ByVal id As Integer, ByRef msg As Any, ByVal blen As Integer) As Integer 'snip' Function TmSendByLength(ByVal id As Integer, ByVal msg As String, ByVal blen As Integer) As Integer TmSend...

What is LenB actually doing on none string parameters

I have this bit of code that is being converted from vb6 to vb.net. I need to know what LenB is doing in this bit of code. Dim singleValue As Single 'var for conversion use(4byte -> 1single)' Dim bytes() As Byte Dim valueB() As Byte 'this gets set elsewhere and is redim-d to its size' For n = 0 To CDbl(ItemNumberCombo.Text) - 1 'bytes...