我正在尝试制作一个简单的弹出窗口.但是每次我制作一个,它最终都会变得非常小......而不是我想要它的长度.这是弹出窗口的样子:

这是弹出窗口的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/popup_element"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#444444"
android:padding="10px"
android:orientation="vertical">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Transfering data"
android:textColor="@color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Status"
android:textColor="@color/white"/>
<TextView android:id="@+id/server_status_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Awaiting answer..."
android:paddingLeft="10sp"
android:textColor="@color/white"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:gravity="center_horizontal|bottom">
<Button android:id="@+id/end_data_send_button"
android:layout_width="100dp"
android:layout_height="100dp"
android:drawablePadding="3sp"
android:layout_centerHorizontal="true"
android:text="Cancel" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的java代码:
private PopupWindow pw;
private void bindActivity() {
fabButton = (ImageButton) findViewById(R.id.activity_profileView_FAB);
fabButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
initiatePopupWindow();
}
});
}
private void initiatePopupWindow() {
try …Run Code Online (Sandbox Code Playgroud) 我已经到处搜索这种情况,除了动态SQL之外找不到解决方案,我不想使用它.
这是我想在服务器2上更新的表:
(Stuff Id UNIQUEIDENTIFIER
, stuffname NVARCHAR(64))
Run Code Online (Sandbox Code Playgroud)
我需要从服务器1更新它.
所以我一直在尝试这个:
DECLARE @newstuff nvarchar(64)
SELECT @newstuff = 'new stuff'
UPDATE [server2].database2.dbo.Stuff
SET stuffname=@newstuff
WHERE stuffId='4893CD93-08B3-4981-851B-5DC972288290'
Run Code Online (Sandbox Code Playgroud)
这需要11秒.下一个使用文字在1秒内运行
UPDATE [server2].database2.dbo.Stuff
SET stuffname='new stuff'
WHERE stuffId='4893CD93-08B3-4981-851B-5DC972288290'
Run Code Online (Sandbox Code Playgroud)
我比较了实际的执行计划.速度较慢的是远程扫描需要100%的成本,另外还有5个其他步骤(过滤器,表假脱机,计算标量,远程更新,更新).快速的只是执行UPDATE和远程查询步骤.我需要使用变量,所以我需要一种方法来强制它远程执行整个查询.
我尝试过使用OPTION(RECOMPILE)但是server1正在使用SQL Server 2005.server2正在使用SQL Server 2012.我无法在服务器2上更改数据库结构而不会出现严重问题.我没有任何身份验证问题.我在更新时尝试对表进行别名.
我也尝试过使用Openquery.当我将id过滤器放在查询字符串中时,它会回落到1秒以下:
UPDATE OPENQUERY([server2], 'select stuffname, stuffid from database2.dbo.stufftable where contactid=''4CA1D489-9221-E511-A441-005056C00008''')
SET stuffname = @newstuff
Run Code Online (Sandbox Code Playgroud)
但是我需要id也是一个变量,而open查询不需要变量(https://msdn.microsoft.com/en-CA/library/ms188427.aspx).我尝试使用查询外部的id过滤器运行Openquery,但是在4秒内运行.它比11好,但不是很好:
UPDATE OPENQUERY([server2],'select stuffname, stuffid from database2.dbo.stufftable')
set stuffname=@newstuff
where contactid='4CA1D489-9221-E511-A441-005056C00008'
Run Code Online (Sandbox Code Playgroud)
当然,我使用exec(@sql)运行openquery,但我真的不想这样做.我可以使用文字来完成整个更新语句,甚至不使用OPENQUERY并获得相同类型的结果.
有没有办法让我在不使用exec(@sql)的情况下修复此性能?
这是我正在查看的表的简化版本:
CREATE TABLE [dbo].[FrustratingTable]
(
[Id] Uniqueidentifier NOT NULL
, [SecondField] [datetime]
, [ThirdField] varchar(128)
)
Run Code Online (Sandbox Code Playgroud)
我想在此表中插入新记录.我尝试了3种方法:
INSERT INTO [dbo].[FrustratingTable] (Id, SecondField, ThirdField)
SELECT newid() as Id,
'6/25/2015' as SecondField, 'Example' as ThirdField
Run Code Online (Sandbox Code Playgroud)
这种方法插入,但结果键不是一个很好的顺序GUID,就像表中的其他键
INSERT INTO [dbo].[FrustratingTable] (Id, SecondField, ThirdField)
SELECT NEWSEQUENTIALID() as Id, '6/25/2015' as SecondField, 'Example' as ThirdField
Run Code Online (Sandbox Code Playgroud)
这失败了,错误
newsequentialid()内置函数只能在CREATE TABLE或ALTER TABLE语句中的"uniqueidentifier"类型的列的DEFAULT表达式中使用.它不能与其他运算符组合以形成复杂的标量表达式.
INSERT INTO [dbo].[FrustratingTable] (SecondField,ThirdField)
SELECT '6/25/2015' as SecondField, 'Example' as ThirdField
Run Code Online (Sandbox Code Playgroud)
这失败了,错误
无法将值NULL插入列'id',表'mydatabase.dbo.frustratingtable'; 列不允许空值.INSERT失败.
是否有可能在不改变表定义的情况下解决这个问题?
是的,我知道这是重复的,但是其他答案现在已经过时了。我将SharePoint Online与SharePoint Designer 2013一起使用。
我想为SharePoint列表视图设置disable-output-escaping = yes。
这是我尝试过的:
这是我对aspx的看法:
<FieldRef Name="After_x0020_Mitigation"/></ViewFields>
<RowLimit Paged="TRUE">100</RowLimit><Aggregations Value="Off"/
<JSLink>clienttemplates.js</JSLink><XslLink default="TRUE">Main.xsl</XslLink>
Run Code Online (Sandbox Code Playgroud) 我有一个包含销售数据和用户ID的交易数据库,如下所示:
id_usuarioweb dt_fechaventa
1551415 2015-08-01 14:57:21.737
1551415 2015-08-06 15:34:21.920
6958538 2015-07-30 09:26:24.427
6958538 2015-08-05 09:30:06.247
6958538 2015-08-31 17:39:02.027
39101175 2015-08-05 16:34:17.990
39101175 2015-09-20 20:37:26.043
1551415 2015-09-05 13:41:43.767
3673384 2015-09-06 13:34:23.440
Run Code Online (Sandbox Code Playgroud)
我想计算数据库中同一客户的日期之间的平均差异(找出用户购买的平均频率).
我知道我可以使用两列进行约会,但是我在尝试在同一个字段中执行此操作并按用户ID"分组"时遇到问题.
期望的结果是这样的:
id_usuarioweb avgtime_days
1551415 5
6958538 25
39101175 25
1551415 0
3673384 0
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?我将按user_id和dt_fechaventa(销售时间)排序数据库.
使用:SQL Server 2008
sql ×3
sql-server ×2
android ×1
average ×1
date ×1
datediff ×1
guid ×1
openquery ×1
popupwindow ×1
sharepoint ×1
sql-update ×1
xslt ×1