小编che*_*505的帖子

Git克隆到当前目录

我正在尝试将存储库克隆到我当前的目录中.但是,当我使用此命令克隆它时:

git clone REPOURL .
Run Code Online (Sandbox Code Playgroud)

它说:

fatal: destination path '.' already exists and is not an empty directory.
Run Code Online (Sandbox Code Playgroud)

我克隆的文件夹已经存在,我只想添加我在git repo中的文件.

有什么方法可以做到这一点吗?

谢谢

git

16
推荐指数
1
解决办法
2万
查看次数

Laravel Migrations - 创建时间戳时出现的问题

我正在尝试在我的Laravel实例上运行迁移.它们只是默认迁移(用户和密码重置),但是当它尝试生成时间戳时会抛出此错误:

 [Illuminate\Database\QueryException]
 SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created_at' (SQL: create table `
 users` (`id` int unsigned not null auto_increment primary key, `name` varchar(255) not null, `email` varchar(255) n
 ot null, `password` varchar(60) not null, `remember_token` varchar(100) null, `created_at` timestamp default 0 not
 null, `updated_at` timestamp default 0 not null) default character set utf8 collate utf8_unicode_ci)
Run Code Online (Sandbox Code Playgroud)

以及PDOException:

SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created_at'
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?

谢谢.

php mysql migration laravel

13
推荐指数
2
解决办法
1万
查看次数

php-serial无法正常工作

我正在尝试使用PHP让我的Arduino发出信号.每当我运行下面的代码时,它会显示"无效的串口",虽然它有效吗?

<?php

include 'serial_connect.php';

$serial = new phpSerial;

$serial->deviceSet("COM2");

$serial->deviceOpen();

$serial->sendMessage("1000");

$serial->deviceClose();
?>
Run Code Online (Sandbox Code Playgroud)

serial_connect.php类是php-serial,链接在这里:http://www.phpclasses.org/package/3679-PHP-Communicate-with-a-serial-port.html

这是我的Arduino草图:

int ledPin = 13;

void setup() {
    pinMode(ledPin, OUTPUT);
    Serial.begin(9600);
}

void loop() {
    if(Serial.available() > 0) {
        int time = Serial.parseInt();        
        digitalWrite(ledPin, HIGH);
        delay(time);
        digitalWrite(ledPin, LOW);
    }
}
Run Code Online (Sandbox Code Playgroud)

请帮忙.谢谢.

php windows serial-port arduino

7
推荐指数
1
解决办法
2591
查看次数

单个按钮上的 HTML DELETE 方法

我将 Laravel 与Route::resource()控制器一起使用,并删除运行该函数所需的内容destroy()。此方法需要 DELETE HTTP 方法才能执行。如何通过单个按钮执行此操作?

谢谢

laravel

6
推荐指数
1
解决办法
1万
查看次数

使用Java将数据发送到Arduino Uno

我刚刚买了一个Arduino Uno,我正在尝试制作一个闪烁的LED.我想知道如何做到这一点,我看了Arduino Playground并找到了一个程序来获取输入.我需要输出到Arduino.除了Java之外,我不可能使用任何东西,因为我已经有了另一个需要Arduino的程序.请留下任何想法.

java arduino

5
推荐指数
1
解决办法
1万
查看次数

Java if()不起作用

当我运行一些代码(稍后显示)时,我告诉它检查字符串=="1",如果是,输出"它是1!",否则输出字符串.

码:

double shirt3 = Math.random() * 9;
String shirt2 = Double.toString(shirt3);
char shirt1 = shirt2.charAt(0);
String shirt = Character.toString(shirt1);

if(shirt == "1") {
    System.out.println("It's 1!");
} else {
    System.out.println(shirt);
}
Run Code Online (Sandbox Code Playgroud)

输出:

7
4
8
1
7
1
7
7
6
0

java numbers

3
推荐指数
2
解决办法
823
查看次数

将文件添加到ZIP文件

我试图将一些文件添加到ZIP文件,它创建文件但不添加任何内容.代码1:

String fulldate = year + "-" + month + "-" + day + "-" + min;

File dateFolder = new File("F:\\" + compname + "\\" + fulldate);
dateFolder.mkdir();

String zipName = "F:\\" + compname + "\\" + fulldate + "\\" + fulldate + ".zip";

zipFolder(tobackup, zipName);
Run Code Online (Sandbox Code Playgroud)

我的功能:

public static void zipFolder(File folder, String name) throws Exception {
    byte[] buffer = new byte[18024];

    ZipOutputStream out = new ZipOutputStream(new FileOutputStream(name));
    FileInputStream in = new FileInputStream(folder);

    out.putNextEntry(new ZipEntry(name));

    int len;

    while((len = …
Run Code Online (Sandbox Code Playgroud)

java directory zip fileinputstream zipoutputstream

1
推荐指数
1
解决办法
2万
查看次数

访问命名空间之外的 PHP 类

我正在尝试扩展mysqli到我的命名空间之外。每当我运行它时,它都无法mysqli在命名空间内找到。如何访问mysqli命名空间之外的内容?

这是我的代码:

<?php

namespace xBell\Database;

class Database extends mysqli {
    public function __construct() {
        $hostname = \eBot\Config\Config::getInstance()->getMySQLIP();
        $username = \eBot\Config\Config::getInstance()->getMySQLUser();
        $password = \eBot\Config\Config::getInstance()->getMySQLPassword();
        $database = \eBot\Config\Config::getInstance()->getMySQLIP();

        parent::__construct($hostname, $username, $password, $database);

        if(mysqli_connect_error()) {
            \eBot\Printer\Printer::error("Unable to connect to the MySQL server! Error: " . mysqli_connect_error());
        }
    }
}

?>
Run Code Online (Sandbox Code Playgroud)

谢谢!

php mysqli namespaces

1
推荐指数
1
解决办法
680
查看次数

Arduino - 需要疯狂的0才能使LED持续3秒

我正在做一个用arduino制作响铃的项目,当我第一次尝试时,它的工作方式我想要它(wait(Serial.read())),但现在我需要0通过串口发送100 多个才能显示4秒 这是我的Java代码: 为长期做准备

Main.ringBell("100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");

public static void ringBell(String length) throws Exception {
     output.write(length.getBytes());
     output.flush();
}
Run Code Online (Sandbox Code Playgroud)

这是Arduino草图:

int ledPin = 13;

void setup() {
    pinMode(ledPin, OUTPUT);
    Serial.begin(9600);
}

void loop() {
    if(Serial.available() > 0) {
        digitalWrite(ledPin, HIGH);
        delay(Serial.read());
        digitalWrite(ledPin, LOW);
    }
}
Run Code Online (Sandbox Code Playgroud)

有没有人在我的代码中看到错误?如果是这样,请告诉我什么是错的,我会解决它.

谢谢.

serial-port arduino

0
推荐指数
1
解决办法
271
查看次数

如何使用PHP处理JSON数组中的值

我试图name从这块JSON中获取值:

{
  "tournament": {
    "id": 1605872,
    "name": "eBotMatchMakerTest",
    "event_id": null,
    "participants": [
      {
        "participant": {
          "id": 24899481,
          "tournament_id": 1605872,
          "name": "Team1",
          "seed": 1,
          "active": true,
          "created_at": "2015-04-18T07:05:48.601-05:00",
          "updated_at": "2015-04-18T07:05:48.601-05:00",
          "invite_email": null,
          "final_rank": null,
          "misc": null,
          "icon": null,
          "on_waiting_list": false,
          "invitation_id": null,
          "group_id": null,
          "checked_in_at": null,
          "challonge_username": null,
          "challonge_email_address_verified": null,
          "removable": true,
          "participatable_or_invitation_attached": false,
          "confirm_remove": true,
          "invitation_pending": false,
          "display_name_with_invitation_email_address": "Team1",
          "email_hash": null,
          "username": null,
          "display_name": "Team1",
          "attached_participatable_portrait_url": null,
          "can_check_in": false,
          "checked_in": false,
          "reactivatable": false
        }
      }
    ],
    "matches": [ …
Run Code Online (Sandbox Code Playgroud)

php json

0
推荐指数
1
解决办法
35
查看次数