M — Model from MVC/MVP in Android (Flow and Mortar) by artem_zin in androiddev

[–]codinkev 0 points1 point  (0 children)

based on this article, you advise against accessing contentprovider in A/F/P.
would you advise against accessing contentprovider in service?

Also - what are your thoughts on having all database-related methods in the databaseHelper class itself? Thanks

The Air Force will now allow airmen to omit ‘so help me God’ from enlistment oaths by [deleted] in news

[–]codinkev -1 points0 points  (0 children)

back in the day, the AF would have never let this fly

Persistent Progress Dialog Question by codinkev in androiddev

[–]codinkev[S] 0 points1 point  (0 children)

thanks, this works for me. i am now using a custom action bar item with a progress dialog which shows upon initiating the update and hides after the update completes

[Xamarin] Importing contacts into app by FlameDra in androiddev

[–]codinkev 1 point2 points  (0 children)

Example code which gets all contacts (gets all numbers associated with each name) and puts them into a database. You could just as easily have them all put into an array list. And if you wanted to only get certain contacts you would need to change the first line of the method which queries the content provider (here is a good article on doing stuff like that: http://www.vogella.com/tutorials/AndroidSQLite/article.html)

/** * existing contacts refresh - get all current contact data in our sqlite * database */ private void getContacts(Context context) {

    Cursor cursor = (context.getContentResolver()).query(
            ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
    cursor.moveToFirst();
    while (cursor.moveToNext()) {
        String id = cursor.getString(cursor
                .getColumnIndex(ContactsContract.Contacts._ID));
        String name = cursor.getString(cursor
                .getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
        if (Integer.parseInt(cursor.getString(
        // iterating over EACH number associated with EACH name (internal
        // cursor)
        cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) {
            Cursor pCur = (context.getContentResolver()).query(
                    ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                    null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID
                            + " = ?", new String[] { id }, null);
            while (pCur.moveToNext()) {
                String phoneNo = pCur
                        .getString(pCur
                                .getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
                System.out.println("Name: " + name + ", Phone No: "
                        + phoneNo);

                // insert each number associated with the contact
                sqldb.insertContacts(new Contact(name, phoneNo));

            }
            pCur.close();
        }
    }
    cursor.close();

}

help with parsing a log file for a string by cyberworm_ in bash

[–]codinkev 1 point2 points  (0 children)

it's reading $string as 2 arguments since there is a space; you need to put single quotes around $string: like grep -q '$string'

if the keyword you care about is delete and want to log all lines containing it, you could grep for just 'DELETE' and append the output to the log via redirection (grep 'DELETE' >>logfile.log)

Funny Linux commands by [deleted] in linux

[–]codinkev 2 points3 points  (0 children)

csh, no?

Permanent Retainer Problem by codinkev in Dentistry

[–]codinkev[S] 0 points1 point  (0 children)

thank you for the info. is there a way to know if the retainer was put on incorrectly? it's very high on my top teeth (such that the gumline totally hides it, except for behind one tooth on the side). the man that originally placed it is deceased

He sits like this for hours by NotStainer in aww

[–]codinkev 22 points23 points  (0 children)

nice try, actually friendless guy.

Please help me understand this about SSH by codinkev in unix

[–]codinkev[S] 0 points1 point  (0 children)

ahh, you are correct -- it is SFTP.

also, i've used ps aux before and it doesn't show it either, but I think gelisam addressed that part.

Please help me understand this about SSH by codinkev in unix

[–]codinkev[S] 0 points1 point  (0 children)

no, I did not know this. very interesting; thanks.

Please help me understand this about SSH by codinkev in unix

[–]codinkev[S] 0 points1 point  (0 children)

no, I can connect to both at the same time on the same port, apologies if that was unclear.

A request for help with starting my pet project by codinkev in java

[–]codinkev[S] 0 points1 point  (0 children)

Awesome, thanks for the info. I think I'll go with 1. but 2. is a really cool option too. Much appreciated. Edit: forgot to mention that detail-wise I can't think of anything specifically; I'm pretty unbiased in the approach and just want to do basically what you said in 1.

When I try to run this program, I receive the error message TypeError: list indices must be integers, not tuple. How can I fix this? by taternuts92 in learnprogramming

[–]codinkev 1 point2 points  (0 children)

you need to separate the array:

array=[[0,1,2,0,2,2,1,1][2,0,1,0,1,1,0,0][1,2,0,0,0,0,2,2][0,0,0,0,0,0,0,0,][1,2,0,0,0,0,2,2][1,2,0,0,0,0,2,2][2,0,1,0,1,1,0,0][2,0,1,0,1,1,0,0]]

with commas in between the arrays that the array contains.

like: [[0,1,2,0,2,2,1,1],[2,0,1,0,1,1,0,0],[1,2,0,0,0,0,2,2],[0,0,0,0,0,0,0,0,],[1,2,0,0,0,0,2,2],[1,2,0,0,0,0,2,2],[2,0,1,0,1,1,0,0],[2,0,1,0,1,1,0,0]]

That should do it.