cursor

How to change the default position of a cursor in a JTextArea?

a 夏天 提交于 2019-12-11 13:37:55
问题 I have a _result JtextArea. Every second there is a new piece of text String being appended to it. By default, the cursor is at the top. I need the cursor always to be at the very end of the text in the JTextArea. So that I could see what is the last String being appended. _result.append("my text"); // How do I make the cursor of `_result` JTextArea to be at the end of the text? 回答1: Maybe this will help. _result.setCaretPosition(_result.getText().length()); 回答2: You could also try: _result

Nested cursor in a cursor

故事扮演 提交于 2019-12-11 12:43:53
问题 I have a cursor which is CURSOR B_CUR IS select DISTINCT big_id from TEMP_TABLE; This would return multiple values. Earlier it was being used as FOR b_id IN B_CUR LOOP select s.col1, s.col2 INTO var1, var2 from sometable s where s.col3 = b_id.col1; END LOOP; Earlier it was certain that the inner select query would always return 1 row. Now this query can return multiple rows. How can I change this logic? I was thinking to create a nested cursor which will fetch into an array of record type

Effective way to get contacts info with photo

守給你的承諾、 提交于 2019-12-11 11:57:10
问题 I want to get some basic info of all contacts(I use api lvl 8). Currently i use this code snippet private List<ContactInfo> readContacts() { ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, Phone.DISPLAY_NAME + " ASC"); for (int i = 0; i < cur.getColumnCount(); i++) { Log.v("COlum", cur.getColumnName(i)); } List<ContactInfo> temp = new ArrayList<ContactInfo>(); if (cur.getCount() > 0) { while (cur.moveToNext()) {

Android strange behavior with listview and custom cursor adapter

天涯浪子 提交于 2019-12-11 11:49:20
问题 I have a problem with a list view and a custom cursor adapter and I just can't seem to figure out what is wrong with my code. Basically, in my activity I call initalize() that does a bunch of stuff to handle getting the proper data and initializing the listview. On first run of the activity you can see from the images that one of the items is missing from the list. If I go to another activity and go back to this activity the item that was missing shows up. I believe it has something to do

Is cursor.skip() on indexed keys always faster?

别等时光非礼了梦想. 提交于 2019-12-11 11:30:19
问题 I have 2 databases: slow and fast ; each of which was fed with 4096 entries. The age key is a unique random integer that was generated with this script: var arr = [] while(arr.length < 4096){ var randmnum=Math.ceil(Math.random()*1000000) var found=false; for(var i=0;i<arr.length;i++){ if(arr[i]==randmnum){found=true;break} } if(!found)arr[arr.length]=randmnum; } var i=0; for (i=0 ; i< arr.length; ++i) { db.fast.insert({name:"john doe", email:"once@upon.a.time.com", age:arr[i]}); db.slow

T-SQL How To Count Of Records For Each Column

白昼怎懂夜的黑 提交于 2019-12-11 11:22:21
问题 I have a table with over 120 columns and need to determine which column is used the least. I tried using sql queries to do this, but found T-SQL a bit simpler. I tried the following but my count comes out as 0 for every column. Declare data1 Cursor for select column_name from information_schema.columns where table_name = 'repository' Declare @mField nvarchar(255) Declare @count int Open data1; fetch next from data1 into @mField; set @count = -1; while @@fetch_status = 0 begin select @count =

The data types nvarchar and varchar are incompatible in the modulo operator

让人想犯罪 __ 提交于 2019-12-11 11:10:45
问题 I am using the following cursor command to update a record on my table based on a join. I have some similar code working fine in another part of my program, but without using LIKE logic on the join. But when I execute the this code it throws an error. Msg 402, Level 16, State 1, Line 12 The data types nvarchar and varchar are incompatible in the modulo operator. Here is my code: DECLARE @tablevalue NVARCHAR(MAX), @sql NVARCHAR(MAX); DECLARE table_value_cursor CURSOR FOR SELECT DISTINCT

what is the default value of %NOTFOUND in cusor attribute?

随声附和 提交于 2019-12-11 10:49:03
问题 I am studying PL/SQL cursors. I have a problem with a cursor attribute. What a default value for %FOUND , %NOTFOUND in implicit and explicit cursors? I am going through the PDF I found this sentence LOOP FETCH c1 INTO my_ename, my_sal, my_hiredate; EXIT WHEN c1%NOTFOUND; ... END LOOP; Before the first fetch, %NOTFOUND evaluates to NULL. So, if FETCH never executes successfully, the loop is never exited. That is because the EXIT WHEN statement executes only if its WHEN condition is true. To be

Recursive sql server query 4

天大地大妈咪最大 提交于 2019-12-11 10:47:42
问题 I have 2 tables t1 and t2 with columns objectid, parentid and objectname. for each t1.objectid id I need to navigate t2 until t2.parentid is null and concatenate t2.objectname. The navigation criteria is that t1.objectid=t2.parentid .. traverse until t2.parent id is null. I tried cursor however I am not getting desired result. SCHEMA create table t1(objectid varchar(100), parentid varchar(100),objectname varchar(100)) go create table t2(objectid varchar(100), parentid varchar(100),objectname

How to display matrix cursor using list adapter in Android?

风流意气都作罢 提交于 2019-12-11 10:40:05
问题 I am trying to add row to the cursor (which is done with matrix cursor), then pass the cursor to the list adapter (resource adapter). The list adapter takes only a cursor. How do I add a row to the list adapter? 回答1: You don't add a row to the list adapter. You just add a row to the matrix cursor like this: mx.newRow().add(0).add("value of second column").add("value of third column"); mx.newRow().add(1).add("value of second column").add("value of third column"); ... etc. Then with a