mapping

Calculate min distance between a “line” and one “point”

只谈情不闲聊 提交于 2020-01-03 05:15:09
问题 I have a "linestring" (with init and end points) and a single "point" (two coordinates). And I have implemented the following ActionSctipt code to use "haversine formula" to calculate the distance between two points (each point has x & y coordinates); this function can return the "distance" in "kms", "meters", "feets" or "miles": private function distanceBetweenCoordinates(lat1:Number, lon1:Number, lat2:Number, lon2:Number, units:String = "miles"):Number { var R:int = RADIUS_OF_EARTH_IN_MILES

PHP ElasticSearch how to set mapping before indexing records?

对着背影说爱祢 提交于 2020-01-03 03:55:08
问题 I'm using laravel and elasticsearch-php to index and store data to elastic, my problem is that elastisearch uses from dynamic mapping but I need to set my custom mapping. How can I use from my mapping? Bellow is my code: $client = \Elasticsearch\ClientBuilder::create()->build(); $mappingData = array( 'index' => 'promote_kmp', 'body' => array( 'mappings' => $resource->getMappingProperties() ) ); $client->indices()->create($mappingData); $params = [ 'type' => 'resources', 'id' => uniqid(),

Elasticsearch queries on “empty index”

你离开我真会死。 提交于 2020-01-03 02:34:25
问题 in my application I use several elasticsearch indices, which will contain no indexed documents in their initial state. I consider that can be called "empty" :) The document's mapping is correct and working. The application also has a relational database that contain entities, that MIGHT have documents associated in elasticsearch. In the initial state of the appliation it is very common that there are only entities without documents, so not a single document has been indexed, therefore "empty

How to map datatable columns to properties of DTO object of Type T

风格不统一 提交于 2020-01-02 20:30:17
问题 How can map datatable columns with the properties of DTO object of Type T using LINQ query or Lambda expression. This should automatically map with any DTO. If there is a way to do this without hardcoding of column names of datatable DataTable dt = db.GetEmployees(); foreach(DataRow dr in dt.Rows) { var obj = new T(); PropertyInfo[] prop = obj.GetType().GetProperties(); var results = dt.AsEnumerable().Select(dr => new T { ///How to directly map type T properties in prop with columns in

Setting up mapping for a JDBC elasticsearch river

*爱你&永不变心* 提交于 2020-01-02 15:38:32
问题 I'm using ES 0.20.6 with the elasticsearch-river-jdbc plugin. I created a river that works using : SQL="SELECT ..." curl -XPUT 'localhost:9200/_river/myindex_river/_meta' -d '{ "type" : "jdbc", "jdbc" : { "driver" : "org.postgresql.Driver", "url" : "jdbc:postgresql://localhost:5432/mydb_db", "user" : "myuser", "password" : "mypassword", "sql" : "'"$SQL"'" }, "index" : { "index" : "myindex", "type" : "mytype", "type_mapping" : null } }' Now what i want is to add type mappings as the option is

Java JNA Mapping in Delphi Dll function

。_饼干妹妹 提交于 2020-01-02 15:26:07
问题 How do i map this function with JNA: Delphi Dll Function Code: function send_command (const command : byte; var size : byte; var data : pbyte) : integer; stdcall external 'comunication.dll'; Use example in Delphi Example Program: send_command (cmdCLOCK_ADJUST, tam, pb); Where: const cmdCLOCK_ADJUST = $18; var tam : byte; pb, p : pbyte; begin ... tam = 7; p:= pb; for i:= 1 to tam do begin p^:= Dados [i]; inc (p) end; send_command (cmdCLOCK_ADJUST, tam, pb); freemem (pb); ... end The int value

Get UNC Path for Mapped Drive VB.net

回眸只為那壹抹淺笑 提交于 2020-01-02 10:29:10
问题 I neet to get UNC path from mapped drive. I tried to use WNetGetConnection, but it doesn't work for me. It returns error 487. Does anybody know how to deal with this error or any other way to get the UNC path? 回答1: Totally go with @Alex K's P/Invoke suggestion, I just wanted to post a hack method of piping through the net use command: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim RemotePath = GetUncSourcePath("v"c) If String

Using AutoMapper to unflatten a DTO

天涯浪子 提交于 2020-01-02 04:49:08
问题 I've been trying to use AutoMapper to save some time going from my DTOs to my domain objects, but I'm having trouble configuring the map so that it works, and I'm beginning to wonder if AutoMapper might be the wrong tool for the job. Consider this example of domain objects (one entity and one value): public class Person { public string Name { get; set; } public StreetAddress Address { get; set; } } public class StreetAddress { public string Address { get; set; } public string City { get; set;

Symfony2 - The class 'X' was not found in the chain configured namespaces

ⅰ亾dé卋堺 提交于 2020-01-02 03:23:22
问题 I've been searching forever to solve my problem. But I can't find any solution. I always get this error message when I try to open the homepage: Uncaught exception 'Doctrine\Common\Persistence\Mapping\MappingException' with message 'The class 'Test\Bundle\UserBundle\Entity\User' was not found in the chain configured namespaces ' in... The weird thing is that I only get it when I have following URL: http://localhost/ But when I run it on this URL I don't get any error and my page is being

How to convert Perforce depot locations to client view locations

时光总嘲笑我的痴心妄想 提交于 2020-01-02 02:01:13
问题 I'd like to know how to convert Perforce depot locations to client view locations for the purpose of script writing. I have a script that first checks out a file for edit in perforce and then interacts with the file. I need to have the depot location (i.e. \Projects\Project6) converted to the client view location. (i.e. d:\Projects\Project6). Is this possible? 回答1: I have always used the p4 where command for this. Here is its description from the built-in help: where -- Show how file names