constraints

How to center two labels

别等时光非礼了梦想. 提交于 2019-12-12 05:59:01
问题 I have two buttons. I want both buttons on the same line horizontally and i want equal space on the left of the left button, between the two buttons, and on the right of the right button. I want to center two buttons like this: 回答1: If I were you, I would make them programmatically. This would work if they were contained in a view. The code below assumes you want to center the buttons in your viewController. To Make UIButtons Programmatically In ViewDidLoad: let myFirstXCoordinate = CGFloat(

Partial value constraint of sql server table

£可爱£侵袭症+ 提交于 2019-12-12 05:58:19
问题 I have a SQL Server table with two columns id:INT and flagged:BOOLEAN. Is it possible to add a constraint that ensures that there is only one entry for (id=a, flagged=b) where b = 1? For example: ok (id=1, flagged=1) (id=1, flagged=0) (id=1, flagged=0) not ok (id=1, flagged=1) (id=1, flagged=1) (id=1, flagged=0) 回答1: Create Unique Index with filter: CREATE UNIQUE INDEX idx_name ON your_table(id) WHERE flagged=1; Demo: SqlFiddleDemo CREATE TABLE your_table(id INT, flagged INT); CREATE UNIQUE

Adding constraints without auto-layout

点点圈 提交于 2019-12-12 05:46:26
问题 I am building an app with a modal view containing a UICollectionView and below it a view containing two buttons (validate/cancel). The number of rows in my UICollectionView can change depending on the data and don't know it beforehand so I want to add a constraint to always keep my buttons 30px below the collectionView. I am not using auto-layout for this as I have some animations which work better without it so I don't know how to programmatically add such constraints. Does anyone have any

Query to find Constraint by SEARCH_CONDITION

隐身守侯 提交于 2019-12-12 04:55:15
问题 I want to find a CONSTRAINT_NAME in Oracle by SEARCH_CONDITION. SELECT * FROM ALL_CONSTRAINTS WHERE TABLE_NAME = 'myTableName'; AND SEARCH_CONDITION = '"myColumn" IS NOT NULL'; ORA-00997: illegal use of LONG datatype. How to query by SEARCH_CONDITION? 回答1: SEARCH_CONDITION is LONG so you can't use it for .... very much useful. For this particular use, I suggest PLSQL routine to write the LONG col into a VARCHAR2(32767) and then apply the check on teh VARCHAR2 variable. LONGs are an absolute

How do I center 4 uibuttons with equal distance from each other?

我的未来我决定 提交于 2019-12-12 04:22:52
问题 I have 4 uibuttons. Each button MUST be 100x100. I want to center the 4 of them in the center of my screen (horizontally), but put them down vertically. I have no idea where to start, but i've heard stackviews might work? Not sure. I tried using basic constraints, but i was unable to get them to work. here is what im trying to get: 回答1: Step 1 :- take 4 button in your Storyboard. Button1 , Button2 , Button 3 , Button4 Step 2 :- Give Fixed Height and width to All buttons . Step 3 :- All 2 - 2

Why does adding an align with centre constraint to a UIImage throw out the radius of corners setting?

被刻印的时光 ゝ 提交于 2019-12-12 03:34:57
问题 I am trying to turn a square image into a circle. I am using this code to do it: profilePicture2.layer.cornerRadius = profilePicture2.frame.size.height/2 profilePicture2.clipsToBounds = true It works perfectly, until I try centre the image in the container view by adding a 'Align centre X to superview' constraint. When I add this constraint I simply get very rounded corners instead of a circle. In fact, it seems to half the value of the corner radius. So if the image has a height of 100, and

Auto layout issue with a row of image views

只谈情不闲聊 提交于 2019-12-12 03:33:16
问题 This is driving me nuts! I am trying to show a row of images of followers to a profile in my app. The idea is for it to be 5 images where you could theoretically click on them and move to their profile. Here is what I am having troubles with now : I've never had to ask about auto layout before so I don't know what to show you all for your help. Is feel like this is a silly problem... Here is the setup: Designed in a separate XIB All elements are encapsulated in a UITableViewCell Any help

Simple restrictions/constraint for multiple imputation (MICE) in R

∥☆過路亽.° 提交于 2019-12-12 03:27:38
问题 This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 3 years ago . I want to perform multiple imputation for a set of variables using the MICE package in R. # Example data data <- data.frame( gcs = c(3, 10, NA, NA, NA, 15, 14, 15, 15, 14, 15, NA, 13, 15, 15), hf = c(50, 66, 78, 99, NA, NA, 56, 55, NA, 76, 98, 105, NA, NA, 65), ... ) The minimum for gcs is 3 and the maximum is 15 , and it may not be a fractional number, how can I set these

SQLiteConstraintException: error code 19: constraint failed when set ringtones

瘦欲@ 提交于 2019-12-12 03:11:58
问题 Here is my code. ContentValues values = new ContentValues(); values.put(MediaStore.MediaColumns.DATA, newSoundFile.getAbsolutePath()); values.put(MediaStore.MediaColumns.TITLE, "my ringtone"); values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/*"); values.put(MediaStore.MediaColumns.SIZE, newSoundFile.length()); values.put(MediaStore.Audio.Media.ARTIST, R.string.app_name); values.put(MediaStore.Audio.Media.IS_RINGTONE, true); values.put(MediaStore.Audio.Media.IS_NOTIFICATION, true); values

Portfolio Optimisation under participation constraints

一曲冷凌霜 提交于 2019-12-12 03:06:34
问题 I am trying to find a set of hedge ratios by optimising a portfolio for minimum variance under participation constraints of the assets. Ultimately I would like to optimise the assets weights for other measures of risk such as minimum CVaR, VaR or maximum return/risk. My portfolio comprises 9 series. 1 domestic asset and 4 international assets which are 0% currency hedged: "D_Asset1","F_Asset2","F_Asset3","F_Asset4","F_Asset5" I have also series for those that are 100% currency hedged: "H_F