Browsing 7239 questions and answers with Jon Skeet

No definition for GetFilesAsync

Whenever i try this code: foreach (StorageFile filesAsync in await folderFromPathAsync.GetFolderAsync(_selectedPlayList).GetFilesAsync())//Error here { ...
Jon Skeet
people
quotationmark

You're trying to call GetFilesAsync() on the result of calling GetFolderAsync() - whereas you should be awaiting the result of GetFolderAsync() and then calling GetFilesAsync() on the result of the await. The return value from... more 11/13/2014 6:01:51 PM

people

ArrayList contains

I don't really understand what's happening, if someone could explain this to me that would be great. So, here's my code: public static ArrayList<Integer> numbers = new...
Jon Skeet
people
quotationmark

You're picking from 89 random numbers (1-89 inclusive) and trying to find a unique number each time... but you're calling that 90 times. What do you expect the last iteration to do? (To put it another way - you're trying to squeeze 90... more 11/13/2014 5:15:23 PM

people

is there a Map on Java that don't clone value when get()

We have known, value of element will be clone when we get it from a Map, such as: Map<String, MyObject> map = new HashMap(); MyObject obj = new...
Jon Skeet
people
quotationmark

We have known, value of element will be clone when we get it from a Map No, it won't. It's unclear exactly how you're seeing your original output, but that's not the normal behaviour. Here's a short but complete example based on your... more 11/13/2014 1:16:30 PM

people

LINQ get list from list by comparing enum

I am trying to get a list of objects from a list by comparing an enum that is passed into the method. public List<IAnimal> GetListOfAnimalsByType(IAnimal.AnimalType...
Jon Skeet
people
quotationmark

It looks like you really just want Where instead of SelectMany: public List<IAnimal> GetListOfAnimalsByType(IAnimal.AnimalType animalType) { return animalList.Where(ani => ani.Type == animaleType).ToList(); } SelectMany... more 11/13/2014 12:20:23 PM

people

Not a sub class error

import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.TextField; import...
Jon Skeet
people
quotationmark

I don't understand how it's not a subclass when the scope of the import is over the Calc class so that means the sub classes of those should be able to use them imports. Subclassing and imports are entirely different things. It's... more 11/13/2014 9:47:55 AM

people

Can read my class inside the mouse click event but can't modify it, why?

I have some problem that i can only update my gui inside my Mainwindow() method. And cant really figure out why it does not work inside a event to change the gui. Im using...
Jon Skeet
people
quotationmark

Currently your GUI doesn't change so much as start off right... you don't have a MainWindow method, you have a MainWindow constructor. The UI will only finish updating after that constructor has completed, by which time PosX will be 5... more 11/13/2014 9:28:11 AM

people

Java Util date Parse ebay api timestamp

ebay api retruns the timestamp as <Timestamp>2014-11-13T06:31:38.258Z</Timestamp> which has to be parsed to java.util.Date, I could come with the following...
Jon Skeet
people
quotationmark

You should change the time zone specifier part of the pattern to X, which is the ISO-8601 time zone (well, UTC offset) specifier: objectConstructor("java.text.SimpleDateFormat","yyyy-MM-dd'T'HH:mm:ss.sssX") That will handle Z and treat... more 11/13/2014 7:21:08 AM

people

java, integer isn't used (calculator)

I am busy making a calculator but somehow the integer isn't used, I don't know why. I try to fix it but I can't find out how to do it. I use a button with a event to calculate the...
Jon Skeet
people
quotationmark

This is the problem: try { int xValue = Integer.parseInt(x); int yValue = Integer.parseInt(y); } catch (NumberFormatException exep) { exep.printStackTrace(); } That's declaring new local variables xValue and yValue, rather... more 11/12/2014 6:42:52 PM

people

How to save a timestamp using NodaTime?

I have the following implementation using basic UtcNow, and then converting it back to the UI. The purpose in this scenario is very simple. When I insert a new client to the...
Jon Skeet
people
quotationmark

It sounds like you're trying to store points in time, regardless of calendar system or time zone. Those are represented by Instant values in Noda Time. So within most of your code, that's probably what you should use to represent the... more 11/12/2014 5:53:13 PM

people

For loop in a static method does not need {}

using System; class FirstArray { static void Main() { int numOfGrades; double[] listOfGrades; Console.Write("How many students in the class? "); ...
Jon Skeet
people
quotationmark

Why does the for loop in the GetGradeSum method not require {}? Because its body is a single statement. It's much simpler to understand if you indent your code properly. Your current code is more clearly written as: static double... more 11/12/2014 5:47:30 PM

people