cursor

Building a pagination cursor

谁说我不能喝 提交于 2019-12-06 03:37:45
问题 I have activities that are stored in a graph database. Multiple activities are grouped and aggregated into 1 activity in some circumstances. A processed activity feed could look like this: Activity 1 Activity 2 Grouped Activity Activity 3 Activity 4 Activity 5 Activities have an updated timestamp and a unique id. The activities are ordered by their updated time and in the case of a grouped activity, the most recent updated time within its child activities is used. Activities can be inserted

Chrome extension custom cursor

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 03:33:08
问题 I building an Google Chrome extension that place some IMG tag in sites. This img tag on :hover must show a custom cursor. The extension uses jQuery as its injected core script. I tried the following methods: 1. var cursor = 'url('+chrome.extension.getURL('icons/cursor.cur')+')'; $('#myImgId').css({ 'position': 'absolute', 'top':'5px', 'left':'5px', 'cursor':cursor }); This is the best working. On smaller sites its shows the cursor. On slower loading sites it does not. But on little sites it

How do I convert tuple of tuples to list in one line (pythonic)?

流过昼夜 提交于 2019-12-06 03:26:09
问题 query = 'select mydata from mytable' cursor.execute(query) myoutput = cursor.fetchall() print myoutput (('aa',), ('bb',), ('cc',)) Why is it (cursor.fetchall) returning a tuple of tuples instead of a tuple since my query is asking for only one column of data? What is the best way of converting it to ['aa', 'bb', 'cc'] ? I can do something like this : mylist = [] myoutput = list(myoutput) for each in myoutput: mylist.append(each[0]) I am sure this isn't the best way of doing it. Please

基于loghub的消息消费延迟监控

笑着哭i 提交于 2019-12-06 02:58:17
  我们可以把loghub当作一个消息中间件来使用。如果能知道当前的消费进度,自然好了,否则消费情况一无所知,总是有点慌!   loghub消费分两种情况,一是普通消费,二是消费组消费;   消费组消费,loghub服务端会记录消费情况,这时可以通过调用服务端API进行偏移信息查询。   普通消费则不同,需要自行维护偏移量,即只有自己知道偏移信息,自己处理延迟。我们主要讨论这种情况。 一、 消费loghub数据的样例如下: // 普通消费 private static void consumeDataFromShard(int shardId) throws Exception { String cursor = client.GetCursor(project, logStore, shardId, new Date()).GetCursor(); System.out.println("cursor = " +cursor); try { while (true) { PullLogsRequest request = new PullLogsRequest(project, logStore, shardId, 1000, cursor); PullLogsResponse response = client.pullLogs(request); List

How to set mouse cursor on X11 in a C application

与世无争的帅哥 提交于 2019-12-06 02:58:01
I've got a rather large and rather old C application that has been ported to Linux. I'm in charge of getting mouse cursors to work correctly, but having some issues. I was able to convert most of the cursors we require to using the standard cursors provided by XFontCursor by using something like: gCursorTable[waitCurs] = XCreateFontCursor(gDisplay, XC_watch); ... XDefineCursor(gDisplay, WHostWindow(w), gCursorTable[cursor]); XFlush(gDisplay); This is fine for cursors which have analogs in the extremely limited list of (useful) cursors that XFontCursor provides, but there are other built in

plsql-游标

不打扰是莪最后的温柔 提交于 2019-12-06 02:38:13
简介:游标的使用,处理多行数据(类似于java中的Iterator迭代器,用于集合的遍历),游标基本不处理,直接把结果返回给程序处理,例如java的list    4.1显示游标      (1)定义游标 (2)打开游标 (3)提取游标 (4)对游标进行循环操作:判断游标中是否有下一条记录 (5)关闭游标    4.2隐式游标游标判断:游标属性     %FOUND    布尔型属性,当最近一次读记录时成功返回,则值为TRUE;      %NOTFOUND 布尔型属性,与%FOUND相反;      %ISOPEN 布尔型属性,当游标已打开时返回TRUE;      %ROWCOUNT 数字型属性,返回已从游标中读取的记录数; 1.基本使用方法,while循环 --要求: 打印出 80 部门的所有的员工的工资:salary: xxx declare --1. 定义游标 cursor salary_cursor is select salary from employees where department_id = 80; v_salary employees.salary%type; begin --2. 打开游标 open salary_cursor; --3. 提取游标,(单个值) fetch salary_cursor into v_salary; --正确的做法,循环

VBA - How to Set Cursor in a Specific Position in a Textbox?

假装没事ソ 提交于 2019-12-06 02:26:10
问题 The title mostly explains what I need. I have a textbox that I continuously examine for data validity using the _keypress procedure. If the user enters ( then I auto-fill it for them by typing the closing parenthesis ) . The result is () and the cursor is at the end of the textbox. My question is, how can I push the cursor back one step to put it between the two parenthesis? Thanks, Edit: Test scenario: Private Sub txtInput_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If KeyAscii = Asc("

python3.6.4 + pymysql 连接Mysql数据库,实现增删改查

柔情痞子 提交于 2019-12-06 00:05:08
import pymysql conn = pymysql.connect( host = '127.0.0.1', port = 3306, user = 'root', passwd = 'tedu', db = 'tedu', charset = 'utf8' ) cursor = conn.cursor() insert_dep = 'insert into departments values(%s, %s)' ##实现增操作 jihe = [(2, '运维部'), (3, '测试部'), (4, '行政部'), (5, '战略部')] ##把值放进去元组,进行批量插入 cursor.executemany(insert_dep, jihe) ##执行语句 conn.commit() ##提交直接结果 cursor.close() conn.close() cursor = conn.cursor() update_dep = 'update departments set dep_name=%s where dep_id=%s' ##实现改操作 cursor.execute(update_dep, ('人力资源部', 1)) ##单个值修改,元组内的值对应sql语句的占位符 conn.commit() cursor.close() conn.close() cursor

Procedure mysql with cursor is too slow.. Why?

房东的猫 提交于 2019-12-06 00:04:12
I create a Mysql procedure using cursor, but it's run too slow... It's get between 40 and 60 lines by second.. See: DELIMITER $$ CREATE PROCEDURE sp_create(IN v_idsorteio INT,OUT afetados INT) BEGIN DECLARE done INT default 0; DECLARE vc_idsocio INT; DECLARE z INT; DECLARE cur1 CURSOR FOR select IdSocio from socios where Sorteio=1 and Finalizado='S' and CodClientes IS NOT NULL; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done=1; SET z=1; OPEN cur1; FETCH cur1 INTO vc_idsocio; WHILE done=0 DO -- SELECT register as t; insert INTO socios_numeros_sorteio (IdSocio,IdSorteio,NumerodeSorteio)

android cursor movetofirst performance issue

China☆狼群 提交于 2019-12-05 22:22:38
i am trying to optimize my application. I noticed that cursor.movetofirst() method somehow slowing the performance of my code. Cursor cursor = myDbHelper.getDayInfo(new SimpleDateFormat("yyyy-MM-dd").format(myCalendar.getTime()); above line executes in 10 ms in 2.1 emulator , and if(cursor != null && cursor.moveToFirst()) this line took about 1.6 seconds . I made little search about this. Somepeople say make it in another thread or in asynctask, but this will make the code more complicated. I 'm just trying to figure out what is actually happening to this cursor. Can anyone simplify or give a