鍍金池/ 問(wèn)答/ C++問(wèn)答
蝶戀花 回答

把你對(duì)應(yīng)的canvas坐標(biāo)系放大
你做的transform操作對(duì)應(yīng)的都轉(zhuǎn)換到坐標(biāo)系的轉(zhuǎn)化上

柒喵 回答

這個(gè)需求就比較迷吧,有時(shí)候應(yīng)該換下思路,哪怕在操作上麻煩了一步,自己解決了,換個(gè)思路在最后這里

尐懶貓 回答

console出來(lái)的object明顯key不對(duì),key為action[0][action]而不是action,看起來(lái)像你post的content-typeapplication/x-www-form-urlencoded而不是application/json

九年囚 回答

進(jìn)度只有你的Fortran自己知道。你的Fortran DLL如果沒(méi)有報(bào)告進(jìn)度的接口的話,QT這邊是不可能猜得到的。只能用假進(jìn)度條或無(wú)限進(jìn)度條。

蟲児飛 回答

C++ 我沒(méi)調(diào)用過(guò)。 我通過(guò)node子進(jìn)程child_process 調(diào)用過(guò)C#可執(zhí)行文件去調(diào)用熱敏打印機(jī)和身份證識(shí)讀器。至于調(diào)用C++,node-gyp可以C++ 文件進(jìn)行編譯,博客教程

陌離殤 回答
如果當(dāng)成執(zhí)行式的話,c++,++c,c+=1,c=c+1對(duì)程式設(shè)計(jì)師來(lái)說(shuō)是相同的,
也就是說(shuō),在程式裡出現(xiàn):
c++;
++c;
c=c+1;
c+=1;
這四段程式碼執(zhí)行結(jié)果是相同的.

但如果拿來(lái)當(dāng)表示式,就有所不同了,
c=7; x=c++; 執(zhí)行後c=8,x=7
c=7; x=++c; 執(zhí)行後c=8,x=8
c=7; x=c+=1; 執(zhí)行後c=8,x=8
也就是說(shuō)++cc+=1會(huì)先執(zhí)行加的動(dòng)作,
再拿其值來(lái)當(dāng)表示式,
c++則是先拿其值來(lái)當(dāng)表示式,再執(zhí)行加的動(dòng)作.

http://www.programmer-club.co...

L33用的是k++,先把k=3賦給了m[3][0],之后再加。所以跟m[2][0]是一樣的。

建議:++k/k++永遠(yuǎn)單獨(dú)放一行,不給自己找麻煩。事實(shí)上,因?yàn)檫@兩個(gè)語(yǔ)法太討厭,python這種以優(yōu)雅為設(shè)計(jì)原則的語(yǔ)言直接廢棄了這兩種語(yǔ)法。

柚稚 回答

這么說(shuō)吧,你用brew install packagename是用來(lái)安裝命令行工具的,一般不可能影響到圖形界面。
brew cask install packagename倒是有可能。
mysql官方文檔是通過(guò)dmg文件安裝的:

The MySQL Installation Package includes a MySQL preference pane that enables you to start, stop, and control automated startup during boot of your MySQL installation.

這個(gè)面板就只有開啟、關(guān)閉、控制開機(jī)自啟mysql功能。 你用brew install mysql安裝的mysql能用Homebrew Services來(lái)實(shí)現(xiàn)這些功能。

# 啟動(dòng)
$ brew services run mysql
# 關(guān)閉
$ brew services stop mysql
# 重啟
$ brew services restart mysql
# 開啟自啟
$ sudo brew services start mysql
脾氣硬 回答

這是Angular的:

$http({
    url: "",
    method: 'POST',
    timeout: 60000,
    headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=utf8'},
    transformRequest: function(obj) {
        var str = [];
        for(var p in obj)
            str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
        return str.join("&");
    },
    data:{}
}).success(function (data) {
    var blob = new Blob([data], {type: "application/vnd.ms-excel;charset=utf-8"}),
        Temp = document.createElement("a");

    Temp.href = window.URL.createObjectURL(blob);
    Temp.download = "XXX.xlsx";
    angular.element('body').append(Temp);
    Temp.click();
});

1169行代碼是什么,直接看1169行,或者找到1169行對(duì)應(yīng)的未編譯文件位置找錯(cuò)誤

北城荒 回答

