composite

USB DUAL CDC endpoints for transferring data

主宰稳场 提交于 2019-11-27 07:31:14
问题 I have emulated two VCPs with only one USB Device. I can send data in one VCP that has the following Endpoint Address. #define CDC_IN_EP 0x81 /* EP1 for data IN */ #define CDC_OUT_EP 0x01 /* EP1 for data OUT */ #define CDC_CMD_EP 0x82 /* EP2 for CDC commands */ I would like to know if it's possible to send data in the other VCP with other Endpoint Address like: #define CDC_IN_EP3 0x83 /* EP3 for data IN */ #define CDC_OUT_EP3 0x03 /* EP3 for data OUT */ #define CDC_CMD_EP4 0x84 /* EP4 for CDC

how can I set up multiple listeners for one event?

一曲冷凌霜 提交于 2019-11-27 07:27:14
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? class CompositeListener implements OnEventListener { private List<OnEventListener> registeredListeners = new ArrayList<OnEventListener>(); public void registerListener (OnEventListener listener) { registeredListeners.add(listener); } public void onEvent(Event e) { for(OnEventListener listener:registeredListeners) { listener.onEvent(e); } } } ..... CompositeListener composite = new CompositeListener(); composite.registerListener(listener1); composite

Implementing MEF with ASP.NET MVC?

喜欢而已 提交于 2019-11-27 05:10:38
问题 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

How do composite indexes work?

别来无恙 提交于 2019-11-26 19:01:42
问题 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"

MySQL: how to index an “OR” clause

北战南征 提交于 2019-11-26 18:18:11
问题 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

R::ggplot2::geom_points: how to swap points with pie charts?

限于喜欢 提交于 2019-11-26 17:25:49
问题 I would like to plot pie charts in two dimensions to show the composition of each point in terms of their composite "groups." So far, I'm using label repel to label to highest scoring points but it is still not great. I've looked around and I haven't seen what I'm looking for. ggplot(data=aggtmp2,aes(x=cluster,y=x,color=groups,shape=dataset)) + geom_jitter() + facet_grid(datasubset~.) + geom_text_repel(data=aggtmp2[aggtmp2$xnorm>.925,],aes(label=groups),size=2) > str(aggtmp2) 'data.frame':

How to set value of composite variable field using dynamic SQL

感情迁移 提交于 2019-11-26 15:25:44
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 anyelement, field text) RETURNS text as $BODY$ DECLARE value text; BEGIN EXECUTE 'SELECT $1."' || field || '"' USING object INTO value; return value; END; $BODY$ LANGUAGE plpgsql Calling get_field('(david)'::testType, 'name') works as expected returning "david". But how can I set a value of a field in a composite type? I've tried these functions: CREATE OR REPLACE FUNCTION set_field_try1(object anyelement,

how can I set up multiple listeners for one event?

泄露秘密 提交于 2019-11-26 13:10:00
问题 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? 回答1: class CompositeListener implements OnEventListener { private List<OnEventListener> registeredListeners = new ArrayList<OnEventListener>(); public void registerListener (OnEventListener listener) { registeredListeners.add(listener); } public void onEvent(Event e) { for(OnEventListener listener:registeredListeners) { listener.onEvent(e); } } } .....

Relations on composite keys using sqlalchemy

核能气质少年 提交于 2019-11-26 10:21:52
问题 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__

How to set value of composite variable field using dynamic SQL

微笑、不失礼 提交于 2019-11-26 04:25:49
问题 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 anyelement, field text) RETURNS text as $BODY$ DECLARE value text; BEGIN EXECUTE \'SELECT $1.\"\' || field || \'\"\' USING object INTO value; return value; END; $BODY$ LANGUAGE plpgsql Calling get_field(\'(david)\'::testType, \'name\') works as expected returning \"david\". But how can I set a value of a