mercredi 1 juillet 2015

How to make your own file/datastructure to use in a wpf app

I've just created a simple wpf app which uses tables that are part of a SQLite database. Now I want when the user clicks on new project, to create a blank file that will later hold all the data (database with tables) that is going to be used in the app.

Each new project the user start needs to create a blank file and needs to be later called when they want to open it up again in the app.

How do I do this and how do I make my app recognize which data/file it needs to use in the app. I can't find much documentation about how to do this.

Can anybody guide me in the right direction or which are the right steps to follow.

android.database.CursorIndexOutOfBoundsException Index -1 requested, with a size of 0

android.database.CursorIndexOutOfBoundsException Index -1 requested, with a size of 0

email2 and password2 will get values entered by the user.

public int getemail(String email2, String password2)

{

    // TODO Auto-generated method stub
    String [] rows=new String [] {First_Name, Last_Name, Email, Password, Phone_Number, Gender};

    String password="";
    Cursor c =ourDatabase.query(Database_Table, rows, "Email=?",new String [] {email2}, null, null, null, null);

    password=c.getString(c.getColumnIndex(Password));
    if(password.equals(password2))
    {
        return 1;
    }
    else
    return 0;
}

How to copy preloaded data to exiting sqlite database in ios

I am new to ios,I want to know is it possible to copy an external preloaded sqlite file to app generated sqlite file in coredata framework in runtime?How?

Which i have to do it at runtime when user click a button.My app also use api to store data

Find duplicate value in large amount of data

I must test an application that generate random keys. Keys are generated with the state of the system. There is 1,7668470647783843295832975007429e+72 states possible. The state change is pseudo random. How can I find the first duplicated value state of the system?

I have made some tries, but i'm far of the solution. Now I use sqlite to stock the data because I catch an out of memory exception if I try to do it with the system memory. With sqlite it's very slow.. I currently use Sqlite with only a text field (primary key) containing the state of the system.

I'm searching for an idea on how to find the first duplicated value generated bye the system. Thanks you!

sqlite3.0 library and xcode returning error "1"

I am using the sqlite3.0 library with xcode and I'm having trouble deleting rows from my database. I am using a tableview to generate my DELETE sql query and calling another method to execute it. However, the code is not being run in the if block where i test "test". test evaluates to and int value of 1, which is listed as " /* SQL error or missing database */ " in the definition in the sqllite API code.

I am not sure how to debug this one as I am unsure of how the API truly works under the hood. it seems that the arguments to the C function are all valid. the query looks fine in the debugger, the null, null, &error are all standard from what i've seen online. And I am not sure how passing the personDB, which is a "sqlite3" type object as an instance variable in my tableviewcontroller class.

anyone with this sqlite API experience who can point me in the right direction?

   -(void)deleteData:(NSString *)deleteQuery
        {
    char *error;
    int test = sqlite3_exec(personDB, [deleteQuery UTF8String], NULL, NULL, &error);
    if (test==SQLITE_OK)
    {
        NSLog(@"Person Deleted");
        UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Delete" message:@"Person Deleted" delegate:self cancelButtonTitle:@"Close" otherButtonTitles:nil];
        [alert show];
    }
    } 

SQLite: query for all unique elements from multiple columns and multiple tables

I got an SQLite table similar to this one:

enter image description here

I'd like to perform a query that returns all unique user IDs in this table (i.e. all unique values over columns first_user_id, second_user_id and third_user_id). In the example above this query would return 1, 2, 3, 5, 6, 7.

I need this query to be efficient.

The second part of the question concerns the same functionality, but achieved over multiple columns from multiple tables. For example if I also have the following table:

enter image description here

I would like to know all unique values over columns first_user_id, second_user_id, third_user_id, first_owner_id, second_owner_id. For the two tables above this query would return 1, 2, 3, 4, 5, 6, 7

Thanks

How can I test if the queries I am writing returns the correct result?

I am developing a Ruby on Rails application, and I am constructed complicated queries.

Is there a way to test if the results that I have is correct?

Unit tests provide testing for each model, but how I can test if my results are correct?