constraints

Why is my Symfony2 @UniqueEntity constraint not working at all?

六眼飞鱼酱① 提交于 2019-12-03 07:04:13
I have the following entity class in my application: <?php namespace ...; // use ... use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;; // ... /** * @ORM\Table(name="sc_user") * @ORM\Entity(repositoryClass="...\UserRepository") * @ORM\HasLifecycleCallbacks() * @UniqueEntity(fields={"email", "username"}) */ class User implements UserInterface, \Serializable, EquatableInterface { /** * @var integer $id * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string $email * * @ORM\Column

UICollection View Adjust Cell Size for Screen Size

此生再无相见时 提交于 2019-12-03 06:32:45
问题 Currently i have a collection view which takes up most of my screen at the 3.5 inch screen size.The collection view is 51 pixels from the top and 20 pixels from the bottom of the screen. I am using the cells with UIPageControl to create a paged layout, with one cell per page. When switching to the 4 inch size, using constraints i can get the collection view to expand into the new space (maintaining the 51 pixels from the top and 20 from bottom), but the cell size stays the same, so now there

Certificates Basic Constraint's Path Length

跟風遠走 提交于 2019-12-03 05:34:17
问题 Is having a Path Length of 0 and None the same thing for Basic Constraint's of a CA type? To clarify, does a path length of 0 mean that the CA can issue no certificates while a path length of none mean that it can issue an infinite amount of certificates? 回答1: Taken from RFC 5280, section 4.2.1.9: A pathLenConstraint of zero indicates that no non-self-issued intermediate CA certificates may follow in a valid certification path. Where it appears, the pathLenConstraint field MUST be greater

SQL Server 2005: Nullable Foreign Key Constraint

若如初见. 提交于 2019-12-03 05:17:14
I have a foreign key constraint between tables Sessions and Users. Specifically, Sessions.UID = Users.ID. Sometimes, I want Sessions.UID to be null. Can this be allowed? Any time I try to do this, I get an FK Constraint Violation. Specifically, I'm inserting a row into Sessions via LINQ. I set the Session.User = null; and I get this error: An attempt was made to remove a relationship between a User and a Session. However, one of the relationship's foreign keys (Session.UID) cannot be set to null. However, when I remove the line that nulls the User property, I get this error on my SubmitChanges

How to programmatically increase the height of UIView with Swift

孤街醉人 提交于 2019-12-03 05:13:26
Inside IB I have a viewController with a segmentedControl and 2 containerViews. In each containerView I have a tableView. From each tableView I push on a detailView. My auto layout is in IB. Once I pick a segment, I see the corresponding tableView, I pick a cell and the correct detailView gets pushed on the scene. The issue is once the detailView gets pushed on the segmentedControl is still visible. I decided to hide the segmentedControl which works but there is a big empty space there. I tried to programmatically increase the size of detailView's view but it's not expanding. From what I read

GCC inline assembly: constraints

笑着哭i 提交于 2019-12-03 05:06:02
问题 I'm having difficulty understanding the role constraints play in GCC inline assembly (x86). I've read the manual, which explains exactly what each constraint does. The problem is that even though I understand what each constraint does, I have very little understanding of why you would use one constraint over another, or what the implications might be. I realize this is a very broad topic, so a small example should help narrow the focus. The following is a simple asm routine which just adds

where to create autolayout constraints for subclassed uitableviewcell?

早过忘川 提交于 2019-12-03 03:53:13
问题 I am trying to use autolayout for a uitableviewcell subclass I am creating and I would appreciate some advice on what method to put the layout constraint creation code. I have been searching around and all the information I find talks about adding constraints after adding subviews in the viewDidLoad method. As far as I know viewDidLoad isn't an option for a uitableviewcell subclass. I am using interface builder to create a custom cell and dynamically allocating it in my code. Nothing special

Difference between _sql_constraints and _constraints on OpenERP/Odoo?

百般思念 提交于 2019-12-03 03:37:16
I noticed there are 2 kinds of constraints on Odoo ERP. But I want to know what is the difference between _sql_constraints vs _constraints? _sql_constraints = { ('email_uniq', 'unique(email)', ' Please enter Unique Email id.') } _constraints=[ (_check_qty_and_unitprice, u'Qty must be more than 0',['product_qty', 'cost_unit']), ] Bhavesh Odedra _sql_constraints means it will set constraint on postgresql database side. _sql_constraints = [ ('email_uniq', 'unique(email)', ' Please enter Unique Email id.'), ] Where: email_uniq means constraint name, unique(email) means unique is name of constraint

What does “where T : somevalue” mean?

孤街浪徒 提交于 2019-12-03 03:32:35
What does where T : somevalue mean? I just saw some code that said where T : Attribute . I think this has something to do with generics but I am not sure what this means or what it is doing. Does anyone know? It is a constraint on a type parameter , meaning that the type T given to a generic class or method must inherit from the class Attribute For example: public class Foo<T> : where T : Attribute { public string GetTypeId(T attr) { return attr.TypeId.ToString(); } // .. } Foo<DescriptionAttribute> bar; // OK, DescriptionAttribute inherits Attribute Foo<int> baz; // Compiler error, int does

Ruby on Rails: How do I add a not null constraint to an existing column using a migration?

…衆ロ難τιáo~ 提交于 2019-12-03 03:21:53
问题 In my Rails (3.2) app, I have a bunch of tables in my database but I forgot to add a few not null constraints. I've googled around but I can't find how to write a migration which adds not null to an existing column. TIA. 回答1: For Rails 4+, nates' answer (using change_column_null) is better. Pre-Rails 4, try change_column. 回答2: You can also use change_column_null: change_column_null :table_name, :column_name, false 回答3: 1) FIRST: Add column with default value 2) THEN: Remove default value add