w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
How to add an additional field to Meteor.users collection (not within the Profile field)
You just add one. user.voted = false; If you want to access the field on the client side, make sure to create additional subscription channel for it. Meteor does not publish custom user properties by default.

Categories : Facebook

Adding an array object to Users collection in Meteor.js
You're on the right track, but do declare an array instead of an object: Accounts.onCreateUser(function(options, user){ user.games = []; return user; }); Push the value directly instead of an object, and use $addToSet to avoid duplicates in case you push the same gameId multiple times: Meteor.methods({ addGame: function(gameId) { Meteor.users.update(Meteor.userId(), { $addToSet: { games: gameId }}); } });

Categories : Meteor

Installing Meteor-Permission Denied/Run 'meteor update'
Delete all meteor folders In finder (cmd +shft+g) type in "~/.meteor" on the top of the finder window where is has the folder.meteor click and drag folder to trash 2. In finder (cmd +shft+g) type in "/usr/bin/meteor" then drag the meteor folder to trash 3.In /usr/ create a new folder "local" (password required) and inside "local" create a folder "bin" 4. Go back to terminal a run curl install.meteor.com | /bin/sh –

Categories : Meteor

Meteor.js / MongoDB : finding a document's place in a collection
You can find out how many documents have larger popularity: var popularity = Documents.findOne(documentId).popularity; var morePopular = Documents.find({popularity: {$gt: popularity}}).count();

Categories : Javascript

When update nested collection in meteor, how to pass variable for the update path
It doesn't work because you can't use dynamic keys for object literals in javascript. You need to use bracket notation and build up the object you want to use in the update. For example: var city = 'NYC'; var object = {}; object["address." + city] = 'new address'; MyCollectionName.update(idOfObjectToUpdate, {$set: object}); Your last example should work, assuming Collection is actually the name of a collection, and {sel} is the correct selector for what you are trying to do.

Categories : Javascript

WPF Access to the path 'C:Users...DocumentsMy Music' is denied
Found the solution : http://readmystuff.wordpress.com/2013/08/08/wpf-access-to-the-path-cusersmichaeldocumentsmy-music-is-denied/ Oh thanks for the downvotes!

Categories : Wpf

Meteor: Embed documents inside a document or separate them into each collection object and link them?
Separate collections for students and classrooms seems more straightforward. I think just keeping a 'classroom' or 'classroomId' field in each student document will allow you to join the two collections when necessary.

Categories : Mongodb

In Meteor Collections, use an array-field or another collection?
I inspected what was sent as commented by user728291, and it seems like the entire array-field is sent, and not just the pushed value. I don't know if this always is the case (I just tested with an array containing few and small values; if it contains many or big values Meteor maybe try to do some optimization I couldn't see in my tiny test), but I'll go with the solution using another collection instead of the array-field.

Categories : Arrays

