在Windows 7 64位机器上使用python 2.7.
如何获取文件关闭事件:
那么,如何在上述情况下获取文件关闭事件?是否可以通过公共代码实现上述情况?我正在处理不同的文件类型
这是我想要做的
class BaseClass(object):
successify = lambda x: "<Success>%s</Success>" % x
errorify = lambda x: "<Error>%s</Error>" % x
def try1(self):
print successify("try1")
def try2(self):
print self.successify("try2")
Run Code Online (Sandbox Code Playgroud)
但这两种方法似乎都不起作用..
>>> BaseClass().try1()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 5, in try1
NameError: global name 'successify' is not defined
>>> BaseClass().try2()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 7, in try2
TypeError: <lambda>() takes exactly 1 argument (2 given)
Run Code Online (Sandbox Code Playgroud)
如何在类中使用lambdas作为方法?
我正在阅读这里提到的例子,我正在看这个例子.我在ipython上运行了一个示例示例,结果是一致的,即"%d"
慢于"%s"
:
In [1]: def m1():
...: return "%d" % (2*3/5)
In [2]: def m2():
...: return "%s" % (2*3/5)
In [4]: %timeit m1()
1000000 loops, best of 3: 529 ns per loop
In [5]: %timeit m2()
1000000 loops, best of 3: 192 ns per loop
In [6]: from dis import dis
In [7]: dis(m1)
2 0 LOAD_CONST 1 ('%d')
3 LOAD_CONST 5 (6)
6 LOAD_CONST 4 (5)
9 BINARY_DIVIDE
10 BINARY_MODULO
11 …
Run Code Online (Sandbox Code Playgroud) 我有 2 个分支命名developer
和Current
远程。在本地,我在分支上工作,developer
并将更改推送到 remote developer
。问题是,如何从本地推developer
送到远程Current
?
我试过这些:
git push origin Current -f
// error:
// src refspec Current does not match any.
// failed to push some refs to ...
// and this one too:
git config push.default upstream
git push origin Current -f
// error: same as the first try
// and this one too:
git branch --set-upstream-to developer origin/Current
// or:
git branch --set-upstream-to developer Current
// …
Run Code Online (Sandbox Code Playgroud) 我目前的命令是
git clone ssh://username@onboard.com/srv/git/repo
Run Code Online (Sandbox Code Playgroud)
之后
password
Run Code Online (Sandbox Code Playgroud)
......很好,效果很好.
现在我想在一行中做到这一点.像这样的东西:
git clone ssh://username:password@onboard.com/srv/git/repo
Run Code Online (Sandbox Code Playgroud)
但它没有工作,并给我的信息:
Please make sure you have the correct access rights and the repository exists.
Run Code Online (Sandbox Code Playgroud)
我怎样才能克隆一行?
我正在使用Ionic 2.
第1页(SearchPage) - > popover - >第2页(MapPage) - >第1页(SearchPage)(menuToggle not working)
我有一个根页面(SearchPage):
HTML
<ion-header>
<ion-navbar>
<button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
</ion-navbar>
</ion-header>
Run Code Online (Sandbox Code Playgroud)
TS
presentPopover(event: Event): void {
let popover: Popover = this.popoverController.create(SearchPopOverPage, {
ev: event,
employeeModel: this.employeeModel
});
popover.present();
}
Run Code Online (Sandbox Code Playgroud)
酥料饼
presentFilterMap(event: Event) {
this.viewCtrl.dismiss().then(() => {
this.nav.push(MapPage, {
ev: event,
employeeModel: this.employeeModel,
fromSearch: true
})
});
}
Run Code Online (Sandbox Code Playgroud)
但是当我尝试返回根页面(带参数)时,它会显示菜单切换按钮(3行),但是当我点击它时它不起作用(即什么都不做,它应该显示侧面菜单).
返回root的ts(MapPage)文件:
this.nav.insert(0, SearchPage, {
employeeModel: this.employeeModel
});
Run Code Online (Sandbox Code Playgroud)
如果我尝试popToRoot(options)
,这可以工作,菜单切换按钮正在工作.但是,它不会使用新参数重新加载页面.
有什么想法我应该如何导航回带有参数的根页面?
谢谢
更新:我尝试了以下内容,但它没有回到根目录:
let options = …
Run Code Online (Sandbox Code Playgroud) TLDR:如果X作为远程分支存在,那么git checkout X
应该创建它的本地分支.就我而言,对于一个分支,它没有.
远程存储库有一个master,
release,
和其他一些分支(比方说refactor-update
)我这样做:
git clone WHATEVER/repo.git
git checkout release
但我没有得到正常的分支切换消息,也没有origin/release
创建本地分支跟踪(man
每页都有git checkout
).我还在master.
注意,如果我做的git checkout refactor-update
一切都按预期工作.
这在其他计算机上是可重现的(尽管是相同的平台,可能是相同版本的git).我(出于绝望,不是因为我认为它会起作用),删除release
分支并用备份替换它并且master
分别没有改变行为(git push origin :release && git push origin master:release
)
我被困在可能导致问题的地方.我怀疑是因为某些原因git checkout
似乎没有认出这个词release
,这会让它像执行一样git checkout
.为了尝试跟进这个,在另一个回购中我创建了一个发布分支,看看它是一个保留字还是什么,但它肯定只是在这个存储库中.似乎没有任何与众不同的东西.git/config
.
Git版本:1.8
在开发过程中,我经常将文件的工作版本(但不提交它们)添加到我的git repo中.我继续处理这些文件,直到它们达到可执行阶段,当我可以提交它们时.所以回购看起来如下
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: testfile1
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: testfile1
# modified: testfile2
Run Code Online (Sandbox Code Playgroud)
当我做一个git stash
,然后做一个git stash pop
,我得到
# On branch master
# Changes not staged for …
Run Code Online (Sandbox Code Playgroud) 我正在尝试git的一些示例指令,并遇到了这个特殊情况,当我们执行a时git rm *
,它不会.*
在第一次尝试时删除文件.为什么会这样?
mkdir -p test_repo1/folder && cd test_repo1
touch .testfile1 .testfile2 testfile3 folder/testfile4 folder/.testfile5
git init && git add . && git commit -m "test commit"
Run Code Online (Sandbox Code Playgroud)
如果现在我做了git rm
如下,我必须再次删除所有文件
$ git rm -r *
rm 'folder/.testfile5'
rm 'folder/testfile4'
rm 'testfile3'
$ git rm -r *
rm '.testfile1'
rm '.testfile2'
Run Code Online (Sandbox Code Playgroud)
为什么git在第一次尝试中没有删除所有文件?另外,为什么仅对具有repo root的文件发生这种情况?
有趣的是,如果我只有那些.testfiles
,那么git会在第一次尝试中删除它们.
我正在使用git版本 1.7.9.5
在调试模式下,我可以运行django web,可以通过公共(LAN内部)访问:
python manage.py runserver 0.0.0.0:8000
Run Code Online (Sandbox Code Playgroud)
那么,是否有可能直接在端口80(可能是域)上运行它,就像通常的网络服务器一样?如果是的话,这是一个坏主意吗?我的意思是,使用apache更好mod_wsgi
吗?