我正在尝试将我的Alt+ x组合重新映射到NERDTree Enter功能.让我解释一下:当我浏览NERDTree中的文件/文件夹时,我可以打开文件/扩展文件夹Enter.
我想用左手键组合来做这个,比如Alt+ x.我试图将这些密钥重新映射到,<CR>并且<Enter>都没有工作:
# in ~/.vimrc
nnoremap ? <Enter> " doesn't work
nnoremap ? <CR> " doesn't work
nnoremap ? <CR><Enter> " doesn't work
Run Code Online (Sandbox Code Playgroud)
当我说"不工作"时,我的意思是当我在浏览文件/文件夹时按Alt+ x,我移动到下一个文件/文件夹(我想这就像移动到下一行).
注意我在Mac上,所以?实际上是Alt+ 的输出x(它是用其他映射测试的).
我应该重新映射什么?
在我的Mac,我使用MacVim与homebrew我的大多数编辑的.
~|? vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 20 2012 13:16:02)
Compiled by root@apple.com
Normal version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent
+listcmds +localmap …Run Code Online (Sandbox Code Playgroud) 我使用的是vim 7.3,在OS X 10.8.3上通过自制软件安装.出于某种原因没有W或E按预期工作在正常模式.它不是一次向后移动一个单词,而是向前移动.行为W是相同的w.和行为E是一样的e.
我已经在正常模式下尝试了o和O命令,它按预期工作,所以它不像我的shift键坏了.
这让我疯狂,因为它是我无法工作的核心功能.我试过擦除我的vimrc和vim目录并更改shell.
对于任何能够为我解决问题或者如何诊断问题提供良好建议的人,我都会答应.
我正在编写一个stm8s微控制器,并且正在使用STVDIDE和COSMIC编译器。
两个uint32_t变量相减的结果保存在另一个uint32_t变量中。有时,此过程会产生怪异的价值。这个怪异的值始终是最高位设置为的期望值1s。
这是我的代码片段:
static uint32_t lastReceivedLed = 0;
uint32_t timeSinceLast = 0;
timeSinceLast = IL_TimTimeNow() - lastReceivedLed;
if(timeSinceLast > 2500U)
{
Inhibitor = ACTIVE; // HERE IS MY BREAKPOINT
}
Run Code Online (Sandbox Code Playgroud)
这里是如何IL_TimTimeNow()被定义的:
volatile uint32_t IL_TimNow = 0;
uint32_t IL_TimTimeNow(void)
{
return IL_TimNow; // Incremented in timer ISR
}
Run Code Online (Sandbox Code Playgroud)
以下是调试会话中的一些实际值:
timeSinceLast 应该 865280 - 865055 = 225 = 0xE1
但是,编译器计算的结果是 4294967265 = 0xFFFFFFE1
注意,最低有效字节是正确的,而其余字节1s在编译器的结果中设置为!!
另请注意,这种情况仅偶尔发生一次。否则,它会按预期工作。
这是溢出吗?什么会导致这种情况?
成功运行我的 stm 几次后,现在每次尝试运行它时都会收到此错误消息:
\nUNRELIABLE VALUE: Future (\xe2\x80\x98<none>\xe2\x80\x99) unexpectedly generated random numbers without specifying argument 'seed'. There is a risk that those random numbers are not statistically sound and the overall results might be invalid. To fix this, specify 'seed=TRUE'. This ensures that proper, parallel-safe random numbers are produced via the L'Ecuyer-CMRG method. To disable this check, use 'seed=NULL', or set option 'future.rng.onMisuse' to "ignore".\nRun Code Online (Sandbox Code Playgroud)\n这是我运行的代码:
\nmany_models <- data_frame(K = c(10, 20, 30, 40, 50, 60)) %>%\nmutate(topic_model = …Run Code Online (Sandbox Code Playgroud) 我正在学习使用基于arm cortex m3的MCU STM32f100RB.为了测试定时器6,我写了一些代码,如下所示.它应该使LED闪烁.但它不起作用.任何人都可以帮我告诉我什么是问题?定时器是否正确初始化?谢谢
#include "stm32f10x.h"
#include "stm32f10x_rcc.h"
#include "stm32f10x_gpio.h"
#include "stm32f10x_tim.h"
void delay_millisec(register unsigned short n);
int main(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC | RCC_APB1Periph_TIM6, ENABLE);
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; //enable the pin 8 and pin 9
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOC, &GPIO_InitStructure);
while(1)
{
GPIO_WriteBit(GPIOC, GPIO_Pin_8, Bit_RESET);
delay_millisec(1000);
GPIO_WriteBit(GPIOC, GPIO_Pin_8, Bit_SET);
delay_millisec(1000);
}
return 0;
}
void delay_millisec(register unsigned short n)
{
if (n > 1) n--;
TIM6->PSC = 23999; // Set prescaler to 24,000 (PSC + …Run Code Online (Sandbox Code Playgroud) 当println在Clojure中并发调用时,我发现它的行为与Java的行为不同System.out.println。
我会用Java写什么
class Pcalls {
public static void main(String[] args) {
Runnable[] fns = new Runnable[3];
for (int i = 0; i < 3; i++) {
fns[i] = new Runnable() {
@Override public void run() {
for (int i = 1; i <= 5; i++) {
System.out.println("Hello iteration " + i);
}
}
};
}
for (Runnable fn : fns) new Thread(fn).start();
}
}
Run Code Online (Sandbox Code Playgroud)
我在Clojure中解释为:
(doall (apply pcalls
(repeat 3 #(dotimes [i 5] (println "Hello iteration" …Run Code Online (Sandbox Code Playgroud) 在这个答案中,我尝试创建一个静态实用程序方法,使其List成为Map:
public static <K, T> Map<K, T> toMapBy(List<T> list,
Function<? super T, ? extends K> mapper) {
return list.stream().collect(Collectors.toMap(mapper, Function.identity()));
}
Run Code Online (Sandbox Code Playgroud)
它工作得很好.但是,我发现该方法不能在与list.stream().collect(...)表达式相同的上下文中使用.该方法不够灵活.
List<Student> students = Arrays.asList();
Map<Long, Student> studentsById1 = students.stream()
.collect(Collectors.toMap(Student::getId, Function.identity()));
Map<Long, Student> studentsById2 = toMapBy(students, Student::getId);
Map<Long, Person> peopleById1 = students.stream()
.collect(Collectors.toMap(Student::getId, Function.identity()));
Map<Long, Person> peopleById2 = toMapBy(students, Student::getId); // compile error!
Run Code Online (Sandbox Code Playgroud)
在这个例子中,Student是一个子类型,Person并有一个getId返回a 的方法Long.
最后一个语句失败incompatible types: inference variable T has …
我在写一个优雅drop-last-by或butlast-by功能时遇到了麻烦.
(drop-last-by odd? [2 1 9 4 7 7 3]) ; => (2 1 9 4)
(drop-last-by odd? [2 4]) ; => (2 4)
(drop-last-by odd? [9]) ; => ()
Run Code Online (Sandbox Code Playgroud)
到目前为止我的工作但看起来有点笨拙,我想知道它是否可以在两三行中完成.
(defn drop-last-by [pred coll]
(let [p (partition-by pred coll)]
(apply concat (if (and (seq p) (pred (first (last p))))
(butlast p)
p))))
Run Code Online (Sandbox Code Playgroud) uint32_t PAGEError = 0;
FLASH_EraseInitTypeDef EraseInitStruct;
EraseInitStruct.TypeErase = FLASH_TYPEERASE_SECTORS ;
EraseInitStruct.Sector = FLASH_SECTOR_0;
EraseInitStruct.VoltageRange = FLASH_VOLTAGE_RANGE_3;
HAL_FLASH_Unlock();
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR);
HAL_FLASHEx_Erase(&EraseInitStruct, &PAGEError);
HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, 0x08000000, counter)
HAL_FLASH_Lock();
counter2 = *(__IO uint32_t *)0x08000000;
counter3 = *(__IO uint32_t *)0x08000001;
counter4 = *(__IO uint32_t *)0x08000002;
sprintf(buf, "%d", counter2); //gets send to the OLED with I2C
sprintf(buf2, "%d", counter3);
sprintf(buf3, "%d", counter4);
Run Code Online (Sandbox Code Playgroud)
我想将变量计数器写入闪存,然后将其读取为counter2。第一个闪存扇区始于0x08000000。
counter2,3并4通过OLED屏幕显示。显示counter2作品并向我显示的值counter-1,但仅能显示一次。如果我再次写闪存,似乎什么也没发生。 …
我是 clojure 的新手,我刚刚学习并尝试了记忆功能。在我看来,这个功能的存在很奇怪。
首先具有副作用的函数以 !
其次使用记忆非常简单
为什么 clojure 不为我做这个?内存使用和性能之间存在平衡,但您可以轻松地让 clojure 运行时将一大块内存分配给函数结果。如果使用相同参数多次调用函数,则使用缓存结果,如果内存耗尽,则清除缓存并跟踪缓存命中,因此频繁调用的函数不太可能从缓存中删除。
如果我设计了这个,我什至会为函数设置一个最低性能级别,这样如果函数调用比缓存检索更快,它就不会被缓存。(或者将其作为所有函数调用工作方式的属性。)
谁能解释为什么 clojure 不这样做
谢谢