Browsing 7239 questions and answers with Jon Skeet

The namespace RDotNet could not be found

I'm trying to use R with C#. I'm using Unity and MonoDevelop on the C# side and I've R version 3.2.1. I've tried my best to follow instructions here:...
Jon Skeet
people
quotationmark

I wouldn't expect just running the nuget install to add a reference into your project - the nuget installer is basically just downloading the package for you. You could manually add a reference in your project to the relevant assembly... more 9/10/2015 9:16:16 AM

people

Get next Hannukah date in C#

I am trying to find out from today's UTC date the date of the next Hannukah. I already found that C# has HebrewCalendar class and I was able to get the current Jewish date with...
Jon Skeet
people
quotationmark

As it was suggested on Twitter, here's a Noda Time solution: // As of 2.0, it will be CalendarSystem.HebrewCivil var calendar = CalendarSystem.GetHebrewCalendar(HebrewMonthNumbering.Civil); var today =... more 9/10/2015 7:27:26 AM

people

Java Lists.partition not working properly

Hi so I'm currently working on a system that splits a given Set of UUID's into separate sublists using Guava's Lists.partition method. Here's my code currently: public static...
Jon Skeet
people
quotationmark

Lists.partition is working properly - it's just you're not using it properly. You've got a rounding problem, basically: 5 / 2 evaluates to 2, so you're asking for partitions of size 2... so you get 3 partitions. You actually want a... more 9/10/2015 6:13:22 AM

people

ReadAllText does only return first line

I'm trying to replicate this PHP function with VB.net: function getGiantsModMD5Hash($modFile) { $info = pathinfo($modFile); // Add mod zip data $fileContent =...
Jon Skeet
people
quotationmark

A zip file is not a text file, so don't try to use it as if it were. It's vitally important that you distinguish between text data and binary data - not just here, but all over the place. Hashing a file is simple though. Unfortunately as... more 9/9/2015 4:54:01 PM

people

unable to Preserve property after group by linq

I have a collection of usages as follows and need the following output as below : This is my Usage class : public class Usage { public Usage() {} public string Alias {...
Jon Skeet
people
quotationmark

Basically there are two problems here: You're grouping by Day rather than Date, which I doubt you want to do You're not using the fact that you've already got the alias as the key in the outer grouping You can actually do this more... more 9/9/2015 4:43:51 PM

people

Java javac compile with classpath

I was wondering if it's possible to include a jar in the classpath when compiling instead of executing. At the moment I am just checking to see if my PostgreSQL driver can be...
Jon Skeet
people
quotationmark

Why is this and is there a way for me to use the second method for including jars? It's because specifying the classpath for compilation just tells the compiler where to find types. The compiler doesn't copy those types into its... more 9/9/2015 3:56:29 PM

people

Error callback for a Task type in C#

I was wondering whats the error callback for a Task in C#. For example : In JavaScript you have two callbacks for a promise. obj.save().then(function(){ //success },...
Jon Skeet
people
quotationmark

Well, there are various options: You could use Task.ContinueWith, specifying the error callback using TaskContinuationOptions.OnlyOnFaulted You could await the task and just catch the exception which will be unwrapped... more 9/9/2015 8:21:37 AM

people

Extension methods declared on Object need one more parameter than others?

Extension methods on Object can be declared on Object but cannot be used like obj.ExtMethod(). This is by design. On the other hand, any extension method can be also used like...
Jon Skeet
people
quotationmark

Why calling of extension methods declared on Object differ from extension methods declared on other types if Option Strict On is present? Because your calling context (which you haven't shown) isn't convertible to Integer, but is... more 9/8/2015 4:35:57 PM

people

Application runs as x86 in unit tests in Visual Studio, but runs as x64 when it stands alone

this line of code Environment.Is64BitProcess Evaluates to true when my app is running standing alone. But the same expression evaluates to false when it's running in my unit...
Jon Skeet
people
quotationmark

That basically says that the unit test runner is starting up as a 32-bit process. How you configure that will depend on which unit test runner you're using (there are many of them). When you're running your unit tests, any preference your... more 9/8/2015 2:44:29 PM

people

Syntax for 'new' in java

Constructors of non static member classes take an extra hidden parameter which is a reference to an instance of the immediately enclosing class. There is also a syntactic...
Jon Skeet
people
quotationmark

It's calling the constructor of Kb. It's easier to show this in three statements: K.Ka.Kb x1 = new K.Ka.Kb(); K.Ka.Kb.Kc x2 = x1.new Kc(); // Pass x1 as the hidden constructor arg K.Ka.Kb.Kd.Kd k = x2.new Kd(); // Pass x2 as the hidden... more 9/8/2015 2:37:55 PM

people