Posts

d3.js - How to get only those data which have particular code in crossfilter -

i have following dataset var data= [ {code:501, value:25}, {code:501, value:30}, {code:501, value:30}, {code:501, value:35}, {code:501, value:60}, {code:502, value:25}, {code:502, value:25} ] i want dataset contains data code 501. tried following code var ndx=crossfilter(data); var dim1=ndx.dimension(function(d){return d.code}); var filtereddata=dim1.filter(501); but not working. not returning me data want. tried print returned data using console printed vague things. function getdata(){ var range = $("#range").val()*1; if(isnan(range)){ alert("kindly enter valid number"); }else{ var data= [ {code:501, value:25}, {code:501, value:30}, {code:501, value:30}, {code:501, value:35}, {code:501, value:60}, {code:502, value:25}, {code:502, value:25} ]; var ndx=crossfilter(data); var dim1=ndx.dimension(function(d){return d.code}); var filtereddata=dim1.filter(range); alert("requested data is\n"+(json.st...

Using MySQL Join -

i'm trying join 2 mysql tables staffid 1 , username tied staffid in table have username displayed select ost_ticket.staff_id, count(*) numbers ost_ticket join ost_staff re on re.username = us.userid group ost_ticket.staff_id; from i've been reading joins should work? edit: i've ran , unknown column 'ost_ticket.staff_id' in field list select us.staff_id, re.username, count(*) numbers ost_ticket join ost_staff re on re.userid= us.staff_id group us.staff_id;

sql server - create sql query to fetch repeat column values within time frame -

can me query? want result of customer_id repeats more once in 24hrs select o.order_no, o.customer_id, o.dateordered, o.ipaddress, c.firstname, c.lastname, cd.nameoncard order_no o inner join carddata cd on o.card_id = cd.id inner join customers c on o.customer_id = c.customer_id order o.order_no desc adding more details.. suppose order customer id xx placed on 04/23 2:30 pm , again 2nd order placed same customer id xx on same day 04/23 5:30 pm. i want query return me customer id xx thanks select customer_id, cast(dateordered date) dateordered, count(*) qtde order_no group customer_id, cast(dateordered date) having count(*) > 1 to customers have orders issued after first one, use following query: select distinct a.customer_id order_no inner join (select customer_id, min(dateordered) dateordered order_no group customer_id ) b on a.customer_id = b.customer_id , a.dateordered - b.dateordered <= 1 , a.dateordered >...

How to create explosion effect using image frames sprite kit swift -

so created game have shoot @ objects. now, have imageset replicates object exploding. call images appear in sequence looks explosion after projectile hits object. images have called @ exact location of projectile hits object. have idea on how make happen? here code. func projectiledidcollidewithmonster(projectile:skspritenode, monster:skspritenode) { projectile.removefromparent() monster.removefromparent() playerscore = playerscore + 1 playerscoreupdate() if (playerscore > 100) { let reveal = sktransition.crossfadewithduration(0.3) let gameoverscene = gameoverscene(size: self.size, won: true) self.view?.presentscene(gameoverscene, transition: reveal) } } func didbegincontact(contact: skphysicscontact) { var firstbody: skphysicsbody var secondbody: skphysicsbody if contact.bodya.categorybitmask < contact.bodyb.categorybitmask { firstbody = contact.bodya secondbody = contact.bodyb } else { ...

python - Get word frequency in Elasticsearch with large document -

i have been trying word frequency in elasticsearch. using elasticsearch python , elasticsearch dsl python client. here code: client = elasticsearch(["my_ip_machine:port"]) s = search(using=client, index=settings.es_index) \ .filter("term",content=keyword)\ .filter("term",provider=json_input["media"])\ .filter("range",**{'publish': {"from": begin,"to": end}}) s.aggs.bucket("group_by_state","terms",field="content") result = s.execute() i run code , output this: (i modified output more concise) { "word1": 8, "word2": 8, "word3": 6, "word4": 4, } the code run without problem in elasticsearch 2000 document in laptop. but, got problem when run code in droplet in do. have >2.000.000 document in elasticsearch , use droplet 1 gb ram. every time run code, memory usage increase , elasti...

angularfire - Firebase: Delete a node -

Image
need delete entry trainname i tried below code didnt work me. var usersref = new firebase('https://hosurcabapp.firebaseio.com').child('user');delee var clientinfo = $firebase(usersref); $scope.clientinfo = clientinfo.$asobject(); $scope.deleteclient = function(key) { clientinfo.$remove(key); }; kindly since new firebase you can not set null value in firebase, since firebase treats null instruction delete node. quote docs : passing null set() remove data @ specified location. since application uses null signal specific condition, should substitute value signal condition: ref.child('trainname').set('<unnamed>'); update if want delete node, can do: usersref.child(key).remove(); see documentation firebase delete function .

c# - How to get the PAN and TILT of a DMX spotlight from the X and Y of a plan (Camera View) -

context i have dmx spotlights fixed round platform located @ 12 meters above floor. camera fixed centre (approximately) of platform. camera supposed film ground find , track targets. camera static , give me 2d plan x/y cartesian coordinates system. when found target, need put spotlight on it. illustration top view of scene top view image http://img15.hostingpics.net/pics/635699691.png side view of scene side view image http://img15.hostingpics.net/pics/275272232.png problem to light target spotlight, need find pan , tilt angles corresponding of x/y position of target. these spotlights have no specific orientation, can find x/y projection point of on ground camera. some data i found formulas on web : float radius = sqrt( x*x + y*y + z*z ); float inclination = atan2( y, x ) * 180.0 / pi; float azimuth = acos( z/radius ) * 180.0 / pi; or rotx = math.atan2( y, z ) roty = math.atan2( x * math.cos(rotx), z ) rotz = math.atan2( math.cos(rotx), math.sin(rotx) * math....