PouchDB Extension not showing second database - ionic-framework

I’ve only just started using PouchDB (with Ionic), so I’m still working on wrapping my head around everything and getting it all set up (all my experience is in MySQL).
I have a simple Ionic app working with PouchDB and some basic CRUD abilities, now I’m trying to visualise what I’m doing using the PouchDB Extension for Chrome. So far so good, I click a “+” button to add an item to a list and the new database shows up under “Databases” in the PouchDB Extension.
Now I’m doing the exact same thing for a second database, and it’ll put my newly created items in a separate list, all seems to be good, I can edit and delete these items as well, just like in the first database. But this second database won’t show up in the PouchDB Extension and for the life of me I can’t figure out why, I’m doing exactly the same as with the first database.
This is part of my code for the first database:
function initDB() {
_db = new PouchDB('threads');
};
function addThread(thread) {
return $q.when(_db.post(thread));
};
And then this is what I'm doing for the second one:
function initDB() {
_db = new PouchDB('categories');
};
function addCategory(category) {
return $q.when(_db.post(category));
};
Btw: This is the tutorial I've followed to get the PouchDB part of my Ionic app working. (Basically just followed part of it twice to get the second database working)
Edit: So I just found the "application" tab in Chrome's developer tools (again, I come from MySQL databases, never worked with local storage before). I can view the Web SQL databases there and both my databases do show up there, but still only the first one is shown in the PouchDB extension :(
Edit 2: Alright this is turning into a whole different problem. I was aware that the PouchDB extension doesn't support the websql adapter, I thought PouchDB defaulted to IndexedDB but apparently idb isn't available in my Chrome installation? If I do the following to explicitly say I want to use the IndexedDB adapter:
_db = new PouchDB('threads', {adapter: 'idb'});
I get the following error: Error: Invalid Adapter: idb
If open the page in either Firefox or Chrome Canary I get no errors at all, and after adding the PouchDB inspector to Canary everything works as I want it to. I did update Chrome to the latest version (Version 53.0.2785.101 (64-bit)).
Any ideas as to why my regular Chrome installation doesn't support IndexedDB? (it should right, or am I going nuts? (I feel like I am))
Edit 3: Ok even though I feel like I'm talking to myself I'll continue posting my findings. Since the problems seemed to lie with my Google Chrome installation I reinstalled it, problem solved. If someone has some idea of what went wrong I'm all ears, until then I'm finally continuing on my project haha..

I ran into same issues, chrome extention doesnt support websql, only index db.
https://github.com/angular-pouchdb/angular-pouchdb/issues/63
you can try this to get the DB sizing etc.
db.info().then(function (resp) {
//resp will contain disk_size
})

Related

Invalid login, please try again after upgrade from 3.5.10 to 3.6.8

I have created an identical copy of our production instance to my local environment running XAMPP and I am trying to do the following:
After upgrading Moodle from 3.5.10 to 3.6.8 and restoring all plugins etc. I am unable to login. Before upgrading to 3.6.8, I had already performed the following upgrades,
3.4.1 -> 3.4.9
3.4.9 -> 3.5.10
and everything worked fine during those 2 upgrades. I followed exactly the recommended upgrading method as described in moodle's docs.
After successfully upgrading to 3.6.8, I successfully passed the step about the server requirements for the correct php mysql and db versions, I then successfully passed the next step as well for upgrading the database and made sure that all the plugins are fine and had no errors (just some warnings about a few plugins that can be updated to newer version) and after that step finished too, I then got back to the /admin/index.php screen asking me to login. That seemed weird to me because during the previous updates, it never asked me to login after completing the upgrading, but I said, ok. i'll just login. So after trying to login i am constantly getting the message "Invalid login, please try again"
I have tried almost anything here and by anything I mean the following.
First of all, I checked my hashed password in the local database and it is exactly the same with my hashed password in production database.
I then read an article that from moodle 3.1 the logintoken was introduced and since we use the mb2nl theme, I supposed that I just have to add the new input hidden field for this logintoken to the login form but the field was already there and again that was not the issue.
I am at a point where I cannot think of what else might be wrong and I am stuck.
A few more information about our whole setup, we have a Joomla website and our moodle users are actually coming from Joomla, Therefore we use a plugin named Joomdle which connects these 2 CMSs. Our users register to our Joomla website and the Joomdle plugin sends the credentials to moodle and the user is being created to the moodle CMS as well and an entry is being created in the moodle's "user" table. The difference is that moodle generates a different hashed password from the hashed password that joomla does. Anyway, there were no problems at all with logins or anything else since I tried logging in with multiple user accounts in moodle and all worked fine, before upgrading to version 3.6.8.
This is not a Joomdle issue since I already checked this by completely removing Joomdle and this is not the cause. This is probably coming from moodle core but since moodle has NO error reporting or logging at all, I really cannot understand what this is.
To exclude one more matter linked in this question, I already checked and made sure that moodle's password salt is the same both in production and local environments.
I am not sure what is going on here and this is why I desperately need some help from experts.
Solution:
I was able to solve this problem but forgot to come back here and give the solution.
The problem was that, as I said above, we are using the mb2nl theme and the theme's login form did not include the hidden input field to create the logintoken.
On my question above I write somewhere in the middle "I supposed that I just have to add the new input hidden field for this logintoken to the login form but the field was already there and again that was not the issue". I was looking at the wrong place. The login form that I was looking at, was the Moodle's itself login form and not the theme's login form.
I then found the login form in the theme's files and the logintoken hidden input field was indeed missing from there. I added it and then I was able to login normally.
Happened to me today. Executing the cron.php cli script trigered again the upgrade process and solved my problem.

