鍍金池/ 問答/ 網(wǎng)絡(luò)安全問答
離殤 回答

自問自答。

module = __import__('module.%s' % modulename)
class_ = module()
func = getattr(class_, 'func')
func()
不將就 回答

data-*這部分不是 arttemplate的語法
只有{{ }} <% %>這種模板語法才是art的

你給的源代碼太少 看看是不是其他組件的吧

尐懶貓 回答

Apache,項(xiàng)目文件下有.htaccess文件
內(nèi)容

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule  ^$ public/    [L]
    RewriteRule  (.*) public/$1 [L]
</IfModule>
真難過 回答

注意: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)

成品

clipboard.png

怣痛 回答

1.查看自己的 ip,以及網(wǎng)關(guān)

假如自己的ip是 192.168.20.50,網(wǎng)關(guān):192.168.20.100
那么另一個(gè)人的配置應(yīng)該為:
192.168.20.xxx, 網(wǎng)關(guān)一致。

2.設(shè)置 homestead 配置

在 Homestead 目錄下面的 homestead.yaml:

追加配置:
networks:
- type: "public_network"
    ip: "192.168.20.10" //這里是重點(diǎn),配置成局域網(wǎng)同ip段的
    bridge: "en1: Wi-Fi (AirPort)"

3.重啟 homestead

vagrant reload
厭惡我 回答

而且這個(gè)正則還有個(gè)bug
console.log(numberWithCommas(12345678912.1234))
12,345,678,912.1,234
小數(shù)后面不能正確處理,不知道哪位大神可以幫忙修正下

20180606更新:
自己這幾天沒事就關(guān)注下正則,整了個(gè)答案:

clipboard.png

/(B(?=(d{3})+(?!d)D))|(B(?<=D(d{3})+))/g

離魂曲 回答

一般這種問題都是logstash 啟動(dòng)時(shí)使用的配置寫錯(cuò)了,貼一下配置

毀了心 回答

變量是零時(shí)存儲(chǔ)到內(nèi)存中,腳本執(zhí)行完畢變量就不存在了,緩存是存在文件或者內(nèi)存中,緩存有效期內(nèi)是有效的,內(nèi)存緩存當(dāng)重啟后也就不存在了!

局外人 回答

我記得weex debug是不支持windows的,不知道是不是記錯(cuò)了...

怣痛 回答
DataGridView 改變一下`Id`呢、
可能多個(gè)`Id`造成了報(bào)錯(cuò)
解夏 回答

一般的做法是定義一個(gè)中間寬度,1200px或者1000px,具體的值要根據(jù)你的設(shè)計(jì)稿來定。這個(gè)中間寬度里的尺寸直接根據(jù)設(shè)計(jì)稿的尺寸1:1來就行了,兩邊寬度自適應(yīng),中間寬度居中,就好了。

陌璃 回答

setTimeout 與 setInterval沒有精度可言, 它們只是把任務(wù)扔進(jìn)js的事件循環(huán), 什么時(shí)候才輪到執(zhí)行可說不定,

setTimeout(()=>{xxx}, 0);也只是會(huì)盡快給你執(zhí)行, 不能保證立即執(zhí)行

參考
"事件循環(huán)"
實(shí)際延時(shí)比設(shè)置值更久的原因

只說參數(shù)的精度的話, 毫秒
參考API文檔

解夏 回答

為啥要用1000臺(tái)服務(wù)器,是為了IP分散么?如果是這個(gè)目的建議改用代理池

薔薇花 回答
  1. 針對(duì)表格中提出的bug一一修復(fù)
  2. 換linux系統(tǒng)
青瓷 回答

你檢查一下第三方包的一些文件有沒有打包進(jìn)去

小眼睛 回答

這種動(dòng)畫叫做骨骼動(dòng)畫,需要一定的物理知識(shí),
https://www.cnblogs.com/zhang...

蟲児飛 回答

你的代碼等效為:

const func = () => {
  console.log(this);
};

const Person = {
  hello: func,
};

Person.hello();

那么自然就是 window 咯,聲明函數(shù)的地方是 window 嘛。