You searched for jon skeet. We found 71 results in 0.223 seconds.

Thread safe Singleton: why the memory model does not guarantee that the new instance will be seen by other threads?

I have read in Jon's Skeet online page about how to create a thread safe Singleton in C# http://csharpindepth.com/Articles/General/Singleton.aspx // Bad code! Do not use! public...
Jon Skeet
people
quotationmark

Can you please explain why doesn't the memory model does not guarantee that the new value of instance will be seen by other threads? The memory model is complex and not terribly clearly documented at the moment, but fundamentally... more

people

How to convert Linq.IEnumerable(Of String) to formatted Strings

I have a List(Of String) that stores validation errors. Should that list contain any items, I'd like to concatenate them into an HTML list to show each error. Currently this is...
Jon Skeet
people
quotationmark

It sounds like you need a combination of Join and Select: String.Join("", _ l.Select(Function(s as String) String.Format("<li>{0}</li>", s)) Of course, you could always write your own JoinFormat extension method - that... more

people

IllegalArgumentException using Java8 Base64 decoder

I wanted to use Base64.java to encode and decode files. Encode.wrap(InputStream) and decode.wrap(InputStream) worked but runned slowly. So I used following code. public static...
Jon Skeet
people
quotationmark

I strongly suspect that the problem is that you're ignoring the return value from InputStream.read, other than to check for the end of the stream. So this: while (in.read(inBuff) > 0) { // This always decodes the *complete* buffer ... more

people

Using XhtmlTextWriter with XmlTextReader

After reading this article, I have decided to update the following code (using XmlDocument) with XmlReader: Rendering controls public string Rendering(Control baseControl) { ...
Jon Skeet
people
quotationmark

Is there a room for optimizing the existing code? Absolutely. The first place I'd change has nothing to do with how you load the XML - it's string concatenation. I'd change your recursiveOperation method to: private static string... more

people

java: local variable looper is accessed from within inner class; needs to be declared final, but then variable might not have been initialized

I'm using something a bit like the command pattern to create a class which implements a simple interface for a method I reuse frequently, but in different ways. I was able to get...
Jon Skeet
people
quotationmark

You've effectively got a cyclic dependency: your Looper needs to be initialized with the Commandable, and the Commandable needs to be initialized with the Looper. The compiler is absolutely right to complain - imagine if the Looper... more

people

Why awaiting cold Task does not throw

I was just experimenting to see what happens when a cold task (i.e. a Task which hasn't been started) is awaited. To my surprise the code just hung forever and "Finsihed" is never...
Jon Skeet
people
quotationmark

You're trying to start the task returned by the async method - that isn't the cold task that you started out with. Indeed, if you add some diagnostics to your Task.Run call, you'll see that an exception is thrown: ... more

people

How to ignore reference to jetbrains.annotations.dll in NodaTime nuget package xml documentation file

I lean quite heavily on Resharper context actions to generate boilerplate code. The Check parameter for null context action had, up until recently, generated code that performs...
Jon Skeet
people
quotationmark

Noda Time deliberately ships with an internal copy of the R# annotations, so that those who do want them can benefit from them - it will know which methods are pure, etc. It sounds like you don't actually want to use annotations at all,... more

people

Stream<Set<Path>> to Set<Path>

Here is the Java 8 code, using streams: Set<String> getFields( Path xml ) { final Set<String> fields = new HashSet<>(); for( ... ) { ... ...
Jon Skeet
people
quotationmark

I suspect you want flatMap instead of map, and then use Collectors.toCollection to create the sorted set: final SortedSet<String> fields = files .stream() .parallel() .flatMap(x -> getFields(x).stream()) ... more

people

Is the string == overloaded operator actually used in some generic comparison method?

I am currently reading Jon Skeet's C# in Depth, 2nd Edition. I'd like to quote listing 3.5: static bool AreReferencesEqual<T>(T first, T second) where T : class { ...
Jon Skeet
people
quotationmark

Yes, there's a massive difference. In example 1, intro1 and intro2 refer to different objects. In examples 2 and 3, intro1 and intro2 have the same value - they refer to the same object, so if you call Object.ReferenceEquals(intro1,... more

people

Filter by time range in list of DateTime objects

I have a list of DateTime objects. I need to take from this list only those objects that have time part of the date between '00:00:01' and '12:00:00'. How can I query this...
Jon Skeet
people
quotationmark

It seems to me that all you need is the DateTime.TimeOfDay property. I would then recommend changing your conditions slightly if you're able to, so that the lower bound is inclusive and the upper bound is exclusive, e.g. var time =... more

people