down

Django: track down causes of DeprecationWarning

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I've upgraded to Django 1.4 and now when I run my development server I get the following warning: /home/ flc / venvs / myprj / lib / python2 . 6 / site - packages / django / views / generic / simple . py : 8 : DeprecationWarning: Function-based generic views have been deprecated; use class-based views instead. DeprecationWarning I have tracked down most of the causes of this and fixed them by making the following changes: django.views.generic.simple.direct_to_template => django.views.generic.base.TemplateView django.views.generic

BitBlt drawing bitmap upside down

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an MFC control to which I pass a handle to a bitmap (HBITMAP). In the controls OnPaint method I am using BitBlt to render the bitmap. But the bitmap is being rendered upside down. As a test I created a CBitmap object from this handle and write that out to a file and it created a bitmap that was right side up. So am I doing something wrong with my call to BitBlt? I've posted my code from OnPaint below. I did try to change the mapping mode of my device context to MM_LOENGLISH and was able to get the bitmap to render right side up but it

OSX: detect SPACEBAR down and up events

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to record several thousand short soundbites of my own speech (I'm training an acoustic model for a speech recognition engine) So for each one, a line of text presents itself on the screen and I have to speak it, and capture the audio into a .WAV I found a sample project for recording the audio; now I am trying to figure out how to do keyboard input. I would like to push the SPACEBAR down to start recording and release it to terminate the recording. Can anyone get me started? ( an example would be ideal! ) Sorry, this is probably

Error:SSL peer shut down incorrectly In Android studio 3.0.1

匿名 (未验证) 提交于 2019-12-03 00:53:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When I build the project I receive the following error Error:SSL peer shut down incorrectly please let me know how to fix this error 回答1: The problem is caused by some kind of incompatibility with HTTPS. For solve this, in the Android SDK Manager, go to "Options" in the "Tools" menu, and check the option " Force https://... sources to be fetched using http://... ". Then try again to download the package. OR check out this link hope this helps you. 回答2: It's probably a problem of the certificate, I had similar issue with Android Studio and I

Open the drop down list permanently of select2

匿名 (未验证) 提交于 2019-12-03 00:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using select2 for multiple value selection. I need to display the drop down list permanently. Right now when we select or click the input box of select2, the drop down list is displayed. I'd like to know if there is any way we can always show the list. 回答1: From the select2 documentation, here : $("#select").select2({ closeOnSelect: false }); 文章来源: Open the drop down list permanently of select2

Xcode 支持方向 - Upside Down

匿名 (未验证) 提交于 2019-12-03 00:37:01
问题说明:Xcode 默认支持的方向有:Portrait、Landscape Left、Landscape Right,默认Upside Down 方向不支持,这是因为IPhone 在使用过程中,接到来电,很容易就会把听筒和话筒位置搞反。 打开Xcode,在 General -》Deployment Info 中,可以看到,默认只勾选了三个方向, 此时,我们把 Upside Down 也勾选中,会发现 IPad 已默认支持四个方向,但在IPhone中,还是默认只支持三个方向,此时,需要在控制器中,显示声明一下来支持Upside Down方向。具体代码如下: 这样,IPhone 和 IPad 一样,四个方向都支持了。 总结:想要App支持某个方向,需要两个设置: 一:Deployment Info 中,勾选 Device Orientation ; 二:在控制器中,重写 supportedInterfaceOrientations 方法。(如不重写,IPad 默认是UIInterfaceorientationMaskAll , IPhone 默认是 UIInterfaceOrientationMaskAllButUpsideDown )。 转载请标明出处: Xcode 支持方向 - Upside Down 文章来源: Xcode 支持方向 - Upside Down

使用autohotkey映射按键

匿名 (未验证) 提交于 2019-12-03 00:36:02
如果你特别烦躁vim、emacs、bash、IDE、编辑器、浏览器按键不统一带来的麻烦,可以试试autohotkey。目前唯一缺点不支持linux 脚本功能: alt+j -> left alt+shift+j -> shift+left alt+ctrl+shift+j -> ctrl+shift+left alt+e -> pgup alt+shift+e -> shift+pgup alt+ctrl+e -> ctrl+pgup ctrl+h -> backspace 诸如此类 !i::SendPlay {Up down} !+i::SendPlay {shift down}{Up down} !k::SendPlay {down down} !+k::SendPlay {shift down}{down down} !j::SendPlay {left down} !+j::SendPlay {shift down}{left down} !^+j::sendplay {shift down}{ctrl down}{left down} !l::SendPlay {right down} !+l::SendPlay {shift down}{right down} !^+l::sendplay {shift down}{ctrl down}{right down} !h:

Android 滑动冲突的处理

匿名 (未验证) 提交于 2019-12-03 00:27:02
概念:滑动冲突即某些 特定的滑动事件被父View拦截导致子View接收不到 该事件无法滑动。 基本类型: 其他复杂类型都是由基本类型组成的。 ˼· 从滑动冲突的概念可知,只需 让子View接收到特定的滑动事件 即可解决冲突。 子View要接收到ACTION_MOVE必须: ACTION_DOWN:从 Android事件分发机制本质是树的深度遍历(图+源码) 的结论(即ACTION_DOWN会深度遍历“分发树”并确定“消耗树”,后续同一序列事件都是沿着这一“消耗树”分发(深度遍历,但通常都是线性结构)的,且可被中途拦截但“消耗树”不变。)可知,要让ACTION_DOWN至少能分发到子View并且被子View或更下层的View消耗,其实就是让“消耗树”能够到达子View,这样后续的ACTION_MOVE事件才有机会到达子View。总之, ACTION_DOWN必须被子View或它的下层消耗。 解决办法:在子View的在onTouchEvent()中消耗ACTION_DOWN。 ACTION_MOVE: 父View不拦截子View需要的特定ACTION_MOVE 。 解决办法: 外部拦截:重写父View的onInterceptTouchEvent(),不拦截子View需要的特定滑动事件。(“自控”:父View自己控制拦截ACTION_MOVE与否) 内部拦截

Eclipse常用快捷键

匿名 (未验证) 提交于 2019-12-03 00:22:01
代码助手:Ctrl+Space(简体中文操作系统是Alt+/) 快速修正:Ctrl+1 单词补全:Alt+/ 打开外部Java文档:Shift+F2 显示搜索对话框:Ctrl+H 快速Outline:Ctrl+O 打开资源:Ctrl+Shift+R 打开类型:Ctrl+Shift+T 显示重构菜单:Alt+Shift+T 上一个/下一个光标的位置:Alt+Left/Right 上一个/下一个成员(成员对象或成员函数):Ctrl+Shift+Up/Down 选中闭合元素:Alt+Shift+Up/Down/Left/Right 删除行:Ctrl+D 在当前行上插入一行:Ctrl+Shift+Enter 在当前行下插入一行: Shift+Enter 上下移动选中的行:Alt+Up/Down 组织导入:Ctrl+Shift+O 2 定位 2.1行内定位 行末/行首:End/Home 前一个/后一个单词:Ctrl+Right/Left 2.2文件内定位 跳到某行:Ctrl+L 上下滚屏:Ctrl+Up/Down 上一个/下一个成员(成员对象或成员函数):Ctrl+Shift+Up/Down 快速Outline:Ctrl+O 2.3跨文件定位 打开声明:F3 打开资源:Ctrl+Shift+R 打开类型:Ctrl+Shift+T 在workspace中搜索选中元素的声明:Ctrl+G

BZOJ2727: [HNOI2012]双十字-树状数组

匿名 (未验证) 提交于 2019-12-03 00:22:01
传送门 给定一个 R C R C 的01 矩阵,要求计算出这个 01 矩阵中有多少个双十字。 双十字由两条水平的和一条竖直的“1”线段组成,要求满足以下几个限制: 1.两条水平的线段不能在相邻的两行。 2.竖直线段上端必须严格高于两条水平线段,下端必须严格低于两条水平线段。 3.竖直线段必须将两条水平线段严格划分成相等的两半。 4.上方的水平线段必须严格短于下方的水平线段。 输出双十字的个数 mod 1,000,000,009 的值。 R , C , N ≤ 10000 , R C ≤ 1000000 R , C , N ≤ 10000 , R C ≤ 1000000 Solution: l r [ i ] l r [ i ] 表示从i开始表示最多能左右延伸多少 d o w n [ i ] d o w n [ i ] 表示从i开始最多往下延伸多少 top[i]表示从i开始最多往上延伸多少 我们考虑枚举下端线段的中点j,然后对于每个上端线段的中点i,对答案的贡献有 ∑ l r [ j ] l e n = 1 m i n ( l e n 1 , l r [ i ] ) t o p [ i ] d o w n [ j ] ∑ l e n = 1 l r [ j ] m i n ( l e n 1 , l r [ i ] ) t o p [ i ] d o w n [ j ]