Visual Studio中是否内置了标准选项,以便像Vim scrolloff选项或Emacs scroll-margin选项一样工作?
目标是Visual Studio始终在当前点的上方和下方显示至少x行.
首先,如果我错了,请纠正我,但是如果你关闭数据库连接,你不能使用你从中得到的光标,对吗?
db.open();
Cursor c = db.query(true, "MyTable", columns, null, null, null, null, null, null);
db.close();
// The Cursor is empty now because the db was closed...
c.moveToNext();
Log.v(TAG, c.toString(0));
Run Code Online (Sandbox Code Playgroud)
那么在关闭数据库后有没有办法使用Cursor?就像有没有办法将它传递到其他地方并使用它有点像一个对象?或者,在完成光标操作之前,您是否始终保持数据库连接处于打开状态?
我正在使用MySQL的MySQLdb模块(用于Windows Python 2.7的v1.2.3预编译二进制文件)来读取和写入MySQL数据库的数据.一旦连接打开,我就可以使用该连接来观察在同一连接上对数据库所做的更改,但是看不到使用其他连接进行的更改,无论另一个连接是在Python中进行还是使用了更改MySQL命令行客户端.在我使用Python进行更新的情况下,请注意我在连接上运行commit()命令.
使用一个VARCHAR列将新记录插入测试表的程序示例:
import MySQLdb
conn = MySQLdb.connect("localhost", "test", "test", "test")
c = conn.cursor()
c.execute("INSERT INTO test VALUES(%s)", ("Test",))
conn.commit()
c.close()
conn.close()
Run Code Online (Sandbox Code Playgroud)
最终打印常量记录计数的程序示例(而不是打印最新的记录计数).我只能通过杀死和重新运行脚本或每次SELECT运行语句时打开一个新连接来更新计数.
import MySQLdb
conn = MySQLdb.connect("localhost", "test", "test", "test")
while True:
input = raw_input("Enter anything: ")
if input == "exit":
break
c = conn.cursor()
c.execute("SELECT COUNT(*) FROM test")
res = c.fetchone()[0]
c.close()
print("Number of records: %d" % res)
Run Code Online (Sandbox Code Playgroud) 我想在单击div时聚焦输入元素.
我的HTML看起来像这样:
<div class="placeholder_input">
<input type="text" id="username" maxlength="100" />
<div class="placeholder_container">
<div class="placeholder">username</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我的脚本是:
$("#username").focus(function() {
$(this).next().hide();
});
$(".placeholder_input").mousedown(function() {
$(this).children(":first").focus();
});
Run Code Online (Sandbox Code Playgroud)
当我单击文本框时,占位符文本会正确消失,但闪烁的光标不会显示在文本框中.(我无法在文本框中输入任何文字)
在mousedown事件处理程序内部,$(this).children(":first")表达式选择正确的输入元素,因此我不知道为什么focus()调用不起作用.
我收到此错误:
TypeError:'Cursor'类型的对象没有len()
当我尝试执行时:
reply = db['test'].find({"date":{"$gt":date_query}} ,{"date":1,"route_id":1,"loc":1,"_id":0})
length = len(reply)
Run Code Online (Sandbox Code Playgroud) 我在OS X 10.8.4上使用ST2.当我使用Home和End键时,视口移动并且光标保持不变.这是标准的Mac行为,也是我所期待的.
但是,当我使用Page Up(pageup/pgup)和Page Down(pagedown/pgdn)时,光标会随着视口移动.这不是其他Mac应用程序的行为,我希望光标也可以单独保留这些键.
通过将其添加到我的键绑定中,我已经能够完成这一半工作:
[
{ "keys": ["pageup"], "command": "scroll_lines", "args" : {"amount": 30.0} },
{ "keys": ["pagedown"], "command": "scroll_lines", "args" : {"amount": -30.0} }
]
Run Code Online (Sandbox Code Playgroud)
但是,金额是硬编码的.看起来viewport_extent会让我获得视口的高度,但是如何在键绑定文件中使用它呢?这甚至是正确的解决方案吗?我觉得要获得这种行为是一项非常艰巨的工作.
提前致谢.
不确定最适合在此发布.我没有在Sublime的官方/非官方文件或网站上找到它.
任何人都有一个解决方案,在sublime文本中有一个vim /终端类型块游标?
任何建议都是受欢迎的.先感谢您.
我正在开发一个触摸屏应用程序,我需要隐藏光标,只要它在主窗体内.
有任何想法吗?
我遇到了问题ListView(使用CursorAdapter).当我打电话给getListView().getLastVisiblePosition()我的时候-1.这是一个问题,因为我的列表中填充了项目.此外,getListView().getFirstVisiblePosition()无论我在列表中滚动的位置,始终返回0.有任何想法吗?
它与startManagingCursor有关
@Override
public void changeCursor(Cursor cursor) {
super.changeCursor(cursor);
MyActivity.this.mCursor = cursor;
//startManagingCursor(MyActivity.this.mCursor);
}
Run Code Online (Sandbox Code Playgroud)
如果我注释掉startManagingCursor,一切正常.我也尝试stopManagingCursor()在更改之前添加Cursor并仍然有相同的问题.
cursor ×10
android ×2
python ×2
sublimetext3 ×2
c# ×1
cocoa ×1
focus ×1
html ×1
java ×1
javascript ×1
jquery ×1
listview ×1
mongodb ×1
mysql ×1
mysql-python ×1
nsbutton ×1
pymongo ×1
sqlite ×1
sublimetext ×1
sublimetext2 ×1
winforms ×1