Questions tagged [composite]
The Composite pattern is a design pattern that allows a group of objects to be treated in the same way as a single instance of an object. It is one of the Gang of Four's structural design patterns.
composite
978
questions
1286
votes
25
answers
1.3m
views
How to clear the canvas for redrawing
After experimenting with composite operations and drawing images on the canvas I'm now trying to remove images and compositing. How do I do this?
I need to clear the canvas for redrawing other images;...
89
votes
5
answers
102k
views
How do composite indexes work?
I've created composite indexes (indices for you mathematical folk) on tables before with an assumption of how they worked. I was just curious if my assumption is correct or not.
I assume that when ...
73
votes
11
answers
49k
views
When should I use composite design pattern?
I don't understand when I should use composite design pattern.
What kinds of benefits will I get from this design pattern?
I visited this website but it only tells me about the structure of the design ...
68
votes
7
answers
42k
views
Difference between the Composite Pattern and Decorator Pattern?
What is the difference between the Composite Pattern and Decorator Pattern?
61
votes
1
answer
37k
views
Relations on composite keys using sqlalchemy
I have this simple model of Author - Books and can't find a way to make firstName and lastName a composite key and use it in relation. Any ideas?
from sqlalchemy import create_engine, ForeignKey, ...
49
votes
1
answer
71k
views
SQL join with composite primary key
I have to join two tables.
But in one table primary key is not there,composite primary key is there,means three columns put together uniquely define a row of that table.
I have those three columns in ...
42
votes
0
answers
2k
views
How to make a composite manifest for Microsoft smooth streaming
I am new to Microsoft Smooth Streaming and have questions about the making of composite manifests.
Following the guidance from here.
I was able to make a composite manifest of a single clip element ...
39
votes
1
answer
21k
views
Design patterns: Composite vs. Composition
I am finishing a course on design patterns, and while reviewing the notes came across something I missed during the semester: Composite vs. Composition. What I managed to understand is that composite ...
33
votes
2
answers
70k
views
Check if a Postgres composite field is null/empty
With postgres composite types you can basically build a field with the structure being defined as another table. I have the composite field called "recipient" of type "person". This recipient field is ...
33
votes
6
answers
12k
views
Implementing MEF with ASP.NET MVC?
I am trying to find out if anyone has any experience or ideas of using MEF (Managed Extensible Framework (Microsoft's new plugin framework) with ASP.NET MVC. I need to create a standard ASP.NET MVC, ...
30
votes
2
answers
27k
views
MySQL: how to index an "OR" clause
I'm executing the following query
SELECT COUNT(*)
FROM table
WHERE field1='value' AND (field2 >= 1000 OR field3 >= 2000)
There is one index over field1 and another composited over field2&...
29
votes
3
answers
19k
views
how can I set up multiple listeners for one event?
I want to set up multiple listeners for one event, and have found that using composite listener is the key.
Could anyone give me an example?
28
votes
15
answers
16k
views
When are interfaces needed?
(In the context of .NET for what its worth)
I tend to not use inheritance and rarely use interfaces. I came across someone who thinks interfaces are the best thing since spit. He uses them ...
26
votes
4
answers
60k
views
How do I configure a RollingFileAppender to roll by date and size with log4net?
I am configure log4net to use a composite RollingFileAppender so that the current file is always named logfile.log and all subsequent files are named logfile-YYYY.MM.dd.seq.log where seq is the ...
24
votes
2
answers
32k
views
How do I dynamically set an environment variable in a github composite action step?
I do need it to be an environment variable and this is for a composite action specifically.
In a composite action, I've tried many different ways of setting environment variables. The only way I've ...
24
votes
2
answers
10k
views
composed_of in Rails - when to use it?
When should you use ActiveRecord's composed_of class method?
20
votes
8
answers
16k
views
Composite primary key
I am working on the design of a database that will be used to store data that originates from a number of different sources. The instances I am storing are assigned unique IDs by the original sources. ...
18
votes
4
answers
9k
views
The composite pattern/entity system and traditional OOP
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 ...
16
votes
4
answers
3k
views
Imagick: compose with mask
I try to recreate a script that uses the ImageMagick command "convert" to compose an image. But I want to do the same in PHP using Imagick (version 6.6.2-10).
The command is as follows:
convert A1....
15
votes
6
answers
13k
views
How to do composite with gm node.js?
How to do 'gm composite -gravity center change_image_url base_image_url' with GM Node.js?
How to call gm().command() & gm().in() or gm().out() to achieve the above?
15
votes
3
answers
30k
views
A tree, where each node could have multiple parents
Here's a theoretical/pedantic question: imagine properties where each one could be owned by multiple others. Furthermore, from one iteration of ownership to the next, two neighboring owners could ...
15
votes
2
answers
1k
views
Java AWT custom CompositeContext & anti-aliasing: RasterFormatException when drawing outside of the client area
I am trying to implement SWT GC-like xor-mode drawing for an AWT Graphics2D. Using the built-in XORComposite is not an option as it does not implement xor-mode drawing as in SWT.
The SWT xor-mode ...
14
votes
6
answers
24k
views
How to set value of composite variable field using dynamic SQL
Given this type:
-- Just for testing purposes:
CREATE TYPE testType as (name text)
I can get the value of a field dynamically with this function:
CREATE OR REPLACE FUNCTION get_field(object ...
13
votes
4
answers
4k
views
Is the Composite Pattern SOLID?
A Leaf in the Composite Pattern implements the Component interface, including Add, Remove, and GetChild methods that a Leaf is never going to use. This seems to be a violation of the Interface ...
13
votes
4
answers
3k
views
Django Class Based View Composite
I'm using Django 1.3's Class-base generic views for a project. They're really nice but I would like to be DRYer. I have a page that displays a list of press coverage we've received and another which ...
12
votes
3
answers
14k
views
WPF, Prism v2, Region in a modal dialog, add region in code behind
I have a composite WPF application. In one of my modules I want to make a wizard and have the steps show up in a region so I can switch between the steps easier. Originally I had this wizard showing ...
12
votes
1
answer
12k
views
ImageMagick: Layering Images with convert -composite with gravity center
background
overlay
composite -gravity center overlay.png background.jpg result1.jpg
result1.jpg
convert -composite background.jpg overlay.png -gravity center result2.jpg
result2.jpg
...
12
votes
3
answers
1k
views
Possibility to mix composite pattern and curiously recurring template pattern
I have a composite pattern implementation, used for GUI components:
class CObject {
private:
CObject * m_pParent;
CObjectContainer * m_pChildren;
void private_foo() {
this->foo();
...
11
votes
2
answers
9k
views
How do I associate a keypress with a DelegateCommand in Composite WPF?
I am building a composite application using CAL/Prism. The main region is a tab control, with multiple types of views in it. Each view has a custom set commands that it can handle which are bound to ...
11
votes
2
answers
9k
views
Composite Index vs. INCLUDE Covering Index in SQL Server
I understand that Composite Indexes are always used Left to Right (e.g. if an Index was on City, State, WHERE City = "Blah" or WHERE City = "Blah" AND State = "AA" would work fine but WHERE State = "...
11
votes
4
answers
316
views
What design pattern to use for generating multiple simulations?
I have a simulation that runs at a specific height and a specific temperature:
interface IGeneratable
{
string Name { get; }
void Generate();
}
interface ISimulation : IGeneratable
{
...
11
votes
2
answers
3k
views
Composite foreign key columns in GORM
I need to customize the column names for composite foreign keys in GORM, and I didn't find any document that shows how to do it. I know how to customize PK columns, and how to customize a single-...
10
votes
3
answers
3k
views
Using Interpreter pattern on a Composite structure
I've been asked to make an expression evaluator using Composite, Recursive Descendent Parser and Interpreter.
Here's the grammar :
<cond> → <termb> [OR <termb>]*
<termb>→<...
10
votes
3
answers
11k
views
Is it alright to put data members in an interface?
Recently, I've learnt about composite pattern. I want to use it in my assignment which I have to implement File and Folder classes. I realize that sub-classes like CFile and Cfolder got to have the ...
10
votes
3
answers
3k
views
REST returning an object graph
I am new to the REST architecural design, however I think I have the basics of it covered.
I have a problem with returning objects from a RESTful call. If I make a request such as http://localhost/{...
10
votes
1
answer
7k
views
How to get child views from Backbone Marionette's composite view?
I am working on an application based on Backbone and Marionette. I am using composite view to show an table now I want to update multiple child view's together So I want their object and model. So to ...
10
votes
3
answers
11k
views
python, wrap and object into a list if not is an iterable
I want to have a function that wraps and object in an iterable one in order to allow
the clients of the function treat the same way collections and single objects, i did the following:
def to_iter(...
10
votes
4
answers
3k
views
Implementing a composite pattern using MVC/Backbone.js
My webapp has a composite structure i.e. each Category collection can contain a mixture of individual Items and other Categories as its rows/nodes/children (not sure of the correct terminology here). ...
10
votes
1
answer
210
views
Composite property object that inhibits multiple signal emissions when all subobjects are changed
I have a simple property<T> class with a value_changed<T> which you can connect/disconnect to and receive or inhibit events when value_changed<T>::emit(T) is called. Think Qt signal/...
10
votes
3
answers
4k
views
Volume rendering: confusion with front-to-back compositing
In, for example, GPU Gems the front-to-back compositing equation (for colour) is
C'i = (1 - A'i-1)Ci + C'i-1
where C'i is the output accumulated colour value; A'i-1 is the accumulated alpha (opacity)...
10
votes
0
answers
562
views
ASTs: prefer inheritance or variants? [closed]
In object oriented languages, it is fairly common to implement ASTs (Abstract Syntax Trees) using simple hierarchies (the Composite pattern), and to traverse them via visitors.
In functional ...
9
votes
1
answer
5k
views
Difference between a WebControl and a CompositeControl? [duplicate]
I have been looking around on the web and found some articles about the topic, but i still can't figure out the difference between them. I have the code show below, if i inherit from a ...
9
votes
1
answer
8k
views
How to formulate an array literal of a composite type containing arrays?
I have a composite type like
CREATE TYPE example AS (id integer, some_stuff integer[]);
Thought I can use an array of this type as an argument of a function. The only problem is I couldn't find a ...
9
votes
1
answer
2k
views
Build To Order Products in WooCommerce -- overriding product combinations
I am trying to set up a site with very complex "build to order" products. I am using WooCommerce but I realize that it might not be best solution, however, I am not a programmer so I'm trying to work ...
8
votes
1
answer
7k
views
PostgreSQL: how to return composite type
I'm trying to get a composite value with a stored function in PostreSQL as follows.
I created a type called PersonId, and I used the type in a table called Person.
And I inserted values into the ...
8
votes
2
answers
10k
views
GWT Composite best practices
I'm learning GWT and have started to get the hang of it. I'm at the point where my code is getting to be a spaghetti mess so I'm going back and factoring reasonable bits of it out as Composites. The ...
8
votes
3
answers
3k
views
Iterating hierarchy of nodes - Visitor and Composite?
Let's imagine I have a collection of nodes that I use for my Renderer class later on. Then I have a Visitor class that can visit node or whole collection. It's simple because my collection of nodes it'...
8
votes
1
answer
2k
views
What is 'composite pattern'?
Could anybody please explain and give a real-live example of Composite Design Pattern?
8
votes
1
answer
4k
views
HTML5 Canvas compositing (source-in)
I am trying to recreate a page flipping type animation in HTML5 using canvas. The animation is based on ideas from this page. But that's not really important. The problem I am having is that using the ...
7
votes
1
answer
3k
views
Image compositing
I have an album title of some music band. I want to draw it with some mask which will round the corners of image.
So, I've prepared such mask in gimp:
I'm using white mask, but it's invisible at ...