小编Ian*_*han的帖子

git config --global写到哪里?

git config --global用于设置时,它将写入哪个文件?

例:

git config --global core.editor "blah"
Run Code Online (Sandbox Code Playgroud)

我在这些地方找不到它:

C:\Program Files\Git\etc\gitconfig

C:\myapp\.git\config
Run Code Online (Sandbox Code Playgroud)

我还没有设置ENV?

我的Git版本:1.6.5.1.1367.gcd48 - 在Windows 7上

git config

958
推荐指数
12
解决办法
67万
查看次数

我如何修复brew医生的错误

当谈到这一切时,我非常喜欢新手,请原谅我的无能.

当我运行brew Doctor时,我得到以下内容.有人可以帮忙吗?

[/usr/local]$ brew doctor

Error: Setting DYLD_LIBRARY_PATH can break dynamic linking.
You should probably unset it.
Error: Some keg-only formula are linked into the Cellar.
Linking a keg-only formula, such as gettext, into the cellar with
brew link f will cause other formulae to detect them during the
./configure step. This may cause problems when compiling those
other formulae.

Binaries provided by keg-only formulae may override system binaries
with other strange results.

You may wish to brew unlink …
Run Code Online (Sandbox Code Playgroud)

homebrew

63
推荐指数
1
解决办法
7万
查看次数

git difftool给目录比较?

是否可以通过git difftool命令打开已更改文件与登台/已检查文件之间的目录比较?

理想情况下,如果2个文件已更改,则它们将是显示的唯一2个,但在目录比较中.

我已经阅读了关于获取git以并行提供所有文件差异的帖子,因此像BeyondCompare这样的工具在选项卡中有所有差异,但我对此并不满意!

可以将已更改文件的副本从登台/签入文件中提取到临时文件夹中,然后将其打开.这是唯一的选择吗?

git diff beyondcompare

32
推荐指数
1
解决办法
2万
查看次数

Linux内核设备驱动程序从设备DMA到用户空间内存

我希望尽快将支持DMA的PCIe硬件设备中的数据导入用户空间.

问:如何将"使用/和/通过DMA传输直接I/O连接到用户空间"

  1. 通过LDD3读取,似乎我需要执行一些不同类型的IO操作!?

    dma_alloc_coherent给我一个可以传递给硬件设备的物理地址.但是在传输完成时需要设置get_user_pages并执行copy_to_user类型调用.这似乎是浪费,要求设备DMA进入内核内存(充当缓冲区),然后再将其传输到用户空间.LDD3 p453:/* Only now is it safe to access the buffer, copy to user, etc. */

  2. 我理想的是一些记忆:

    • 我可以在用户空间中使用(也许通过ioctl调用请求驱动程序来创建DMA'able内存/缓冲区?)
    • 我可以从物理地址获取传递给设备,以便所有用户空间必须执行的是对驱动程序执行读取操作
    • read方法将激活DMA传输,阻塞等待DMA完成中断并随后释放用户空间读取(用户空间现在可以安全使用/读取存储器).

我是否需要单页流映射,设置映射和用户空间缓冲区映射get_user_pages dma_map_page

到目前为止,我的代码get_user_pages在用户空间的给定地址设置(我称之为直接I/O部分).然后,dma_map_page用一个页面get_user_pages.我将设备的返回值dma_map_page作为DMA物理传输地址.

我使用一些内核模块作为参考:drivers_scsi_st.cdrivers-net-sh_eth.c.我会看看infiniband代码,但无法找到哪一个是最基本的!

提前谢谢了.

linux linux-device-driver linux-kernel dma

30
推荐指数
3
解决办法
4万
查看次数

链接到GitHub上的一行Markdown文件

我经常通过#LURI中的param 链接到GitHub源代码.

例如:https://github.com/github/learn.github.com/blob/gh-pages/episodes.yaml#L1

但是有没有办法链接到Markdown文件中的行?

例如https://github.com/github/learn.github.com/blob/gh-pages/README.md#L1 (不起作用!)

我知道我可以链接到'部分',但线条要好得多!

例如https://github.com/github/learn.github.com/blob/gh-pages/README.md#learngithubcom

github

28
推荐指数
3
解决办法
6012
查看次数

运行黄瓜规格时,红宝石1.9.2奇怪的警告

我刚刚更新了试用rails 3,使用rvm和ruby 1.9.2-p0.

当我运行我的黄瓜规格时,我会听到奇怪的警告

/home/ubuntu/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/utils.rb:16: warning: regexp match /.../n against to UTF-8 string

/home/ubuntu/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/utils.rb:16: warning: regexp match /.../n against to UTF-8 string

/home/ubuntu/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/utils.rb:16: warning: regexp match /.../n against to UTF-8 string
Run Code Online (Sandbox Code Playgroud)

我的包包含以下宝石......

Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.0) 
Using builder (2.1.2) 
Using i18n (0.4.1) 
Using activemodel (3.0.0) 
Using erubis (2.6.6) 
Using rack (1.2.1) 
Using rack-mount (0.6.13) 
Using rack-test (0.5.4) 
Using tzinfo (0.3.23) 
Using actionpack (3.0.0) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.8) 
Using mail (2.2.5) …
Run Code Online (Sandbox Code Playgroud)

