constraints

How to Create layout constraints programmatically

余生颓废 提交于 2019-11-26 18:38:50
I am displaying a view in the bottom of the universal application and adding this view dynamically in my view. I want to show this view in bottom every time like iAd. in both orientation. How can I add constraints for this. Please suggest. Thanks To fix a view to the bottom of the screen you need following constraints to set. Leading Constraint with respect of Parent View for - X Trailing Constraint with respect of Parent View for - Width Bottom Constraint with respect of Parent View for - Y Height Constraint attached to self for - Height . Lets add. UIView *subView=bottomView; UIView *parent

Strange constraints behaviour on iPad

六眼飞鱼酱① 提交于 2019-11-26 18:37:55
问题 I try to do one of the simples things ever and get a strange result. I have a UIViewController with one UIImageView inside I set the constraints like follow And I get the following result My questions are Why I get a padding on the left and right side? To remove that padding I have to use a constrains from -20 instead of -16 but then is the frame x - 4. Why Is the Vertical space to superview (top space) automatically -20 Does someone has this behaviour before and now how to solve it? https:/

What constraints should I pass to getUserMedia() in order to get two video mediaStreamTracks?

不羁的心 提交于 2019-11-26 18:30:28
问题 I can get mediaDevices of 'videoinput' kind via navigator.mediaDevices.enumerateDevices() promise. I can get mediaStream via navigator.mediaDevices.getUserMedia(constraints) promise. What should constraints look like in order to have two video tracks in userMedia? 回答1: You can get max one video track and one audio track each time you call getUserMedia() , but you can call it multiple times. This may ask the user more than once though, depending on https, browser, and what the user does.

How to constrain generic type to must have a construtor that takes certain parameters?

▼魔方 西西 提交于 2019-11-26 18:20:05
问题 I have a wrapper generic class that intended to be used with a set of types. Those types are generated by a utility and are all derived from a base class ClientBase. While ClientBase has only a default constructor, all generated types have default constructor as well as a constructor takes a string as parameter. In the constructor of the wrapper class, I instantiate an instance of the type with the constructor that takes a string. Here is a sample code: public class ClientBase { } public

MS SQL “ON DELETE CASCADE” multiple foreign keys pointing to the same table?

巧了我就是萌 提交于 2019-11-26 18:13:29
问题 Howdy, I have a problem where i need a cascade on multiple foreign keys pointing to the same table.. [Insights] | ID | Title | | 1 | Monty Python | | 2 | Spamalot | [BroaderInsights_Insights] | broaderinsight_id | insight_id | | 1 | 2 | Basically when either record one or two in the insights table is deleted i need the relationship to also be deleted.. I've tried this: CREATE TABLE broader_insights_insights(id INT NOT NULL IDENTITY(1,1), broader_insight_id INT NOT NULL REFERENCES insights(id)

How to truncate a foreign key constrained table?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 18:02:25
Why doesn't a TRUNCATE on mygroup work? Even though I have ON DELETE CASCADE SET I get: ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key constraint ( mytest . instance , CONSTRAINT instance_ibfk_1 FOREIGN KEY ( GroupID ) REFERENCES mytest . mygroup ( ID )) drop database mytest; create database mytest; use mytest; CREATE TABLE mygroup ( ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY ) ENGINE=InnoDB; CREATE TABLE instance ( ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, GroupID INT NOT NULL, DateTime DATETIME DEFAULT NULL, FOREIGN KEY (GroupID) REFERENCES mygroup(ID) ON DELETE

Why does this generic constraint compile when it seems to have a circular reference

亡梦爱人 提交于 2019-11-26 17:48:49
问题 I have written an extension method in csharp for an MVCContrib Html helper and was surprised at the form of the generic constraint, which on the face of it seems to circularly reference itself through the type parameter. This being said the method compiles and works as desired. I would love to have someone explain why this works and if a more intuitive intuitive syntax exists and if not if anyone know why? Here is the compiling and function code but I have removed the List of T example as it

Unique constraint that allows empty values in MySQL

五迷三道 提交于 2019-11-26 17:30:38
I have a field that stores product codes. The codes are unique, but some products simply doesn't have a code. I can't invent codes because those are providers codes. Is this kind of constraint possible in MySQL? I'm a noob with stored procedures and triggers, so if the solution involves one of these, please be patient. Update: The column is NOT Null. That's why I was unable to do this. Yes, you can do this. See the MySQL reference (version 5.5) . A UNIQUE index creates a constraint such that all values in the index must be distinct. An error occurs if you try to add a new row with a key value

MySQL CHECK constraint alternative

社会主义新天地 提交于 2019-11-26 17:24:15
问题 As per the MySQL manual "The CHECK clause is parsed but ignored by all storage engines." So I know the simple solution is out of the question but is there another feasible means of coming to the same outcome? Maybe through some use of triggers or stored procedures? If so how? Also since it is just "parsed" is that as good as saying avoid using it since it doesn't serve a purpose? Using MySQL 5.5.11 and InnoDB tables 回答1: Take a look at this interesting article https://wikis.oracle.com/display

MySQL and Check Constraints

人走茶凉 提交于 2019-11-26 17:14:59
问题 I have inherited an application that uses MySQL and that is used by a PHP front end. The guy that wrote this system has gone to some fairly convoluted lengths to ensure that codes that users enter are valid - and tat means that these codes also exist in another table. When I first saw this I wondered why he hadn't used CHECK constraints and let the dbms sort this out - I have visions of a load of different programs implementing the same checks instead of just the one place in the dbms. And