有时在我提交之后,我发现我遗漏了一个文件,该文件也应该包含在提交中,但实际上并没有.我经常做的是再次提交.
git add the_left_out_file
git commit "include the file which should be added in the last commit"
Run Code Online (Sandbox Code Playgroud)
我认为这样做可能不是一个好主意,我想要做的只是在不添加提交的情况下包含文件.像这样的东西,
git add the_left_out_file
git add_staged_files_to_previous_commit
Run Code Online (Sandbox Code Playgroud)
可能吗?
如果您的DPI超过150的显示器(例如Macbook Pro),您可能也会发现问题:Java Swing应用程序上的字体对于高DPI显示器来说太小了,我根本无法更改字体大小(It直接忽略Windows DPI,仅显示非常原始的DPI - > 96).除了改变屏幕分辨率,我什么也做不了,这绝对会让LCD上的一切变得模糊.
是的,我有一台带有高DPI显示器的笔记本电脑,分辨率为1920x1080的15.6英寸笔记本电脑,笔记本电脑上的一些Java桌面应用程序看起来很小,比如Matlab,Burpsuite等.我一直在互联网上搜索很长时间,但是仍然找不到问题的方法.我知道我可以通过改变JRE字体JRE_HOME/lib/font/fontconfig.properties.src,但我找不到任何地方来设置Java桌面字体的默认字体大小或DPI.
问题没有解决方案吗?你有一台高DPI显示器吗?你如何处理这些应用程序?Swing是否会放弃高DPI用户?
我的Eclipse上安装了PyDev,Java和CDT,有时我需要在不同的视角之间切换; 例如,调试到Pydev.Eclipse有快捷方式可以在它们之间切换吗?
我注意到python 3.5和python 3.6增加了很多关于静态类型检查的功能,所以我尝试使用以下代码(在python 3.6中,稳定版本).
from typing import List
a: List[str] = []
a.append('a')
a.append(1)
print(a)
Run Code Online (Sandbox Code Playgroud)
让我感到惊讶的是,python没有给我一个错误或警告,虽然1附加到一个list只应该包含字符串.Pycharm检测到类型错误并给我一个警告,但它并不明显,它没有在输出控制台中显示,我害怕有时我可能会错过它.我想要以下效果:
那可能吗?也许mypy可以做到,但我更喜欢使用python-3.6-style类型检查(比如a: List[str])而不是使用的注释风格(如# type List[str])mypy.而且我很好奇是否在本机python 3.6中有一个切换来实现我上面提到的两点.
虽然已经安装了python3-pip,但我不能使用pip3.如何解决问题?
sudo pip3 install virtualenv
sudo: pip3: command not found
sudo apt-get install python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
Run Code Online (Sandbox Code Playgroud) 我__class__在python中有一个问题.
文档说这__class__是类实例所属的类.所以我进行了一系列实验:
class counter:
count = 0
def __init__(self):
self.__class__.count += 1
NewCounter1 = counter()
print NewCounter1.count #The result is 1
NewCounter2 = counter()
print NewCounter2.count #The result is 2
print NewCounter2.__class__.count is NewCounter2.count #result: True
Run Code Online (Sandbox Code Playgroud)
一切顺利.
然后我输入如下代码:
NewCounter2.__class__.count = 3
print NewCounter1.count #result:3
print NewCounter1.__class__.count #result:3
print NewCounter2.count #result:3
print NewCounter2.__class__.count #result:3
print NewCounter2.__class__.count is NewCounter2.count #result: True
Run Code Online (Sandbox Code Playgroud)
从上面的代码中,我认为可能NewCounter1.count等于NewCounter1,或者__class__.count,但以下代码让我感到惊讶:
NewCounter2.count = 5
print NewCounter1.count #result:3
print NewCounter1.__class__.count #result:3
print …Run Code Online (Sandbox Code Playgroud) 最近我学习使用node和node-sqlite3来操作sqlite3,这里有一个示例.
var sqlite3 = require('sqlite3');
var db = new sqlite3.Database(':memory:');
db.serialize(function() {
db.run("CREATE TABLE test(info TEXT)");
db.run("INSERT INTO test (info) VALUES ('info1')");
})
db.close();
Run Code Online (Sandbox Code Playgroud)
文档说db.serialized用来确保SQL行按顺序执行,但我很困惑,为什么不按顺序执行它们db.serialize,毕竟它们会从事件队列中拉出并按顺序执行?它在这里如何运作?
如果只有一个sql要执行,运行它是否安全,db.serialize如下所示?
var sqlite3 = require('sqlite3');
var db = new sqlite3.Database(':memory:');
db.run("CREATE TABLE test(info TEXT)");
db.close();
Run Code Online (Sandbox Code Playgroud) 我试图将一个实例移动到另一个实例,如下所示:
#include <iostream>
class student {
public:
student() = default;
student(const student& student) {
std::cout << "copy student" << std::endl;
}
student(student&& student) {
std::cout << "move student" << std::endl;
}
virtual ~student() = default;
};
class undergraduate: public student {
public:
undergraduate(): student() {}
~undergraduate() override = default; // removing this line will make std::move work
};
int main() {
undergraduate student;
undergraduate student1 = std::move(student);
}
Run Code Online (Sandbox Code Playgroud)
这是输出:
copy student
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,std::move没有工作,student被复制而不是被移动,但是,如果我删除了undergraduate析构函数,即以下行:
~undergraduate() override …Run Code Online (Sandbox Code Playgroud) 我有这个代码:
import thread
def print_out(m1, m2):
print m1
print m2
print "\n"
for num in range(0, 10):
thread.start_new_thread(print_out, ('a', 'b'))
Run Code Online (Sandbox Code Playgroud)
我想创建10个线程,每个线程运行该函数print_out,但我失败了.错误如下:
Unhandled exception in thread started by
sys.excepthook is missing
lost sys.stderr
Unhandled exception in thread started by
sys.excepthook is missing
lost sys.stderr
Unhandled exception in thread started by
sys.excepthook is missing
lost sys.stderr
Unhandled exception in thread started by
sys.excepthook is missing
lost sys.stderr
Unhandled exception in thread started by
sys.excepthook is missing
lost sys.stderr
Unhandled exception …Run Code Online (Sandbox Code Playgroud) python ×5
c++ ×1
class ×1
database ×1
debugging ×1
dpi ×1
eclipse ×1
fonts ×1
git ×1
ip ×1
java ×1
matlab ×1
mypy ×1
node-sqlite3 ×1
node.js ×1
perspective ×1
pip ×1
python-3.6 ×1
python-3.x ×1
shortcut ×1
sqlite ×1
swing ×1
type-hinting ×1