我搜索redis命令列表.我找不到命令来获取redis pub/sub中的所有可用频道.在流星服务器中,等效命令是LISTCHANNELS,它列出了所有已知信道,每个信道上存储的消息数和当前用户数.
我有一个需要定期了解可用频道的cron.redis是否有本机命令?或者我需要找到一种方法来自己实现它?
我正在尝试使用圆角构建Android按钮.但是沿着圆角(左下角和右下角),周围有不必要的灰色阴影.
这是我的代码:
drawable/my_button.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#ffa6c575" />
<solid android:color="#ffa6c575"/>
<corners android:radius="15dp" />
</shape>
</item>
</selector>
Run Code Online (Sandbox Code Playgroud)
然后在布局xml文件中,我有:
<LinearLayout
<Button
android:id="@+id/buy_button"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="35dp"
android:layout_gravity="center"
android:background="@drawable/my_button"
android:textColor="@android:color/white"
android:text="BUY" />
<View
android:layout_width="10dp"
android:layout_height="match_parent"
android:background="@android:color/transparent" >
</View>
<Button
android:id="@+id/sell_button"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="35dp"
android:layout_gravity="center"
android:background="@drawable/my_button"
android:textColor="@android:color/white"
android:text="SELL" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
1)如何摆脱圆角(左下角和右下角)的额外灰色阴影?
2)按钮具有默认的波纹效果.如何保持默认的连锁效果?
我有stock_price_alert3列的表.stock_price_id是PRIMARY KEY和FOREIGN KEY其他表.表定义如下:
create table stock_price_alert (
stock_price_id integer references stock_price (id) on delete cascade not null,
fall_below_alert boolean not null,
rise_above_alert boolean not null,
primary key (stock_price_id)
);
Run Code Online (Sandbox Code Playgroud)
我需要:
1)INSERT记录如果不存在
-- query 1
INSERT INTO stock_price_alert (stock_price_id, fall_below_alert, rise_above_alert)
VALUES (1, true, false);
Run Code Online (Sandbox Code Playgroud)
2)UPDATE记录是否存在
-- query 2
UPDATE stock_price_alert SET
fall_below_alert = true,
rise_above_alert = false
WHERE stock_price_id = 1;
Run Code Online (Sandbox Code Playgroud)
首先,我需要SELECT在stock_price_alert表上发出查询,以决定是执行查询(1)还是(2).
Postgres支持INSERT …
我正在使用Java HttpClient 3.1来编写REST API调用的代码.我遇到了Post的问题multipart/form-data.这是我想要进行的API调用,以API提供者为例:
POST /v1/documents HTTP/1.1
Host: .......
x-session-key: 02e57c7d-d071-4c63-b491-1194a9939ea5.2016-01-13T22:34:53.101Z
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="documentImage"; filename="ScreenShot 2016-01-14 at 1.48.48 PM.png"
Content-Type: image/png
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="documentType"
Picture ID
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="token"
02e57c7d-d071-4c63-b491-1194a9939ea5
----WebKitFormBoundary7MA4YWxkTrZu0gW
Run Code Online (Sandbox Code Playgroud)
这是我的HttpClient 3.1代码:
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.multipart.FilePart;
import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
import org.apache.commons.httpclient.methods.multipart.Part;
import org.apache.commons.httpclient.methods.multipart.StringPart;
Part[] parts = new Part[3];
parts[0] = new StringPart("token", this.user.userID);
parts[1] = new StringPart("documentType", "Picture ID");
try {
File imageFile = new File("/path/test2.png");
parts[2] = new FilePart("documentImage", …Run Code Online (Sandbox Code Playgroud) 我在 Android 上使用 Retrofit2 和 OkHttp 进行 HTTP 请求。这里我正在做一个带有文档上传的 POST 请求。我遇到了以下错误:
D/OkHttp: <-- 500 Server Error http://api.drivewealth.io/v1/documents (4289ms)
D/OkHttp: Date: Tue, 11 Apr 2017 03:29:48 GMT
D/OkHttp: Cache-Control: must-revalidate,no-cache,no-store
D/OkHttp: Content-Type: text/html; charset=ISO-8859-1
D/OkHttp: Server: Jetty(9.2.17.v20160517)
D/OkHttp: Content-Length: 9323
D/OkHttp: Connection: keep-alive
D/OkHttp: <html>
D/OkHttp: <head>
D/OkHttp: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
D/OkHttp: <title>Error 500 Server Error</title>
D/OkHttp: </head>
D/OkHttp: <body><h2>HTTP ERROR 500</h2>
D/OkHttp: <p>Problem accessing /v1/documents. Reason:
D/OkHttp: <pre> Server Error</pre></p><h3>Caused by:</h3><pre>org.apache.cxf.interceptor.Fault: Couldn't determine the boundary from the message!
D/OkHttp: …Run Code Online (Sandbox Code Playgroud) 我希望学习如何通过应用 UWP 中的一些现代 UI(如导航视图)来构建本机 WPF 桌面应用程序。
但是,我很困惑,类名相同,但命名空间不同
我想知道,哪个是哪个,我应该在我的 WPF 项目中使用哪个?
谢谢。
我有stock_price_code如下表格。value列有UNIQUE约束。
create table stock_price_code (
id serial primary key,
value text not null,
unique (value)
);
Run Code Online (Sandbox Code Playgroud)
我想INSERT进入表格,如果没有找到value. 我有这两个查询:
-- query 1
INSERT INTO stock_price_code (value)
SELECT 'MCD'
WHERE NOT EXISTS (SELECT * FROM stock_price_code WHERE value = 'MCD')
RETURNING id;
-- query 2
INSERT INTO stock_price_code (value) VALUES ('MCD')
ON CONFLICT (value) DO NOTHING
RETURNING id;
Run Code Online (Sandbox Code Playgroud)
我query 1在 Postgres 9.5 之前使用。然后 Postgres 9.5 开始引入INSERT ... ON CONFLICT …
在Android中,我用来java.util.Calendar获取格式为昨天的日期yyyy-MM-dd'T'hh:mm:ss'Z'。例如,如果今天是31 May 2017,我想将昨天的日期设为2017-05-30T00:00:00Z。
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
// Date End = yesterday
calendar.add(Calendar.DATE, -1);
Date dateEnd = calendar.getTime();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss'Z'");
this.dateEndStr = formatter.format(dateEnd);
Run Code Online (Sandbox Code Playgroud)
我期望输出为2017-05-30T00:00:00Z. 但它给了我2017-05-30T12:00:00Z。
这里有什么问题吗?与时区有关吗?我的时区是GMT/UTC + 08:00 hour.