Browsing 7239 questions and answers with Jon Skeet

How to execute java method in abstract class?

I have a method in abstract class that may be overriden in extended class or not. I'd like to call the original (not overriden) method. How to reference it? Example: public...
Jon Skeet
people
quotationmark

I'd like to call the original (not overriden) method. You can't do that from outside the subclass. From the subclass itself, you can call super.my_method(); which will always call the superclass implementation, even if it's been... more 10/30/2014 2:28:41 PM

people

async / await vs BeginRead, EndRead

I don't quite 'get' async and await yet, and I'm looking for some clarification around a particular problem I'm about to solve. Basically, I need to write some code that'll handle...
Jon Skeet
people
quotationmark

To my eyes, the async way looks cleaner, but there is that 'while (true)' loop that my uneducated brain tells me is going to use an extra thread, more resources, and therefore won't scale as well as the other one. Nope, it won't. The... more 10/30/2014 11:59:19 AM

people

Cannot implicity convert type System.Linq.Expression<System.Func<Object, bool>> to bool

actually I have an Expression like this that work very well in the case of Linq to Entity public static Expression<Func<Tender, bool>> GetPublic() { var now =...
Jon Skeet
people
quotationmark

Firstly, I suspect you actually mean you can call it as: _repositoryObject.Where(GetPublic()) It's important that you call the method to get the expression tree. Your query expression is being converted into: var results =... more 10/30/2014 11:54:30 AM

people

Retrieve the hashed password from the database to the text

I want to do the Forgot your password? in the program, I already could retrieve the username and password that hashed from the database and send it to the email user (I use my own...
Jon Skeet
people
quotationmark

The whole point of hashing is that it's one way - that you can't retrieve the original password from the hash. A "forgot your password" feature shouldn't email the existing password to the user... it should generate a temporary... more 10/30/2014 7:24:18 AM

people

get set accessors from static Main() and best practice for boolean store

I can't adequately explain why Console.WriteLine(val.getSetNum) from static void Main(string[] args) returns 0. I would have thought that after calc()had been called, ...
Jon Skeet
people
quotationmark

You're creating two different instances of Values - one inside Main, which keeps its value of 0 for getSetNum, and one inside Calc, which is given a value of 6 for getSetNum. They're entirely separate instances. You could fix this by... more 10/30/2014 7:09:36 AM

people

Head nodes of Linked lists not getting updated

I have been implementing a simple utility function in Linked lists called MoveNode() using Java. The main aim of MoveNode() is to remove the first node of one linked list...
Jon Skeet
people
quotationmark

Why does the head nodes of the lists does not get updated properly? Because you're just changing the values of local variables. That's all you're doing - you're not making any changes to the list objects at all. Changes to local... more 10/30/2014 6:56:12 AM

people

Strange results in AutoSuggestBox in Windows Phone 8.1

I am trying to use the standard AutoSuggestBox in a Windows Phone 8.1 XAML app, but it behaves really strangely. In a simple demo, I have collection Items = new...
Jon Skeet
people
quotationmark

Based on this blog post, it looks like what you're expecting (automatic filtering) isn't the case - instead, you need to hook into the TextChanged event and populate the Suggestions collection yourself. From the documentation: The app... more 10/29/2014 5:50:01 PM

people

The conversion of a datetime2 data type to a datetime data type resulted in out of range value

I'm using Entity Framework in Visual Studio 2012 developing C# program. I want to add records in my database table . The record (object) includes an attribute (TRANSACTION_DATE)...
Jon Skeet
people
quotationmark

You shouldn't think about the database as storing the values in a particular string format at all - any more than it stores numbers as decimal or hex. Instead, you should just view it as a date/time, e.g. // TODO: Do you really want the... more 10/28/2014 1:25:46 PM

people

Dequeue not the same as what is enqueued

Hello there stackoverflow! I'll just cut to the chase: I have a server / client program using TCP and I am having some trouble with the queue I use to put read packets in. This...
Jon Skeet
people
quotationmark

The ReadBuffer is indeed modified right after its enqueued, but I thought enqueuing is by value and not reference? The reference is enqueued by value. Arrays are always reference types. All that ends up in the queue is a reference to... more 10/27/2014 5:52:22 PM

people

The requested operation caused a stack overflow

I am trying to create a derived class and the error pops up. Not quite sure how it comes out. Please help! Base class: public class Command : identifiableobject { ...
Jon Skeet
people
quotationmark

This is the problem: public class Command : identifiableobject { LookCommand l = new LookCommand(); ... That means that in order to construct a Command, you need to construct a new LookCommand. But a LookCommand is a Command,... more 10/25/2014 5:29:28 AM

people