所以很长一段时间我都有一个坏习惯,就是走到一条线的末端,i按下键然后按下右箭头插入最后一个字符后.然而,这是非常低效的,无法做到hjkl.
什么是更好的方式插入线的非常结束?
我对PHP 7中的新功能非常满意.但我对如何在PHP 7中返回一个对象数组感到困惑.
例如,我们有一个类Item
,我们想从函数返回这个类的对象数组:
function getItems() : Item[] {
}
Run Code Online (Sandbox Code Playgroud)
但它不会这样.
我正在寻找一种方法来回答golang中的shell密码提示.
喜欢 :
bussiere@kus:~/Workspace/rteest$ ./passwordtest.sh
Password :
Run Code Online (Sandbox Code Playgroud)
在启动shell命令/脚本后,我想在golang中使用我的令牌自动输入密码...
我已经制作了一些脚本,如果一切正常(在golang中),可以使用mfa获得一次性令牌.所以我需要输入tempory标记到linux密码提示符.
我知道有期望命令,但我想编译我的程序嵌入它并具有最小的依赖性.
感谢致敬
编辑到@nevermore我试过这个(但它不起作用):https://play.golang.org/p/Ffm3q5h636
package main
import (
"os/exec"
"fmt"
"log"
"io"
)
func main() {
cmdb := "git"
args := "clone https://bb@gitlab.com/bb/fzgs.git"
cmd := exec.Command(cmdb, args)
stdin, err := cmd.StdinPipe()
if err != nil {
log.Fatal(err)
}
go func() {
defer stdin.Close()
io.WriteString(stdin, "QSRDFGHJfZERTYU")
}()
out, err := cmd.CombinedOutput()
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", out)
}
Run Code Online (Sandbox Code Playgroud)
它给了我这个:
2017/05/12 20:42:36 exit status 1
exit status 1 …
Run Code Online (Sandbox Code Playgroud) 我正在捕获输出ps aux
:
current_processes=`ps aux | grep "tempdir" | tail -3`
Run Code Online (Sandbox Code Playgroud)
当我回应它时,它看起来像这样
echo $current_processes
19984 10089 17784
Run Code Online (Sandbox Code Playgroud)
当我echo
加双引号时,它看起来像这样:
echo "$current_processes"
19984
10089
17784
Run Code Online (Sandbox Code Playgroud)
当我使用双引号但没有双引号时,为什么将它们放在新行上?
我遇到FireBase推送通知问题.当我的应用程序在后台时,通知即将到来,但是当我的应用程序在前台时我没有收到通知,但在控制台中显示通知,这意味着通知在这里,但它没有显示在通知栏中.你可以帮帮我吗?
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d("OnMessage", "Received");
super.onMessageReceived(remoteMessage);
Log.d(TAG, "From " + remoteMessage.getFrom());
Log.d(TAG, "Body " + remoteMessage.getNotification().getBody());
String aa=remoteMessage.toString();
Intent intent=new Intent(MyFirebaseMessagingService.this, MainActivity.class);
intent.putExtra("msg", aa);
sendNotification(remoteMessage);
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setContentText(remoteMessage.getNotification().getBody());
// remoteMessage.getNotification().getBody();
}
private void sendNotification(RemoteMessage remoteMessage) {
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
PendingIntent.FLAG_ONE_SHOT);
Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setContentText(remoteMessage.getNotification().getBody())
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0 /* …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用“whiptail”在删除一些 RPM 的同时向用户显示进度。使用
{
echo 25
yum remove package_name
echo 50
yum remove package_name
echo 75
yum remove package_name
echo 100
sleep 1
} | whiptail --gauge "Removing RPM's" 6 60 0*
Run Code Online (Sandbox Code Playgroud)
我想是与进度条一起显示消息“删除程序包”,就像当RedHat的安装包 这样的事情 我怎么能做到这一点?
我目前正在考虑自动测试Android手机和其他设备之间的蓝牙连接.
我发现了许多有用的ADB命令,例如
adb shell service call bluetooth_manager 6
adb shell am start -a android.bluetooth.adapter.action.REQUEST_ENABLE
adb shell am start -a android.bluetooth.adapter.action.REQUEST_DISCOVERABLE
adb shell service call bluetooth_manager 8
但无法找到以下操作的任何内容:
这些存在吗?或者我是否需要编写可以执行这些操作的包装Android应用程序?
在我的情况下,我有2个项目项目和活动,他们看起来像这样.
项目是顶部的表格和底部的活动.
在Activity表中,activityID和projectID是主键.
我想要实现的是创建一个View,它返回所有项目,其活动的endDate晚于Project projectionEndDate.
总之,我想这样做:
SELECT *
FROM Project
WHERE (SELECT MAX(endDate) FROM Activity GROUP BY projectID) > projectedEndDate
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Run Code Online (Sandbox Code Playgroud)
谢谢
我已经实现了一个用于插入到用于预订服务的数据库表中的访问控制。它可以正常工作一段时间,然后sem_get()
尽管我sem_release()
在每个sem_get()
.
case 'room':
$key = "room";
$semaphore = sem_get($key, 1, 0666, 1);
if ($semaphore) {
sem_acquire($semaphore);
//do some stuff
if ($already_reserved_rooms < $max_rooms) {
$return="ok";
sem_release($semaphore);
return $return;
}
sem_release($semaphore);
}
else {
//send me mail that semaphore failed
}
return 'no rooms';
break;
Run Code Online (Sandbox Code Playgroud)
我sem_remove()
也应该打电话吗?
我按照这个网站上的步骤。
我有一个像这样*.{jpg,png}
的字符串,但字符串也可能只是*.scss
- 实际上它是一个editorconfig.
然后我想搜索我的git存储库跟踪的这个扩展的每个文件.
我尝试了几种方法,但没有找到任何充分的解决方案.
我得到的最接近的是:
git ls-tree -r master --name-only | grep -E ".*\.jpg"
但这仅适用于单个文件扩展名,而不适用于此类内容git ls-tree -r master --name-only | grep -E ".*\.{jpg,png}"
.
有人可以帮帮我吗?