Posts

javascript - Killing a "personalized" Interval -

i've made system users can login website , play game requires interval timing. when user done playing want kill interval. while seems running fine, there wrong killing interval. here problem whenever user done playing interval gets killed, not user playing everyone . might because i'm assigning variable interval , when user done playing game i'm killing interval , right kill other intervals well? here code i've written question, var user; //this variable has info user. (its not empty) var usersplaying = []; socket.on('game', function(game) { if(game.type == "start"){ usersplaying.push({ user_id: user.id }); var game = setinterval(function(){ if(finduser(user.id) !== undefined){ console.log('second passed!'); }else{ clearinterval(game); //stop interval } }, 1000); }else if(game.type == "stop"){ ...

java - db.delete deletes the first row instead of the row specified -

i want able delete specific column in sqlite database. i have tried pass id of column whereclause , keep getting error saying whereclause needs string value. i have combed so solution have not found answers question. have tried google search , have written question many different ways, no avail. here code delete button public void todeletenote(view view) { dbhelper dbhelper = new dbhelper(this); int deletedrows = dbhelper.deletedata(selectedid); if (deletedrows > 0){ toast.maketext(getbasecontext(), selectedname + " deleted successfully", toast.length_long).show(); } else { toast.maketext(getbasecontext(), "something went wrong!", toast.length_long).show(); } intent intent5 = new intent(editdata.this, mainactivity.class); startactivity(intent5); } } dbhelper delete method public int deletedata(int id){ string id = string.valueof(id); sqlitedatabase database = this.getwritabledatabase()...

how to write cursor alternative query in sql server -

i need implement without using cursor. below script using cursor , it's taking 5 hours 140k records. how improve performance in sql server? in orginal table have on 100k records. set nocount on create table #temp ( recordid int identity, address varchar(50), city varchar(30), state varchar(5), gpslat numeric(9,6), gpslong numeric(9,6), mapurl varchar(255)) insert #temp (address, city, state) values ('1033 southwest 152nd street', 'burien', 'wa') insert #temp (address, city, state) values ('11910 northeast 154th street', 'brush prairie', 'wa') insert #temp (address, city, state) values ('500 seaworld drive', 'san diego', 'ca') insert #temp (address, city, state) values ('1 legoland drive', 'carlsbad', 'ca') declare curgeo cursor local static select recordid, address, city, state #temp declare @recordid int declare @address varchar(50) declare @city varchar(30) declare @sta...

html - How to change the background colour of different components in Angular2? -

in angular2 app, there problem keep encountering, i.e, setting background colour or image of page. in app, if mention particular colour in styles.css background colour applied pages develop, since applies styles globally. if login page blue in colour , want change background colour of home page white, how go doing that? because in component homepage have : homepage.component.html , homepage.component.css . in homepage.component.css, css affects elements of homepage. cannot change colour of entire page or add image background entire page either since body { ... } not work there. neither @import url work. how can change background colours of different components in angular2 app? any appreciated. thanks. an other solution, little basic, works: style.css body, html{ padding: 0; width: 100vw; height: 100vh; } .my-container{ with:100vh; height:100vw; .... } home.component.css .my-container{ background-color: red; } home.component.html ...

http - Why does a directory exist and not exist on a web server simultaneously? -

while i'm sure title improved clarity, meaning thus: when fetching url file download @ http://example.com/dir1/dir2/file.zip , response code 200 , yet attempting access http://example.com/dir1 , or http://example.com/dir1/dir2 , elicits 404 response code. why this? urls don't correspond actual directories on server. path component of url name; server can translate name whatever wants on end. in case seems /dir1/dir2/ is directory on server, doesn't mean anything. server knows resource named /dir1/dir2/file.zip , doesn't know resource named /dir1 .

matlab: limiting erosion on binary images -

i trying erode objects in binary image such not become smaller fixed size. consider, instance, binary map composed of connected components (blobs), wherein 1 defines blob size either minimal or maximal antipolar (anti-perimetric) distance (i.e., distance between 2 points far 1 can on perimeter or contour of blob; if contour consists of n consecutively numbered points, distances evaluated between points 1 , n/2+1, points 2 , n/2+2, etc.). given such arrangement, seek erode these blobs until distance metric reaches specified limit. if blobs simple circles, effect realized ultimate erosion followed dilation fixed size; however, contour of irregular object lost such procedure. there way achieve such effect connected, irregular components using built-in functions in matlab? with no image , tried code presented can understand wrong, may iterative using bwmorph 'thin','skel' or 'shrink' you. while(cond < cond_threshold) bw=bwmorph(bw,...,1); %one ...

big o - could some one explain time complexity to me from this image -

Image
could 1 please explain why n >= 1 , not n >=0 since 0 true below argument n>=0 not ok, definition in introduction algorithms(clrs), requires n positive. think reason use big-o notation make approximation of algorithm, want input, , n=0 means no input, don't want involve in our calculation.