python官方庫(kù)中沒(méi)有,因?yàn)槟悴⒉荒苤纼?nèi)存地址處存儲(chǔ)的對(duì)象是什么類型的,對(duì)于一切都是用對(duì)象的python(底層c中的對(duì)象),僅根據(jù)一個(gè)內(nèi)存地址無(wú)法判斷底層c的類型

澐染 回答

conf 下面確實(shí)沒(méi)有cert這個(gè)路徑啊,從你的圖上看來(lái)的話

苦妄 回答

TypeScript

ES6 的超集,支持async、Promiseyield等新語(yǔ)法


適合面向?qū)ο蟮膱?chǎng)景

最終會(huì)編譯成 es5js 代碼,也就是任何瀏覽器可以執(zhí)行的JS

使用編輯器 Visual Studio Code 無(wú)縫編輯,編譯也只要運(yùn)行 tsc 即可輸出目標(biāo)js文件

我一般開啟嚴(yán)格模式,強(qiáng)類型模式,這樣在編寫過(guò)程中就可以知道是否有錯(cuò),避免一些低級(jí)錯(cuò)誤

比如

下面例子中:

  • namespace 命名空間
  • abstract 虛類、虛函數(shù)
  • extends 繼承
  • : number 參數(shù)類型
  • : boolean 返回類型
  • x: number = 0 默認(rèn)參數(shù)值
  • public x 類變量以及作用域
  • public position 類作用域
  • constructor 構(gòu)造函數(shù)
  • public get getter setter

/ui/base.ts

namespace ui {

    abstract class Base {
        public x: number;
        public y: number;
        constructor(x: number = 0, y: number = 0)
        {
            this.setTo(x, y);
        }
        
        public abstract position(x: number, y: number);
    }
}

/ui/sharp.ts

namespace ui {
    class Sharp extends Base {
        public position(x: number, y: number)
        {
            this.x = x;
            this.y = y;
        }
    }
}

/ui/sharp/rect.ts

namespace ui.sharp
{

    class Rect extends ui.Sharp {
        public width: number;
        public height: number;
        
        public get empty(): boolean {
            return this.height == 0 || this.width == 0;
        }
        
        constructor(x: number = 0, y: number = 0, width: number = 0, height: number = 0)
        {
            super(x, y);
            this.width = width;
            this.height = height;
        }
    }
}

調(diào)用

調(diào)用方式 無(wú)特殊js即可

let rect = new ui.sharp.Rect();
console.log(rect.empty); // true
練命 回答

Wherever possible, you should use <a href="foo.html"> over window.location.href, for a number of very good reasons.

If you have javascript disabled, none of the links would work.
Spiders, such as Google Bot, do not interpret javascript, and so they won't follow any of your links.
IT BREAKS THE INTERNET. No, really though - the World Wide Web is built on the very basis of discoverable linkages between pages. Hiding these linkages with non-standard .. err, links, goes against that very premise.
It makes for a bad user experience: a user expects that when they mouse over a link, they will have access to some information:
the destination displayed in the status bar (very important!)
right-click -> copy link location
middle-click -> open new tab
etc
Using window.location breaks all of these
It's much easier!

Reference: https://stackoverflow.com/que...

不一定。可能不是連續(xù)的。因?yàn)橛蟹猪?yè)映射到物理地址,所以最多一個(gè)內(nèi)存頁(yè)內(nèi)部連續(xù),頁(yè)和頁(yè)之間可以不連續(xù)。

青瓷 回答

使用require.js進(jìn)行模塊化了,可以使用webpack

焚音 回答

函數(shù)呼叫, invoke/call, 就是你調(diào)用函數(shù)的那個(gè)語(yǔ)句.

函式宣告, 即declaration, 與definition相對(duì), 前者是后者的超集, 所以每一個(gè)definition都是一個(gè)declaration, 而definition不一定是declaration:

clipboard.png

簡(jiǎn)而言之, definition是definition的超集, definition是declaration的子集, 所以是one definition ruler, 而不是one declaration ruler

乖乖噠 回答

1. 關(guān)于 pyo 優(yōu)化:

參考鏈接

  • When the Python interpreter is invoked with the -O flag, optimized code is generated and stored in .pyo files. The optimizer currently doesn't help much; it only removes assert statements. When -O is used, all bytecode is optimized; .pyc files are ignored and .py files are compiled to optimized bytecode.
  • Passing two -O flags to the Python interpreter (-OO) will cause the bytecode compiler to perform optimizations that could in some rare cases result in malfunctioning programs. Currently only __doc__ strings are removed from the bytecode, resulting in more compact .pyo files. Since some programs may rely on having these available, you should only use this option if you know what you're doing.
  • Your program doesn't run any faster when it is read from a .pyc or .pyo file than when it is read from a .py file; the only thing that's faster about .pyc or .pyo files is the speed with which they are loaded.
  • When a script is run by giving its name on the command line, the bytecode for the script is never written to a .pyc or .pyo file. Thus, the startup time of a script may be reduced by moving most of its code to a module and having a small bootstrap script that imports that module. It is also possible to name a .pyc or .pyo file directly on the command line.

2. 關(guān)于 pyd:

pyd 可以理解為 Windows DLL 文件。

參考鏈接

  • Yes, .pyd files are dll’s, but there are a few differences. If you have a DLL named foo.pyd, then it must have a function PyInit_foo(). You can then write Python "import foo", and Python will search for foo.pyd (as well as foo.py, foo.pyc) and if it finds it, will attempt to call PyInit_foo() to initialize it. You do not link your .exe with foo.lib, as that would cause Windows to require the DLL to be present.
  • Note that the search path for foo.pyd is PYTHONPATH, not the same as the path that Windows uses to search for foo.dll. Also, foo.pyd need not be present to run your program, whereas if you linked your program with a dll, the dll is required. Of course, foo.pyd is required if you want to say import foo. In a DLL, linkage is declared in the source code with __declspec(dllexport). In a .pyd, linkage is defined in a list of available functions.
歆久 回答

1.這個(gè)問(wèn)題涉及到動(dòng)態(tài)鏈接庫(kù)的3個(gè)不同的庫(kù)名的文件,一個(gè)link name,一個(gè)是so name,一個(gè)是real name,link name很好理解,就是編譯鏈接時(shí)使用的名稱,比如你的smbclient庫(kù)它的link name為libsmbclient.so,它的so name為libsmbclient.so.0,而real name為libsmbclient.so.0.x,“x”是什么要看你具體的版本。可以使用objdump -p /home/chenzhen/packSource/my_samba/libsmbclient.so | grep SONAME查看你重新編譯的smbclient.so庫(kù)的so name,我猜絕對(duì)是libsmbclient.so.0
2.gcc或者g++在生成可執(zhí)行程序時(shí)如果發(fā)現(xiàn)動(dòng)態(tài)庫(kù)包含有so name則會(huì)把so name信息保留到可執(zhí)行文件中,可執(zhí)行文件在啟動(dòng)時(shí)是使用so name去查找動(dòng)態(tài)庫(kù)的,如果庫(kù)沒(méi)有so name則可執(zhí)行文件啟動(dòng)時(shí)是使用link name去查找動(dòng)態(tài)庫(kù)的。
3.理解了上面動(dòng)態(tài)庫(kù)三個(gè)名稱文件的區(qū)別上面問(wèn)題就很好解決了。你上面雖然在LD_LIBRARY_PATH中添加了/home/chenzhen/packSource/my_samba/你修改后庫(kù)所在的路徑,但是程序就是不加載這個(gè)目錄下的動(dòng)態(tài)鏈接庫(kù)是因?yàn)槌绦騿?dòng)的時(shí)候搜索的so name,而不是link name,所以解決方案也很簡(jiǎn)單,在/home/chenzhen/packSource/my_samba/目錄下創(chuàng)建一個(gè)so name的軟連接即可。
cd /home/chenzhen/packSource/my_samba/; ln -s libsmbclient.so.0 libsmbclient.so

清夢(mèng) 回答

遞歸


f(arr, 3, [])

function f(arr,k,temp){
    if(k<=0){
        let sum = 0
        let r =[]
        for(let i = 0; i < temp.length; i++){
            sum += temp[i]
            r.push(temp[i])
        }
        if (sum  === hz) {
            result.push(r)
        }
        return
    }
    for (let i = 0; i < arr.length; i++) {
        temp.push(arr[i])
        f(arr, k-1, temp)
        temp.splice(temp.length-1, 1)
    }
}