Search Results

Search found 2876 results on 116 pages for 'cursor'.

Page 22/116 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • changing image on listview at runtime in android

    - by Raj
    Hi, I am using a LinearLayout to display some Text and image. I have the images at drawable/ and i am implimenting this with ListActivity with some onListItemClick functionality. now i wants to change the image for the rows which are processed by onclick functionality to show the status as processed. can some one help me in this issue to change the image at runtime. the following is my implimentation. public class ListWithImage extends ListActivity { /** Called when the activity is first created. */ private SimpleCursorAdapter myAdapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // raj setContentView(R.layout.main); Cursor cursor = getContentResolver().query(People.CONTENT_URI, null, null, null, null); startManagingCursor(cursor); String[] columns = new String[] {People.NAME, People.NUMBER}; int[] names = new int[] {R.id.contact_name, R.id.contact_number}; myAdapter = new SimpleCursorAdapter(this, R.layout.main, cursor, columns, names); setListAdapter(myAdapter); } @Override protected void onListItemClick(ListView listView, View view, int position, long id) { super.onListItemClick(listView, view, position, id); Intent intent = new Intent(Intent.ACTION_CALL); Cursor cursor = (Cursor) myAdapter.getItem(position); long phoneId = cursor.getLong(cursor.getColumnIndex(People.PRIMARY_PHONE_ID)); intent.setData(ContentUris.withAppendedId(Phones.CONTENT_URI, phoneId)); startActivity(intent); } } and main.xml is : <LinearLayout android:layout_height="wrap_content" android:orientation="vertical" android:layout_width="250px"> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Name: " /> <TextView android:id="@+id/contact_name" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Phone: " /> <TextView android:id="@+id/contact_number" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout>

    Read the article

  • Why connection in Python's DB-API does not have "begin" operation?

    - by newtover
    Working with cursors in mysql-python I used to call "BEGIN;", "COMMIT;", and "ROLLBACK;" explicitly as follows: try: cursor.execute("BEGIN;") # some statements cursor.execute("COMMIT;") except: cursor.execute("ROLLBACK;") then, I found out that the underlying connection object has the corresponding methods: try: cursor.connection.begin() # some statements cursor.connection.commit() except: cursor.connection.rollback() Inspecting the DB-API PEP I found out that it does not mention the begin() method for the connection object, even for the extensions. Mysql-python, by the way, throws the Deprecation Warning, when you use the method. sqlite3.connection, for example, does not have the methd at all. And the question is why there is no such method in the PEP? Is the statement somehow optional, is it enough to invoke commit() instead?

    Read the article

  • Cursors vs Procedures in SQL

    - by CogitoErgoSum
    So, I just learned about CURSORS but still don't exactly grasp them. What is the difference between a cursor and procedure or even a function? So far from the various examples (DECLARE CURSOR ... SELECT ... FROM ...) It seems at most its a variable to hold a query. Is the data real time, or a snapshot of when the cursor was declared? i.e. I have a table with one row and one col with a value of 2. I do DECLARE CURSOR ... SELECT * FROM table1 I then insert a new row with a value of 3. When I run the cursor, would I Just get the one row from before the cursor was declared, or both rows? Thanks

    Read the article

  • how to draw rectangle around mouse cursor in java?

    - by Nitz
    hey guys i had made one module in my project, on which user can draw any thing using pencil now i want to create eraser for that drawing module so i need that as soon as user click on that eraser button then, around my mouse cursor i want little rectangle shape around it. so user can use it to erase the some parts in drawing. may be smilier kind of things happen in mspaint but i am doing this in java - swing. how to do this, any suggestion? thanks in advance... nitz.

    Read the article

  • predict location of single-line text from a UITextView

    - by William Jockusch
    Is this possible? Specifically, I have a UITextView, and the text is short enough that it will fit on a single line. I want to predict where it will appear, so that (for example) if I wanted to, I could set up a UILabel that rendered the text in exactly the same location. Once I get that figured out, what I really want to do is pick contentInset and/or contentOffset so that the text of the UITextView and the left-justified UILabel will render in the same location. But I figure the above will let me do that. EDIT: In response to a comment, the fundamental problem I am trying to get around is that UITextField does not let you set the location of the cursor. It appears a lot of people have tried to get around this without success. I need to be able to move the cursor -- inserting/deleting text there is not enough. Control cursor position in UITextField Insert string at cursor position of UITextField Moving the cursor to the beginning of UITextField iOS -- dealing with the inability to set the cursor position in a UITextField

    Read the article

  • Graphics Question: How do I restrict the mouse cursor to within a circle?

    - by Dan
    I'm playing with XNA. When I click the left mouse button, I record the X,Y co-ordinates. Keeping the mouse button held down, moving the mouse draws a line from this origin to the current mouse position. I've offset this into the middle of the window. Now, what I'd like to do is restrict the mouse cursor to within a circle (with a radius of N, centred on the middle of the screen). Restricting the mouse to a rectangular region is easy enough (by adjusting the origin by the difference of the mouse position and the size of the region), but I haven't a clue on how to start doing it for a circular region. Can anyone explain how to do this? Any advice on where to start would be helpful.

    Read the article

  • Ubuntu 14.04 stalling. Problem with LightDM. Plymouth (and logging out) switches over to a black screen w/ white cursor

    - by Kage
    if its a duplicate, sorry. Couldn't find anything that fits my issue, much less that was on 14.04. I changed a few things recently. Switched to the Numix theme (from PPA), installed lm-sensors and psensor (ran all the I/O probes), Ubuntu Tweak, Pinta, and well, Team Fortress 2 on Steam. :P The system will get to the Plymouth 'ubuntu' screen, load load, all dots filled, switches over to LightDM, but wait! No LightDM. :I Just a blank screen with that white cursor. Can't switch out to tty1-6 - not sure if the Ctrl-Alt-F1 is disabled in 14.04 or if its literally just locked down. If I change any files, I have access to the filesystem from my Windows 8 partition. That's it. :/ I'm pretty familiar with Linux, especially Ubuntu, but I think I'm still at the point I know just enough to break things and not always how to fix 'em. Any help would be greatly appreciated. Thanks! UPDATE I was just able to get into my desktop briefly. I booted Ubuntu. When the black screen froze, I hit Ctrl-Alt-Del. When it started switching off, I hit Ctrl-Alt-Backspace. It rebooted. I plugged the second monitor in I had been using before the issue ever came about. Plymouth displayed on both. LightDM came up, displayed on both (it used to show only the ubuntu logo on the unfocused monitor though). I logged in just fine. Even ran some pending software updates. I logged out of the desktop though, and LightDM refused to show again. xP

    Read the article

  • My feenix nascita mouse isn't moving my cursor. Ubuntu version appears to not matter. How do I debug this, and get the mouse working?

    - by NullVoxPopuli
    I had 13.04, upgraded to 13.10, and did a fresh install of 13.10, no luck. Any ideas? Just tail -f'd my syslog and plugged in the mouse. here is what I got: Oct 26 16:15:50 Orithyia kernel: [83369.618365] usb 1-1.5.2: new full-speed USB device number 6 using ehci-pci Oct 26 16:15:50 Orithyia kernel: [83369.718913] usb 1-1.5.2: New USB device found, idVendor=04d9, idProduct=a081 Oct 26 16:15:50 Orithyia kernel: [83369.718919] usb 1-1.5.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Oct 26 16:15:50 Orithyia kernel: [83369.718921] usb 1-1.5.2: Product: USB Gaming Mouse Oct 26 16:15:50 Orithyia kernel: [83369.718924] usb 1-1.5.2: Manufacturer: Holtek Oct 26 16:15:50 Orithyia kernel: [83369.722486] input: Holtek USB Gaming Mouse as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5.2/1-1.5.2:1.0/input/input13 Oct 26 16:15:50 Orithyia kernel: [83369.722786] hid-generic 0003:04D9:A081.0004: input,hidraw3: USB HID v1.10 Keyboard [Holtek USB Gaming Mouse] on usb-0000:00:1a.0-1.5.2/input0 Oct 26 16:15:50 Orithyia kernel: [83369.729362] hid-generic 0003:04D9:A081.0005: usage index exceeded Oct 26 16:15:50 Orithyia kernel: [83369.729366] hid-generic 0003:04D9:A081.0005: item 0 2 2 2 parsing failed Oct 26 16:15:50 Orithyia kernel: [83369.729379] hid-generic: probe of 0003:04D9:A081.0005 failed with error -22 Oct 26 16:15:50 Orithyia kernel: [83369.731759] hid-generic 0003:04D9:A081.0006: hiddev0,hidraw4: USB HID v1.10 Device [Holtek USB Gaming Mouse] on usb-0000:00:1a.0-1.5.2/input2 Oct 26 16:15:50 Orithyia mtp-probe: checking bus 1, device 6: "/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5.2" Oct 26 16:15:50 Orithyia mtp-probe: bus: 1, device: 6 was not an MTP device So, I see it did see it is a mouse... but the cursor doesn't move when I move the mouse. Not sure where to debug from here.

    Read the article

  • Permission issues causes Unity Segmentation fault

    - by Dj Gilcrease
    I upgraded from 13.04 to 13.10 and I can boot to the unity-greeter and login just fine, but after login I just get a black screen with a cursor. I have tried following http://help.ubuntu.com/community/BinaryDriverHowto/ATI http://help.ubuntu.com/community/RadeonDriver and the manual install of the downloaded AMD drivers. All have the same affect. Also I have read Black screen after login with cursor I get a black screen after logging in ubuntu 13.04 black screen after login Ubuntu 13.10 - Black screen after login session Ubuntu 13.04 - Black screen with unresponsive cursor Upgrade to Ubuntu 13.04 Problem - Boots into Blank Black Screen All of which were no further help then the two support articles about ATI drivers So I switched back to the default drivers and went a little further into debugging, when I do ctrl+alt+F1 and login and try unity --debug > unity_start.log then ctrl+alt+F8 the screen stays black with a cursor and when I switch back ctrl+alt+F1 the contents of the log output are http://pastebin.com/rdQG4Hb0 However when I try sudo unity --debug > unity_start_root.log then ctrl+alt+F8, unity starts and the output of the log is http://pastebin.com/Yv4RD2j7 The fact that it starts as root tells be it is either a permissions issue of some required file or there is some setting that is specific to my user that is causing the SIGSEGV. So to narrow this down I activated the guest account and tried to login and got the same black screens with only a mouse cursor, so this tells me that it is not a configuration issue, but a permissions issue, so how do I narrow down which file has the wrong permissions? Also is there anything further that may help debug this issue? Ok after a few more hours of googling I found that if I add myself to the video group I can login and see the desktop, but there are lots of other permission related issues, so I am thinking something went wonky with PolicyKit during the upgrade, is there a way to reset PolicyKit settings for a user?

    Read the article

  • How to make mouse wheel to scroll control under mouse cursor?

    - by skevar7
    Currently, mouse wheel scrolls the control that has keyboard focus. That's not good when window has several scrollable controls, because I have to click control first and then scroll. And the same again when trying to scoll another control. Especially bad, when that control has some action associated with click (like MSDN's article list - it opens new article on click). So, is there any tool to fix mouse scroll behavior?

    Read the article

  • How to use database adapters' cursors safely?

    - by lvictorino
    I started to use psycopg2 to connect my little python script to a PostgreSQL database few days ago. After some research I found that a lot of database connector, like psycopg, work using cursors. I know what is a cursor and how to use it. But I still wonder if it's safe to use the same cursor all along the script life. Is it safe? Or would it be preferable to use a different cursor for each query?

    Read the article

  • Why does Unity not extend to my 2nd monitor, even when it is displaying an X-Screen?

    - by Gridwalker
    I recently added a 2nd video card to my system, but unity refuses to extend my desktop over to the second screen. Although the secondary monitor initialises when I boot and I can move the mouse cursor over to the 2nd screen, the screen is otherwise blank (showing no wallpaper or interface elements) and I am unable to move any windows to this monitor. Moving the mouse cursor over to the 2nd monitor changes it from the default cursor to the old-style X cursor, such as the one that appears when you run X-kill, indicating that this screen is initialised in the X Server but that Unity is not recognising it. Although the Nvidia X Server Settings application can see both monitors, the unity systems settings application does not detect the 2nd adapter. Sometimes the additional drivers application can see both adapters, but it doesn't consistently show options for them both. Xrandr also fails to detect the 2nd monitor, but iNex lists both adapters. I have experimented with several different drivers for each adapter and with setting each of the graphics cards as the primary adapter in the BIOS, but this has made little difference. The two adapters are an onboard Geforce 8200 and a PCIE Geforce 7200 GX. The onboard adapter is currently set as the primary, however this adapter crashes whenever I use the Nouveau driver and I have to switch over to the PCIE as a primary whenever I purge the proprietary drivers (switching back when the 304 driver has been reinstalled). It doesn't matter which adapter I set as my primary, the results are the same : one screen showing the unity interface and one screen showing an X-Screen that only displays the mouse cursor. All I want is to be able to run this system in a dual screen configuration. I am not a gamer, nor do I require 3D rendering capabilities. Anything you can suggest to get the desktop to extend across both screens will be massively appreciated!

    Read the article

  • Can I reactivate the cursor keys for modifying a cell reference in a formula?

    - by Jonas Heidelberg
    When I enter an Excel formula by hand avoiding the mouse, I can conveniently reference cells by using the arrow keys (-,<- etc.). For example, I can enter the formula =A2&B2 in cell C2 by entering =<-&<-<- The result looks like this: If I want to change from B2 to B3, I can just press the downward arrow on the keyboard at this time. How do I do the same thing later, after having left this cell (e.g. by pressing Enter)? In other words, how do I get the flashing dashed line back when re-entering a cell with F2?

    Read the article

  • HP Probook touchpad

    - by ScienceSE
    I wrote about this problem some weeks ago, but now the question is: "Why is touchpad works not so good as in windows". I tried some "experiments": When I use windows and if I accidentally touched touchpad - cursor isn't moving, also no clicks occurring. So in windows working with touchpad is quite normal, but in Ubuntu ?f I accidentally touch the touchpad even with my wrist - cursor is moving etc. In Windows, the cursor moves only when I touch it with finger. And... If, for example, I hold one finger on touchpad and simultaneously move the second finger on the touchpad - the cursor doesn't move, however in ubuntu he does. He's "super sensetive" in ubuntu or what? Also I tried to apply the option in "Mouse and touchpad", which called "Disable touchpad when typing", but nevertheless he isn't disabling when i'm typing... Note: this option is circled in red frame, i dont know is it a good "sign" ) What can I do to fix the problem?

    Read the article

  • How to open the file under cursor in vim when its listing directory contents(Netrw Directory Listing)

    - by balki
    I can press o but it creates a new window and opens the file there. I want it to open in the same window. At least it should display on the same window each time open some file but it creates new windows for each file I open. Also is there a way to make it open as a vertical split and not horizontal split? Where can I find the complete documentation/cheatsheet of all possible commands in 'Netrw Directory Listing' mode?

    Read the article

  • why it throws index out of bounds exception??

    - by Johanna
    Hi I want to use merge sort for sorting my doubly linked list.I have created 3 classes(Node,DoublyLinkedList,MergeSort) but it will throw this exception for these lines: 1.in the getNodes method of DoublyLinkedList---> throw new IndexOutOfBoundsException(); 2.in the add method of DoublyLinkedList-----> Node cursor = getNodes(index); 3.in the sort method of MergeSort class------> listTwo.add(x,localDoublyLinkedList.getValue(x)); 4.in the main method of DoublyLinkedList----->merge.sort(); this is my Merge class:(I put the whole code for this class for beter understanding) public class MergeSort { private DoublyLinkedList localDoublyLinkedList; public MergeSort(DoublyLinkedList list) { localDoublyLinkedList = list; } public void sort() { if (localDoublyLinkedList.size() <= 1) { return; } DoublyLinkedList listOne = new DoublyLinkedList(); DoublyLinkedList listTwo = new DoublyLinkedList(); for (int x = 0; x < (localDoublyLinkedList.size() / 2); x++) { listOne.add(x, localDoublyLinkedList.getValue(x)); } for (int x = (localDoublyLinkedList.size() / 2) + 1; x < localDoublyLinkedList.size(); x++) { listTwo.add(x, localDoublyLinkedList.getValue(x)); } //Split the DoublyLinkedList again MergeSort sort1 = new MergeSort(listOne); MergeSort sort2 = new MergeSort(listTwo); sort1.sort(); sort2.sort(); merge(listOne, listTwo); } public void merge(DoublyLinkedList a, DoublyLinkedList b) { int x = 0; int y = 0; int z = 0; while (x < a.size() && y < b.size()) { if (a.getValue(x) < b.getValue(y)) { localDoublyLinkedList.add(z, a.getValue(x)); x++; } else { localDoublyLinkedList.add(z, b.getValue(y)); y++; } z++; } //copy remaining elements to the tail of a[]; for (int i = x; i < a.size(); i++) { localDoublyLinkedList.add(z, a.getValue(i)); z++; } for (int i = y; i < b.size(); i++) { localDoublyLinkedList.add(z, b.getValue(i)); z++; } } } and just a part of my DoublyLinkedList: private Node getNodes(int index) throws IndexOutOfBoundsException { if (index < 0 || index > length) { throw new IndexOutOfBoundsException(); } else { Node cursor = head; for (int i = 0; i < index; i++) { cursor = cursor.getNext(); } return cursor; } } public void add(int index, int value) throws IndexOutOfBoundsException { Node cursor = getNodes(index); Node temp = new Node(value); temp.setPrev(cursor); temp.setNext(cursor.getNext()); cursor.getNext().setPrev(temp); cursor.setNext(temp); length++; } public static void main(String[] args) { int i = 0; i = getRandomNumber(10, 10000); DoublyLinkedList list = new DoublyLinkedList(); for (int j = 0; j < i; j++) { list.add(j, getRandomNumber(10, 10000)); MergeSort merge = new MergeSort(list); merge.sort(); System.out.println(list.getValue(j)); } } PLEASE help me thanks alot.

    Read the article

  • SQL Server Reset Identity Increment for all tables

    - by DanSpd
    Basically I need to reset Identity Increment for all tables to its original. Here I tried some code, but it fails. http://pastebin.com/KSyvtK5b actual code from link: USE World00_Character GO -- Create a cursor to loop through the System Ojects and get each table name DECLARE TBL_CURSOR CURSOR -- Declare the SQL Statement to cursor through FOR ( SELECT Name FROM Sysobjects WHERE Type='U' ) -- Declare the @SQL Variable which will hold our dynamic sql DECLARE @SQL NVARCHAR(MAX); SET @SQL = ''; -- Declare the @TblName Variable which will hold the name of the current table DECLARE @TblName NVARCHAR(MAX); -- Open the Cursor OPEN TBL_CURSOR -- Setup the Fetch While that will loop through our cursor and set @TblName FETCH NEXT FROM TBL_CURSOR INTO @TblName -- Do this while we are not at the end of the record set WHILE (@@FETCH_STATUS <> -1) BEGIN -- Appeand this table's select count statement to our sql variable SET @SQL = @SQL + ' ( SELECT '''+@TblName+''' AS Table_Name,COUNT(*) AS Count FROM '+@TblName+' ) UNION'; -- Delete info EXEC('DBCC CHECKIDENT ('+@TblName+',RESEED,(SELECT IDENT_SEED('+@TblName+')))'); -- Pull the next record FETCH NEXT FROM TBL_CURSOR INTO @TblName -- End the Cursor Loop END -- Close and Clean Up the Cursor CLOSE TBL_CURSOR DEALLOCATE TBL_CURSOR -- Since we were adding the UNION at the end of each part, the last query will have -- an extra UNION. Lets trim it off. SET @SQL = LEFT(@SQL,LEN(@SQL)-6); -- Lets do an Order By. You can pick between Count and Table Name by picking which -- line to execute below. SET @SQL = @SQL + ' ORDER BY Count'; --SET @SQL = @SQL + ' ORDER BY Table_Name'; -- Now that our Dynamic SQL statement is ready, lets execute it. EXEC (@SQL); GO error message: Error: Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '('. How can I either fix that SQL or reset identity for all tables to its original? Thank you

    Read the article

  • Android ExpandableListView From Database

    - by SterAllures
    I want to create a two level ExpandableListView from a local database. The group level I want to get the names from the database Category table category_id | name ------------------- 1 | NameOfCategory the children level I want to get the names from the List table list_id | name | foreign_category_id -------------------------------- 1 | Listname | 1 I've got a method in DatabaseDAO to get all the values from the table public List<Category> getAllCategories() { database = dbHelper.getReadableDatabase(); List<Category> categories = new ArrayList<Category>(); Cursor cursor = database.query(SQLiteHelper.TABLE_CATEGORY, null, null, null, null, null, null); cursor.moveToFirst(); while(!cursor.isAfterLast()) { Category category = cursorToCategory(cursor); categories.add(category); cursor.moveToNext(); } cursor.close(); return categories; } Now adding the names to the group level is easy I do it the following way: ArrayList<String> groups; for(Category c : databaseDao.getAllCategories()) { groups.add(c.getName()); } Now I want to add the children to the ExpandableListView in the following array ArrayList<ArrayList<ArrayList<String>>> children;. How do I get the children under the correct group name? I think it has to do somenthing with groups.indexOf() but in the list table I only have a foreign category_id and not the actual name.

    Read the article

  • How to compare 2 lists and merge them in Python/MySQL?

    - by NJTechGuy
    I want to merge data. Following are my MySQL tables. I want to use Python to traverse though a list of both Lists (one with dupe = 'x' and other with null dupes). For instance : a b c d e f key dupe -------------------- 1 d c f k l 1 x 2 g h j 1 3 i h u u 2 4 u r t 2 x From the above sample table, the desired output is : a b c d e f key dupe -------------------- 2 g c h k j 1 3 i r h u u 2 What I have so far : import string, os, sys import MySQLdb from EncryptedFile import EncryptedFile enc = EncryptedFile( os.getenv("HOME") + '/.py-encrypted-file') user = enc.getValue("user") pw = enc.getValue("pw") db = MySQLdb.connect(host="127.0.0.1", user=user, passwd=pw,db=user) cursor = db.cursor() cursor2 = db.cursor() cursor.execute("select * from delThisTable where dupe is null") cursor2.execute("select * from delThisTable where dupe is not null") result = cursor.fetchall() result2 = cursor2.fetchall() for cursorFieldname in cursor.description: for cursorFieldname2 in cursor2.description: if cursorFieldname[0] == cursorFieldname2[0]: ### How do I compare the record with same key value and update the original row null field value with the non-null value from the duplicate? Please fill this void... cursor.close() cursor2.close() db.close() Thanks guys!

    Read the article

  • I can not get the text from a selected item in a listview...pleeeeasss help.

    - by Miguel
    I always get an ClassCastException error... i do not what else to do... - I'm using a data biding concept to populated the listview from a sqlite3 database. - I just want to get the selected item text after a long press click. This is the code of the activity: public class ItemConsultaGastos extends ListActivity { private DataHelper dh ; TextView seleccion; private static String[] FROM = {DataHelper.MES, DataHelper.ANO}; private static int[] TO = {R.id.columnaMes, R.id.columnaAno }; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.muestrafechas); this.dh = new DataHelper(this); Cursor cursor = dh.selectAllMeses(); startManagingCursor(cursor); this.mostrarFechas(cursor); ListView lv = getListView(); lv.setOnItemLongClickListener(new OnItemLongClickListener(){ @Override public boolean onItemLongClick(AdapterView<?> arg0, View arg1,int row, long arg3) { //here is where i got the classCastException. String[] tmp = (String[]) arg0.getItemAtPosition(row); //tmp[0] ist the Text of the first TextView displayed by the clicked ListItem Log.w("Gastos: ", "El texto: " + tmp[0].toString()); return true; } }); } private void mostrarFechas(Cursor cursor) { SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,R.layout.muestrafechasitem,cursor, FROM, TO); setListAdapter(adapter); } } ///// This is the xml where a define the rows to show on the listview <TextView android:id="@+id/espacio" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" " /> <TextView android:id="@+id/columnaAno" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="20sp" android:layout_toRightOf="@+id/espacio"/> <TextView android:id="@+id/separador1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" -- " android:layout_toRightOf="@+id/columnaAno" android:textSize="20sp" /> <TextView android:id="@+id/columnaMes" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_toRightOf="@+id/separador1" android:textSize="20sp"/>

    Read the article

  • Rollback doesn't work in MySQLdb

    - by Anton Barycheuski
    I have next code ... db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db, charset='utf8', use_unicode=True) db.autocommit(False) cursor = db.cursor() ... for col in ws.columns[1:]: data = (col[NUM_ROW_GENERATION].value, 1, type_topliv_dict[col[NUM_ROW_FUEL].value]) fullgeneration_id = data[0] type_topliv = data[2] if data in completions_set: compl_id = completions_dict[data] else: ... sql = u"INSERT INTO completions (type, mark, model, car_id, type_topliv, fullgeneration_id, mark_id, model_id, production_period, year_from, year_to, production_period_url) VALUES (1, '%s', '%s', 0, %s, %s, %s, %s, '%s', '%s', '%s', '%s')" % (marks_dict[mark_id], models_dict[model_id], type_topliv, fullgeneration_id, mark_id, model_id, production_period, year_from, year_to, production_period.replace(' ', '_').replace(u'?.?.', 'nv') ) inserted_completion += cursor.execute(sql) cursor.execute("SELECT fullgeneration_id, type, type_topliv, id FROM completions where fullgeneration_id = %s AND type_topliv = %s" % (fullgeneration_id, type_topliv)) row = cursor.fetchone() compl_id = row[3] if is_first_car: deleted_compl_rus = cursor.execute("delete from compl_rus where compl_id = %s" % compl_id) for param, row_id in params: sql = u"INSERT INTO compl_rus (compl_id, modification, groupparam, param, paramvalue) VALUES (%s, '%s', '%s', '%s', %s)" % (compl_id, col[NUM_ROW_MODIFICATION].value, param[0], param[1], col[row_id].value) inserted_compl_rus += cursor.execute(sql) is_first_car = False db.rollback() print '\nSTATISTICS:' print 'Inserted completion:', inserted_completion print 'Inserted compl_rus:', inserted_compl_rus print 'Deleted compl_rus:', deleted_compl_rus ans = raw_input('Commit changes? (y/n)') db.close() I has manually deleted records from table and than run script two times. See https://dpaste.de/MwMa . I think, that rollback in my code doesn't work. Why?

    Read the article

  • Twitter API PHP script error

    - by bardockyo
    I am having issues with my php script that I am using for gathering a users followers by accessing the twitter API. The script works fine for a user that has < 5000 followers but I tried adjusting the script using cursors to collect the complete set of users. Here is my script: <?php $cursor = -1; $file = fopen ('ids.csv', 'w+'); fwrite($file, "User id\n\r"); for ($i = 0; $i <= 1; $i++) { $xml = getFollowers($cursor); foreach ($xml->ids->id as $id) { fwrite($file, $id . ", "); fwrite($file, "\n"); } $cursor = $xml->next_cursor; } function getFollowers ($cursor) { $xmldata = 'https://api.twitter.com/1/followers/ids.xml?cursor='.$cursor.'&screen_name=microsoft'; $open = fopen($xmldata, 'r'); $content = stream_get_contents($open); fclose($open); $xml = simplexml_load_file($xmldata); return $xml; } ?> I am getting an error Warning: fopen("https://api.twitter.com/1/followers/ids.xml?cursor=-1&screen_name=microsoft") failed to open stream HTTP request failed bad request warning: stream_get_contents() expects parameter 1 to be resource, boolean given. Any ideas?

    Read the article

  • Difficult to point-and-click target with Apple Magic Trackpad?

    - by Andrew Swift
    My Magic Trackpad is great for most things involving dragging and gestures, but for simple point-and-click use it is starting to get really annoying. For example, my bank has a numeric code that I need to enter from a visual grid on the screen, by clicking on the six numbers in order. To do this is quite difficult with the Magic Trackpad. Idea 1: it is because when you start dragging on the touchpad, there is a brief delay before the mouse starts to move. The delay might be enough to screw up my anticipation of where the cursor is going to go. Idea 2: it may have to do with the cursor acceleration. If I move it a little, the cursor moves a little. If I move it a lot, it goes much faster. I have tried various settings in the preference pane, and although the cursor does move more or less quickly, it doesn't seem any more or less easy to hit a given target. As I am writing this post, I tried a brief experiment -- I chose a spot on the page (the bracket in the superuser logo) and tried to move the cursor there in one quick movement. It's extremely difficult, even though I've been using Macs and touchpads since 1999. There is something about the behavior of the trackpad that is making it impossible for me to learn how to accurately predict where the cursor will end up. Does anyone else have this problem?

    Read the article

  • Difficult to point-and-click target with Apple Magic Trackpad?

    - by Andrew Swift
    My Magic Trackpad is great for most things involving dragging and gestures, but for simple point-and-click use it is starting to get really annoying. For example, my bank has a numeric code that I need to enter from a visual grid on the screen, by clicking on the six numbers in order. To do this is quite difficult with the Magic Trackpad. Idea 1: it is because when you start dragging on the touchpad, there is a brief delay before the mouse starts to move. The delay might be enough to screw up my anticipation of where the cursor is going to go. Idea 2: it may have to do with the cursor acceleration. If I move it a little, the cursor moves a little. If I move it a lot, it goes much faster. I have tried various settings in the preference pane, and although the cursor does move more or less quickly, it doesn't seem any more or less easy to hit a given target. As I am writing this post, I tried a brief experiment -- I chose a spot on the page (the bracket in the superuser logo) and tried to move the cursor there in one quick movement. It's extremely difficult, even though I've been using Macs and touchpads since 1999. There is something about the behavior of the trackpad that is making it impossible for me to learn how to accurately predict where the cursor will end up. Does anyone else have this problem?

    Read the article

  • SQl function in android

    - by rui.pereira
    Cursor cursor = db.rawQuery("SELECT COUNT(rat) FROM "+ TABLE_NAME_EXTRA +" apkid=\""+apkid, null); cursor.moveToFirst(); int somatotal = cursor.getInt(0); I'm trying to do a SQL function like count and sum, but this code returns a exception saying "emptyvalues". anyone know why?

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >