conversion

java string to datetime conversion issue

I can't seem to see the problem with the example code below. For some reason seems to be ignoring the year and saying the dates are the same, as can be seen in the output below. I must be missing something simple. 01/28/2006 01/16/2007 Tue Apr 01 00:00:00 PDT 2008 Tue Apr 01 00:00:00 PDT 2008 done import java.util.*; impo...

C# Help converting this code from VB.NET to C#

Any help would be appreciated, I'm trying to convert the code below to C#, I've never used VB.NET so ReDim is a new one to me. Thanks Dim inFile As System.IO.FileStream Dim binaryData() As Byte Dim strFileName As String strFileName = "C:\MyPicture.jpeg" inFile = New System.IO.FileStream(strFileName, System.IO.FileMode.Open, System.IO...

access 2003 adp opened & saved in 2007 now behaves odd in 2003

I inherited an access 2003 ADP file which uses sql 2000 as it's data source. This is my first access maintenance project and not thinking about the issues involved simply opened it in access 2007 on my dev machine. It of course worked and I proceeded to do the work requested. I have completed the work and presented the file to the clie...

Convert from Datetime.ToFileTime() to DateTime object

How to convert from DateTime.ToFileTime() back to a DateTime object? ...

Convert a double to a String in Java and vice versa without losing accuracy

A String representation of a double is written to and read from a file by a C# application. The C# application converts the double to a string using the following fragment: value.ToString("R", NumberFormatInfo.InvariantInfo); The C# application converts the string to a double using the following fragment double num = double.Parse(s,...

Why must we convert everything to a char* when we write it to a file?

Out of curiosity, why are we converting something to a char* when we write it to a ( binary ) file? ...

How do I convert a decimal fraction to binary in Java?

I need to convert 0.5 in base 10 to base 2 (0.1). I have tried using Double.doubleToRawLongBits(0.5) and it returns 4602678819172646912 which I guess is in hex, but it does not make sense to me. ...

How does PDF's BitsPerComponent translate to Bits Per Pixel for images?

My goal is to convert a PDF into an image (specifically in TIFF). There is a PDF property called BitsPerComponent And According to description on the page, This property can take the value 1, 2, 4, 8 or 16. Other values are not supported in the PDF Specification Does that mean, 1, 2, 4, 8 or 16 translates to bits per pixel in im...

Integer representation for day of the week

I would like to convert a date object its integer representation for the day of week in C#. Right now, I am parsing a XML file in order to retrieve the date and storing that info in a string. It is in the following format: "2008-12-31T00:00:00.0000000+01:00" How can I take this and convert it into a number between 1 and 7 for the day o...

Winforms to WPF conversion: BeginInvoke to what?

Hi all, Here's my old code from WinForms: private void ValueChanged(double inValue1, double inValue2) { //only manual mode for this driver, so that's easy. if (ValueLabel.InvokeRequired) { ValueLabel.Invoke(new MethodInvoker(delegate { ValueLabel.Text = (inValue1* inValue2/ 1000).ToString...

how to convert string into time format and add two hours

Hi, I have the following requirement in the porject. I have a input field by name startdate and user enters in the format YYYY-MM-DD HH:MM:SS. I need to add two hours for the user input in the startdate field. how can i do it. Thanks in advance ...

Is there a good way to handle conversions between arrays and strongly typed collections automatically?

Background: I have a big solution where hundreds of functions take strongly typed collections as inparameters and using them as return values. The solution references a generated proxy wich converts calls to a webservice that always returns collection in the format int[] or Order[] or wathever type it is. The proxy wraps them up as Int...

Branching a subversion repository into a distributed CMS

I have a problem that I am not sure of the best way to tackle. I have been working on a project that requires me to go to China to do the install and integration. My code has been under subversion since the start, since that was what I knew and had used in the past. I now have concerns that I may not be able to do any checkins while I am...

Migrating an Access data table to SQL Server 2005

I used the standard import / export tool to bring a table into my SQL database. The dates all came over as CHAR types. Now, I keep getting a conversion error stating the CHAR to datetime resulted in an out of range condition. Help please. ...

Why can't I define both implicit and explicit operators?

Why I cannot define both implicit and explicit operators like so? public class C { public static implicit operator string(C c) { return "implicit"; } public static explicit operator string(C c) { return "explicit"; } } You can do this hack though :) ...

LINQ: Group by month and year within a datetime field

I have a table with a datetime field. I want to retrieve a result set grouped by the month/year combination and the number of records that appear within that month/year. How can this be done in LINQ? The closest I've been able to figure out is in TSQL: select substring(mo,charindex(mo,'/'),50) from ( select mo=convert(varchar(2),mont...

Convert "1.79769313486232E+308" to double without OverflowException?

I have this string "1.79769313486232E+308" and am trying to convert it to a .NET numeric value (double?) but am getting the below exception. I am using Convert.ToDouble(). What is the proper way to do this conversion? OverflowException: Value was either too large or too small for a Double ...

How should I pass a user-defined type to SqlParameterCollection.AddWithValue?

I have a custom data type called StudentID, which has an implicit conversion to string. When I pass a StudentID instance to SqlCommand.Parameters.AddWithValue (as the value) and execute the command, I receive the following error: "No mapping exists from object type StudentID to a known managed provider native type." Specifying a type ...

cvs2svn fails with "xxx is not a valid ,v file"

I finally found an answer to my question when I wanted to post it! However I'll still post it, including my answer, in case it helps someone else: When converting from CVS to Subversion cvs2svn failed on some files with the message "xxx is not a valid ,v file" What's the problem? ...

Saving a word document as an image

I am using the below code to convert a Word Doc into an image file. But the picture appears too big, and the contents don't fit - is there a way to render the picture or save the picture to size? private void btnConvert_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtFileName.Text)) { ...