How do you deal with m..n relationships in a relational database?

How do you deal with m..n relationships in a relational database?

Let's look at an example - books. A book can have 1..n authors. An author can have 1..m books. What is a good way to represent all of the authors of a book?I came up with an idea to create a Books table and an Authors table. The Authors tab

SQLAlchemy - Writing a hybrid method for child count

SQLAlchemy - Writing a hybrid method for child count

I'm using Flask-SQLAlchemy, and I'm trying to write a hybrid method in a parent model that returns the number of children it has, so I can use it for filtering, sorting, etc. Here's some stripped down code of what I'm trying:# parent.pyfrom

Creating one NuGet package from multiple projects in one solution

Creating one NuGet package from multiple projects in one solution

I have a solution that I'm working on that contains 4 class library projects (A, B, C, D). A and B could be considered the top level projects in the solution. Both A and B reference C, and D stands alone.These four projects represent a grou

Fluent NHibernate & one-to-one

Fluent NHibernate & one-to-one

For a (very) long time I've been looking for an example on how to correctly implement a one-to-one mapping with Fluent NHibernate.Most resources I find say: I think you mean a many-to-oneHowever no one actually gives an example on how to c

Volatile for reference type - Does it always avoid publication of references issues due to JMM?

Volatile for reference type - Does it always avoid publication of references issues due to JMM?

Assuming this class:public class AmIThreadSafe { private int a; private int b; AmIThreadSafe(int a, int b) { this.a = a; this.b = b; }}Assuming that instance's reference to this class (declared as volatile) is acce

Entity Framework – Inserting into multiple tables using foreign key

Entity Framework – Inserting into multiple tables using foreign key

I am a relative newby to EF and have created a simple model (see below) using EF4.I am having a problem inserting a new record into the UserRecord entity and subsequently adding the UserDetail entity which uses the newly created UserRecordI

Password protecting a PDF file

Password protecting a PDF file

I have the following:routine X that creates a PDF file on a daily basis.routine Y that attaches this file to an Outlook e-mail and sends it to recipients.Both the above are in VBA. They are called from a C# console application.Once the PDF

RGoogleDocs and now RGoogleData

RGoogleDocs and now RGoogleData

RGoogleDocs is fantastic. It allows one to store data on Google and read it in in real time to R. I tried to install it on a computer the other day and lo and behold all I could find was RGoogleData in RForge. What is the relationship betwe

SQLAlchemy query, join on relationship and order by count

SQLAlchemy query, join on relationship and order by count

I have two SQLAlchemy models set up as follows:############### Post Model ###############class Post(db.Model): id = db.Column(db.Integer, primary_key = True) title = db.Column(db.String(250)) content = db.Column(db.String(5000))

Foreign key relationship with composite primary keys in SQL Server 2005

Foreign key relationship with composite primary keys in SQL Server 2005

I have two tables Table1( FileID, BundledFileID, Domain)and Table2( FileID, FileType, FileName)In Table2 FileID and FileType are the composite primary key. I want to create a foreign key relationship from Table1.FileID to Table2. Is

Django-Admin: list_filter attribute from UserProfile

Django-Admin: list_filter attribute from UserProfile

I want to allow the admins of my site to filter users from a specific country on the Admin Site. So the natural thing to do would be something like this:#admin.pyclass UserAdmin(django.contrib.auth.admin.UserAdmin): list_filter=('userpro

The use of c3p0.idle_test_period.

The use of c3p0.idle_test_period.

I'm new to c3op, and confused about the use of : c3p0.idle_test_periodIn this link : HowTo configure the C3P0 connection poolidleTestPeriod : Must be set in hibernate.cfg.xml (or hibernate.properties), Hibernate default: 0, If this is a n

Ember Data - Saving record loses has many relationships

Ember Data - Saving record loses has many relationships

I am having an issue working with Ember Data Fixture Adapter. When saving a record, all of the record's hasMany associations are lost. I have created a simple JS Bin to illustrate the issue: http://jsbin.com/aqiHUc/42/editIf you edit any of

