composite

Canvas - Fill a rectangle in all areas that are fully transparent

萝らか妹 提交于 2019-11-28 08:48:34
I'm writing a simple 2D game engine using the HTML5 canvas. I've come to adding a lighting engine. Each light source has a radius value and an intensity value (0-1, eg 1 would be very bright). There's also an ambient light value that is used to light everything else in the world that isn't near a light source (0-1, eg 0.1 would be moonlight). The process of lighting is done on a separate canvas above the main canvas: For each light source, a radial gradient is drawn at that position with the same radius as the light source. The gradient is given two stops: the center is black with an alpha of

Implementing MEF with ASP.NET MVC?

*爱你&永不变心* 提交于 2019-11-28 03:34:51
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, which I have. But I need to offer additional functionality i.e. Views and Controllers, etc, depending on if I add a plugin. It doesn't need to be dynamically compiled i.e. source code... but a DLL that i put into the system.. Is there any way to dynamically load a DLL when the app starts, and then MERGE a VIEWS and CONTROLLERS with the main system? I don't know if i am on the right track here. Then

How do composite indexes work?

限于喜欢 提交于 2019-11-28 03:32:36
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 you list the order of columns for the index, you are also specifying how the indexes will be grouped. For instance, if you have columns a , b , and c , and you specify the index in that same order a ASC , b ASC , and c ASC then the resultant index will essentially be many indexes for each "group" in a . Is this correct? If not, what will the resultant index actually look like? Composite indexes work

Imagick: compose with mask

落花浮王杯 提交于 2019-11-27 23:16:19
问题 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.mpc A3.mpc A4.mpc -channel rgba -alpha on -virtual-pixel background -background none -define compose:args=312x26.6776 -compose displace -composite out.mpc I found out that the parameters stand for the following: convert {background} {overlay} [{mask}] [-compose {method}] -composite {result} The PHP

Composite primary key

假装没事ソ 提交于 2019-11-27 17:21:32
问题 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. Each instance I store should contain information about the source it came from, along with the ID it was associated by this source. As an example, consider the following table that illustrates the problem: ---------------------------------------------------------------- | source_id | id_on

How to use LINQ to select all descendants of a composite object

南笙酒味 提交于 2019-11-27 17:02:34
问题 How can I make ComponentTraversal.GetDescendants() better using LINQ? Question public static class ComponentTraversal { public static IEnumerable<Component> GetDescendants(this Composite composite) { //How can I do this better using LINQ? IList<Component> descendants = new Component[]{}; foreach(var child in composite.Children) { descendants.Add(child); if(child is Composite) { descendants.AddRange((child as Composite).GetDescendants()); } } return descendants; } } public class Component {

How do I configure a RollingFileAppender to roll by date and size with log4net?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 15:51:47
问题 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 sequence number if a log exceeds a certain size within a single day. Unfortunately, I have had very little success in configuring such a setup. Edit: My current configuration is pasted below. It has been updated based on several answers which gets me close enough for my needs. This generates files of

MySQL: how to index an “OR” clause

时光怂恿深爱的人放手 提交于 2019-11-27 14:20:45
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&field3. I see MySQL always selects the field1 index and then makes a join using the other two fields which is quite bad because it needs to join 146.000 rows. Suggestions on how to improve this? Thanks (EDIT AFTER TRYING SOLUTION PROPOSED) Based in the solution proposed I've seen this on Mysql when playing with this. SELECT COUNT(*) FROM (SELECT * FROM table WHERE columnA = value1 UNION SELECT * FROM table

Relations on composite keys using sqlalchemy

允我心安 提交于 2019-11-27 10:56:26
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, Column, String, Integer from sqlalchemy.orm import relationship, sessionmaker from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() engine = create_engine('mssql://user:pass@library') engine.echo = True session = sessionmaker(engine)() class Author(Base): __tablename__ = 'authors' firstName = Column(String(20), primary_key=True) lastName = Column(String(20), primary_key

When are interfaces needed?

依然范特西╮ 提交于 2019-11-27 10:00:48
问题 (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 everywhere. I don't understand this and hence the questions that follow. I just want a check on my understanding of interfaces. If you are using interfaces everywhere, I'm assuming you can predict the future, your app requirements are nailed down and nothing will ever change in your app. For me, during