$username = ''是$username的默認(rèn)參數(shù),可以使用new User()或new User('abc')來給User類的$username屬性賦值$username = []是一種好的習(xí)慣,對(duì)$username進(jìn)行初始化,參見手冊(cè)PHP基礎(chǔ),初始化變量
<?php
function test($res){
$ret = [];
if($res){
$ret = [1,2,3];
}
return $ret;
}
function test2($res){
if($res){
$ret = [1,2,3];
}
return $ret;
}
var_dump(test(false));
var_dump(test2(false));$PATH(打開adb shell可查看該環(huán)境變量)對(duì)應(yīng)的目錄下你沒有把原型寫清楚,如果getitem函數(shù)/方法有一個(gè)返回值來指示錯(cuò)誤信息,那對(duì)于 C++ 這種單返回值的語言,只能把返回的數(shù)據(jù)通過指針傳回來。
如果不是,那可能寫書的這個(gè)人喜歡這樣寫吧。
看你給出的代碼,你以前沒寫過“異步”結(jié)構(gòu)的代碼嗎?
js 里拿數(shù)據(jù)都是異步的,不是同步的,沒有 return ,只有 callback 。
寬的可能是用meta標(biāo)簽設(shè)置的,窄的可能是知乎自己寫的
https://www.kernel.org/
https://github.com/torvalds/l...
找一本參考書比較好,只看源碼有難度
已經(jīng)解決了問題,首先要修改一下pom.xml中的build里面的配置。
然后要把本地的jar包都用maven來進(jìn)行管理。
貼上我的pom.xml文件供大家參考。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.qd</groupId>
<artifactId>portal</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<name>portal</name>
<description>Intelligence Connect Electric Drill</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!–<scope>provided</scope>–>
</dependency>-->
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>-->
<!-- 添加mysql的依賴 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!-- 添加jpa的支持 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.12.RELEASE</version>
</dependency>
<dependency>
<groupId>com.qd</groupId>
<artifactId>commons</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<!-- 嘗試加一下core依賴 -->
<dependency>
<groupId>com.qd</groupId>
<artifactId>core</artifactId>
<version>1.0.0</version>
</dependency>
<!-- 把他們都改成maven引入,1-16 -->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>3.2.3</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<!-- Mqtt -->
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
你可以在pom.xml中使用相對(duì)路徑指定submodule的位置,如
父項(xiàng)目中
<modules>
<module>../module1</module>
<module>../module2</module>
<module>../module3</module>
</modules>
子模塊中
<parent>
<groupId>my.awsome.module1</groupId>
<artifactId>parent-pom</artifactId>
<version>1.0.1<version>
<relativePath>../parent-pom/pom.xml</relativePath>
</parent>
但顯然這不是什么好的做法, 最好重新規(guī)劃項(xiàng)目路徑, 避免因?yàn)檫@個(gè)產(chǎn)生的各種微妙的小問題.
打開藍(lán)牙的HCI log ,抓取hci log 看看通訊情況 ,hci log 可以用 wireshark 軟件查看 hci log文件一般會(huì)保存SD卡目錄下,也有的手機(jī)保持其他路徑,可以找 /etc下的藍(lán)牙配置文件查看保持路徑
你把反編譯前的 apk 后綴改為 zip 再解壓看看,里面應(yīng)該也有 classes.dex classes2.dex classes3.dex classes4.dex 等文件,這是因?yàn)?apk 中方法數(shù)超過了 65536 個(gè),使用了 multidex support library 將一個(gè) apk 中的 dex 文件分割成多個(gè) dex 文件的緣故。相關(guān)知識(shí)可以搜索 "android 65k" 來進(jìn)行了解。
callback-回調(diào).
this._rowsData.foreach(v=>document.querySelector("<selector>").value = v.xxx) public function msgId($spid, $sqid)
{
$timeStr = time();
//echo bindec(sprintf("%04s%05s%05s%06s%06s%022s%016s",decbin(date('m', $timeStr)),decbin(date('d', $timeStr)),decbin(date('H', $timeStr)),decbin(date('i', $timeStr)),decbin(date('s', $timeStr)),decbin($spid), decbin($sqid)));
return bindec(sprintf("%04s%05s%05s%06s%06s%022s%016s",decbin(date('m', $timeStr)),decbin(date('d', $timeStr)),decbin(date('H', $timeStr)),decbin(date('i', $timeStr)),decbin(date('s', $timeStr)),decbin($spid), decbin($sqid)));
}
$this->msgId('600010','2');
在這里面給你糾正一下思路
第一: 64位里面只能存0-1之間的數(shù)值,也就是說都是2進(jìn)制數(shù)據(jù)
所以拼接一下2進(jìn)制數(shù)據(jù)就好了
月份(1-12)(【0001-1100】區(qū)間 4位)decbin(date('m', $timeStr))
日(1-31)(【00001-11111】區(qū)間 5位)decbin(date('d', $timeStr))
時(shí)(1-24)(【00001-11000】區(qū)間 5位)decbin(date('H', $timeStr))
分(1-59)(【000001-111011】區(qū)間 6位)decbin(date('i', $timeStr))
秒(1-59)(【000001-111011】區(qū)間 6位)decbin(date('s', $timeStr))
網(wǎng)關(guān)代碼(【0~0 - 1~1】22位)decbin($spid1)
// (如果這個(gè)網(wǎng)關(guān)代碼是22位0和1組成就不用decbin,本身就是2進(jìn)制了,如果不是的話,就變成二進(jìn)制)
序列號(hào)(區(qū)間 16位)decbin($spid2)
網(wǎng)關(guān)代碼多少位我沒洗數(shù),序列號(hào),什么的位數(shù)你自己調(diào)就行了%04d%06d%05d%06d%06d【%021d%016d】<-這里 如果沒算錯(cuò)的話是4+5+5+6+6+22+16應(yīng)該是64位了,那么這64位是一個(gè)2進(jìn)制的字符串,用bindec()轉(zhuǎn)換成十進(jìn)制的數(shù)值,存進(jìn)數(shù)據(jù)庫(kù)里面,那么數(shù)據(jù)庫(kù)存貯的2進(jìn)制數(shù)據(jù)就是符合你要的規(guī)定了,而且10進(jìn)制數(shù)據(jù),8位,64字節(jié),完美
變量名用點(diǎn)心$spid, $sqid 我以為是一個(gè)
下面這種方法也是簡(jiǎn)單,邏輯上不好理解,但是還是挺簡(jiǎn)單的,學(xué)習(xí)了
$messageId = 0;
$messageId |= $m << 60;
$messageId |= $d << 55;
$messageId |= $h << 50;
$messageId |= $i << 44;
$messageId |= $s << 38;
$messageId |= $spid << 16;
$messageId |= $sqid & 0xff;
echo $messageId
問題一,是的,listen參數(shù)backlog就是這個(gè)沒有建立(accept)的連接隊(duì)列的最大長(zhǎng)度,不過系統(tǒng)內(nèi)核還有另外一個(gè)上限控制,backlog不是隨便設(shè)多大就行。
問題二,這個(gè)socket對(duì)象在內(nèi)核內(nèi)存里,你只有它的句柄(fd)。
內(nèi)核其中包括收發(fā)的緩沖區(qū)。你不能直接讀寫它,內(nèi)核收發(fā)時(shí)read或send時(shí),會(huì)把內(nèi)核緩沖區(qū)的數(shù)據(jù)拷貝到用戶空間或者反之。能接收多少數(shù)據(jù)取決于內(nèi)核和網(wǎng)卡驅(qū)動(dòng)的參數(shù)配置,即相應(yīng)內(nèi)核緩沖區(qū)的大小。不同的IP連接有不同的描述符,不同進(jìn)程之間也是隔離的,都在內(nèi)核里統(tǒng)一維護(hù)。如果放不下。UDP會(huì)導(dǎo)致丟包,TCP連接對(duì)方則會(huì)嘗試重發(fā)。
從調(diào)試工具比如gdb那拿到的結(jié)果有時(shí)不能保證是正確的。至于這到底是為什么,這也許是gdb的問題,在深入的話我也不了解了(如果有人知道的話,還請(qǐng)?jiān)谠u(píng)論區(qū)指教)。這也是為什么有的時(shí)候用IDE的單步跟蹤查看變量值可能是不正確的。
如果打log的話,就可以保證完全正確了。
用post提交表需要確認(rèn)服務(wù)器需要的數(shù)據(jù)項(xiàng),然后組成json對(duì)。
requests.post(url=url, data=data)
我覺得樓主說的是data的提交。
一般用瀏覽器的開發(fā)者工具確認(rèn)網(wǎng)頁(yè)請(qǐng)求時(shí)候的方法,cookie,請(qǐng)求頭等等
也就是說data也可以在這里找到
模擬一次提交表的過程,就可以看到提交的參數(shù)項(xiàng)了
requests.post(headers=headers,params=json.dumps(payload),url=url)
嗯嗯嗯,用的payload。我錯(cuò)了。。。
答案來了。
const axios = require('axios')
// 下面代碼發(fā)送一個(gè)post請(qǐng)求到一個(gè)服務(wù)器
axios.post('驗(yàn)證驗(yàn)證碼的目標(biāo)url', {
telephone: "17202345234" // 帶上手機(jī)號(hào)參數(shù)
})
.then(function (response) { // 后端處理成功,給你返回一個(gè)驗(yàn)證碼數(shù)據(jù),數(shù)據(jù)通過response讀取
console.log(response.testnumber);
return axios.post('獲取驗(yàn)證碼成功再發(fā)送一次請(qǐng)求的地址',{
password: "我是密碼",
telephone: "17202345234",
noteinfo: "我是備注"
})
})
.then(function(res){
//完成注冊(cè)了
console.log("注冊(cè)完成");
})
.catch(function (error) { // 如果請(qǐng)求失敗就走這里了
console.log(error);
});已解決.
java對(duì)于帶報(bào)名的類的查找是需要路徑的,看修改就知道了.
mkdir com
mv MyTest.jar com/
tar cvf MyTest.jar com
代碼如上,ppp可以成功返回沒有報(bào)錯(cuò),ppp是個(gè)左值,那肯定不會(huì)是移動(dòng)的吧,那就要執(zhí)行拷貝構(gòu)造函數(shù)吧,但是unique_ptr沒有拷貝構(gòu)造啊。。。。
你這個(gè)判斷是錯(cuò)的,給你一個(gè)例子如下:
#include <iostream>
#include <memory>
using namespace std;
static unique_ptr<int> p1 = std::make_unique<int>(10);
// move -> copy construction -> failed
unique_ptr<int> foo()
{
auto p = make_unique<int>(10);
return p; // 1 ok p is local parameter(rvalue) can run it with move
//return move( p ); // 2 also ok
//return p1; // NOK. p1 is lvalue can not performance move on it.
}
int main()
{
unique_ptr<int> p = foo();
cout << *p << endl;
return 0;
}
首先,ppp是return回來的局部值,這是右值而不是左值;
其次,std::unique_ptr不接受左值作為入?yún)⒌目截悩?gòu)造函數(shù). 只有這個(gè):
unique_ptr( unique_ptr&& u ) noexcept;
你再揣摩一下這個(gè)例子吧:
https://github.com/lynnboy/Cp...
HttpClient post請(qǐng)求了解一下
Java使用HttpClient實(shí)現(xiàn)Post請(qǐng)求
已解決。只要加一個(gè)空插槽就行了
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國(guó)IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國(guó)家
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國(guó)一站式人才培養(yǎng)平臺(tái)、一站式人才輸送平臺(tái)。2014年4月3日在美國(guó)成功上市,融資1
北大課工場(chǎng)是北京大學(xué)校辦產(chǎn)業(yè)為響應(yīng)國(guó)家深化產(chǎn)教融合/校企合作的政策,積極推進(jìn)“中國(guó)制造2025”,實(shí)現(xiàn)中華民族偉大復(fù)興的升級(jí)產(chǎn)業(yè)鏈。利用北京大學(xué)優(yōu)質(zhì)教育資源及背
博為峰,中國(guó)職業(yè)人才培訓(xùn)領(lǐng)域的先行者
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動(dòng)互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項(xiàng)目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺(tái)面向?qū)ο箝_發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫(kù),具有快速界面開發(fā)的能力,對(duì)瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁(yè)制作和網(wǎng)頁(yè)游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國(guó)Software AG 技術(shù)顧問,美國(guó)Dachieve 系統(tǒng)架構(gòu)師,美國(guó)AngelEngineers Inc. 系統(tǒng)架構(gòu)師。