我正在使用FlatList来显示两列中的项目列表
<FlatList style={{margin:5}}
data={this.state.items}
numColumns={2}
keyExtractor={(item, index) => item.id }
renderItem={(item) => <Card image={item.item.gallery_image_url} text={item.item.name}/> }
/>
Run Code Online (Sandbox Code Playgroud)
卡组件只是一个具有一些样式的视图:
<View style={{ flex: 1, margin: 5, backgroundColor: '#ddd', height: 130}} ></View>
Run Code Online (Sandbox Code Playgroud)
它工作正常,但如果项目数是奇数,则最后一行只包含一个项目,该项目会延伸到屏幕的整个宽度.
如何将项目设置为与其他项目相同的宽度?
我刚刚在我的机器上安装了visual studio 2012,之前我曾安装过visual studio 2012 RC.安装成功,但在我打开一个项目之后,C#编辑器无法运行,就像这样的纯文本编辑器:
我已经尝试修复它,完全卸载然后重新安装,但没有成功.
有人有想法吗?
我不知道它是否相关,但是在创建新项目或打开现有项目时,我有时也会收到此错误:
提前致谢
我在插件jOrgChart的div中有一个twitter bootstrap下拉列表.
我遇到的问题是,当我单击按钮打开下拉菜单时,它还会触发父div中的单击事件,该事件会执行其他元素的折叠.
这是我的HTML:
<div id="chart">
<div class="node">
<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
Actions
<span class="caret"></span>
</a>
<ul class="dropdown-menu" style="text-align:left;">
<li><a href="#">Edit</a></li>
<li><a href="#">Delete</a></li>
</ul>
</div>
</div>
<div class="node">
...
</div>
Run Code Online (Sandbox Code Playgroud)
我想阻止点击a.dropdown-toggle从冒泡到div.node,我尝试了这个:
$("div#chart div.btn-group > a.dropdown-toggle").click(function (e) {
e.stopPropagation();
});
Run Code Online (Sandbox Code Playgroud)
但现在下拉列表不起作用.
编辑
这是具体案例:http://jsfiddle.net/UTYma/2/ (感谢Joe Tuskan开始小提琴)
我正在尝试使用Entity Framework Code First在表中创建'time(7)'列.这是我的实体:
public class ShiftDetail
{
public long Id { get; set; }
[Required]
public int DayOfWeek { get; set; }
[Required]
[Column(TypeName="time")]
public DateTime StartTime { get; set; }
[Required]
[Column(TypeName = "time")]
public DateTime EndTime { get; set; }
public long ShiftId { get; set; }
public virtual Shift Shift { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我正在尝试将StartTime和EndTime列的数据库类型设置为"time",但是我收到此错误:
(112,12):错误2019:指定的成员映射无效.类型'ShiftDetail'中成员'StartTime'的类型'Edm.DateTime [Nullable = False,DefaultValue =,Precision =]'与'SqlServer.time [Nullable = False,DefaultValue =,Precision = 7]'不兼容'CodeFirstDatabaseSchema.ShiftDetail'类型中的成员'StartTime'.
我也试过TypeName ="time(7)"但我得到了另一个错误:
(104,6):错误0040:类型时间(7)未使用命名空间或别名限定.只有原始类型可以无限制地使用.
如何创建包含代码的时间列?(最好没有流畅的API)
提前致谢.
.net entity-framework code-first entity-framework-4 ef-code-first
我有一个带有CoordinatorLayout,AppBarLayout和NestedScrollView的布局,在NestedScrollView中我有多个CardViews,一切正常,直到我将CardViews设置为可点击,然后如果我在CardView中开始滚动,则滚动不起作用.
这是我的布局:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_height="256dp"
android:layout_width="match_parent"
app:contentScrim="?attr/colorPrimary"
android:fitsSystemWindows="true"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary">
<ImageView
android:id="@+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nestedScroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_gravity="fill_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="0dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@color/primary" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingLeft="7dp"
android:paddingRight="7dp"
android:paddingBottom="7dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lines="1"
android:includeFontPadding="false"
android:text="Title1"
style="@android:style/TextAppearance.Medium" />
<TextView …
Run Code Online (Sandbox Code Playgroud) android android-design-library android-coordinatorlayout android-collapsingtoolbarlayout android-appbarlayout
我正在开始开发一个webapp,我想尽可能多地使用HTML5.我的应用程序有一个大量使用拖放的界面,我的问题是,此时,是否建议使用html5本机拖放?或者像jquery ui那样使用另一个js库更好吗?
提前致谢
埃斯科瓦尔
我有以下实体:
public class ApplicationUser : IdentityUser
{
...
public int? StudentId { get; set; }
public virtual Student Student { get; set; }
}
public class Student
{
public int Id { get; set; }
public string UserId { get; set; }
public virtual ApplicationUser User { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试创建一个新的应用程序用户和学生,所以我这样做:
var user = new ApplicationUser() {
Name = "test",
UserName = "test",
Student = new Student ()
};
var result = await userManager.CreateAsync(user, "test12345!");
Run Code Online (Sandbox Code Playgroud)
结果成功,两个实体插入数据库,但Student.UserId为null
如何插入实体及其关系?
我尝试设置student.UserId = …
c# entity-framework asp.net-web-api asp.net-identity asp.net-identity-2
我的项目中有用户模型和事件模型.事件具有创建者(用户)并具有参与者(用户),因此事件与用户具有一对多关系,并且与同一个表具有多对多关系.
我首先得到了这样的一对多关系:
Public class Event
{
...
public int CreatedById { get; set; }
public virtual User CreatedBy { get; set; }
...
}
Run Code Online (Sandbox Code Playgroud)
然后当我添加多对多关系时,迁移不会产生多对多的关系:
Public class User
{
...
public virtual ICollection<Event> Events { get; set; }
...
}
Public class Event
{
...
public int CreatedById { get; set; }
public virtual User CreatedBy { get; set; }
public virtual ICollection<User> Users { get; set; }
...
}
Run Code Online (Sandbox Code Playgroud)
如果我删除了一对多关系,则迁移会成功生成多对多关系.
有没有办法只用数据注释来做到这一点?
我试图在web api控制器中从我的Post Action中排除一个属性,是否有像[Bind(Exclude="Property")]
asp.net web api 这样的东西?
这是我的模特:
public class ItemModel
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我想在Post Action中排除Id,因为它是自动生成的,但我需要在Get Action中返回它.
我知道我可以有两个模型,一个用于我的Post动作,一个用于我的Get动作,但我只想用一个模型做这个.
我正在尝试在windows azure中获取我的worker角色的跟踪日志,但它不起作用,看不到任何错误.
我已经将我的应用程序配置为使用azure诊断程序,如下所述:https://www.windowsazure.com/en-us/develop/net/common-tasks/diagnostics/
首先,我在我的worker角色的app.config中有这个:
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
Run Code Online (Sandbox Code Playgroud)
然后,在我的ServiceConfiguration.Cloud.cscfg中,我有这个连接字符串:
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=XXXXXXX;AccountKey=XXXXXXXXX" />
...
Run Code Online (Sandbox Code Playgroud)
在我的ServiceDefinition.csdef中我有:
<Import moduleName="Diagnostics" />
Run Code Online (Sandbox Code Playgroud)
最后在WorkerRole.cs的OnStart()方法中我有:
var config = DiagnosticMonitor.GetDefaultInitialConfiguration();
config.Logs.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(1.0);
config.Logs.ScheduledTransferLogLevelFilter = LogLevel.Information;
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config);
Run Code Online (Sandbox Code Playgroud)
然后我在Run()方法中做了一些Trace.WriteLine().
这应该是在存储中创建WADLogsTable,但事实并非如此.
当我通过远程桌面连接到我的实例时,我在事件查看器中看不到任何错误,我看到的唯一奇怪的是WaHostBootstrapper日志,我看到DiagnosticsAgent.exe进程启动两次,然后获取状态时进程响应而另一个没有响应,这是日志的一部分:
[00002868:00002872, 2012/11/23, 21:26:30.367, 00100000] <- WapGetEnvironmentVariable=0x800700cb
[00002868:00002872, 2012/11/23, 21:26:30.383, 00100000] <- WapGetEnvironmentVariable=0x800700cb
[00002868:00002872, 2012/11/23, 21:26:30.414, 00040000] Executing Startup Task type=2 rolemodule=Diagnostics cmd="E:\plugins\Diagnostics\DiagnosticsAgent.exe"
[00002868:00002872, 2012/11/23, 21:26:30.414, 00040000] Executing "E:\plugins\Diagnostics\DiagnosticsAgent.exe" . …
Run Code Online (Sandbox Code Playgroud) .net ×2
c# ×2
code-first ×2
javascript ×2
jquery ×2
android ×1
android-collapsingtoolbarlayout ×1
azure ×1
diagnostics ×1
html ×1
html5 ×1
react-native ×1