Proper way to add field to the user collection in meteor
You should use the callback of the function to get the result: Meteor.call('get_user', Meteor.userId(), function(error, result){ // do something with result console.log(error, result); }); For the other bit, try with: Meteor.startup(function () { if (Meteor.users.find().count() === 0){ var user = Accounts.createUser({ email: 'email@fake.com', password: 'password' }); Meteor.users.update({_id: user._id}, {$set : {account_type: 'admin'}}); } }); Notice that I added user._id.

Categories : Javascript

How do I setup an api to access my meteor collection?
The simplest way to do so is to add item to WebApp stack, for example: WebApp.connectHandlers.stack.splice (0, 0, { route: '/api/path', handle: function(req, res, next) { var count = Documents.find({}).count(); res.writeHead(200, { 'Content-Type': 'application/json', }); res.write(JSON.stringify({count: count})); res.end(); }, }); Notice that this code is for Meteor 0.6.5.

Categories : Meteor

When using Meteor I cannot access the collection from client console?
to answer your question @ is used for CoffeeScript (Javascript Alternative), you can add the meteor package for it and then write your app in that language. Learn about it here http://coffeescript.org

Categories : Mongodb

Meteor how to get the result of Collection.update on success or failure?
Use the third argument callback (docs) callback Function Optional. If present, called with an error object as its argument.

Categories : Meteor

Update meteor collection without removing or overriding existing fields
Just do this: $set: {"profile.name": "Test2", "profile.new_fields": "value"} I.e. You were replacing the whole hash. Instead you can update the fields within the hash.

Categories : Mongodb

Meteor on collection change update Template select element
In your HTML-template, if you surround your select-element with the constant block helper, the part inside the constant block won't be re-rendered. Maybe that would be a solution?

Categories : Meteor

Adding new users to a collection and having them render on a list automatically?
So I assume then that "player" records belong to a user in some way? So when you create a new user, you create their new default player record? Maybe you just need your helpers to check that a player record for the user exists, and if not, create it. Template.leaderboard.players = function () { var players = Players.find({/* Get players for this user */ }, {sort: {score: -1, name: 1}}); if(!players) { players = /* Insert default player record */ } return players; };

Categories : Meteor

JPA MERGE failed to update entity field value when this field is a collection(using ElementCollection)
Kind of resolve the issue, more like a work around: Before calling merge(), place several condition checkers to make sure the collection fields are not null public void save(Manifest entity) { if(entity.getStudents()==null){ entity.setStudents(new ArrayList<String>()); } if(entity.getTeachers()==null){ entity.setTeachers(new ArrayList<String>()); } if(entity.getOthers()==null){ entity.setOthers(new ArrayList<String>()); } entity.merge(); } Simple as it, it seems the UI returns those collection fields as null even we initiate them as with empty String lists. cheers.

Categories : Spring

Lucene 4.4: Update particular term's frequency in a document field without re-indexing the whole field
No, to update a document in Lucene, you must reindex the document. The process can be simplified using a call to updateDocument, but this doesn't simplify the operation on the backend. It still must delete the old document, and index a new one.

Categories : Solr

Update document in Meteor mini-mongo without updating server collections
There are some people working on local storage in the browser https://github.com/awwx/meteor-browser-store You might be able to adapt some of their ideas to provide "fake" documents.

Categories : Meteor

MongoDB update query (update an array field in document)
You are using the array operator push with a data structure that is not considered by MongoDb as an array (array must have 0-based ascending numeric indexes). You must treat it as an object. So you have 2 choices. If in [21] => 0, the value 0 is useless (and I don't expect so), you can use a true array: "emailQueries" : [21,22] and you can use the push operator in the PHP code like this $collection->update( array('email' => $user['email']), array( '$push' => array( 'emailQueries' => (string) $email_id ) )); On the other hand, if you must keep the value 0, and for instance, increment it, you have to considered your EmailQuery as an object : "emailQueries" : { "21" : 0, "22" : 0 } So you c

Categories : PHP

TFS 2012 configuration Access Denied: [User Name] needs the following permission(s) to perform this action: View collection-level information
One of those groups has View Collection-level Info set to deny. Open the Control panel, choose "Manage collection security and group membership", select the user and hover your mouse over the "View collection-level info" item. It should say "deny" and a "Why?" should show up next to it. That will tell you which Group the deny value is being inherited through.

Categories : Tfs

Is there a better way to update html based on input field reactively with Meteor.js?
1) Use the keyup event to detect when a new letter has been entered 2) Use normal jquery to get the value so do: Template.hello.events({ 'keyup #personName': function () { Session.set("personName", $("#personName").val()); } });

Categories : Jquery

Access Update Statement: update according to current value
Since your column is of type string you will have to work with substrings like (ms-access syntax, if you are working in the acces DB) SET recordTime= mid(recordTime,7,4) & "-" & mid(recordTime,4,2) & "-" & left(recordTime,2) & " " & mid(recordTime,12,8) MS-SQL syntax SET recordTime= SUBSTRING(recordTime,7,4)+'-'+SUBSTRING(recordTime,4,2)+'-'+ LEFT(recordTime,2)+' '+SUBSTRING(recordTime,12,8)

Categories : SQL

Adding Drupal Field Collection element to a custom form
I see the issue that you are having. You are building the field collection form, and then you are trying to build an additional field collection form, but the content is not being attached. I think that instead, you want to use the following module_load_include('inc', 'field_collection', 'field_collection.pages'); $field_collection_item = entity_create('field_collection_item', array('field_name' => 'field_collection_name')); field_attach_form('field_collection_item', $field_collection_item, $form['participant'], $form_state); That will allow you to attach numerous field collection items by changing the location in field_attach_form module_load_include('inc', 'field_collection', 'field_collection.pages'); for ($i=0;$i<5;$i++) { $field_collection_item = entity_create('field_coll

Categories : Drupal

Meteor.js: having multiple subscriptions on one collection enforce storage results in one local collection(Workarounds?)
If you want your client side collection to have a different name from the server side collection you can not just return a collection cursor. This can be done in the publish function though like this: Meteor.publish("details", function (id) { //details here matches the subscribe request var self = this; self.added( "details", id, collection.findOne({_id: id}); //details here tells the client which collection holds the data self.ready(); }); This will not be reactive but can be made that way by using observe as in the counts by room example at http://docs.meteor.com which is explained in detail here How does the messages-count example in Meteor docs work?. While this answers your question of how to get a specific name for a collection without having that collection on the serv

Categories : Meteor

Meteor: meteor-collectionapi PUT overwrites the entire object instead of just updating the field I want
I'm guessing that bash is replacing "$set" with an empty environment variable eg. echo "$set" vs echo "$set" so update your PUT command to: curl -H "X-Auth-Token: 97f0ad9e24ca5e0408a269748d7fe0a0" -X PUT -d "{"$set":{"gender":"Female"}}" http://localhost:3000/collectionapi/players/8BW9Yg2oKByBGdnSa By default Collection.update() will replace a document if no modifiers are present ($set, $unset, $push, $pull etc). So the command being sent to the server is to replace the document with {"":{"gender":"Female"}}

Categories : Api

Meteor: display document's key and value without knowing the document itself?
Using Underscore.js you could loop through the unknown document and add the values/keys to an array. Using this array in the template will let you output all the keys/values. Like this (untested but should work): // Template js Template.whatever.elementToReturn = function() { var elementToReturn = []; var someDoc = CollectionWithUnknowFields.findOne({}); var index = 0; _(someDoc).each( function( value, key, someDoc ) { elementToReturn[index] = {}; elementToReturn[index]['value'] = value; elementToReturn[index]['key'] = key; index++; }); return elementToReturn; }; // Template HTML <template name="whatever"> {{#each elementToReturn}} <p>Key is: {{key}}</p> <p>Value is: {{value}}</p>

Categories : Meteor

Meteor Security: should all database insert, update, remove operation be a Meteor.call() to the server?
For the first point, you can choose any of the two possibilities, but i prefer to use the second one : Client can do insert/update/delete Server has some security checks With this system you use the latency compensation of meteor. So it seems to be a good way of doing. For the second point, you can imagine to store in Session where you are on the list when you click on the detail. Then when you come back to the list, you check the session value and you just have to use it to restore the state.

Categories : Javascript

Ruby on Rails 4 - Can't update data after adding one field to model
You should show model for Ticket. And also make sure to read your server log. But most probably your are failing in adding phone to attr_accessible: attr_accessible ..., :phone For Rails 4 see answer of the OP.

Categories : Ruby On Rails

Access - Update a field based on other fields
Run an Update query. It can be triggered in VBA code based on an OnChange event of a field, or an OnDirty event of the form. Or, you can just set the control equal to your value based on the same events. You can put code in the OnChange or AfterUpdate event of every control that automatically does that calculation, or have a button that the user would have to press to do the calculation. It's basically: If Nz(Len(Me.A)) > 1 and Nz(Len(Me.B)) >1 Then Me.D = "X" Me.G = "" Else Me.D = "" Me.G = "X" EndIf You obviously have to add more fields, but you get the idea. Make sure you use the Nz function or it will get tripped up if the field has a NULL value in it.

Categories : SQL

Error executing aapt: Cannot run program, CreateProcess error=5, Access is denied: CreateProcess error=5, Access is denied
Go to your eclipse folder, open eclipse.ini and add the lines -vm C:Program FilesJavajdk1.6.0_29jreinserverjvm.dll Replace jdk1.6.0_29 with the version code of your jdk. These lines should be added above -vmargs

Categories : Android

SSRS 401.3 error access denied due to Access Control Lists
Solved! After granting the appropriate AD group read & execute rights on C:Program FilesMicrosoft SQL ServerMSRS10_50.MSSQLSERVERReporting Services the 401 disappeared!! My users can connect to the report server and my .NET app can connect to the report service / asmx Don't know what triggered it and why it's necessary to grant access on the file system but it's a quick relief compared to my alternatives.. Regards, Mike

Categories : Sql Server

Sorting an IEnumerable collection with a virtual field of that collection
My problem was occurring because I had not set initialized lazy loading and so the virtual properties were always being returned as nil. I overcame this problem by adding the following line of code to my ViewModel: this.dbcontext.Configuration.LazyLoadingEnabled = true; Within the View itself I also had a series of nested queries for some of the more complex models and had to add the following segment to the connection string: MultipleActiveResultSets=True";

Categories : Misc

PDO access denied to external host, but I can access to phpmyadmin cp
Nothing seems wrong with your code except the setAttribute method is setting the error output to raise warnings.. but you're in a try/catch block.. so you may want to consider using PDO::ERRMODE_EXCEPTION. Secondly, check your remote permissions for that username/password. There may be an IP limitation for that user account. You can use the wildcard % for the HOST on user accounts or (suggested) provide the server IP that is connecting TO the database.

Categories : PHP

Meteor Collection.allow
On the client you should use Meteor.userId() and on the server this.userId, but only in a publish function: Meteor.publish("Categories", function() { return lists.find({owner:this.userId},{fields:{Category:1}}); }); And when you insert it, on the client: lists.insert({Category:catVal,owner:Meteor.userId()}); You also need to make sure you remove autopublish, which automatically publishes everything, before you start meteor meteor remove autopublish

Categories : Javascript

How to get a doc from a collection in meteor?
As you noted, Collection.find() returns a cursor, whereas Collection.find().fetch() returns the document. I'm not sure I understand what you're trying to do exactly, but maybe something like this (untested): var cursor = Saves.find({ _id : Meteor.userId() /* , save : { $not : true } */ }); cursor.forEach(function(item) { console.log(item); Saves.update({ _id : item._id }, { $set : { save : true } }); }); You'd wrap the whole thing in a Meteor method to take advantage of latency compensation, and ensure write permission with your Collection.update.

Categories : Javascript

XAMPP - SELECT command denied to user ''@'localhost' for table 'users'
The user has not been given privileges to read the tables. When creating an user for the database through the cpanel of your host, you can give the user the privileges. Or read this documentation to do it through MySql command, http://dev.mysql.com/doc/refman/5.1/en/grant.html

Categories : PHP

How to export to CSV in R "cannot open file 'C:/Users/brian_000/Documents': Permission denied"
C:/Users/brian_000/Documents is (presumably) a directory, so you can't write to it like it is a file. Instead, write to a file like C:/Users/brian_000/Documents/myfile.csv.

Categories : R

Publishing Meteor Users to Admin
Your collection should probably be defined on the beginning so that client knows where to write! Also, your Meteor.subscribe("directory"); runs once when the app is loaded. You should make it reactive. Directory = new Meteor.Collection("directory"); Deps.autorun(function(){ Meteor.subscribe("directory"); });

Categories : Meteor

using method in meteor collection
Mongodb is a database, you should't put some logic code inside. So you need to extract the attributes of your object and then use a transform function in your collection. Like this: Targets = new Meteor.Collection("targets", { transform: function(doc) { return new Target(doc) } }); Or if you don't want to create a Target object: Targets = new Meteor.Collection("targets", { transform: function(doc) { doc.title = function(){ if(false) { console.log("true"); return 'Le commencement'; } else { console.log("false"); return 'Le début'; } return doc } } });

Categories : Mongodb

Meteor where to define my collection?
Variables defined with var keyword are local to the file they're defined in. If you want a global variable, shared across files, you need to define it without the var keyword. It looks like it's not in the doc, but it's in the https://github.com/meteor/meteor/blob/master/History.md file (for version 0.6.0): Variables declared with var at the outermost level of a JavaScript source file are now private to that file. Remove the var to share a value between files. Basically, each JS file is wrapped in the (function(){ ... })(); pattern to provide this encapsulation.

Categories : Meteor



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.