我在Excel 2007中有大量数据,但行应该是列,反之亦然.是否有一种简单的方法来"旋转"这个电子表格,重新排列所有单元格,使行成为列?
A=matrix(0,4,2)
A[1,1]=2
A[1,2]=3
A[2,1]=2
A[2,2]=3
A[3,1]=2
A[3,2]=3
A[4,1]=2
A[4,2]=3
Run Code Online (Sandbox Code Playgroud)
现在我想要获取第2,4行并在行this is odd的第一个元素之前返回.
但我不知道如何制作循环来获取第2,4行
有没有人知道/在EditorGridPanel中有一个移动行的工作示例(或者知道它为什么不适合我)?我找到了一些例子,我发现的例子使用了这种方法:
// calculate the new index, then remove the record from the store, and re-insert it at the new index
grid.getStore().remove(record);
grid.getStore().insert(index, record);
Run Code Online (Sandbox Code Playgroud)
在我的情况下,这失败了.它在网格中看起来不错,但实际上有2个DELETE http请求被发送到服务器,而没有PUT.当我重新加载页面时,这变得很明显 - 移动的行实际上已被删除.
他是我店的基本配置:
var remoteJsonStore = new Ext.data.JsonStore({
storeId: 'colStore',
autoDestroy: false,
autoSave: true,
proxy: new Ext.data.HttpProxy({url:'/exercises/collect/data_rows'}),
restful: true,
format: 'json',
disableCaching: false,
autoLoad: true,
writer: new Ext.data.JsonWriter({
encode: false
}),
root: 'data',
idProperty: 'data_row_id',
fields: recordFields,
baseParams:{section_id:GridUtils.properties[gridId]['section_id']},
listeners:{
exception:function(misc){
// stuff....
},
beforewrite:function(store, action, rs, options, arg){
this.baseParams["position"]=rs.rowIndex;
},
beforesave:function(store, data){
// stuff.... } …Run Code Online (Sandbox Code Playgroud) 首先,我想为我糟糕的英语道歉.我有多个表的问题.我不是mySQL世界中的新手,但我无法找到解决这个问题的方法.对于这个问题,我使用4个表.
每个类别都有规格和产品,每个规格值都有产品和规格ID.现在,用户可以使用不同的值进行选择.这就是我的问题所在.当用户选择值"绿色"和腿"4"时,我想要所有带有4条腿的绿色产品.所以我使用JOIN(我认为各种各样)来选择合适的产品(例如下面的例子)
SELECT DISTINCT products.id
FROM products
LEFT JOIN specificationvalues ON specificationvalues.products_id = products.id
LEFT JOIN specifications ON specificationvalues.specifications_id = specifications.id
WHERE specifications.name='materiaal'
AND specifications.name='kleur'
AND specificationvalues.id='77'
AND specificationvalues.id='78'
Run Code Online (Sandbox Code Playgroud)
问题是所有值都在不同的行中.这就是为什么WHERE不起作用的原因.我没有得到MySQL错误.只有它返回0行.
我希望有一个人可以帮助我!我从这个论坛得到了很多好东西,所以我希望它会再帮助我!
我不知道为什么我的改变昨天没有保存.但这是我的数据:
SPECIFICATIONS Table
ID CATEGORIES_ID NAME
38 297 Material
39 297 Measures
40 297 Color
SPECIFICATIONVALUES Table
ID SPECIFICATIONS_ID PRODUCTS_ID VALUE
1 38 988979 Masive wood
2 39 988979 24x57x98
3 40 988979 Yellow
4 40 988980 Black
5 39 388980 24x57x98
PRODUCTS Table
ID …Run Code Online (Sandbox Code Playgroud) 我有这两个表:
Factura
FacturaID (PK) int
Fecha date
Total money
Run Code Online (Sandbox Code Playgroud)
FacturaDetalle
FacturaDetalleID (PK) int
FacturaID int FK on Factura.FacturaID
ProductoID char(10) FK on Producto.ProductoID
Precio money
Run Code Online (Sandbox Code Playgroud)
PRODUCTO
ProductoID (PK) char(10)
Descripcion char(50)
Run Code Online (Sandbox Code Playgroud)
现在添加一些数据:
INSERT INTO Producto (ProductoID, Descripcion) VALUES ('1', 'soda')
INSERT INTO Producto (ProductoID, Descripcion) VALUES ('2', 'papas')
INSERT INTO Producto (ProductoID, Descripcion) VALUES ('3', 'pan')
INSERT INTO Factura (Fecha, Total) VALUES ('Some Date', 100) SELECT SCOPE_IDENTITY() //Returns FacturaID = 1
INSERT INTO FacturaDetalle (FacturaID, ProductoID, Precio) VALUES (1, '1', …Run Code Online (Sandbox Code Playgroud) 我想在MATLAB中计算Cell数组中的行数.我使用下面的代码来计算单元格数组中的列数,但我不知道它计算行的方式.
filledCells = ~cellfun(@isempty,a);
columns = sum(filledCells,2)
Run Code Online (Sandbox Code Playgroud)
举个例子,我有x作为单元格数组:
x = [5] [1x8 double] [5]
Run Code Online (Sandbox Code Playgroud)
该单元阵列有一行三列.我需要一个代码来计算等于"1"的行数,但我没有找到计算它的方法.
我正在寻找我的问题的具体答案.这就是,我有一行包含一定数量的div(动态设置).我想要的是交替地将div(3 div)的背景设置为另一种颜色,如下所示:
这可以通过CSS奇数和偶数伪类完成,还是应该通过jQuery完成?
参考下面的HTML,有四个DIV容器,每个容器包含一个图像,heading-element,paragraph-element和一个链接.当页面在全尺寸计算机显示器上打开时,我希望三个div在屏幕上并排排列.
到目前为止,它们只是垂直向下堆叠在屏幕上.
<div class="threeSpread">
<div class="outer">
<img src="imagesForNew/new1.jpg">
<h2>CHININESE INVESTORS COME TO DETROIT</h2>
<p>"the Shanghai-based developer Dongdu International (DDI) made its first move. In an online auction, it snapped up three iconic downtown properties, all built during the citys early 20th-century"</p>
<a href="http://www.theguardian.com/cities/2014/jul/22/does-multimillion-dollar-chinese-investment-signal-detroits-rebirth">theguardian.com</a>
</div>
<div class="inner">
<img src="imagesForNew/new1.jpg">
<h2>CHININESE INVESTORS COME TO DETROIT</h2>
<p>"the Shanghai-based developer Dongdu International (DDI) made its first move. In an online auction, it snapped up three iconic downtown properties, all built during the citys early …Run Code Online (Sandbox Code Playgroud) 总结:
Windows 10
Visual Studio 2015
C#,赢表格
dataGridView
->尝试删除按钮单击事件上的空行
(我不知道问题出在哪里,所以我慷慨地从其他按钮添加了代码)
private void someButton_Click(object sender, EventArgs e)
{
dataGridView1.Rows.Add(1);
dataGridView1.Select();
dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0];
}
Run Code Online (Sandbox Code Playgroud)
另一个按钮删除dataGridView的最后一行:
private void anotherButton_Click(object sender, EventArgs e)
{
if (dataGridView1.Rows.Count > 0)
{
dataGridView1.Rows.Remove(dataGridView1.Rows[dataGridView1.Rows.Count - 1]);
}
}
Run Code Online (Sandbox Code Playgroud)
由于(目前)用户将能够自由编辑dataGridView中的单元格,因此某些行可能最终为空。为了解决这个问题,我尝试添加第三个按钮以删除空行:
private void thirdButton_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if (row.Cells[0].Value == null)
{
dataGridView1.Rows.RemoveAt(row.Index);
}
}
}
Run Code Online (Sandbox Code Playgroud)
存在4个空行+按下按钮
->剩下2个空行
2个空行+按下按钮
->剩下1个空行
最后1个空行+按下按钮
-> 0个空行(是的)
(与例如11-> 5-> 2-> 1-> …
我有一个数组
Array = [[1,1,1],[2,2,2],[3,3,3],[4,4,4],[5,5,5],[1,1,1],[2,2,2]]
Run Code Online (Sandbox Code Playgroud)
而且我想输出以下内容:
Repeated = [[1,1,1],[2,2,2]]
Run Code Online (Sandbox Code Playgroud)
保留重复行的数量也可以,例如
Repeated = [[1,1,1],[1,1,1],[2,2,2],[2,2,2]]
Run Code Online (Sandbox Code Playgroud)
我以为解决方案可能包括numpy.unique,但我无法使其正常工作,是否有本机python / numpy函数?