我有一个 Flutter 应用程序,使用 firebase-messaging 插件进行推送通知。
我像往常一样在客户端注册 firebase,然后将其发送fcmToken到服务器。
通知是通过使用aiofcm(使用 firebase 的 XMPP api)的 python 服务器创建的。它们是这样创建的:
message = aiofcm.Message(
device_token = t2,
notification = {
"title":notification_title,
"body":notification_body,
"sound":"default",
"tag":link
},
data = {
"click_action": "FLUTTER_NOTIFICATION_CLICK"
},
priority=aiofcm.PRIORITY_HIGH
)
await fcm.send_message(message)
Run Code Online (Sandbox Code Playgroud)
在 iOS 上,通知会在屏幕顶部弹出。
在 Android 上,只有图标显示在通知托盘中 - 而不是任何通知内容。这是在运行 Android P 的 Pixel 3 和 OnePlus 6 上测试的。
理想情况下,我希望通知是这样的“单挑”风格:
在我能够使用data消息并在本机 android 中以编程方式创建通知之前,我想避免这种情况,因为如果应用程序终止,数据消息不会在 Android 上传递。
我正在尝试使用AForge.NET来检测图像上的粗白线.
它就像我得到的管道,是应用阈值过滤器后的理想结果.
我知道如何检测形状,我已经这样做了,但是这在任何形状下都不匹配,因为它没有边缘而且不是圆形.
我有检测等边形状的示例代码,但我不知道这是否相关.
public void DetectQuadrilateralType(Bitmap bitmap)
{
BlobCounter blobCounter = new BlobCounter();
blobCounter.ProcessImage(bitmap);
Blob[] blobs = blobCounter.GetObjectsInformation();
//Graphics object to draw
Pen pen;
Graphics g = Graphics.FromImage(bitmap);
SimpleShapeChecker shapeChecker = new SimpleShapeChecker();
for (int i = 0; i < blobs.Length; i++)
{
List<IntPoint> edgePoints = blobCounter.GetBlobsEdgePoints(blobs[i]);
List<IntPoint> corners;
if (i < edgePoints.ToArray().Length && i > -1)
{
try
{
if (shapeChecker.IsConvexPolygon(edgePoints, out corners))
{
PolygonSubType subType = shapeChecker.CheckPolygonSubType(corners);
pen = new Pen(colors[subType], 2);
g.DrawPolygon(pen, ToPointsArray(corners));
pen.Dispose();
}
} …Run Code Online (Sandbox Code Playgroud) 所以这个代码功能本身没有问题.我有这样的事情:
<div>
<div><img id="imageToChange" src="/path/image.png" /></div>
<div id="textToChange">Text</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我有另一部分代码,用jQuery更改图像src/text.
function changeImage() {
$('#imageToChange').prop('src', '/path/image2.png');
$('#textToChange').html('New Text');
}
Run Code Online (Sandbox Code Playgroud)
正如您所料,这完全符合我的预期.但有1个怪癖.
在所有主流浏览器中(chrome/FF/IE).图像需要很长时间才能改变.
因此,例如,当我调用changeImage()时,文本会立即更改,但图像可能会在1-2秒后更改.(不是任何伸展的大图像,约6KB左右,本地)
我还没有找到其他人真正抱怨它,但我想知道是否有任何方法可以加快图像src的变化?也许更好的方法呢?
这也是jquery 1.8.0.
谢谢
我正在开发一个处理加密货币(钱包)的Flutter应用程序.有些人要求应用程序采取一些措施来隐藏他们的平衡等.
然而,我无法弄清楚的一件事是隐藏最近的应用程序菜单中的信息(如Android上的安全窗口模式,或者只是更改界面,因此无法看到平衡.)
我添加了一个WidgetsBindingObserver到我的主要小部件并尝试了类似的东西:
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
switch (state) {
case AppLifecycleState.paused:
setState(() {
_hideBalance = true;
});
super.didChangeAppLifecycleState(state);
break;
case AppLifecycleState.resumed:
setState(() {
_hideBalance = false;
});
super.didChangeAppLifecycleState(state);
break;
default:
super.didChangeAppLifecycleState(state);
break;
}
}
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
@override
Widget build(BuildContext context) {
return _hideBalance ? SizedBox() : Text("$12,234");
}
Run Code Online (Sandbox Code Playgroud)
但是,这对最近的应用程序没有任何影响,这些应用程序从按下主页按钮的那一刻开始就是一个精确的快照(至少在我的OnePlus 6T上).例如 - 我仍然可以在最近的应用/应用切换器概述中看到平衡.
有没有办法用颤动来做到这一点?
我正在尝试在列表视图中设置可点击按钮的页眉和页脚.问题是OnClickListener没有响应任何东西,我无法弄清楚我做错了什么.
$ View header = getLayoutInflater().inflate(R.layout.header_layout, null, true);
getListView().addHeaderView(header);
myAdapter = new myAdapter(this);
header.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Do what I want when i click it
}
});
Run Code Online (Sandbox Code Playgroud)
更新
我最终提出的最佳解决方案是在标题布局中添加一个单独的按钮,然后像这样做:
View header = getLayoutInflater().inflate(R.layout.header_layout, null);
Button headerButton = (Button)header.findViewById(R.id.header_button);
getListView().addHeaderView(header);
headerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// My Click Stuff
}
});
Run Code Online (Sandbox Code Playgroud) 我在esql(IBM Websphere Message Broker)中有一个子流,我需要在其中实现类似于select distinct功能的功能。
一些背景:我在Oracle数据库中有一个表group_errcode_ref。该表几乎是ERROR_CODEand 的固定链接/映射ID。ERROR_CODE是唯一的,但ID可以重复。例如,错误代码4000和4001都可以链接到ID 1。
在我的esql子流中,我有一系列错误代码,这些错误代码根据进入该流的当前数据而有所不同。
所以我需要做的是获取输入错误代码数组,并ID从表中为数组中的所有错误代码选择group_errcode_ref
我现在所拥有的:
declare db rows;
set db.rows[] = (select d.ID from Database.group_errcode_ref as d where d.ERROR_CODE in (select D from errCodes.Code[] as D);
Run Code Online (Sandbox Code Playgroud)
errCodes是来自输入的错误代码的数组。row是与错误代码对应的所有ID的数组。
很好,但是我想从db.rows[]数组中删除重复项。
我不确定在esql中执行此操作的最佳方法,但它不支持distinct。group by, 要么order by
我做了一个小递归算法,以下列格式找到迷宫的解决方案
###S###
##___##
##_#_##
#__#_##
#E___##
Run Code Online (Sandbox Code Playgroud)
其中'#'代表墙,'_'代表开放空间(可自由移动).'S'代表起始位置,'E'代表结束位置.
我的算法工作正常,但我想知道如何修改它以适应最短的路径.
/**
* findPath()
*
* @param location - Point to search
* @return true when maze solution is found, false otherwise
*/
private boolean findPath(Point location) {
// We have reached the end point, and solved the maze
if (location.equals(maze.getEndCoords())) {
System.out.println("Found path length: " + pathLength);
maze.setMazeArray(mazeArray);
return true;
}
ArrayList<Point> possibleMoves = new ArrayList<Point>();
// Move Right
possibleMoves.add(new Point(location.x + 1, location.y));
// Down Move
possibleMoves.add(new Point(location.x, location.y - 1)); …Run Code Online (Sandbox Code Playgroud) 我在 oracle 中有一个表,它有一列created_ts类型timestamp(6) with timezone
我想选择created_ts>= 今天的记录。因此,例如,如果我今天 (2/20/17) 运行查询,我希望 created_ts 更新或等于 02-20-2017 00:00:00 的所有记录。
我已经看到date使用对列执行此操作的示例trunc(sysdate),但还没有看到如何使用时间戳 + 时区列执行此操作。
谢谢
这就是我想要做的.我有一个每周包含多天的字段.(例如,它可以存储星期一或星期一|星期二,或星期三|星期五) - 基本上任何组合.
为此,我使用了权力为2的枚举,如下所示:
public enum DayOfWeek {
Monday(1),
Tuesday(2),
Wednesday(4),
Thursday(8),
Friday(16),
Saturday(32),
Sunday(64);
private final int index;
DayOfWeek(int index) {
this.index = index;
}
public int value() {
return index;
}
}
Run Code Online (Sandbox Code Playgroud)
然后我在数据库中存储一个整数,如下所示:
DayOfWeek days = DayOfWeek.Monday | DayOfWeek.Thursday; // Monday and Thursday
int daysAsInt = (DayOfWeek)days; // Value to save
Run Code Online (Sandbox Code Playgroud)
我可以测试这些日子
if ((days & DayOfWeek.Monday) == DayOfWeek.Monday) /* If days contains Monday */
Run Code Online (Sandbox Code Playgroud)
我的问题是我不知道如何将整数值转换回DayOfWeek.我以为我可以施展它(DayOfWeek)daysAsInt.但它不起作用.
任何建议将非常感激.
我有一个看起来像这样的输入 xml
<log>
<line>
<id>1</id>
<line>
<id>2</id>
<otherLine>
<id>2</id>
<field>
12345-67
</field>
</otherLine>
</log>
Run Code Online (Sandbox Code Playgroud)
我在 esql 中所做的基本上是迭代每个<line>元素,我想从值匹配的<otherLine>地方检索<id>值。
我有这样的代码:
declare inDoc reference to InputRoot.XMLNSC.log;
declare line reference to inDoc;
declare fieldValue character;
move line firstchild name 'line';
while lastmove(line) do
set fieldValue = select r.field from inDoc.otherLine[] as r where r.id = line.id;
-- I want this to be null when hitting the line with <id>1</id> and 12345-67 and hitting the line with <id>2</id>
move …Run Code Online (Sandbox Code Playgroud)