multiple-columns

SQL constraint to make 2 clumns not equal to each other

↘锁芯ラ 提交于 2020-01-06 03:47:31
问题 I have a table that has two columns to store id from another table. Column1 gets id from ABC table and Column2 also gets id from that table but letter is called parent ID, so with this information I know who is parent of who. Now I want to create a constraint not to ever let both columns to get same id. The following did not work: ALTER TABLE id_parent_table ADD CHECK (parent_id != main_id) This is still allowing to insert two identical numbers. 回答1: Apparently, MySQL does not support check

How to combine overflow:visible and overflow:scroll in CSS?

社会主义新天地 提交于 2020-01-06 03:27:26
问题 I am working on a page with horizontal scrolling and multiple columns. The first column of the text should be centered on the page and the other columns should be visible, too. Here is a sketch, which demonstrates what I have right now – an article with columns which is scrollable: jsfiddle. I would like to see the overflow text, too. I know overflow-y:visible and overflow-y:scroll cannot be combined, but how can achive something similar? Only the text (article) should be scrollable, not the

Create new data frame columns with binary (0/1) data based on text strings in existing column in R

风流意气都作罢 提交于 2020-01-06 03:20:48
问题 I have an R data frame that looks like: ID YR SC ABX:22798 1976 A's Frnd; Cat; Cat & Mse ABX:23798 1983 A's Frnd; Cat; Zebra Fish ABX:22498 2010 Zebra Fish ABX:22728 2010 Bear; Dog; Zebra Fish ABX:22228 2011 Bear example data: df <- structure(list(ID = c("ABX:22798", "ABX:23798", "ABX:22498", "ABX:22728", "ABX:22228"), YR = c(1976, 1983, 2010, 2010, 2011), SC = c("A's Frnd; Cat; Cat & Mse", "A's Frnd; Cat; Zebra Fish", "Zebra Fish", "Bear; Dog; Zebra Fish", "Bear")), .Names = c("ID", "YR",

Output isn't shown per line

假装没事ソ 提交于 2020-01-05 06:46:06
问题 I wrote a simple python script like this: #!/usr/bin/python import sys import urllib if len(sys.argv) < 2: print 'usage: python %s <file-urls>' % (sys.argv[0]) sys.exit(2) print '%-15s %15s' % ('URL_PAGE', 'STATUS') FileName = sys.argv[1] InputFile = open(FileName) for url in InputFile: out = urllib.urlopen(url) status = out.getcode() print '%-15s %15s' % (url, status) The out put is something like this: URL_PAGE STATUS http://test.com 200 But I want this output: URL_PAGE STATUS http://test

How to convert rows to new columns in m to n relation ship table?

依然范特西╮ 提交于 2020-01-05 04:17:35
问题 I need some help with a problem. I am working on a microsoft database with SQL and I have a Table that looks similar to this one: |*Name*|*Permissions*| |App1 |Permission 1 | |App1 |Permission 2 | |App1 |Permission 3 | |App2 |Permission 1 | |App2 |Permission 2 | |App2 |Permission 3 | So it is an m to n relation ship, as there are multiple permissions assigned to an app but there are also multiple apps using the same permission. I have already tried something like joining the table with itself

Can pandas split/merge columns based on patterns in their name?

帅比萌擦擦* 提交于 2020-01-04 00:14:29
问题 Can pandas split and/or merge columns, based on patterns in the column name? Here's a DataFrame : meas1_left meas1_right meas2_left meas2_right 0 1 2 3 4 1 6 7 8 9 I'd like to turn the above data and this (I don't really care how the new frame is indexed): meas1 meas2 side 0 1 3 left 1 2 4 right 2 6 8 left 3 7 9 right 回答1: You can first create Multiindex from columns by split: df.columns = df.columns.str.split('_', expand=True) print (df) meas1 meas2 left right left right 0 1 2 3 4 1 6 7 8 9

targeting nth column(made by column-count)

强颜欢笑 提交于 2020-01-03 10:43:13
问题 Let's say I have this <ul> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> </ul> ul { column-count: 2; } and I want to align first column to right and the second to left, is there any way to target one of those columns using css selectors? 回答1: As of now, there is no way to target nth column with pure css. 回答2: It is not clear if you want to align the whole column or the elements inside. If you want the first one, Zach Saucier answer would be the way. If it

Formula to search table and return multiple column headers

回眸只為那壹抹淺笑 提交于 2020-01-03 04:15:09
问题 I am trying to enter a certain value in a cell, search a table for that value (vertically and horizontally), then return the column header of the columns containing that value. My formula works, but it will only return 1 column header, and I need it to return multiple Formula: {=INDEX(Sheet2!A1:J31,,MAX(IF(Sheet2!A1:J31=B2,COLUMN(Sheet2!A1:J1)-COLUMN(Sheet2!A1)+1)))} 回答1: I'm not aware of a built in Excel formula that will do this, but this can be accomplished with a user-defined function.

Extract columns from text based table output

半城伤御伤魂 提交于 2020-01-03 01:59:25
问题 qfarm /load command shows me the load from my servers. Output: PS> qfarm /load Server Name Server Load Load Throttling Load Logon Mode -------------------- ----------- -------------------- ------------------ SERVER-01 400 0 AllowLogons SERVER-02 1364 OFF AllowLogons SERVER-03 1364 OFF AllowLogons SERVER-04 1000 0 AllowLogons SERVER-05 700 0 AllowLogons SERVER-06 1200 0 AllowLogons I need to display only first column (Server Name) and the second one (Server Load) and loop through them, in