Get all database names with mongoid? - ruby-on-rails-3

How can I get the name of all databases with Mongoid?
I found this:
connection = Mongoid.master.connection
connection.database_names
but it is not working. It turns out this error: undefined method master 'for Mongoid: Module (NoMethodError)
Any help?

I got with moped. Maybe it is not the best way, but it is working for me.
session = Moped::Session.new(["127.0.0.1:27017"])
databases = session.databases.first[1]

Related

Error when trying to create a project under a GitLab group

I just discovered GitLab's groups and decided that it would be ideal for the kind of work I am doing. I created a private group and am getting the following error when I try to create a project under it:
The form contains the following error:
PG::QueryCanceled: ERROR: canceling statement due to statement timeout CONTEXT: while rechecking updated tuple (0,187) in relation "site_statistics" : UPDATE "site_statistics" SET "repositories_count" = "repositories_count"+1
I attempted to do the same in a new subgroup; however, I still get the same error. I must add that I am not using a paid plan of GitLab.
Thank you.
I have the same issue. I think only thing that we can to do is to wait until this error will fix.
Found this issue page: https://gitlab.com/gitlab-org/gitlab-ce/issues/53778

Getting FusionAuthClient is not a constructor error

I am trying the fusionauth-node-client and following the wiki https://fusionauth.io/docs/v1/tech/client-libraries/node. But I am getting the following error
const client = new FusionAuthClient('6b87a398-39f2-4692-927b-13188a81a9a3', 'http://localhost:9011');
^
TypeError: FusionAuthClient is not a constructor
at Object.<anonymous>
I have pasted the exact code mentioned in the doc still it is not working. Can anyone help me in identifying what I am missing here.
I dug around in the library and noticed that we are exporting several objects and our example is no longer correct.
To get the client you need to change your syntax a little bit to get the correct object.
const {FusionAuthClient} = require('fusionauth-node-client');
This translates to: require the library fusionauth-node-client and give me the FusionAuthClient from inside it. There are also a RESTClient and JWTManager available in the library but you shouldn't need either of those to code with FusionAuth.
I will also update our example to correct this discrepancy.

Chef Data Bags and dynamic variable passing

I am trying to figure out a way to get the below code work; I have tried various methods but the chef-client run breaks at the 3rd line.
lsf = "#{node[:env]}"+"_ls"
dsf = "#{node[:env]}"+"_ds"
dsTemplateBag = data_bag_item('configTemplates', "#{dsf}")
lcTemplateBag = data_bag_item('configTemplates', "#{lsf}")
However on another test recipe I was able to successfully get the following working:
env = "test"
dsTemplateBag = data_bag_item('configTemplates', "#{env}")
I am quite new to Chef and please can someone advise me on how to get this working ?
After a little bit debugging I realised there was a typo preventing the data bag to be properly used; hence issue.
dsTemplateBag = data_bag_item('configTemplates', "#{node[:env]}_ls")
this worked for me. And as Tensibai suggested in the above comment mixing concatenation and interpolation is not a good practice (I was desperate to make it work! In my defense).

Rails3 CookieOverflow

I am getting this error:
ActionDispatch::Cookies::CookieOverflow
In config/application.rb I have:
config.session_store :active_record_store
There is no data being stored in the sessions table.
I am using RubyCAS-client with this code:
https://github.com/zuk/rubycas-client-rails
Am I doing something wrong to have the code stored in the database or is this code not setup to use active record store?
I figured it out, I was doing it in config/application.rb. When I changed it in config/initializers/session_store.rb it worked.
I don't know if this is completely right because I assume config/application.rb is the place it should be?

Problem during SQL Bulk Load

we've got a real confusing problem. We're trying to test an SQL Bulk Load using a little app we've written that passes in the datafile XML, the schema, and the SQL database connection string.
It's a very straight-forward app, here's the main part of the code:
SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class objBL = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class();
objBL.ConnectionString = "provider=sqloledb;Data Source=SERVER\\SERVER; Database=Main;User Id=Username;Password=password;";
objBL.BulkLoad = true;
objBL.CheckConstraints = true;
objBL.ErrorLogFile = "error.xml";
objBL.KeepIdentity = false;
objBL.Execute("schema.xml", "data.xml");
As you can see, it's very simple but we're getting the following error from the library we're passing this stuff to: Interop.SQLXMLBULKLOADLib.dll.
The message reads:
Failure: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted
We have no idea what's causing it or what it even means.
Before this we first had an error because SQLXML4.0 wasn't installed, so that was easy to fix. Then there was an error because it couldn't connect to the database (wrong connection string) - fixed. Now there's this and we are just baffled.
Thanks for any help. We're really scratching our heads!
I am not familiar with this particular utility (Interop.SQLXMLBULKLOADLib.dll), but have you checked that your XML validates to its schema .xsd file? Perhaps the dll could have issues with loading the xml data file into memory structures if it is invalid?
I try to understand your problem ,but i have more doubt in that,
If u have time try access the below link ,i think it will definitely useful for you
link text
I know I did something that raised this error message once, but (as often happens) the problem ended up having nothing to do with the error message. Not much help, alas.
Some troubleshooting ideas: try to determine the actual SQL command being generated and submitted by the application to SQL Server (SQL Profiler should help here), and run it as "close" to the database as possible--from within SSMS, using SQLCMD, direct BCP call, whatever is appropriate. Detailing all tests you make and the results you get may help.