ruby cucumber rvm ruby-on-rails-3

24
推荐指数
4
解决办法
5281
查看次数

18
推荐指数
1
解决办法
2万
查看次数

监视文件夹内文件更改的linux脚本(如autospec一样!)

我想在文件发生变化时自动启动构建.

我在Ruby中使用过autospec(RSpec)并喜欢它.

怎么能在bash中完成?

linux bash automation rspec build

17
推荐指数
4
解决办法
3万
查看次数

Linux内核中断处理程序互斥保护?

我是否需要保护我的中断处理程序被多次调用同一个中断?

鉴于以下代码,我不确定我应该进行的系统调用.我正在使用当前的实现获得罕见的随机死锁: -

void interrupt_handler(void)
{
    down_interruptible(&sem);  // or use a lock here ?

    clear_intr(); // clear interrupt source on H/W

    wake_up_interruptible(...);

    up(&sem); // unlock?

    return IRQ_HANDLED;
}

void set/clear_intr()
{
    spin_lock_irq(&lock);
    RMW(x); // set/clear a bit by read/modify/write the H/W interrupt routing register
    spin_unlock_irq(&lock);
}

void read()
{
    set_intr();  // same as clear_intr, but sets a bit
    wait_event_interruptible(...);
}
Run Code Online (Sandbox Code Playgroud)
  1. 应该interrupt_handler:down_interruptiblespin_lock_irq/ spin_lock_irqsave/ local_irq_disable
  2. 应该set/clear_intr:spin_lock_irqspin_lock_irqsave/ local_irq_disable? …

linux interrupt linux-device-driver linux-kernel

13
推荐指数
1
解决办法
1万
查看次数

什么时候虚拟方法应该是纯粹的?

我找到了一些我正在研究的代码,并且想知道最好的设计实现是什么.

如果基类将方法定义为虚拟,但也实现了一个空体,因此不需要派生类实现一个体,那么它是不是应该变为纯粹的呢?

virtual void AMethod1() {}                 // 1
virtual void AMethod2() {assert(false);}   // 2
virtual void AMethod3() = 0;               // 3
Run Code Online (Sandbox Code Playgroud)
  1. 目前的代码.
  2. Idea1:警告用户此派生对象尚未实现此方法体.
  3. Idea2:强制派生类来实现一个体,空或不.

你是一个值得信赖的神奇SO人物,你会怎么想?


编辑1:发布(并阅读答案)后,我意识到断言是坏的!

virtual void AMethod3() = {throw (ENotImplemented)};               // 4
Run Code Online (Sandbox Code Playgroud)

c++ methods derived-class pure-virtual

9
推荐指数
3
解决办法
910
查看次数