Browsing 7239 questions and answers with Jon Skeet

Oracle: ISO Week, wrong answer

In Oracle 11 and Oracle 12, issuing the following select: SELECT TO_CHAR((TO_DATE('19720101','YYYYMMDD')), 'YYYYIW') || ' ' || TO_CHAR((TO_DATE('19721230','YYYYMMDD')), 'YYYYIW')...
Jon Skeet
people
quotationmark

You're currently formatting with 'YYYYIW' which is the 4 digit year, followed by the ISO week-of-year. I suspect you want the ISO week-year, followed by the ISO week-of-year. The Oracle documentation is very unclear on this, but you... more 7/5/2016 2:49:45 PM

people

Cannot read file in uploaded path(used by another process)

I upload a csv file to AppData folder in project solution and read the content with the code below: using (var fs = new FileStream(Path.Combine(uploadPath, name), chunk == 0 ?...
Jon Skeet
people
quotationmark

I couldnt get it how and why its being used Because you've not closed the stream that's writing to it: using (var fs = new FileStream(Path.Combine(uploadPath, name), ...) I would suggest you write the file, close the using... more 7/5/2016 11:47:45 AM

people

Calling both the default and super constructor in Java

I guess what I'd want is simply not possible, but I want to make sure. Say I have public class bar { public bar() { } public bar(Object stuff) { //...
Jon Skeet
people
quotationmark

You can only chain to one constructor. Typically the best approach is for the "less specific" constructors (the ones with fewer parameters) to chain to the "more specific" ones, with a single "master" constructor which is the only one with... more 7/5/2016 11:02:14 AM

people

Parameter less delegate in Reactive Extensions in a Universal C# Windows App

I have an eventhanler: public delegate void OnSizeEventHandler(); And I have the class that triggers the event of that type CustomObject.OnSize += OnResize; As you can see...
Jon Skeet
people
quotationmark

If you look at the overloads of FromEvent, you'll see there aren't any that match your current call. You might want to try using this instead: var eventAsObservable = Observable.FromEvent<OnSizeEventHandler>( (Action... more 7/5/2016 10:31:07 AM

people

Convert a string into iso date format

So I am trying to convert a string into an iso format for the date. This is the string that I am trying to convert "2016-07-05 02:14:35.0" I would like to have it in this format...
Jon Skeet
people
quotationmark

Firstly, that value is a LocalDateTime, not a LocalDate. If you want to get a date out in the end, I'd convert it to a LocalDateTime first, then take the date part of that. When performing date formatting and parsing, always read the... more 7/5/2016 5:46:49 AM

people

Where is the BCL DateTimeZoneProvider in the .NET Core implementation of NodaTime?

I use NodaTime to do time zone conversions in ical.net, because it performs much better than the previous implementation which tried to use the VTIMEZONE element to handle time...
Jon Skeet
people
quotationmark

What should we be using for BCL time zone lookups in the .NET Core port of NodaTime? Unfortunately, there isn't good TimeZoneInfo support in the PCL profile that Noda Time 1.x supports - even FindSystemTimeZoneById() and the Id... more 7/4/2016 7:09:12 PM

people

how to understand initialization of 3d arrays?

Been googling but canĀ“t understand how this array is a 1,8,3 array? How can you see that X is 1, Y is 8, and Z is 3 from this array? double[,,] points = { ...
Jon Skeet
people
quotationmark

You just reformat it, basically: double[,,] points = { { // One top-level element {-1, 0, 3}, // 8 "middle-level" elements, each of which has 3 elements {-1, -1, -1}, {4, 1, 1 }, {2, 0.5, 9}, ... more 7/4/2016 11:17:44 AM

people

C# How to comparing two string?

I want to comparison two string. First is from the dateTimePicker, and second is from file. string firtsdate = dateTimePicker1.Value.ToString("yyyy-MM-dd"); string seconddate =...
Jon Skeet
people
quotationmark

I suspect this is the problem: string fileContent = File.ReadAllText(FilePath); string[] integerStrings = fileContent.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); A line break on Windows is "\r\n" - so each line in... more 7/4/2016 7:29:14 AM

people

C# RestSharp Deserialize non standard JSON

I am trying to use RestSharp to Deserialize a JSON string. However I am getting caught on the slightly non standard structure around the "555111222" part. The number 555111222...
Jon Skeet
people
quotationmark

It looks to me like your Data property should be Dictionary<string, GpsDataWrapper> where GpsDataWrapper is just a class with a GpsData property: public class GpsData { public double longitude { get; set; } public double... more 7/4/2016 6:38:50 AM

people

How to benchmark logging infrastructure with BenchmarkDotNet?

We have a an internal framework that handles our logging , data access, crypto..you name it. I'd like to start comparing the performance, of say the logging functionality to other...
Jon Skeet
people
quotationmark

BenchmarkDotNet is most appropriate for microbenchmarking of CPU-bound code. There are so many factors that can affect IO-bound code that I don't view microbenchmarking as a great approach. Instead, I would suggest if possible that you... more 7/3/2016 8:13:22 PM

people