我需要从html表单编辑许多不同的xml文件.我希望动态生成表单(文件可以是任何有效的xml结构),我想将修改后的xml内容以相同的结构保存回数据库.
当你知道xml的结构时,我已经看到了一些使用XSLT的例子,但是在这种情况下我没有.
那么,有两个真正的要点:
我真的试过,但我无法理解Android如何解释layout_weight
设置......
我想要实现的是
键入时我想将EditText增长到特定高度,并在输入的文本超出可用高度时开始滚动.这样做我需要周围的环境LinearLayout
与EditText一起成长.
如果我为内部定义一个特定的高度,LinearLayout
它将不会增长.如果我不这样做,内部布局占用所有空间而不是ScrollView,无论我尝试使用什么layout_weight
.:(
我当前的XML看起来像这样:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="I'm a header" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="bottom">
<LinearLayout
android:id="@+id/itemContainer"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</ScrollView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:padding="2dp"
android:gravity="bottom"
android:isScrollContainer="true"
android:background="@drawable/steel" >
<EditText
android:id="@+id/edittext01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:scrollbars="vertical"
android:fadingEdge="vertical"
android:fadingEdgeLength="60dp"
android:maxHeight="40dp"
android:textSize="15sp" />
<Button
android:id="@+id/button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:layout_gravity="right"
android:text="Send"
android:textStyle="bold"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
任何提示都非常感谢!
当我的列是Geography类型时,我应该使用什么SqlDbType枚举?我正在使用MS SQL Server 2008 R2.
这就是我正在寻找的具体内容:
// ADO.net - what do I use for the SqlDbType when it's defined
// as Geography in the stored proc
SqlCommand command = new SqlCommand();
command.CommandText = "dbo.up_Foobar_Insert";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@SomeGeographyType", SqlDbType.????);
Run Code Online (Sandbox Code Playgroud) 我注意到你可以用这种方式"双重声明"一个变量:
@interface A {
NSString *instanceVariable;
}
@property (nonatomic, retain) NSString *instanceVariable;
@end
Run Code Online (Sandbox Code Playgroud)
这与以下情况具有相同的效果:
@interface A {
}
@property (nonatomic, retain) NSString *instanceVariable;
@end
Run Code Online (Sandbox Code Playgroud)
为什么编译器不会在这种情况下抱怨?
假设我在(g)Vim中有这个简单的文字:
a b c
a b c
a b c
a b c
a b c
Run Code Online (Sandbox Code Playgroud)
更改为可视块选择模式后,如何选择整个第3列?Ctrl+ V G选择全文.我正在寻找一个键盘快捷键来选择整列选择(如果存在).
谢谢.
我已设法使用以下代码以编程方式将形状插入Visio:
ActiveWindow.Page.Drop(VisioApp.Documents["ORGCH_M.VSS"].Masters.ItemU["Executive"], 5.433071, 7.559055);
Run Code Online (Sandbox Code Playgroud)
在插入形状后,我将如何以编程方式检索它的X,Y坐标?
谢谢!
Visual Studio 2010为我生成了一堆单元测试,这似乎很方便,但我怀疑它们是否是实际的单元测试.例如,它生成了一个名为SaveTest的测试,它执行以下代码:
User user = new User(); //I have to create a user
user.Save(); //This saves the user to the database.
//Assertions here....
Run Code Online (Sandbox Code Playgroud)
我上面的问题是,从我所读到的,单元测试应该在隔离中测试,所以通过测试保存到数据库,这不是单元测试或我错了,MsTest是否错了?作为旁注,User由dbml和Save calles SubmitChanges在我的DataContext上生成.
我想在postgres做这样的事情:
UPDATE table1 SET (col1, col2) = (SELECT col2, col3 FROM othertable WHERE othertable.col1 = 123);
INSERT INTO table1 (col1, col2) VALUES (SELECT col1, col2 FROM othertable)
但是,即使使用文档中提到的postgres 9.0,也不可能获得第1点(http://www.postgresql.org/docs/9.0/static/sql-update.html)
点2似乎也不起作用.我收到以下错误:子查询必须只返回一列.
希望有人为我找到解决方法.否则查询将花费时间:(.
仅供参考:我正在尝试从多个表中选择不同的列并将它们存储到临时表中,以便其他应用程序可以轻松获取准备好的数据.
我想组合一些切换按钮,让它们表现为单选按钮.所以我做的是为我的xaml添加单选按钮并创建以下样式:
<Style BasedOn="{StaticResource {x:Type ToggleButton}}" TargetType="RadioButton">
<Setter Property="FontFamily" Value="Arial"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Foreground" Value="White"/>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
Run Code Online (Sandbox Code Playgroud)
现在单选按钮看起来像切换按钮,并且应用了样式的字体和前景属性,但是如果我单击其中一个切换按钮,则背景不会更改为红色.如果我基于IsChecked更改前景,它可以工作,但是当IsChecked为真时我无法更改背景.
有任何想法吗?
更新:
似乎默认的ToggleButton样式不使用Background属性.我现在使用以下代码来解决我的问题.如果有人发现以下内容有任何问题,请告诉我.
<DataTemplate x:Key="RedBackground">
<Grid Background="Red">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center" Text="{Binding}"/>
</Grid>
</DataTemplate>
<Style TargetType="ToggleButton">
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="ContentTemplate" Value="{StaticResource RedBackground}"/>
</Trigger>
</Style.Triggers>
</Style>
Run Code Online (Sandbox Code Playgroud) 是否有用于管理 SQL CE 4 数据库的良好 GUI 工具?例如,不需要我编写创建表语句的东西。
c# ×2
sql ×2
xml ×2
ado.net ×1
android ×1
html ×1
javascript ×1
mstest ×1
objective-c ×1
postgresql ×1
sql-update ×1
unit-testing ×1
vim ×1
visio ×1
wpf ×1
wpf-controls ×1