jeudi 1 octobre 2015

No resource identifier found for attribute 'actionViewClass'

i am getting error in my xml file i have mentioned the min sdk to 11 and i have included v4 support library also its pinching my head please help me

<item
    android:id="@+id/action_search"
    android:orderInCategory="100"        
    android:title="@string/action_search"
    myapp:actionViewClass="android.support.v7.widget.SearchView"
    myapp:showAsAction="always" />



<item
    android:id="@+id/action_settings"
    android:orderInCategory="100"
    android:showAsAction="never"
    android:title="@string/action_settings"/>

Generating pre-filled SQL database for Android app using Android Studio

I have an android app that fetches JSON data from a server and then populates the parsed data into an SQLite database using GreenDAO.

When I ship my app, I want to pre-fill the initial database.

Is there a way that I can create a new runnable module in Android Studio, where I can generate a DB file that I can ship with my app? (My current technique is to run the app once with certain flags set, and then to backup my app and extra the DB from the backup -- this is cumbersome and fragile).

Conditionally add columns in SQLite

I've seen enough answers to know you can't easily check for columns in SQLITE before adding. I'm trying to make a lazy person's node in Node-Red where you pass a message to SQLITE which is the query. Adding a table if it does not exist is easy.

msg.topic='create table IF NOT EXISTS fred (id PRIMARY KEY);'; node.send(msg);

it occurred to me that adding a table which had the names of the fields would be easy - and if the field name is not in the table.... then add the field. BUT you can't add multiple fields at once - so I can't do this...

msg.topic='create table IF NOT EXISTS fred (id PRIMARY KEY, myfields TEXT);'; node.send(msg);

The problem with THAT is that I can't add this in later, there's no way to check before adding a field it the table exists!

This is what I WANT

msg.topic='create table IF NOT EXISTS fred (id PRIMARY KEY, myfields TEXT);'; node.send(msg);

msg.topic='if not (select address from myfields) alter table fred add column address text';

I just cannot think of any way to do this - any ideas anyone (the idea is that the node-red node would input a table, field and value and if the table didn't exist it would be created, if the field didn't exist it would be created, all before trying to add in the value).

SQLite text type

I have a trouble when using SQLite database with datatype text.

When I try this:

SELECT * FROM prob_tokens where (token like 'c%');

One of those results returned: id: 1130, token: có, prob: 0.011 But, when I type this:

SELECT * FROM prob_tokens where (token like 'có');

0 Rows returned People, any helps please?

How to download and read database using Cordova?

I'm using Visual Studio and Cordova 5.1, in my app I read a database and I have to download another one and copy the row of the second one in the first one. I'm able to download the file zip, open and unzip the database but I can't to move it in the www folder so I can't to read it.

How can I do it? If is impossible, there is a way to copy a lot of data from file or db on server?

Thanks

How to save image by capturing from camera and save it on phone memory and save its path to database?

I am creating an app that would take picture from camera or gallery then save it in phone memory and the path of the image to database with title and description. I don't want to save image in sd card. I want those to store on phone memory. I read about this on android developer but couldn't find much info. I am able to open camera take photo then get back it as thumbnail but rest of the functions I am completely clueless how to do it. Can anybody help me with this. PLs

Parse date from string and insert with Sqlalchemy tosqlite

My problem has two subproblems (is that a word?):

A. Parse date from string.

I have datetime from rss feed that has format like below:

u'Wed, 30 Sep 2015 18:59:39 +0000'

What is most 'pythonic' way to make a datetime from string above? I tried to do it with regex but I had about 20 lines of code to do that and I hope there is simplier way to do it, preferably without regex. I also don't know what is easy way to change Sep to 09.

B. Insert to sqlite with Sqlalchemy

Here my problem is, I can't find example of code where I can see how to define column as datetime. Should it look like this?

t = Table('t', medatata, Column('my_date', Datetime)

And then just pass object of datetime to database?