我有以下代码,当它执行时,它返回" 被拒绝 "和" 成功 ":
// javascript promise
var promise = new Promise(function(resolve, reject){
setTimeout(function(){reject()}, 1000)
});
promise
.catch(function(){console.log('rejected')})
.then(function(){console.log('success')});
Run Code Online (Sandbox Code Playgroud)
谁能解释为什么成功被记录?
假设我的更新查询如下所示:
UPDATE a SET
a.colSomething= 1
FROM tableA a WITH (NOLOCK)
INNER JOIN tableB b WITH (NOLOCK)
ON a.colA= b.colB
INNER JOIN tableC c WITH (NOLOCK)
ON c.colC= a.colA
Run Code Online (Sandbox Code Playgroud)
假设以上连接到tableB和tableC需要几分钟才能完成.在表/行锁定方面,整个表在连接期间是否被锁定?或者sql编译器是否足够智能以避免锁定整个表?
与上面的查询相比,通过在实际更新之前首先将连接结果存储在临时表中来获取死锁的可能性较小,如下所示?
SELECT a, b, c
INTO
FROM tableA
INNER JOIN tableB b WITH (NOLOCK)
ON a.colA= b.colB
INNER JOIN tableC c WITH (NOLOCK)
ON c.colC= a.colA
UPDATE a SET a.colSomething=1
FROM tableA a INNER JOIN #tmp t ON a.colA= t.colA
Run Code Online (Sandbox Code Playgroud)
谢谢!
说我有文件夹:
img1/
img2/
Run Code Online (Sandbox Code Playgroud)
如何使用来自Linux终端的正则表达式删除那些文件夹,匹配从img开始的一切?
我有一个主要活动使用的LinearLayout,如下所示:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
tools:context=".MainActivity" >
<LinearLayout
android:id="@+id/activity_main_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我在activity_main_container中动态添加片段,但问题是,当我的片段高度大于屏幕高度时,底部的内容会被隐藏.我无法滚动或做任何事情.
我已经尝试在ScrollView中包装片段的布局,但它对我不起作用,因为我的片段中有listview.我也尝试在每个容器上设置布局高度为3000dp,但它也不起作用.
我动态添加的片段示例布局如下所示.我也在我的片段中动态添加内容.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_listing_detail_linearLayout_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFF"
android:orientation="vertical"
android:paddingLeft="@dimen/fragment_padding_side"
android:paddingRight="@dimen/fragment_padding_side" >
<TextView
android:id="@+id/fragment_listing_detail_textview_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Review Title"
android:textSize="20sp"
android:textStyle="bold" />
<RatingBar
android:id="@+id/fragment_listing_detail_ratingbar_rating"
style="@style/customRatingBarSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
android:stepSize="0.5"
android:isIndicator="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Photos" />
<View style="@style/divider" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp" >
<LinearLayout …Run Code Online (Sandbox Code Playgroud) android ×1
ecmascript-6 ×1
es6-promise ×1
find ×1
javascript ×1
linux ×1
regex ×1
rm ×1
sql ×1
sql-server ×1