Posts

Meteor - Adding a favourite/like user accounts -

i have page display list users. current user "is_teacher" able 'like' individual users in list. likes visible teacher. thought best way add likes: string in collection , store students_id code must way off because not working. can checkout i've done let me know i'm going wrong. path: schemas.js schema.userprofile = new simpleschema({ likes: { type: [string], optional: true } }); path: sudentlist.html <template name="studentlist"> {{#each student}} {{#if like}} <button class="like">unlike</button> {{else}} <button class="like">like</button> {{/if}} {{/each}} </template> path: studentlist.js template.studentlist.helpers({ like: function() { return meteor.users.findone({likes: this._id}); } }); template.studentlist.events({ 'click #like':function(event,template) { var student = this._...

php - CakePHP multiple time and condition with price not working -

i have query in cakephp , not working. have record in db when remove inner price condition return result not working price. select `car`.`id`, `car`.`title`, `car`.`description`, `car`.`image`, `car`.`state`, `car`.`state_code`, `car`.`city`, `car`.`zipcode`, `car`.`person_name`, `car`.`email`, `car`.`phone`, `car`.`mobile`, `car`.`ad_type`, `car`.`ad_status`, `car`.`make`, `car`.`model`, `car`.`year`, `car`.`conditiion`, `car`.`transmision`, `car`.`color`, `car`.`fuel`, `car`.`body`, `car`.`doors`, `car`.`mileage`, `car`.`price`, `car`.`accessories`, `car`.`security`, `car`.`created`, `car`.`user_id` `portal_carsnew`.`cars` `car` `car`.`ad_status` = '1' , `car`.`make` = 'ferrari' , `car`.`model` = '458 italia' , `car`.`state` = 'new york' , `car`.`city` = 'albany' , ((`car`.`price` < 95000) , (`car`.`price` > 0)) order `car`.`id` desc limit 10 use cakephp find method ...

python - Django Rest Framework user authentication -

i have following code. i using django rest framework. i want allow users register. send email address, password, username post. i feel not using django rest framework correctly. can guys please me code below? what's best way structure adhere django rest framework principles? also, form below invalid ... how post error message back? @api_view(['post']) def user_login(request): profile = request.post if ('id' not in profile or 'email_address' not in profile or 'oauth_secret' not in profile): return response( status=status.http_204_no_content) identifier = profile['id'] email_address = profile['email_address'] oauth_secret = profile['oauth_secret'] firstname = none if 'first_name' in profile: firstname = profile['first_name'] lastname = none if 'last_name' in profile: lastname = profile['last_name'] bio = none if 'bio' in profile: bio = profi...

Why is this graph showing up twice in R Markdown? -

Image
```{r scatterplot, fig.width=14, fig.height=14, echo=false, results="hide"} histogram( ~factor( format(df_ian$newdate,"%b"), levels = c("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec") ) | factor( format(newdate,"'%y") ), data=df_ian, layout=(c(3,6)), main="flood counts year , month", ylab="flood count", xlab="year" ) ``` when knit, histogram show twice. missing here? @hrbrmstr correct, cannot reproduce problem. because of that, cannot advance suspect: plotting histogram every factor of second argument of function. consider simple dataset: dt <- data.frame(gender = rep(c("male", "female"), c(4, 2) ), trans = rep(c("car", "bus", "bike"), c(3, 2, 1) )) library(lattice) hist...

Displaying a linked list in java -

i'm working on assignment need create linked list given template. each new node created, need print out updated list. however, until point, i've been stumped on how print out linked list. can figure out doing wrong? have prints out number has been created, followed blank space, instead of entire list point. numberlist.java import java.util.*; public class numberlist { private node head; public numberlist() { } public void insertathead(int x) { node newnode = new node(x); if (head == null) head = newnode; else { newnode.setnext(head); head = newnode; } } public void insertattail(int x) { } public void insertinorder(int x) { } public string tostring() { node tmp = head; string result = ""; while (tmp.getnext() != null) { result += tmp.tostring() + " "; } return result; } //--------------------- // test methods //------------...

javascript - Vue.js Failed to resolve filter: key -

i following tutorial https://laracasts.com/series/search-as-a-service/episodes/2 , got stuck on following error [vue warn]: invalid expression. generated function body: scope.keyup:scope.search [vue warn]: failed resolve filter: key shown in console. this code. <input type="text" v-model="query" v-on="keyup: search | key 'enter'"> <div class="results"> <article v-for="movie in movies"> <h2> @{{ movie.name }}</h2> <h4> @{{ movie.rating }}</h4> </article> </div> </div> <script src="http://cdn.jsdelivr.net/algoliasearch/3/algoliasearch.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.17/vue.js"></script> <script> new vue ({ el: 'body', data: { query: '' , movies: [] }, ...

embedded - Error (10170): Verilog HDL syntax error at final_lab.sv(46) near text "default"; expecting "end" -

hello getting following error in verilog , don't know why can't seem figure out. please error : error (10170): verilog hdl syntax error @ final_lab.sv(46) near text "default"; expecting "end" code module final_lab (clock_50, sw, ledr, key, hex5, hex4, hex3, hex2, hex1,hex0); input logic clock_50; input logic [6:1] sw; input logic [3:0] key; output logic [9:0] ledr; output logic [6:0] hex5, hex4, hex3, hex2, hex1, hex0; logic [6:1] whatwehave; logic reset; logic keyone , keythree; assign whatwehave = 6'b000000; always_comb begin if (whatwehave[6:1] == sw[6:1]) begin keythree = 0; keyone = 0; whatwehave = whatwehave; end else if (whatwehave[6:1] < sw[6:1]) begin whatwehave = whatwehave+1; keythree = 1; keyone = 0; end else if (whatwe...