Search Results

Search found 3444 results on 138 pages for 'mapping'.

Page 7/138 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Nhibernate mapping: fixed count multiple members instead of collection

    - by AhmetC
    I don't want to put wheels into a collection. How can i map kind of relation? Class Wheel { int id; Car Owner; } Class Car { int id; Wheel Wheel1; Wheel Wheel2; Wheel Wheel3; Wheel Wheel4; } I tried this but Wheelmap.Owner comes always null : Class WheelMap : ClassMap<Wheel> { Id(x=>x.Id); References(x=>x.Owner); } Class CarMap : ClassMap<Car> { Id(x=>x.Id); References(x=>x.Wheel1).Cascade.All(); References(x=>x.Wheel2).Cascade.All(); References(x=>x.Wheel3).Cascade.All(); References(x=>x.Wheel4).Cascade.All(); }

    Read the article

  • Offline Mapping API

    - by Aaron M
    Are there any services available that allow me to manipulate maps in an offline setting? I am working on a project that requires me to take a map and based on features on the map, generate a game world. I have looked at a few of the API's for different providers: Google, ms, etc. The API's I looked seem to be strictly showing a user a map. I am looking for something that allows me to create a derivative of a map (the Gameworld), that will never be seen by the public, and is only used by the game engine. However one caveat is that I would like to be able to link the derivative created for use by the game engine, with something I can show the user. As an example. Think of a cross country racing sim. Users cannot control the vehicles directly in this game, they can only control the cars setup, driver, etc. I create a gameworld from a map. The gameworld data (driver position, etc) is overlayed onto a real map. A race might last several days. The only interaction users have with the real map is viewing their position on the map, and where they are in relation to the others. I don't want to violate the terms of the API here. I read Googles API TOS, and it seems to me that creating the gameworld would violdate their TOS. The features I really need are the following The ability to locate a specific place on the map by lat/long The ability/rights to grab those maps and save them as an image file temporarily for processing The ability/rights to store a gameworld that is based on the real map The ability to show a user a map with an overlay (this is optional. I can use googles API, or any other one that supports lat/long.)

    Read the article

  • implmenting 1 to n mapping for ORM c++

    - by karan
    I am writing a project where i need to implment a stripped down version of an ORM solution in c++. I am struck in implmenting 1-n relationships for the same. For instance, if following are the classes: class A { } class B { std::list _a_list; } I have provided load/save menthods for loading/saving to the db. Now, if i take the case of B : Say , for the following workflow : 1 entry from _a_list is removed 1 entry from _a_list is modified 1 entry is added to _a_list Now, i need to update the db using something like "b.save()". So, what would be the best way to save the changes,i.e, identify the additions, deletions and updations to _a_list.

    Read the article

  • Type-safe mapping from Class<T> to Thing<T>

    - by Joonas Pulakka
    I want to make a map-kind of container that has the following interface: public <T> Thing<T> get(Class<T> clazz); public <T> void put(Class<T> clazz, Thing<T> thing); The interesting point is that the Ts in each Class<T><- Thing<T> pair is the same T, but the container should be able to hold many different types of pairs. Initially I tried a (Hash)Map. But, for instance, Map<Class<T>, Thing<T>> is not right, because then T would be same T for all pairs in that map. Of course, Map<Class<?>, Thing<?>> works, but then I don't have type-safety guarantees so that when I get(String.class), I can't be sure that I get a Thing<String> instance back. Is there a way to accomplish the kind of type safety that I'm looking for?

    Read the article

  • Mapping Vectors

    - by Dan Snyder
    Is there a good way to map vectors? Here's an example of what I mean: vec0 = [0,0,0,0,0,0,0,0,0,0,0] vec1 = [1,4,2,7,3,2] vec2 = [0,0,0,0,0,0,0,0,0] vec2 = [7,2,7,9,9,6,1,0,4] vec4 = [0,0,0,0,0,0] mainvec = [0,0,0,0,0,0,0,0,0,0,0,1,4,2,7,3,2,0,0,0,0,0,0,0,0,0,7,2,7,9,9,6,1,0,4,0,0,0,0,0,0] Lets say mainvec doesn't exist (I'm just showing it to you so you can see the general data structure in mind. Now say I want mainvec(12) which would be 4. Is there a good way to map the call of these vectors without just stitching them together into a mainvec? I realize I could make a bunch of if statements that test the index of mainvec and I can then offset each call depending on where the call is within one of the vectors, so for instance: mainvec(12) = vec1(1) which I could do by: mainvec(index) if (index >=13) vect1(index-11); I wonder if there's a concise way of doing this without if statements. Any Ideas?

    Read the article

  • Implementing 1 to n mapping for ORM c++

    - by karan
    I am writing a project where I need to implement a stripped down version of an ORM solution in C++. I am struck in implementing 1-n relationships for the same. For instance, if the following are the classes: class A { ... } class B { ... std::list<A> _a_list; ... } I have provided load/save methods for loading/saving to the db. Now, if I take the case of B and the following workflow: 1 entry from _a_list is removed 1 entry from _a_list is modified 1 entry is added to _a_list Now, I need to update the db using something like "b.save()". So, what would be the best way to save the changes, i.e, identify the additions, deletions and updates to _a_list.

    Read the article

  • Left Outer Join on Many-to-One Mapping

    - by Colin Bowern
    I have a reference to call that may or may not be there. When I add the nullable option it still doing Inner Join when I want an Outer Left Join (show the left even if the right is null). Is this possible in the NH map? References(x => x.DefaultCategory, "CATEGORY_ID") .Nullable();

    Read the article

  • Subdomain mapping to another external subdomain

    - by Davorin
    I'm trying to map help.domain1.com to help.domain2.com. I've seen this on UserVoice. They let you map something.yourdomain.com to something.uservoice.com. On domain1.com I've set up a CNAME to help.domain2.com. It works fine but when I open help.domain1.com I get the content of domain2.com instead of help.domain2.com. After some experimenting I've realized that this is an expected behavior. So my question is what do I have to do on domain2.com (or maybe on domain1.com?) to have it show content of subdomain "help.domain2.com" when I navigate help.domain1.com? (I'm using Plesk and the OS is Windows Server 2003)

    Read the article

  • Haskell - mapping the odd placed values and the even placed values differently

    - by Abstract
    Hey guys, is there an easy way. To take a list of numbers, say 123456. Then multiply the odd placed by three and the even placed by 1. i.e. (1 * 3) + (2 * 1) + (3 * 3) + (4*1) + (5*3) + (6*1) i was thinking the map function somewhere along the lines. But i don't know how to map *3 to just the odd placed values. Oh and if you could give me the version not in prelude that would be great like the actual function or functions, as if its being imported from an external haskell file Thanks for the help

    Read the article

  • Mapping One-to-One subclass in Fluent NHibernate

    - by Mike C.
    I have the following database structure: Event table Id - Guid (PK) Name - NVarChar Description - NVarChar SpecialEvent table Id - Guid (PK) StartDate - DateTime EndDate - DateTime I have an abstract Event class, and a SpecialEvent class that inherits from it. Eventually I will have a RecurringEvent class which will inherit from the Event class also. I'd like to map the SpecialEvent class while preserving a one-to-one relationship mapped with the Ids, if possible. Can anybody point me in the correct direction? Thanks!

    Read the article

  • Google App engine Url Mapping using WSGIAppl and regx grouping Help Needed

    - by spidee
    Hi take this example from google docs class BrowseHandler(webapp.RequestHandler): > def get(self, category, product_id): > # Display product with given ID in the given category. > > > # Map URLs like /browse/(category)/(product_id) to > BrowseHandler. application = > webapp.WSGIApplication([(r'/browse/(.*)/(.*)', > BrowseHandler) > ], > debug=True) > > def main(): > run_wsgi_app(application) > > if __name__ == '__main__': > main() How can i change the regx groupings so that Product id is optional ie the url http://yourdomain.com/category will be sent to the browse handler in the current above example you must add a product id or at least the / after the category ie http://yourdomain.com/category/ r'/browse/(.)/(.)' Any ideas?

    Read the article

  • Hibernate Persistence problems with Bean Mapping (Dozer)

    - by BuffaloBuffalo
    I am using Hibernate 3, and having a particular issue when persisting a new Entity which has an association with an existing detached entity. Easiest way to explain this is via code samples. I have two entities, FooEntity and BarEntity, of which a BarEntity can be associated with many FooEntity: @Entity public class FooEntity implements Foo{ @Id private Long id; @ManyToOne(targetEntity = BarEntity.class) @JoinColumn(name = "bar_id", referencedColumnName = "id") @Cascade(value={CascadeType.ALL}) private Bar bar; } @Entity public class BarEntity implements Bar{ @Id private Long id; @OneToMany(mappedBy = "bar", targetEntity = FooEntity.class) private Set<Foo> foos; } Foo and Bar are interfaces that loosely define getters for the various fields. There are corresponding FooImpl and BarImpl classes that are essentially just the entity objects without the annotations. What I am trying to do is construct a new instance of FooImpl, and persist it after setting a number of fields. The new Foo instance will have its 'bar' member set to an existing Bar (runtime being a BarEntity) from the database (retrieved via session.get(..)). After the FooImpl has all of its properties set, Apache Dozer is used to map between the 'domain' object FooImpl and the Entity FooEntity. What Dozer is doing in the background is instantiating a new FooEntity and setting all of the matching fields. BarEntity is cloned as well via instantiation and set the FooEntity's 'bar' member. After this occurs, passing the new FooEntity object to persist. This throws the exception: org.hibernate.PersistentObjectException: detached entity passed to persist: com.company.entity.BarEntity Below is in code the steps that are occurring FooImpl foo = new FooImpl(); //returns at runtime a persistent BarEntity through session.get() Bar bar = BarService.getBar(1L); foo.setBar(bar); ... //This constructs a new instance of FooEntity, with a member 'bar' which itself is a new instance that is detached) FooEntity entityToPersist = dozerMapper.map(foo, FooEntity.class); ... session.persist(entityToPersist); I have been able to resolve this issue by either removing or changing the @Cascade annotation, but that limits future use for say adding a new Foo with a new Bar attached to it already. Is there some solution here I am missing? I would be surprised if this issue hasn't been solved somewhere before, either by altering how Dozer Maps the children of Foo or how Hibernate reacts to a detached Child Entity.

    Read the article

  • Hibernate mapping to manage bidirectional relationship using intermediate table

    - by shikarishambu
    I have an object hierarchy that is as follows. Party inherited by Organization and Person Organization inherited by Customer, Vendor Person inherited by Contact In the database I have the following tables Party, Customer, Vendor, Contact. All of them have a corresponding row in Party table. Contact belongs to either Vendor or Customer. I have a field on the Contact table for org_party_id. However, since the organization can be either a Customer or Vendor I need to be able to look at different tables. Is there a way to map this in hibernate? Or, a better way to manage it in DB/ hibernate?

    Read the article

  • Choropleth mapping issue in R

    - by chasec
    I am trying to follow the tutorial described here: http://www.thisisthegreenroom.com/2009/choropleths-in-r/ The below code executes, but it is either not matching my dataset with the maps_counties data properly, or it isn't plotting it in the order I would expect. For example, the resulting areas for the greater NYC area show no density while random counties in PA show the highest density. The general format of my data table is: county state count fairfield connecticut 17 hartford connecticut 6 litchfield connecticut 3 new haven connecticut 12 ... ... westchester new york 70 yates new york 1 luzerne pennsylvania 1 Note this data is in order by state and then county and includes data for CT, NJ, NY, & PA. First, I read in my data set: library(maps) library(RColorBrewer) d <- read.table("gissum.txt", sep="\t", header=TRUE) #Concatenate state and county info to match maps library d$stcon <- paste(d$state, d$county, sep=",") #Color bins colors = brewer.pal(5, "PuBu") d$colorBuckets <- as.factor(as.numeric(cut(d$count,c(0,10,20,30,40,50,300)))) Here is my matching mapnames <- map("county",plot=FALSE)[4]$names colorsmatched <- d$colorBuckets [na.omit(match(mapnames ,d$stcon))] Plotting: map("county" ,c("new york","new jersey", "connecticut", "pennsylvania") ,col = colors[d$colorBuckets[na.omit(match(mapnames ,d$stcon))]] ,fill = TRUE ,resolution = 0 ,lty = 0 ,lwd= 0.5 ) map("state" ,c("new york","new jersey", "connecticut", "pennsylvania") ,col = "black" ,fill=FALSE ,add=TRUE ,lty=1 ,lwd=2 ) map("county" ,c("new york","new jersey", "connecticut", "pennsylvania") ,col = "black" ,fill=FALSE ,add=TRUE , lty=1 , lwd=.5 ) title(main="Respondent Home ZIP Codes by County") I am sure I am missing something basic re: the order in which the maps function plots items - but I can't seem to figure it out. Thanks for the help. Please let me know if you need any more information.

    Read the article

  • Texture mapping an NGon?

    - by user146780
    I'm not sure how to go about figuring out how to map texture cooridnates for a 2D NGon (N sided polygon) How can this be done? The effect i'm trying to achieve is for the texture to fit on the polygon and stretch out accordingly so the whole texture fits on it. Thanks

    Read the article

  • many-to-many mapping in NHibernate

    - by Chris Stewart
    I'm looking to create a many to many relationship using NHibernate. I'm not sure how to map these in the XML files. I have not created the classes yet, but they will just be basic POCOs. Tables Person personId name Competency competencyId title Person_x_Competency personId competencyId Would I essentially create a List in each POCO for the other class? Then map those somehow using the NHibernate configuration files?

    Read the article

  • Fluent Nhibernate mapping related items

    - by Josh
    I am trying to relate 2 items. I have a table that is simply an Id field, and then 2 columns for the Item Id's to relate. I want it to be a 2 way relationship - that is, if the items appear twice in the table, I only want one relationship connection back. So, here's my item: public class Item { public virtual Guid ItemId {get; set;} public virtual string Name {get; set;} public virtual IList<Item> RelatedItems {get; set;} } The table for relating the items looks like this: CREATE TABLE RelatedItems ( RelatedItemId uniqueidentifier NOT NULL, ItemId uniqueidentifier NOT NULL, RelatedId uniqueidentifier NOT NULL, CONSTRAINT PK_RelatedItems PRIMARY KEY CLUSTERED (RelatedItemId) ) What is the best way to map this connection?

    Read the article

  • nHibernate storage of an object with self referencing many children and many parents

    - by AdamC
    I have an object called MyItem that references children in the same item. How do I set up an nhibernate mapping file to store this item. public class MyItem { public virtual string Id {get;set;} public virtual string Name {get;set;} public virtual string Version {get;set;} public virtual IList<MyItem> Children {get;set;} } So roughly the hbm.xml would be: <class name="MyItem" table="tb_myitem"> <id name="Id" column="id" type="String" length="32"> <generator class="uuid.hex" /> </id> <property name="Name" column="name" /> <property name="Version" column="version" /> <bag name="Children" cascade="all-delete-orphan" lazy="false"> <key column="children_id" /> <one-to-many class="MyItem" not-found="ignore"/> </bag> </class> This wouldn't work I don't think. Perhaps I need to create another class, say MyItemChildren and use that as the Children member and then do the mapping in that class? This would mean having two tables. One table holds the MyItem and the other table holds references from my item. NOTE: A child item could have many parents.

    Read the article

  • SAF Mapping -Dont forget the Technology

    The next step in SAF after Modeling is technology Mapping. While mappingis not a part of the architecture per se, it is, in my opinion,an important and sometime crucial step.Before I rumble on explaining why I think this is an important step, let me try to define what exactly do I mean by “technology mapping”Architecture [...]...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Fluent NHibernate auto mapping: map property from another table's column

    - by queen3
    I'm trying to use S#arp architecture... which includes Fluent NHibernate I'm newbie with (and with NHibernate too, frankly speaking). Auto mapping is used. So I have this: public class UserAction : Entity { public UserAction() { } [DomainSignature] [NotNull, NotEmpty] public virtual string Name { get; set; } [NotNull, NotEmpty] public virtual string TypeName { get; private set; } } public class UserActionMap : IAutoMappingOverride<UserAction> { public void Override(AutoMap<UserAction> mapping) { mapping.WithTable("ProgramComponents", m => m.Map(x => x.TypeName)); } } Now, table UserActions references table ProgramComponents (many to one) and I want property UserAction.TypeName to have value from db field ProgramComponents.TypeName. However, the above code fails with NHibernate.MappingException: Duplicate property mapping of TypeName found in OrderEntry3.Core.UserAction As far as I understand the problem is that TypeName is already auto-mapped... but I haven't found a way to remove the automatic mapping. Actually I think that my WithTable/Map mapping has to replace the automatic TypeName mapping, but seems like it does not. I also tried different mapping (names are different but that's all the same): mapping.WithTable("ProgramComponents", m => m.References<ProgramComponent>( x => x.Selector, "ProductSelectorID" ) and still get the same error. I can overcome this with mapping.HasOne<ProgramComponent>(x => x.Selector); but that's not what I exactly wants to do. And I still wonder why the first two methods do not work. I suspect this is because of WithTable.

    Read the article

  • Ray Tracing concers: Efficient Data Structure and Photon Mapping

    - by Grieverheart
    I'm trying to build a simple ray tracer for specific target scenes. An example of such scene can be seen below. I'm concerned as to what accelerating data structure would be most efficient in this case since all objects are touching but on the other hand, the scene is uniform. The objects in my ray tracer are stored as a collection of triangles, thus I also have access to individual triangles. Also, when trying to find the bounding box of the scene, how should infinite planes be handled? Should one instead use the viewing frustum to calculate the bounding box? A few other questions I have are about photon mapping. I've read the original paper by Jensen and many more material. In the compact data structure for the photon they introduce, they store photon power as 4 chars, which from my understanding is 3 chars for color and 1 for flux. But I don't understand how 1 char is enough to store a flux of the order of 1/n, where n is the number of photons (I'm also a bit confused about flux vs power). The other question about photon mapping is, if it would be more efficient in my case to store photons per object (or even per Object's triangle) instead of using a balanced kd-tree. Also, same question about bounding box of the scene but for photon mapping. How should one find a bounding box from the pov of the light when infinite planes are involved?

    Read the article

  • Omni-directional light shadow mapping with cubemaps in WebGL

    - by Winged
    First of all I must say, that I have read a lot of posts describing an usage of cubemaps, but I'm still confused about how to use them. My goal is to achieve a simple omni-directional (point) light type shading in my WebGL application. I know that there is a lot more techniques (like using Two-Hemispheres or Camera Space Shadow Mapping) which are way more efficient, but for an educational purpose cubemaps are my primary goal. Till now, I have adapted a simple shadow mapping which works with spotlights (with one exception: I don't know how to cut off the glitchy part beyond the reach of a single shadow map texture): glitchy shadow mapping<<< So for now, this is how I understand the usage of cubemaps in shadow mapping: Setup a framebuffer (in case of cubemaps - 6 framebuffers; 6 instead of 1 because every usage of framebufferTexture2D slows down an execution which is nicely described here <<<) and a texture cubemap. Also in WebGL depth components are not well supported, so I need to render it to RGBA first. this.texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.texture); gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR); for (var face = 0; face < 6; face++) gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, gl.RGBA, this.size, this.size, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); this.framebuffer = []; for (face = 0; face < 6; face++) { this.framebuffer[face] = gl.createFramebuffer(); gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer[face]); gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, this.texture, 0); gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, this.depthbuffer); var e = gl.checkFramebufferStatus(gl.FRAMEBUFFER); // Check for errors if (e !== gl.FRAMEBUFFER_COMPLETE) throw "Cubemap framebuffer object is incomplete: " + e.toString(); } Setup the light and the camera (I'm not sure if should I store all of 6 view matrices and send them to shaders later, or is there a way to do it with just one view matrix). Render the scene 6 times from the light's position, each time in another direction (X, -X, Y, -Y, Z, -Z) for (var face = 0; face < 6; face++) { gl.bindFramebuffer(gl.FRAMEBUFFER, shadow.buffer.framebuffer[face]); gl.viewport(0, 0, shadow.buffer.size, shadow.buffer.size); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); camera.lookAt( light.position.add( cubeMapDirections[face] ) ); scene.draw(shadow.program); } In a second pass, calculate the projection a a current vertex using light's projection and view matrix. Now I don't know If should I calculate 6 of them, because of 6 faces of a cubemap. ScaleMatrix pushes the projected vertex into the 0.0 - 1.0 region. vDepthPosition = ScaleMatrix * uPMatrixFromLight * uVMatrixFromLight * vWorldVertex; In a fragment shader calculate the distance between the current vertex and the light position and check if it's deeper then the depth information read from earlier rendered shadow map. I know how to do it with a 2D Texture, but I have no idea how should I use cubemap texture here. I have read that texture lookups into cubemaps are performed by a normal vector instead of a UV coordinate. What vector should I use? Just a normalized vector pointing to the current vertex? For now, my code for this part looks like this (not working yet): float shadow = 1.0; vec3 depth = vDepthPosition.xyz / vDepthPosition.w; depth.z = length(vWorldVertex.xyz - uLightPosition) * linearDepthConstant; float shadowDepth = unpack(textureCube(uDepthMapSampler, vWorldVertex.xyz)); if (depth.z > shadowDepth) shadow = 0.5; Could you give me some hints or examples (preferably in WebGL code) how I should build it?

    Read the article

  • Abstract mapping with custom JiBX marshaller

    - by aweigold
    I have created a custom JiBX marshaller and verified it works. It works by doing something like the following: <binding xmlns:tns="http://foobar.com/foo" direction="output"> <namespace uri="http://foobar.com/foo" default="elements"/> <mapping class="java.util.HashMap" marshaller="com.foobar.Marshaller1"/> <mapping name="context" class="com.foobar.Context"> <structure field="configuration"/> </mapping> </binding> However I need to create multiple marshallers for different HashMaps. So I tried to reference it with abstract mapping like this: <binding xmlns:tns="http://foobar.com/foo" direction="output"> <namespace uri="http://foobar.com/foo" default="elements"/> <mapping abstract="true" type-name="configuration" class="java.util.HashMap" marshaller="com.foobar.Marshaller1"/> <mapping abstract="true" type-name="overrides" class="java.util.HashMap" marshaller="com.foobar.Marshaller2"/> <mapping name="context" class="com.foobar.Context"> <structure map-as="configuration" field="configuration"/> <structure map-as="overrides" field="overrides"/> </mapping> </binding> However when doing so, when I attempt to build the binding, I receive the following: Error during code generation for file "E:\project\src\main\jibx\foo.jibx" - this may be due to an error in your binding or classpath, or to an error in the JiBX code My guess is that either I'm missing something I need to implement to enable my custom marshaller for abstract mapping, or custom marshallers do not support abstract mapping. I have found the IAbstractMarshaller interface in the JiBX API (http://jibx.sourceforge.net/api/org/jibx/runtime/IAbstractMarshaller.html), however the documentation seems unclear to me on if this is what I need to implement, as well as how it works if so. I have not been able to find an implementation of this interface to work off of as an example. My question is, how do you do abstract mapping with custom marshallers (if it's possible)? If it is done via the IAbstractMarshaller interface, how does it work and/or how should I implement it?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >