Logger

用来记录零碎的知识 编辑


1. Qt:设置pixmap的尺寸

label->setPixmap(pixmap->scaled(300,200));

2. Qt:隐藏tabWidget的tab标签

tabWidget->tabBar()->hide();

3. 使用DOS命令在注册表添加键值

reg add HKLM\SYSTEM\ControlSet001\Services\NetBT\Parameters /v SMBDeviceEnabled /t REG_DWORD /d 0     #reg add 位置 键名 类型 值

4. NPOI使用的一个注意:如果要复制数学公式的话(比如有上下标),需要在同一个Workbook中复制,如果是不同workbook直接复制,只能复制字符串,格式不能复制过去(也就没了上下标)

cell2.CellStyle = cell1.CellStyle;
IRichTextString t = cell1.RichStringCellValue; // 注意要使用富文本
cell2.SetCellValue(t);

5. C#,将数值的字符串格式转换为数值格式 :

string val = "123";
double valNum= double.parse(val);

6. C++,获取鼠标的位置,操作鼠标进行虚拟点击

#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
    POINT x; // 保存位置
    SetCursorPos(10,10); // 设置鼠标的初始位置
    mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); // 左键按下
    mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); // 左键松开

    while (1)
    {
        GetCursorPos(&x); // 获取鼠标位置
        cout << x.x <<","<<x.y<< endl; // 输出位置
    }
}

7. Markdown语法简记

标题

#  一级标题
## 二级标题
...
###### 六级标题

列表

* 1
* 2
* 3

引用


> 该段文字为引用

链接


普通链接:
[链接文字](http://...)
插入图片:
![logo](http://...)

代码

`print 'hello'`
使用三个`表示代码段

分割线

***

文字

加粗:
**test**
斜体
*test*

表格

标题1|标题2|
:----|:----|
内容1| 内容2|

效果:

标题1 标题2
内容1 内容2

8. vs2013:右键->生成依赖项->生成自定义->选择CUDA就可以在属性页中添加CUDA的项,然后对于.cu文件,可以右键修改属性,选择CUDA编译器。

9. caffe 查询GPU信息

caffe device_query --gpu=0 #第一块gpu

10.卷积层的输出大小计算公式

11.python:if __name__ == '__main__'

使得python文件既可以被导入,也可以独立执行

12.python:文件操作

f = open('test.txt','w')
print>>f,'hello'#带换行
print>>f,'world'
f.write('test')#不带换行
f.close

13.python:路径操作

import os
cwdPath = os.getcwd() #获取程序路径
os.listdir("d:/test")#获得test目录下的所有文件名

14.C#:生成dll

csc /target:library /out:xxx.dll xxx.cs
csc /target:library /out:xxx.dll /reference:yyy.dll xxx.cs  #引用了其他dll

15.C++:获取当前程序路径

#include <direct.h>
...
char path[MAX_LENGTH];
getcwd(path,MAX_LENGTH);
cout<< path <<endl;

16.C++:键盘操作

#include <conio.h>
...
while(!kbhit()) // 等待按键按下
int ascii = getch(); //获得按键的ascii码

17.CNN:momentum

Momentum technique is an approach which provides an update rule that is motivated from the physical perspective of optimization. Imagine a ball in a hilly terrain is trying to reach the deepest valley. When the slope of the hill is very high, the ball gains a lot of momentum and is able to pass through slight hills in its way. As the slope decreases the momentum and speed of the ball decreases, eventually coming to rest in the deepest position of valley.

18.CMD:关闭和启用本地连接(需要管理员运行):

netsh interface set interface "本地连接" disabled [enabled] #关闭和启用

19.Python:创建和删除文件夹:

#创建文件夹
import os
if os.path.exists("test_folder") == false:
    os.mkdir("test_folder")
#删除文件夹
if os.path.exists("test_folder"):
    os.removedirs("test_folder")

20.Python:使用matplotlib读取和显示图片

import matplotlib.pyplot as plt #显示
import matplotlib.image as mimg #读取

img = mimg.imread('test.jpg')

plt.imshow(img)
plt.axis('off') #关闭坐标轴
plt.show()

21. Linux:设置shell密码

sudo passwd #然后设置密码,然后可以使用 su root 登录

22.C语言将整型转换为字符串

char str[10];
int j = 123;
sprintf(str,"%d",j);
posted @ 2017-06-04 17:19  whlook  阅读(357)  评论(0编辑  收藏  举报