mapping

Is there a way to setup a Func with a generic object parameter?

I currently have a mapping setup to convert from one base class to another base class. I am mapping a customer class to a thrid party control. The values are similiar but there is enough differences that I can't reuse the thrid party control. _converters = new Dictionary<Type, Func<AnnotationBase, AnnotationMark>>(); _converters.Add( ty...

Return a single Element from an Associative Array from a Function

Lets assume we have two PHP-Arrays: $some_array = array('a','b','c','d','e','f'); $another_array = array(101,102,103,104,105,106); In PHP, there are already some Array-Functions that allow the construction of an Associative Array (AKA hash), e,g,; $hash = array_combine( $some_array, $another_array );...

iterating hash collection

{"Journal"=>[[4, -785.0], [13, -21.9165000915527], [14, -213.008995056152], [15, -50.074499130249]]} How can you to iterate this hash in Ruby, and how would you to separate out keys & values? ...

How can I wrap tables into a more generic class for use with multiple data contexts?

I have two different DataContexts (SQL Databases) that have the same data, just with slightly different naming: DB1: Serialnumber Productnumber DB2: SerialNumber ProductNumber Result So I want to be able to wrap these tables in a class that will let me get back the serial number and product number regardless of the DataContext that it ...

Hibernate mapping for a table with no primary key

I know this question has been asked before but I have a design question as well. There are two tables like so: Table Group_table column pk_Group_name column group_type etc Table Group_members column fk_group_name -> foreign key to group_table column group_member It's easy to work with this structure but I have two questions. First,...

GIS mapping tool on detailed scale

Hi all, I'm looking for good GIS solutions that work on a relatively smaller, detailed scale. Specifically, I was wondering what APIs or toolkits are available for mapping out spaces in a building (like rooms, hallways, shelves). This need not be a 3D solution, like one might envisage for architectural CAD-type drawings. Something relat...

Correct NHibernate Mapping For Stored Procedure?

UPDATE: This is now resolved, see answer below. I am having a bit of trouble trying to work out the correct way to write an NHibernate Mapping File (.hbm.xml) for a MSSQL Stored Procedure. The Stored Procedure accepts two parameters and returns a single row result set containing several columns which have integer values. My mappin...

Write Git commit message in new Vim window, then commit all within Vim

I have these Vim mappings for Git. Most of the commands below work, but the last one, gm, doesn't work at all. I want to open a new Vim (preferrably with my git commit message template already loaded, as per the default terminal behavior), edit and save my message, then commit. Any ideas for another way to approach this? " git shortc...

Workspace being overwritten by Team Foundation Server 2005

Due to a workspace path length limitation, I had to shorten the workspace path mappings used by one of my team builds. To my surprise, each time I launch my build, it's being somehow overwritten by with the previous path mappings. I deleted the Team Foundation cache (C:\Documents and Settings\TFS_BuildService\Local Settings\Application ...

Many to Many relationship using SQL and Linq (entity framework/to entities)

I have two tables: - Attendees - Events Normally, I would create a mapping table 'EventAttendeeMap' to link these tables into a many to many relationship. Is this the best way of doing so? Should I store the list of AttendeeIds in an xml column instead on the Events table? I am using .NET 3.5/4 with Linq as the DAL (although I think...

Google Maps v3 getBounds is extending beyond what is visible on the map

For some reason the getBounds() function for Google Maps v3 seems to be extending much further than what the map is actually showing. Correct me if I'm wrong, but shouldn't it return the NE (top right corner) and SW (bottom left corner) latitude and longitude coordinates for the very corners of what's being shown in the current view? I...

Sorting list of dictionaries according to specific order

I am using Python 2.6 and I have two data stores. Querying the first one returns a list of document IDs in a specific order. I look up all the documents at once in the second data store using these IDs, which returns a list of dictionaries (one for each doc), but not in the same order as the original list. I now need to re-sort this list...

How can I map a different parent class in different projects to the same shared child class?

Summary: I have two projects using the same database relation. I would like to map the relation differently in each project, using the same child class but different parent classes. Detail: I have two projects, ADMIN and SERVICE. ADMIN allows the persisted object Promo to be configured. SERVICE will read Promo. We're using Spring...

.net using xml for mapping csv to class

I have a Task where I have to read an csv file and write the content into a c# List. Since the csv file can change its layout (caption/order) in the future I want to use a configuration file for mapping the attributes. Now I am wondering if there is an example out there so I don't have to reinvent the weel :D My datasource looks like t...

EF 4.0 - mapping to readonly property with private field

Is it possible to map following POCO class with EF 4.0? public class MyClass { private string _myData; public MyClass() { } public MyClass(string myData) { _myData = myData; } public string MyData { get { return _myData; } } } In NHibernate I think it is possible when I use Access attribute ...

How to get mapping for key-property in NHibernate?

Hi, I'm trying to load nhibernate mapping for POCO classes at runtime with following lines: var persistentClass = NHibernateHelper.Configuration.GetClassMapping( type ); var property = persistentClass.GetProperty( propertyName ); It works fine except it fails on property GroupId on a class with following mapping: <class name="GroupP...

Texture mapping to triangle strip from atlas Opengl ES

Hi! I'm new to opengl-es on android and struggling to get my head around the concept of texturing. I am looking to produce a tilemap of various difference textures. I understand that it is better to use an atlas of all the combined textures so I don't repeatedly rebind. However I am unsure quite how to then map these textures on to my ...

Spring MVC - How to map individual methods in a controller without anotation use

Hi, I am very new to Spring framework in general. How can I map individual methods in a controller, so that I can call any other method other than handleRequestInternal for example. Also I do not want to use annotation (@RequestMapping). Thank you manu ...

Basic Hibernate/JPA Mapping question

I have to tables I want to map to each other. I want to populate 2 drop down lists: code_r and code_l. When i choose a value from code_r, code_l should display only certain records. In my database I have 2 tables: Table code_r =================== CODE INT LIBELLE VARCHAR And Table code_l =================== ID ...

C# - copying property values from one instance to another, different classes

I have two C# classes that have many of the same properties (by name and type). I want to be able to copy all non-null values from an instance of Defect into an instance of DefectViewModel. I was hoping to do it with reflection, using GetType().GetProperties(). I tried the following: var defect = new Defect(); var defectViewModel = n...