Sails Wateline find with mongodb Object Id not working

I've an application with sails.js and mongodb.
The sails rest api works fine for create. It also works fine when I access it as "http://localhost:1337/student" but not working when finding a specific document with id "http://localhost:1337/student/54e57a98469768d40df7fb24".
The object id in db is stored as _id : ObjectId("54e57a9e469768d40df7fb25").
I also tried to update record in Controller but that also seems to be NOT working:
Student.update({id:Student.mongo.objectId(req.body.id)},{is_active:0}).exec(function(err, data){
............
});
Any help will be appreciated.
Thanks.
I do notice your ids are different between your URL and the mongo paste, so make sure that is on. Also I'd recommend installing the postman packaged app in the google chrome store, its really nice for doing rest work. If you watch the sailscasts videos by nathanirl on YouTube you'll see some nice examples of what it can do.
Also make sure your blueprints.js in config file is setup with. Actions, shortcuts and rest set to true

Single Sign On not working on TV

I've created a basic application (virtually no content, just a blank page) to test the SSO functionality. It doesn't work, when I test on the TV it gives the error error_cp_001.
The config.xml contains, among other things:
<cpauthjs>Authorization8888.js</cpauthjs>
<login>y</login>
The Authorization8888.js file contains:
var Authorization8888 = {};
Authorization8888.checkAccount = function(id, pw, cb) {
cb("TRUE");
};
I have already tried with <cpauthjs>Authorization8888</cpauthjs>. I have also tried with Authorization without 8888 for the filename and vars. It always shows that error.
I also tried in the SDK simulator, same error as on the real TV. On the simulator I see these extra debug lines:
[JS ALERT]: ####################22222eval(accountCheckFunc) error
[JS ALERT]: Fail to load Account check moudule.
Error : Can't find variable: Authorization8888
I can share the zip file containing the whole application, but it's really simple to reproduce since it has nothing except this basic SSO-related code.
I found the answer, posting it in case someone else hits the same problem.
The problem was deploying via USB. Apparently, an application deployed with the USB stick has limited functionality. Deploying the application via a web server fixed a lot of issues, including this one.

sqlite does not see new tables I added to the db

I have a database that has 7 tables and am calling them from my app simply using sqlite queries ...
am not new to this I made to apps work greatly even with encryption ..
am building now a new app and decide to add 2 new tables my db ,
but when I call them sqlites doesnot see them and return me with an error "No such table :history"
I have added these new tables simply using sqlitemanger add-on that comes with firefox as I always do.
In the terminal I can see them and I can get data from them , but that is not the case in my app..
do you have any idea?!!
Try to delete your app from simulator and run it again.I think your updated database is not copied.

EF Code First not working on deploy hosting

I've an application using MVC and Code First for persistence.
Everything works fine in my development, but when I'm uploading to server, it doesnt work.
In any place i try to create a database, but it keeps me returning the following error: CREATE DATABASE permission denied in database 'master'.
The only thing that i do is override the OnModelCreating method just to map my app.
Anyone has this error?
Thanks
For a tutorial series that shows how to publish your Code First database and prevent Code First from trying to re-create the database in production, see
http://www.asp.net/mvc/tutorials/deployment-to-a-hosting-provider
The third tutorial in the series shows how to set up the Web.config file. The second shows how to deploy if you are using SQL Server Compact, the tenth shows how to deploy to full SQL Server.
You'll need to publish your database out to your hosting provider. Visual Studio has an easy way of doing this. In the server explorer tab, you can navigate to your database, right click and choose publish to provider. By doing this, you will not only export the scheme of your database, but you can also export out all data, stored procs, views etc.
You will need to adjust your code so that you are no longer trying to create a database on code run. Typically this approach is used for development, and you are no longer in development if you're moving to a hosting company. The changes may be in your global.asax, the dbcontext of your solution and any other place where you modified it to create the scheme for the database.
Hope this helps you some, and good luck on your project.