我正在尝试在kotlin中创建一个简单的未绑定服务,但我不能.当我onBind()在Java中覆盖方法时我可以返回null,但在kotlin中它说我只允许返回IBinder而不是IBinder?,这意味着它不能null.除了将MyService类重写为Java之外,有什么想法可以解决这个问题吗?
[已解决]谢谢,伙计们!我真的可以IBinder改为IBinder?.有用!!
我正在创建一个应用程序,它以一定的时间间隔拍摄桌面的屏幕截图.
代码:
String nme = "";
Bitmap printscreen = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height);
Graphics graphics = Graphics.FromImage(printscreen as Image);
graphics.CopyFromScreen(0, 0, 0, 0, printscreen.Size);
nme = DateTime.Now.ToString();
printscreen.Save(@"F:\Temp\printScre.jpg", ImageFormat.Jpeg);
Run Code Online (Sandbox Code Playgroud)
我正在尝试安装 cx_Oracle,但收到此错误,\n我安装了最新的 setuptools 和 pip。\n有人遇到过类似的问题吗?他们是如何解决的?
\n我有 Visual Studio:请参见图片
\n
Processing c:\\....resources\\cx_oracle-8.1.0.tar.gz\n Installing build dependencies ... done\n Getting requirements to build wheel ... done\n Preparing metadata (pyproject.toml) ... done\nBuilding wheels for collected packages: cx_Oracle\n Building wheel for cx_Oracle (pyproject.toml) ... error\n error: subprocess-exited-with-error\n\n \xc3\x97 Building wheel for cx_Oracle (pyproject.toml) did not run successfully.\n \xc2\xa6 exit code: 1\n ?-> [7 lines of output]\n C:\\....\\2\\pip-build-env-806_5jc6\\overlay\\Lib\\site-packages\\setuptools\\config\\expand.py:144: UserWarning: File \'C:\\\\....\\\\2\\\\pip-install-r8jb3ohi\\\\cx-oracle_111cfa7e3d91425bb65e9a6baa89c82f\\\\README.md\' cannot be found\n warnings.warn(f"File {path!r} cannot be found")\n running bdist_wheel\n running build\n running …Run Code Online (Sandbox Code Playgroud) 我的 php 表单中的输入字段出现问题。看起来像:
<input type="number" name="tmax" max="99" min="-99" placeholder="Temperatura max.">
Run Code Online (Sandbox Code Playgroud)
我想检查该字段是否为空。但问题是 php 认为0是空的。
if (empty($_POST['tmax'])) {
$tmax = null;
}else {
$tmax = $_POST['tmax'];
}
Run Code Online (Sandbox Code Playgroud)
如果用户将输入字段留空,则该值将被视为“null”,这是完美的。但如果用户写入0,这在表单中是可能的,它也会被视为空。
我还在 SQL 中将默认值设置为 null,但问题是,如果输入为空,程序会插入0表中。
解决方案:
这个解决方案对我来说效果很好:
if ($_POST['tmax'] == "") {
$tmax = null;
}else {
$tmax = $_POST['tmax'];
}
Run Code Online (Sandbox Code Playgroud)
并且还与is_numeric()
if (is_numeric($_POST['tmax'])) {
$tmax = $_POST['tmax'];
}else {
$tmax = 'null';
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Flutter 通过 WhatsApp 向多个电话号码发送消息:
sendMessage() async {
var number = ["201020402642", "201030666895"];
var baseUrl = "https://api.whatsapp.com/send/";
var urlIos = "";
number.forEach((element) async {
var url = baseUrl +"?phone=${element} &text=msg";
if (await canLaunch(url)) {
await launch(url);
} else {
print("not installed");
}
});
}
Run Code Online (Sandbox Code Playgroud)
它只向最后一个号码发送消息。
有没有办法向一组号码发送消息?
对于我的 Angular 项目(Angular 14、webpack-dev-server 4.9.3),如果应用程序在 Chrome 下运行,则 web-pack-server 会断开连接并尝试重新连接消息,并且不断循环。但如果在 Edge 下运行,则不会显示该消息。
该消息显示在控制台日志下。
假设我有这段代码:
int i = 31240;
string Number = ((double)i / 1000).ToString("0.#k");
Run Code Online (Sandbox Code Playgroud)
我得到这个结果作为数字的字符串:31,2k
而现在,我想做的恰恰相反,就是把这个字符串"31,2k"带回31240甚至31200,但我不知道该怎么做......有什么想法吗?
有人说这是不可能的.但最后我找到了实现目标的完美方式.我为那些愿意知道的人发布解决方案.使用很简单,它允许进行两种转换:
我正在尝试进行测试,看看是否有某些技能.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class timerup
{
public bool timeup = false;
}
class Program
{
public static void timer()
{
for (int i = 1; i < 3; i++)
{
System.Threading.Thread.Sleep(1000);
if (i == 5)
{
object a;
a = true;
a = new timerup();
timerup ClassRef;
ClassRef = (timerup)a;
ClassRef.timeup = true;
}
}
}
static void Main(string[] args)
{
Console.Title = "The Secret Agent Test";
Console.BackgroundColor = …Run Code Online (Sandbox Code Playgroud) 我相信 Node.js 是向后兼容的。在 Node.js N 中运行的脚本也应该在 Node.js N+1 中运行。有没有我找不到提到这一点的文档?或者除了简单地安装更新版本并进行测试之外,还有其他方法可以了解吗?
几年前,当当前的 Node.js 主要版本是 v5 时,我编写了一些脚本。我想升级系统,但需要确保当前进程不会中断。
我正在尝试练习,这意味着我需要使用按钮从imageView更改图像.整个事情被实施到练习的另一个项目中.
问题是:它甚至没有在第二种情况下打开Toast"测试".
package de.vogella.android.temperature;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.Toast;
public class MainActivity extends Activity{
private EditText text;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
text = (EditText) findViewById(R.id.editText1);
Button button1 = (Button) findViewById(R.id.tempbutton);
Button button2 = (Button) findViewById(R.id.imageconverter);
OnClickListener listener = new OnClickListener() {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tempbutton:
button1Click();
break;
case R.id.imageconverter:
button2Click();
break;
}
}
}; …Run Code Online (Sandbox Code Playgroud) android button switch-statement android-imageview android-button
我试图找到一种方法来动态存储我为 shell 脚本传递的所有参数在数组中。当我必须循环遍历每个参数以进一步使用它们时,这会有所帮助。
这就是我的问题的答案。
#!bin/bash
#Overloop alle gegeven argumenten en sla ze op in arg(plaatsvhargument)
arr=( "$@" )
#Code om te testen of het wel werkt
y=0
while [[ $y -lt $# ]]
do
val=${arr[$y]}
echo $val
(( y++))
done
Run Code Online (Sandbox Code Playgroud)
我知道我可以这样做,从数组中取出每个参数。
for i in ${arr[@]}
do
echo $i
done
Run Code Online (Sandbox Code Playgroud)
我的问题是,当我运行脚本时,我最终保存了参数的位置,并且在此过程中丢失了一个参数。例子:
bash testscript.sh 1 2 2 3 1 gives me 2 2 3 1 (empty)
Run Code Online (Sandbox Code Playgroud)
我做错了什么,你们对我的问题有什么解决办法吗?
下面是我的滑块代码,我遇到了无法读取空读取属性的错误,请添加,请做需要的
$('.main_images').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
asNavFor: '.thumb_images'
});
$('.thumb_images').slick({
slidesToShow: 4,
slidesToScroll: 1,
asNavFor: '.main_images',
dots: false,
focusOnSelect: true,
vertical: true,
arrows:false,
infinite: false,
responsive: [
{
breakpoint: 481,
settings: {
vertical: false,
infinite: true,
slidesToShow: 3,
slidesToScroll: 1
}
}
]
});
});
Run Code Online (Sandbox Code Playgroud) 我最近使用自动脚本从Liferay数据库中删除了120,000个用户.然而,在此之前,我使用DELETE FROM User_ WHERE userId = 1234567从数据库中手动删除了2个用户- 只是为了查看用户可能拥有的任何关联可能会发生什么.
用户已删除,但保留该userId(1234567)的所有其他表行仍然存在.精细.
所以现在我想重新索引所有搜索索引以获取当前的用户列表,但是LR会引发异常:
08:07:41,922 ERROR [http-bio-20110-exec-290][LuceneIndexer:136] Error encountere
d while reindexing
com.liferay.portal.kernel.search.SearchException: com.liferay.portal.NoSuchUserE
xception: No User exists with the key {contactId=1234568}
at com.liferay.portal.kernel.search.BaseIndexer.getDocument(BaseIndexer.j
ava:179)
at com.liferay.portlet.usersadmin.util.ContactIndexer$1.performAction(Con
tactIndexer.java:203)
at com.liferay.portal.kernel.dao.orm.BaseActionableDynamicQuery.performActions
InSingleInterval(BaseActionableDynamicQuery.java:309)
at com.liferay.portal.kernel.dao.orm.BaseActionableDynamicQuery.performActi
Run Code Online (Sandbox Code Playgroud)
对于任何创建的用户,此contactId 似乎比userId高一位数(我可能错了)
所以我的问题是,如何解决这个问题,以便我可以执行reindex?
Liferay EE 6.2 Tomcat 7.0.33 SQL Server