EF: Include with where clause

EF: Include with where clause

As the title suggest I am looking for a way to do a where clause in combination with an include.Here is my situations:I am responsible for the support of a large application full of code smells.Changing too much code causes bugs everywhere

Null pointer Exception - findViewById()

Null pointer Exception - findViewById()

Can anyone help me to find out what can be the issue with this program.In the onCreate() method the findViewById() returns null for all ids and this causes a null pointer exception later. I can not figure out why the findViewById() can not

Serialize Map[String, Any] with spray json

Serialize Map[String, Any] with spray json

How do I serialize Map[String, Any] with spray-json? I tryval data = Map("name" -> "John", "age" -> 42)import spray.json._import DefaultJsonProtocol._data.toJsonIt says Cannot find JsonWriter or JsonFormat type class for scala.collection.im

Which is better? array, ArrayList or List (in terms of performance and speed)

Which is better? array, ArrayList or List (in terms of performance and speed)

I require a fast speed in processing my page. The count of the values to be added will be dynamic.Which one of the above is preferred? Support with a valid reason.Edit: For eg:string str = "a,b,c"; //Count of the number of elements in str i

junit: impact of forkMode=“once” on test correctness

junit: impact of forkMode=“once” on test correctness

I'd like to reduce the time which our build (using ant) takes for running the tests.Currently I am using the default forkMode, which forks a new vm on each test class (perTest).I am thinking about to switch to forkMode="once" but I am unsur

C#: Any benefit of List.ForEach(…) over plain foreach loop?

C#: Any benefit of List.ForEach(…) over plain foreach loop?

I'm wondering why List.ForEach(Action) exists.Is there any benefit/difference in doing :elements.ForEach(delegate(Element element){ element.DoSomething(); });overforeach(Element element in elements) { element.DoSomething();}? 1:One key d

ASP.NET MVC: putting custom attributes into option tag in select list

ASP.NET MVC: putting custom attributes into option tag in select list

I'm using ASP.NET MVC, and am trying to render a select list with the HtmlHelper.DropDownListFor method, like so: x.AllTopics, SelectListHelper.GetSelectListItems(Model.AllTopics), "Select a Topic", new { id = "allTopics", @class = "topic-d

Avoid calling BeginInvoke() from ViewModel objects in multi-threaded c# MVVM application

Avoid calling BeginInvoke() from ViewModel objects in multi-threaded c# MVVM application

My C# application has a data provider component that updates asynchronously in its own thread. The ViewModel classes all inherit from a base class that implements INotifyPropertyChanged. In order for the asynchronous data provider to upda

Rails Active Record: find in conjunction with :order and :group

Rails Active Record: find in conjunction with :order and :group

I have a structure something like this:class User has_many :dongles has_many :licences, :through => :donglesendclass Dongle has_many :licences belongs_to :userendclass Licence belongs_to :dongleendHowever, time passes and the user even

Python heapq vs. sorted complexity and performance

Python heapq vs. sorted complexity and performance

I'm relatively new to python (using v3.x syntax) and would appreciate notes regarding complexity and performance of heapq vs. sorted.I've already implemented a heapq based solution for a greedy 'find the best job schedule' algorithm. But th

MongoDB - Difference between index on text field and text index?

MongoDB - Difference between index on text field and text index?

For a MongoDB field that contains strings (for example, state or province names), what (if any) difference is there between creating an index on a string-type field :db.ensureIndex( { field: 1 } )and creating a text index on that field:db.e

How to remove specific object from ArrayList in Java?

How to remove specific object from ArrayList in Java?

How can I remove specific object from ArrayList?Suppose I have a class as below:import java.util.ArrayList; public class ArrayTest { int i; public static void main(String args[]){ ArrayList test=new ArrayList(); Array

Link to a root controller from area controller in ASP MVC

Link to a root controller from area controller in ASP MVC

How can I link to one of my root controllers from one of my areas?This gives me an error: No route in the route table matches the supplied values.I have a controller named Pagein a folder named Admin in my root controller collection.I can

Throwing multiple exceptions in Java

Throwing multiple exceptions in Java

Is there any way to throw multiple exceptions in java? 1:I suppose you could create an exception containing a list of caught exceptions and throw that exception, e.g.:class AggregateException extends Exception { List basket;} 2:No,

mongoose populate field without ref option

mongoose populate field without ref option

I have 3 schema:var User1Schema = new Schema({ name: {type:String , trim: true, required: true }, status: {type:Number, required: true, default:1}},{collection:"user_1"});,var User2Schema = new Schema({ name: {type:String , trim: t

Entity Framework recursively include collection for each entity from included collection

Entity Framework recursively include collection for each entity from included collection

I have the following where I am trying to include the addresses of the people in the cities of the countries.Country country = _db.Countries .Include(p=>p.Cities.People.????) .Where(....)Not sure how to work it?

How can I activate Vim color schemes in OS X's Terminal?

How can I activate Vim color schemes in OS X's Terminal?

I'm working with the Vim 7.2 that comes with Mac OS 10.6.1 (Leopard), using the Mac's "Terminal" app. I'd like to use a fancy color scheme. I did this...:syntax onThen this...:colorscheme slate:colorscheme elflord:colorscheme desertetc...Sy

Meteor: insert failed: Method not found

Meteor: insert failed: Method not found

I am receiving the insert failed: Method not found log message and it probably is the result of what is described in these threads:Meteor using a local connection results in error: insert failed: 404 -- Method not foundGetting a error inser

Forming a tournament table with LINQ (Fixture List)

Forming a tournament table with LINQ (Fixture List)

I have an array of players (string[]) and now I need to get an array of pairs representing games (playerN-playerM) to orginize tournament table like at this picture:The desired end result is to generate a fixture list with all the games the

Java Threadpool size and availableProcessors()

Java Threadpool size and availableProcessors()

I have a program which runs (all day) tasks in parallel (no I/O in the task to be executed) so I have used Executors.newFixedThreadPool(poolSize) to implement it.Initially I set the poolSize to Runtime.getRuntime().availableProcessors(), bu

Spring OpenSessionInViewInterceptor doesn't work

Spring OpenSessionInViewInterceptor doesn't work

I had the (in)famous problem with hibernate and lazy loading when views are rendered.... As many say, the only two solutions are:Make the method transactional (and this is not always desiderable)Use OpenSessionInViewInterceptor. The latter

Create or extend a companion object, using a macro annotation on the class

Create or extend a companion object, using a macro annotation on the class

Using a Scala 2.10/2.11 macro paradise annotation macro, how can I add or extend the companion object of an annotated class? Skeleton:import scala.annotation.StaticAnnotationimport scala.reflect.macros._import language.experimental.macroscl

C# - How to implement multiple comparers for an IComparable class?

C# - How to implement multiple comparers for an IComparable class?

I have a class that implements IComparable.public class MyClass : IComparable{ public int CompareTo(MyClass c) { return this.whatever.CompareTo(c.whatever); } etc..}I then can call the sort method of a generic list of my

Executing a Bash Script from Golang

Executing a Bash Script from Golang

I am trying to figure out a way to execute a script (.sh) file from Golang. I have found a couple of easy ways to execute commands (e.g. os/exec), but what I am looking to do is to execute an entire sh file (the file sets variables etc.).Us

Struct vs Class for long lived objects

Struct vs Class for long lived objects

When you need to have very small objects, say that contains 2 float property, and you will have millions of them that aren't gonna be "destroyed" right away, are structs a better choice or classes?Like in xna as a library, there are point3s