bidirectional

Generic Java Framework to Manage Bidirectional Associations and Inverse Updates

Hello, I've been looking for a generic way to deal with bidirectional associations and a way to handle the inverse updates in manual written Java code. For those who don't know what I'm talking about, here is an example. Below it are my current results of (unsatisfying) solutions. public class A { public B getB(); public void ...

Algorithm to find subset within two sets of integers whose sums match

Hi, I'm looking for an algorithm which can take two sets of integers (both positive and negative) and find subsets within each that have the same sum. The problem is similar to the subset sum problem: http://en.wikipedia.org/wiki/Subset-sum_problem except that I'm looking for subsets on both sides. Here's an example: List A {4, 5, 9,...

Mapping a bidirectional list with Hibernate

I don't understand the behavior of Hibernate when mapping a bidirectional list. The SQL statements that Hibernate produces seem not optimal to me. Can somebody enlighten me? The scenario is the following: I have a one-to-many parent-child relationship. I map this relationship with a bidirectional list. According to the Hibernate Annota...

bidirectional one-to-many entity assosiation

If I have two objects, say ProductOrder and Product, I want both to be able to contain multiple references to the other, e.g. A Product can be referenced by multiple Orders A ProductOrder can contain multiple Products. I've attempted to do it as such... <set name="Products" inverse ="true" cascade="save-update"> <key column="Ord...

Bidirectional graph in rails

Hey guys, I have a simple model "Match" that is supposed to save the bi-directional link between two objects (of the same kind). class Match < ActiveRecord::Base belongs_to :obj1, :class_name => "MyModel", :foreign_key => :obj1_id belongs_to :obj2, :class_name => "MyModel", :foreign_key => :obj2_id ... end The problem I have is...

A bi-directional map in clojure?

What would be the best way to implement a bi-directional map in clojure? (By bi-directional map, I mean an associative map which can provide both A->B and B->A access. So in effect, the values themselves would be keys for going in the opposite direction.) I suppose I could set up two maps, one in each direction, but is there a more idi...

Bidirectional Hibernate collection mapping works in only one direction

My bidirectional collection mapping seems to only work in one direction. One job will have some number of costs. Each cost is associated with one job. The problem is, when I load a job, the costs collection is empty. However, when I load a cost and navigate from it to the job and then check the costs collection, it is properly filled. Ca...

bidirectional named pipe question

I have 2 apps that I want to make communicate via named pipes on .NET 3.5. Its a request/response paradigm, with the data transmitted as XML to make my life easier. There is a listener app, and an app that posts requests to the pipe. I'm trying to use a bidirectional pipe to do this. The problem i have is that the call to StreamReade...

Bidirectional replication update record problem

Hi, I would like to present you my problem related to SQL Server 2005 bidirectional replication. What do I need? My teamleader wants to solve one of our problems using bidirectional replication between two databases, each used by different application. One application creates records in table A, changes should replicate to second datab...

Reversing Strings in Right To Left (BiDirectional) Languages in C#

Hey, I'm using iTextSharp( C# iText port) to create pdfs from text/html. Most of my text is in Hebrew, a Right-To-Left language. My problem is that PDFs show RTL langauge in reverse, so I need to reverse my strings in a way that would only reverse the RTL text without reversing any numbers or text in English. It is my understanding th...

Fluent NHibernate Bidirectional Mapping - results in two similar referencing columns

Hello there, I am trying to implement Bidirectional Mapping with Fluent NHibernate Mapping. Code snippet from Domain classes: public class Template { public virtual int? Id { get; set; } public virtual string Title { get; set; } public virtual TemplateGroup TemplateParentGroup { get; set; } } public class TemplateGroup ...

Does Java have a HashMap with reverse lookup?

I have data that is organized in kind of a "key-key" format, rather than "key-value". It's like a HashMap, but I will need O(1) lookup in both directions. Is there a name for this type of data structure, and is anything like this included in Java's standard libraries? (or maybe Apache Commons?) I could write my own class that basicall...

Java key - key map

Hi, I need a kind of map which is accessible in two directions, so with a key-key structure instead of key-value. Does this exist in Java? If not, what is the best way to create it? So example: mySpecialHashMap.put("key1", "key2"); mySpecialMap.getL2R("key1") returns "key2"; mySpecialMap.getR2L("key2") returns "key1"; ...

IPC between Python and C#

I want to pass data between a Python and a C# application in Windows (I want the channel to be bi-directional) In fact I wanna pass a struct containing data about a network packet that I've captured with C# (SharpPcap) to the Python app and then send back a modified packet to the C# program. What do you propose ? (I rather it be a fast m...

How does ORM solve bidirectional relationship between entities (NHibernate, for example)?

I'm writing a homework for my RDBMS class, I need to perform CRUD operations on quite simple domain, which is cyber sport championship. Students are required to use ADO.NET. My question is how can I solve bidirectional relationship, for example 1:m (every championship has many matches, but every match belongs to only one exact championsh...

Two sided (bidirectional) list in Java

Is there something like a two sided list in Java? Maybe a third party implementation? Here a little example to demonstrate what I have in mind. Original state: A: 0-1-2-3 | | | | B: 0-1-2-3 After removal of element 1 in B: Null | A: 0-1-2-3 | / / B: 0-1-2 The data structure must be accessible from both sides. So...

Gae Jdo persistance on one-to-many owned relationship with bidirectional navigation

I'm trying to persist a one-to-many owned relationship with bidirectional navigation in gae using jdo. I manually add the Contact to User class, and I would expect that in the end the contact will have a reference to the parent User class. If I configure this manually before i persist the parent i get an exception at org.datanucleus....

Drawing Hebrew text to and image using Image module (python)

This is an issue I already asked about and several got answers but the problem remained. when I try to write in hebrew to an image using Image module I get instead of the hebrew lettring some other (ascii??) lettering. if I convert to unicode or ascii I get an error that it doesn't support. I got here a reference to a code that does what...

Going "behind Hibernate's back" to update foreign key values without an associated entity

Updated: I wound up "solving" the problem by doing the opposite! I now have the entity reference field set as read-only (insertable=false updatable=false), and the foreign key field read-write. This means I need to take special care when saving new entities, but on querying, the entity properties get resolved for me. I have a bidirect...

Does BiDi support need to extend to visualizations?

I'm in the process of writing a visualization library for a product I work on and I've been thinking about i18n and BiDi support. I haven't been able to find a good answer anywhere, and my Project Manager doesn't really know the answer either. My question is this: how far should I take bi-directionality with visualizations? Should the...