Posts

Featured post

c++ - What is the difference between && and ||? -

this question has answer here: is short-circuiting logical operators mandated? , evaluation order? 7 answers i'm getting difficult understand how following programs work, kindly me in understanding. int x=2,y=0; (i) if(x++ && y++) cout<<x<<y; output: (ii) if(y++ || x++) cout<<x<<" "<<y; output: 3 1 (iii) if(x++||y++) cout<<x<<" "<<y; output: 3 0 kindly explain me how program working , also, makes difference between (ii) , (iii). you looking @ "c++ puzzle" using 2 languages tricks. the first postincrement uses value of variable first, increments variable. so x++ has value 2 in expression , x becomes 3 y++ has value 0 in expression, , y becomes 1 && , || or both operators short-circuiting. look @ && first. in order , tru...

jquery - Javascript, returning value from a callback -

i have 3 functions in javascript: function a(){ b(data); } function b(data){ element.on('click',function(){ c(data); }); } function c(data){ //process data } function c data processing, data needs passed on click event, have defined in b. so, need pass data b too, ensure c gets it. here, main program , i'd rather not define click event there. there other way pass data directly c a? is there other way pass data directly c a? you need pass call of c th data b that: function a(){ b(function(){ c(data); }); } function b(data){ element.on('click', callback); } function c(data){ //process data } it work same way code have, has decoupled b c.

Visual Studio Pending Changes not being updated -

i have older changeset had get. once code updated results did not reflect in pending changes. files indeed different on server, since checked few , showed different. there way have pending changes recheck differences in code can added pending changes automatically? here solution found same question asking, worded quite differently. how clear tfs server knowledge of local version

node.js - Unable to access newly added column in sequelize -

i have added migration add new column this: module.exports = { up: function(migration, datatypes, done) { migration.addcolumn('topics','isfeatured',{ type: datatypes.boolean, defaultvalue: false }) done() }, down: function(migration, datatypes, done) { migration.removecolumn('topics', 'isfeatured') done() } } then run migration sequelize -m its add new column default value. when retrieve api updatetopic = function (req, res) { db.topic.find(req.params.id).success(function (topic) { console.log(topic.isfeatured) // code }); }; then got console.log(topic.isfeatured) undefined but console.log(topic) show topic default false value of isfeatured. so can me find out why console.log(topic.isfeatured) undefined. thanks it seems have not added isfeatured column in model definitions, have add model definitions. module.exports = function (db, datatypes) { var topic = sequelize.defi...

c# - Get all combinatiion of Items of n number of lists -

this question has answer here: is there linq way cartesian product? 3 answers how can compute cartesian product iteratively? 4 answers i have list contains further sub lists , have objects stored in sub list. want generate possible combinations of elements. e.g. have list contains 2 list l1,l2 , have different objects stored in example l1 contains {obj1,obj2} l2 contains {obj3,obj4} then result should come in form of {obj1,obj3} {obj1,obj4} {obj2,obj3} {obj2,obj4} all lists being generated dynamically. solution should generic irrespective of count of elements in main list , sub list l1.selectmany(l1 => l2.select(l2 => tuple.create(l1, l2))).tolist();

sql - Show COUNT(*) column for value 0 in multiple rows -

i have table content content (id, contenttext, contentdate, iduser → user, contenttype) and table votequestion votequestion (iduser → user, idquestion → content, isup) i want select, instance, first 30 recent questions. select * "content" "type" = 'question' order "contentdate" limit 30 however, want concatenate columns information related question, don't need query database again each question returned. for instance, want count votes each question, , returned in same row. example: | id | contenttext | contentdate | iduser | contenttype | votes | ----------------------------------------------------------------- | 2 | 'abc' | '2013-03-25'| 192 | 'question' | 10 | i tried following query: with question (select * "content" "type" = 'question' order "contentdate" limit 30 ) select count("votequestion"."iduser") "vote...

c++ - Algorithm for generating a triangular mesh from a cloud of points using kinect -

i'm using openni libraries (kinect) , opengl. can catch depth kinect (using openni , opencv) , can convert in cloud of points . so, have 640*480 points in 3d space and, viewing purpose, generate mesh composed of triangles. i need algorithm simple capable of representing walls , obstacles of every kind. can suggest me? meshlab provides algorithms this: ball pivoting, poisson triangulation , vgc. can find implementations of them in web.