read 方法的定義是讀取流中的字節(jié),如果流中有字節(jié),并且字節(jié)數(shù)組也是有空間的話,那么就將其讀取道整個(gè)字節(jié)數(shù)組中,出現(xiàn)這個(gè)情況的原因,我只能說是 stream 中的數(shù)據(jù)暫時(shí)就這么多. 就只有 27 個(gè)字節(jié),多的還在路上.
從這個(gè)方面去想的話,我覺得的網(wǎng)絡(luò)方面的原因,可能是這樣導(dǎo)致流尚未完全傳送完.
而后我換了一下幾個(gè)url進(jìn)行嘗試都是可以的正常讀取的.
http://114.67.130.61/
https://api.github.com/users/chenshun00
baidu
全部顯示是可以正常讀取的.
其次我打開你給的URL看了一下,發(fā)送了 65 個(gè)請(qǐng)求, 157 KB,耗時(shí)了 2.12 s.
以上屬于跟人猜測(cè).
直接用android studio不行嗎?
隨機(jī)端口的問題:設(shè)置下列啟動(dòng)參數(shù)為同一個(gè)端口即可。
com.sun.management.jmxremote.port
com.sun.management.jmxremote.rmi.port
對(duì) Java 7 update 25以后的版本有效。
安全及防火墻的問題:建議采用ssh隧道的方式進(jìn)行訪問,這是通用的安全遠(yuǎn)程訪問方式,對(duì)所有類型的訪問都有效。
參考
https://bugs.java.com/bugdata...
user.dir 指向的是你啟動(dòng) JVM 的地方,你可以看看這里
代碼一是你從工程路徑下啟動(dòng)的,但是代碼二你的 Servlet 是被容器 (Tomcat等等)加載進(jìn) JVM 的,而此時(shí) user.dir 指的是這些容器的路徑,這方面你需要了解一下容器是怎樣運(yùn)行的。
你在 E:\workspace\outer\javaConnectR 寫代碼,這是開發(fā)環(huán)境,但是當(dāng)你打包成 .war 時(shí),它會(huì)被容器解壓到一個(gè)目錄,比如你代碼二中輸出的 E:\workspace\...\wtpwebapps\javaConnectR\,此時(shí)它無論如何也不可能按你所想去讀到開發(fā)時(shí)的路徑,因?yàn)榇a二實(shí)際運(yùn)行的時(shí)候文件已經(jīng)不在你開發(fā)的路徑上了。
getOptimalPreviewSize 的第一個(gè)參數(shù)是硬件所支持的尺寸列表,后面長寬是你想要顯示的UI尺寸。
所以預(yù)覽的圖片顯示是經(jīng)過修正的,并不是攝像頭看到的實(shí)際尺寸。
個(gè)人想法
方案1.只是用完全匹配的尺寸,即UI尺寸和硬件尺寸相同比例的size (不太好,特別是低檔機(jī)的硬件支持?jǐn)?shù)少,會(huì)很模糊)
方案2.拿到拍攝后的圖后修圖。不直接用系統(tǒng)相機(jī)生成的圖,用工具類裁剪后保存。
.roll-inner2 {
animation: roll 8s infinite linear;
animation-delay: 4s;
}
animation-delay這個(gè)改下
像1樓一樣,前后端傳值一般是定義一個(gè)Dto對(duì)象。使用hibernate-validation對(duì)Dto參數(shù)進(jìn)行校驗(yàn),BeanUtils.copyProperties()方法進(jìn)行屬性值替換。
你數(shù)據(jù)庫和程序是部署在一起的嗎?如果是,其實(shí)直接都是localhost都是可以,都是指向的是自己本機(jī)。但是用127.0.0.1更好
http://blog.csdn.net/qq_17864...
異常原因:是因?yàn)閙yeclipse10不支持jdk1.8導(dǎo)致,換成最新的myeclipse或者eclipse,然后配置jdk1.8,問題得到解決。
BeanFactory是Spring中IOC容器最核心的接口,遵循了IOC容器中所需的基本接口。例如我們很常見的:ApplicationContext,XmlBeanFactory 等等都使用了BeanFactory這個(gè)接口。
FactoryBean是工廠類接口,當(dāng)你只是想簡單的去構(gòu)造Bean,不希望實(shí)現(xiàn)原有大量的方法。它是一個(gè)Bean,不過這個(gè)Bean能夠做為工廠去創(chuàng)建Bean,同時(shí)還能修飾對(duì)象的生成。
總結(jié):FactoryBean比BeanFactory在生產(chǎn)Bean的時(shí)候靈活,還能修飾對(duì)象,帶有工廠模式和裝飾模式的設(shè)計(jì)思想在里面,不過它的存在還是以Bean的形式存在。
直接看MyBatis的SqlSessionFactoryBean就明白了
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="typeAliasesPackage" value="com.george"/>
<property name="typeAliasesSuperType" value="com.george.common.persistence.BaseEntity"/>
<property name="mapperLocations" value="classpath:/mappings/**/**/*.xml"/>
<property name="configLocation" value="classpath:/mybatis-config.xml"></property>
</bean>
Spring會(huì)調(diào)用SqlSessionFactoryBean這個(gè)實(shí)現(xiàn)了FactoryBean的工廠Bean 同時(shí)加載dataSource,Mapper文件的路徑,對(duì)sqlSessionFactory進(jìn)行初始化(這里就不貼源碼了 源碼看一下)
BeanFactory因?yàn)槭呛诵慕涌?,編寫?fù)雜邏輯很容易接觸到其他不必要的接口,不好實(shí)現(xiàn)。
如果是FactoryBean就簡單很多,SqlSessionFactoryBean這個(gè)工廠Bean生產(chǎn)不同數(shù)據(jù)源的sqlSessionFactory,同時(shí)加載相應(yīng)的配置信息。
你把 res 變量打印出來, 我猜值是: "json : 瀏覽器不支持..."
你看提示, 和fastjson并沒有什么關(guān)系. 是你自己的邏輯錯(cuò)誤.
注意:python3以后才支持yield from語法
import collections
def flatten(d, prefix="", sep="_"):
def _take_prefix(k, v, p):
if p:
yield from flatten(v, "{}{}{}".format(p, sep, k))
else:
yield from flatten(v, str(k))
if isinstance(d, dict):
for k, v in d.items():
if isinstance(v, str) or not isinstance(v, collections.Iterable):
if prefix:
yield "{}{}{}".format(prefix, sep, k), v
else:
yield k, v
elif isinstance(v, dict):
yield from _take_prefix(k, v, prefix)
elif isinstance(v, list):
for i in v:
yield from _take_prefix(k, i, prefix)
else:
pass
else:
pass
dic = {your dataset}
for key, value in flatten(dic):
print("{}: {}".format(key, value))
結(jié)果如下,應(yīng)該能拍平了
status: changed
dataset_id: 5a4b463c855d783af4f5f695
dataset_name: AE_E
dataset_label: 1- ADVERSE EVENTS - Not Analyzed
details_variables_variable_id: 5a4b4647855d783b494f9d3f
details_variables_variable_name: CPEVENT
details_variables_variable_label: CPEVENT
details_variables_status: changed
details_variables_details_r_type_new_value: unary
details_variables_details_r_type_old_value: factor
details_variables_message: Variable with different R Type
details_variables_variable_id: 5a4b4647855d783b494f9d25
details_variables_variable_name: CPEVENT2
details_variables_variable_label: CPEVENT2
details_variables_status: changed
details_variables_details_r_type_new_value: unary
details_variables_details_r_type_old_value: binary
details_variables_message: Variable with different R Type
details_variables_variable_id: 5a4b4647855d783b494f9d26
details_variables_variable_name: CP_UNSCHEDULED
details_variables_variable_label: CP_UNSCHEDULED
details_variables_status: changed
details_variables_details_r_type_new_value: undefined
details_variables_details_r_type_old_value: unary
details_variables_message: Variable with different R Type
details_variables_variable_id: 5a4b4647855d783b494f9d02
details_variables_variable_name: VISIT_NUMBER
details_variables_variable_label: VISIT_NUMBER
details_variables_status: changed
details_variables_details_r_type_new_value: unary
details_variables_details_r_type_old_value: integer
details_variables_message: Variable with different R Type
details_variables_variable_id: 5a4b4647855d783b494f9ccf
details_variables_variable_name: VISIT_NUMBER2
details_variables_variable_label: VISIT_NUMBER2
details_variables_status: changed
details_variables_details_r_type_new_value: unary
details_variables_details_r_type_old_value: binary
details_variables_message: Variable with different R Type
details_many_visits: None
針對(duì)你修改后的問題, 再加個(gè)函數(shù)就搞定:
# 這個(gè)fuck_all函數(shù)比較特例, 完全是針對(duì)你要區(qū)分的dataset下面的N個(gè)變量信息這種需求
def fuck_all(dic, prefix="details_variables"):
lst = list(flatten(dic)) # flatten函數(shù)則比較通用,任何嵌套數(shù)據(jù)集都可以用它拍平
lines = []
top = {k: v for k, v in lst if not k.startswith(prefix)}
index = 0
for key, value in lst:
if not key.startswith(prefix):
continue
else:
if not lines:
lines.append(top.copy())
if key in lines[index].keys():
index += 1
lines.append(top.copy())
lines[index][key] = value
return lines
d = {your dataset}
for i in fuck_all(d):
print(i)
結(jié)果長這樣,應(yīng)該是能滿足你需求了
{'status': 'changed', 'dataset_id': '5a4b463c855d783af4f5f695', 'dataset_name': 'AE_E', 'dataset_label': '1- ADVERSE EVENTS - Not Analyzed', 'details_many_visits': None, 'details_variables_variable_id': '5a4b4647855d783b494f9d3f', 'details_variables_variable_name': 'CPEVENT', 'details_variables_variable_label': 'CPEVENT', 'details_variables_status': 'changed', 'details_variables_details_r_type_new_value': 'unary', 'details_variables_details_r_type_old_value': 'factor', 'details_variables_message': 'Variable with different R Type'}
{'status': 'changed', 'dataset_id': '5a4b463c855d783af4f5f695', 'dataset_name': 'AE_E', 'dataset_label': '1- ADVERSE EVENTS - Not Analyzed', 'details_many_visits': None, 'details_variables_variable_id': '5a4b4647855d783b494f9d25', 'details_variables_variable_name': 'CPEVENT2', 'details_variables_variable_label': 'CPEVENT2', 'details_variables_status': 'changed', 'details_variables_details_r_type_new_value': 'unary', 'details_variables_details_r_type_old_value': 'binary', 'details_variables_message': 'Variable with different R Type'}
{'status': 'changed', 'dataset_id': '5a4b463c855d783af4f5f695', 'dataset_name': 'AE_E', 'dataset_label': '1- ADVERSE EVENTS - Not Analyzed', 'details_many_visits': None, 'details_variables_variable_id': '5a4b4647855d783b494f9d26', 'details_variables_variable_name': 'CP_UNSCHEDULED', 'details_variables_variable_label': 'CP_UNSCHEDULED', 'details_variables_status': 'changed', 'details_variables_details_r_type_new_value': 'undefined', 'details_variables_details_r_type_old_value': 'unary', 'details_variables_message': 'Variable with different R Type'}
{'status': 'changed', 'dataset_id': '5a4b463c855d783af4f5f695', 'dataset_name': 'AE_E', 'dataset_label': '1- ADVERSE EVENTS - Not Analyzed', 'details_many_visits': None, 'details_variables_variable_id': '5a4b4647855d783b494f9d02', 'details_variables_variable_name': 'VISIT_NUMBER', 'details_variables_variable_label': 'VISIT_NUMBER', 'details_variables_status': 'changed', 'details_variables_details_r_type_new_value': 'unary', 'details_variables_details_r_type_old_value': 'integer', 'details_variables_message': 'Variable with different R Type'}
{'status': 'changed', 'dataset_id': '5a4b463c855d783af4f5f695', 'dataset_name': 'AE_E', 'dataset_label': '1- ADVERSE EVENTS - Not Analyzed', 'details_many_visits': None, 'details_variables_variable_id': '5a4b4647855d783b494f9ccf', 'details_variables_variable_name': 'VISIT_NUMBER2', 'details_variables_variable_label': 'VISIT_NUMBER2', 'details_variables_status': 'changed', 'details_variables_details_r_type_new_value': 'unary', 'details_variables_details_r_type_old_value': 'binary', 'details_variables_message': 'Variable with different R Type'}
送佛送到西好了
from functools import reduce
import json
import pandas as pd
with open("your dataset file", "r") as fh:
dic = json.load(fh)
df = pd.DataFrame(reduce(lambda x, y: x + y, (fuck_all(i) for i in dic)))
df.to_csv("out.csv", index=False)
成品
模擬登陸一般有兩種,一種是直接構(gòu)建數(shù)據(jù)包,一種是模擬人操作
你可以直接用個(gè)模擬器,像webdriver,phantomjs等,直接找到對(duì)應(yīng)的文本框,輸入賬號(hào)密碼,把驗(yàn)證碼截出來,自動(dòng)識(shí)別或者人工輸入,當(dāng)然如果是暴力的話,不知道網(wǎng)站是不是存在驗(yàn)證碼失效的問題,最后模擬點(diǎn)擊登錄就好了
對(duì), 如果需要加上事務(wù)的話, 可以試下通過 AopContext.currentProxy() 獲取到代理對(duì)象, 然后再調(diào)用do2.
幾乎可以肯定是nginx配置,試試配置proxy_http_version 1.1;
natapp可以,配置也比較簡單https://natapp.cn/
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國一站式人才培養(yǎng)平臺(tái)、一站式人才輸送平臺(tái)。2014年4月3日在美國成功上市,融資1
北大課工場(chǎng)是北京大學(xué)校辦產(chǎn)業(yè)為響應(yīng)國家深化產(chǎn)教融合/校企合作的政策,積極推進(jìn)“中國制造2025”,實(shí)現(xiàn)中華民族偉大復(fù)興的升級(jí)產(chǎn)業(yè)鏈。利用北京大學(xué)優(yōu)質(zhì)教育資源及背
博為峰,中國職業(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庫,具有快速界面開發(fā)的能力,對(duì)瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國Software AG 技術(shù)顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。