对于popup style的窗体,要将其System Menu属性改为false,OnNcHitTest的返回正确值后,窗口才会改变大小。
编程
win32限制改变窗口大小
响应WM_SIZING消息,消息函数中做如下处理
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | void CDemoDlg::OnSizing(UINT fwSide, LPRECT pRect) { if (pRect->right - pRect->left < minWidth_) { if (fwSide == WMSZ_LEFT || fwSide == WMSZ_TOPLEFT || fwSide == WMSZ_BOTTOMLEFT) { pRect->left = pRect->right - minWidth_; } else pRect->right = pRect->left + minWidth_; } if (pRect->bottom - pRect->top < memHdcHeight_) { if (fwSide == WMSZ_TOP || fwSide == WMSZ_TOPLEFT || fwSide == WMSZ_TOPRIGHT) { pRect->top = pRect->bottom - minHeight_; } else pRect->bottom = pRect->top + minHeight_; } CDialogEx::OnSizing(fwSide, pRect); } |
如何让安卓APP第二次插上USB设备后不弹系统权限提示窗
方法是把Android App做成随USB设备插入时自启动就可以了。
具体做法是在App的AndroidManifest.xml里,把要自启动activity的地方加两处USB_DEVICE_ATTACHED就可以了。
1 2 3 4 5 6 7 8 9 10 11 12 | <activity android:name="com.serenegiant.usbcameratest2.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/> </intent-filter> <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter"/> </activity> |
refer to: 梦幻贝壳, https://blog.csdn.net/menghuanbeike/article/details/78752715
Javascript技巧
1 2 3 4 5 | <style style="display:block" contentEditable="true"> body { background:rgb(255, 255, 255); } </style> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | const movies = { list: [ { title: 'Heat' }, { title: 'Interstellar' }, { title: 'Savior' } ], [Symbol.iterator]() { let index = 0; return { next: () => { if (index < this.list.length) { const value = this.list[index++].title; return { value, done: false }; } return { done: true }; } }; } }; const [, secondMovieTitle = 'NonTitle'] = movies; console.log(secondMovieTitle); big = { foo: 'value Foo', bar: 'value Bar' }; var { foo = 'Unk' } = big; console.log(foo); var { ['foo']: name = 'Unknown' } = big; console.log(name); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | obj1 = { a() { console.log(this); }, b: 'hi', c: () => { console.log(this); } }; obj1.a(); obj1.c(); A1 = function() { console.log(this); }; a1 = new A1; A1(); |
Fall-back from the nopython compilation path to the object mode compilation
出现此提示的原因是用@jit标注的函数内存在非数值运算语句。
比如下例中,time()函数和print()函数都不能出现在foo()函数中。正确写法为:
1 2 3 4 5 6 7 8 9 10 11 12 13 | import numba as nb import time @nb.jit def foo(x, y): s = 0 for i in range(x, y): s += i return s tt = time.time() print(foo(1, 100000000)) print('Time used: {} secs'.format(time.time() - tt)) |
本地的Documentation for Android SDK浏览还是太慢?
在Android Studio中,通过SDK Manager将Documentation for Android SDK下载到本地后,在Android SDK目录下找到docs\index.html,在浏览器中打开,发现加载还是好慢,原因是本地网页又去访问互联网了。
想到的办法就是阻止浏览器访问外网,可参照
在此Chrome插件中加入以下阻止前缀字符串
1 | http://www.google.com/jsapi |
就可在Chrome中极速查看安卓SDK文档了。
成为上帝玩转Chrome之指定阻止访问的网站
在本地建一个目录,比如路径为d:\BlockSitePlugin
在此目录中写入以下四个文件:
manifest.json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | { "manifest_version":2, "name":"ChromeRequestBlocking", "version":"1.2.4", "author":"shengulong, euhat.com", "description":"Block url request.", "background":{"scripts":["background.js"]}, "browser_action":{ "default_popup":"popup.html", "default_title":"Block url request" }, "permissions":[ "storage", "unlimitedStorage", "webRequest", "webRequestBlocking", "<all_urls>" ] } </all_urls> |
在同一图里画两个隐函数图
1 2 3 4 5 6 | from sympy import * x, y = symbols('x y') p1 = plot_implicit(Eq(x**2 + y**2, 1), show = False, line_color = 'red') p2 = plot_implicit(Eq(x + y, 1), show = False) p1.extend(p2) p1.show() |
openssl vc2017
由于vc2013编译的openssl库用在vc2017的工程中会报LNK2019找不到___iob_func的错误,不得不重新在vc2017下编译openssl库,会到问题如下:
- 要先安装ActivePerl和nasm。
- openssl不能下载最新的,因为比如gsoap使用的很多结构体都是老openssl里的。因此,我这里还是编译openssl-1.0.1p。
-
解压出openssl-1.0.1p目录后,为了防止编译时出现以下错误,
constant_time_test.obj : error LNK2019 ___iob_func
先要修改里面的e_os.h如下:1 2 3 4 5 6 7 8 9 10 11 12
# if defined(_MSC_VER) && !defined(_DLL) && defined(stdin) # if _MSC_VER>=1300 #if 0 // add here # undef stdin # undef stdout # undef stderr FILE *__iob_func(); # define stdin (&__iob_func()[0]) # define stdout (&__iob_func()[1]) # define stderr (&__iob_func()[2]) #endif // add here # elif defined(I_CAN_LIVE_WITH_LNK4049)
也就是禁止它修改stdin之类的指向__iob_func。
注意,如果已执行了nmake,再改e_os.h,再nmake是不能自动解决依赖关系重编的。要么删掉openssl-1.0.1p目录,重新解压,要么执行
nmake -f ms\nt.mak clean -
编译脚本为:
1 2 3 4
perl Configure VC-WIN32 --prefix=d:\OpenSSL ms\do_nasm.bat nmake -f ms\nt.mak nmake -f ms\nt.mak install
最终生成的库在d:\OpenSSL里。
C1083: “string”: No such file or directory
项目属性->VC++目录->包含目录->编辑,在弹出的编辑对话框中,勾选“从父级或项目默认设置继承”复选框,确定保存,再重新编译。