@ManyToMany(mappedBy = “foo”)

@ManyToMany(mappedBy = “foo”)

Foo has:@ManyToMany(mappedBy = "foos")private Set barsand Bar has :@ManyToManyprivate Set foosWhat difference does the location of mappedBy attribute make to a bi-directional relationship , other than whether table is called foo_bar, or bar

EF CTP5 - Strongly-Typed Eager Loading - How to Include Nested Navigational Properties?

EF CTP5 - Strongly-Typed Eager Loading - How to Include Nested Navigational Properties?

Attempting to cutover our EF4 solution to EF CTP5, and ran into a problem.Here's the relevant portion of the model:The pertinent relationship: - A single County has many Cities - A single City has a single StateNow, i want to perform the fo

What are the differences between BringWindowToTop, SetForegroundwindow, SetWindowPos etc.?

What are the differences between BringWindowToTop, SetForegroundwindow, SetWindowPos etc.?

BringWindowToTop, SetForegroundWindow, SwitchToThisWindow, SetWindowPos, ShowWindow all are described as showing and activating a window.What are the real differences between them? When and why would BringWindowToTop be preferred to SetFor

Data Modelling Advice for Blog Tagging system on Google App Engine

Data Modelling Advice for Blog Tagging system on Google App Engine

Am wondering if anyone might provide some conceptual advice on an efficient way to build a data model to accomplish the simple system described below. Am somewhat new to thinking in a non-relational manner and want to try avoiding any obvi

sqlalchemy foreign key relationship attributes

sqlalchemy foreign key relationship attributes

I have a User table and a Friend table. The Friend table holds two foreign keys both to my User table as well as a status field. I am trying to be able to call attributes from my User table on a Friend object. For example, I would love to

Angular's $q.reject() vs deferred.reject()

Angular's $q.reject() vs deferred.reject()

I'm trying to get a handle on the Angular $q service and its related objects and APIs. When I look at the objects in my console I see:var deferred = $q.defer()...(and then from console inspection)...$q: Object {defer: function, reject: func

neo4j finding all paths that meets a certain criteria

neo4j finding all paths that meets a certain criteria

I am trying to model a graph to solve some connection time problem. So for example I have the following graph F1,F2 F3 F4ST_B-------ST2---ST3----ST_E F5,F6 F7 F8ST_B------ST4--ST5----ST_E F9ST_B------ST_EI model S

Parse: How do I query using PFRelation when I just have PFUser?

Parse: How do I query using PFRelation when I just have PFUser?

Here is an example of what I am trying to do. I have the current user as PFUser and on another class named Item I have a relation named "owners" which is a relation of PFUser. I want to query for all instances of Item which have the current

RxJs: Drag and Drop example : add mousedragstart

RxJs: Drag and Drop example : add mousedragstart

How to implement a mousedragstart Observable using the Drag and Drop RxJs's example.mousedragstart should be emit before the first mousedrag after a mousedown until the mouseup. I think we have to play with flatMap/take(1)/takeUntil(mouseup

Oracle ODP.Net and EF CodeFirst - SaveChanges Error

Oracle ODP.Net and EF CodeFirst - SaveChanges Error

Could someone help me with this:The code:Role r = new Role { ID = 1, Name = "Members" };ctx.Roles.Attach(r);//Saving UserUser u = new User { Login = login, Password = password, Status = 1};u.Roles.Add(r);ctx.Users.Add(u);ctx.SaveCh

Are Immutable objects immune to improper publication?

Are Immutable objects immune to improper publication?

It is an example from JCiP.public class Unsafe { // Unsafe publication public Holder holder; public void initialize() { holder = new Holder(42); }}public class Holder { private int n; public Holder(int n) {

Using SignalR with Azure Service Fabric

Using SignalR with Azure Service Fabric

Is it possible to use signalR with Service Fabric provided by Microsoft? I'm trying to connect an UWP app and an angularJS app to my stateless reliable service hosted in an Azure Cluster through signalR/websocket connection. But both are no