composite

Postgres - CRUD operations with arrays of composite types

蹲街弑〆低调 提交于 2020-01-25 06:48:09
问题 One really neat feature of Postgres that I have only just discovered is the ability to define composite type - also referred to in their docs as ROWS and as RECORDS . Consider the following example CREATE TYPE dow_id AS ( tslot smallint, day smallint ); Now consider the following tables CREATE SEQUENCE test_id_seq INCREMENT 1 MINVALUE 1 MAXVALUE 2147483647 START 1 CACHE 1; CREATE TABLE test_simple_array ( id integer DEFAULT nextval('test_id_seq') NOT NULL, dx integer [] ); CREATE TABLE test

How do I save a composite field value in Grails GSP?

╄→гoц情女王★ 提交于 2020-01-23 17:39:05
问题 I have a composite domain object as follows: class Person { static embedded = ['forSale'] Boolean isSelling House forSale } class House { Integer numBedrooms } I have a select control for the numBedrooms as follows: <tr class="prop"> <td valign="top" class="name"> <label for="numBedrooms"><g:message code="person.numBedrooms.label" default="Num Bedrooms" /></label> </td> <td valign="top" class="value ${hasErrors(bean: personInstance, field: 'forSale.numBedrooms', 'errors')}"> <g:select name=

using Composite Pattern to count the number of people in the world

好久不见. 提交于 2020-01-13 19:29:49
问题 I'm trying to make a Composite Pattern that counts the number of people in the world, the continent, the state... sorry no state but country my bad sorry Here is the pattern that I follow: I did this: but I am not sure it's right, because can I use leaf -> population ? Because when I did Composite Pattern for PC so its (PC= component from PC will be Cabinet = composite, from Cabinet will be HDD= leaf and Motherboard = composite, from Motherboard will be RAM = leaf and CPU = leaf). What I want

The composite pattern/entity system and traditional OOP

随声附和 提交于 2020-01-11 17:43:09
问题 I'm working on a small game written in Java (but the question is language-agnostic). Since I wanted to explore various design patterns, I got hung up on the Composite pattern/Entity system (which I originally read about here and here) as an alternative to typical deep hierarchical inheritance. Now, after writing several thousand lines of code, I'm a bit confused. I think understand the pattern and I enjoy using it. I think it's very cool and Starbucks-ish, but it feels that the benefit it

The composite pattern/entity system and traditional OOP

拜拜、爱过 提交于 2020-01-11 17:42:07
问题 I'm working on a small game written in Java (but the question is language-agnostic). Since I wanted to explore various design patterns, I got hung up on the Composite pattern/Entity system (which I originally read about here and here) as an alternative to typical deep hierarchical inheritance. Now, after writing several thousand lines of code, I'm a bit confused. I think understand the pattern and I enjoy using it. I think it's very cool and Starbucks-ish, but it feels that the benefit it

Automapping a Composite Model with Composite Iteration with FluentNhibernate

怎甘沉沦 提交于 2020-01-05 12:06:10
问题 I have a tree structured model and designed it with composite Pattern. for iterating through the entire hierachy Im using Composite Iteration. I have used this tutorial: http://www.blackwasp.co.uk/Composite.aspx but when I want to AutoMap the model, I encounter this problem: {"The entity '<GetEnumerator>d__0' doesn't have an Id mapped. Use the Id method to map your identity property. For example: Id(x => x.Id)."} but getEnumerator is a method. I don't know why handle this like an Entity!!

Apply displacement map via Imagick after version update

☆樱花仙子☆ 提交于 2020-01-05 05:37:10
问题 I had the code running to create a "cylinder" effect via ImageMagick v6.7.9 and PHP (Imagick extension v3.2.0), it's like described in the accepted answer of my previous question: https://stackoverflow.com/a/54807019/1800172 It's inspired by Fred's cylinderize script: http://www.fmwconcepts.com/imagemagick/cylinderize/ After creating the X/Y-displacements ( $a3 / $a4 ) it's combined like this: // merge x-displacement and y-displacement into one displacement-map $displaceMask = new Imagick();

How to do a case insensitive search in titan 1.0 on composite index with tinkerpop API 3

…衆ロ難τιáo~ 提交于 2020-01-04 14:01:12
问题 I have created a composite index on a property in titan 1.0. Now I want to do a case insensitive search on that property. Composite index being created as below : TitanManagement mgmt = graph.openManagement(); TitanManagement.IndexBuilder nameIndexBuilder = mgmt.buildIndex("name_comp_idx", Vertex.class).addKey("name"); titanGraphIndex = nameIndexBuilder.buildCompositeIndex(); Vertex : TitanVertex vertex= graph.addVertex(T.label, "company"); entity.property("name", "APPLE"); Below query is

How do I make it possible to resize a composite by dragging the corner

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 19:20:35
问题 I am working with SWT and I would like to be able to resize a composite by dragging the corner of it, the same way that you can resize a shell. I'm sure someone out there has implemented a good solution. Thanks. 回答1: I think what you are looking for can be implemented with org.eclipse.swt.widgets.Tracker here is sample working code: public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.open(); final Composite b = new Composite

MySQL composite indexes and operator BETWEEN

家住魔仙堡 提交于 2020-01-01 10:06:17
问题 I have a question about this query: SELECT * FROM runs WHERE (NOW() BETWEEN began_at AND finished_at) Do you think it makes sense to create composite index for began_at and finished_at columns? Or it makes sense to create index only for began_at? 回答1: Your style is very uncommon. Most people would probably write WHERE began_at < NOW() AND finished_at > NOW() However. I would recommend putting an index on both fields. A combined key wont be of use to you because you it would only speed up