Search Results

Search found 7724 results on 309 pages for 'backbone js'.

Page 12/309 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Where is the node.js file in the stack trace located?

    - by user225189
    Obviously, I'm pretty new to node.js. I'm attempting to debug a node.js application and I see node.js in the stack trace. I would like to put some sys.puts calls in there, but I cannot locate the node.js that is being run by my server. Is there a way to tell where node.js is located? Is there an equivalent to Ruby's FILE in node? Thanks, Brian

    Read the article

  • Backbone.js: How to utilize router.navigate to manipulate browser history?

    - by Xavier_Ex
    I am writing something like a registration process containing several steps, and I want to make it a single-page like system so after some studying Backbone.js is my choice. Every time the user completes the current step they will click on a NEXT button I create and I use the router.navigate method to update the url, as well as loading the content of the next page and doing some fancy transition with javascript. Result is, URL is updated which the page is not refreshed, giving a smooth user experience. However, when the user clicks on the back button of the browser, the URL gets updated to that of a previous step, but the content stays the same. My question is through what way I can capture such an event and currently load the content of the previous step and present that to the user? Or even better, can I rely on browser cache to load that previously loaded page? EDIT: in particular, I'm trying something like mentioned in this article.

    Read the article

  • mouse to Three.js world coordinates during TrackballControls

    - by PanChan
    I know there are a lot of answers how to translate the mouse coordinates to the Three.js world coordinates (I prefere this one). But I have troubles on calculating when using TrackballControls. First what I expect to do: I want to add a zoom function to my scene. Not by the mouse wheel, the user should be able to draw a rectangular and by lifting the mouse button, the camera is zooming on this rectangular. I've implemented all and it works, but only when the user didn't rotate/zoom/pan with TrackballControls! If the camera was manipulated, I get wrong coordinates for my drawn rectangular. I really can't figure out why... I only know that it's an issue with TrackballControls, because without them, it works. Does anyone see my mistake? I'm sitting here for two days now and can't find it.... :( var onZoomPlaneMouseDown = function(event){ event.preventDefault(); var plane = document.getElementById("zoomPlane"); var innerPlane = document.getElementById("innerZoomPlane"); var mouseButton = event.keyCode || event.which; mouse.x = ( event.clientX / WIDTH ) * 2 - 1; mouse.y = - ( event.clientY / HEIGHT ) * 2 + 1; if(mouseButton === 1){ var vector = new THREE.Vector3( mouse.x, mouse.y, 0.5 ); projector.unprojectVector( vector, camera ); var dir = vector.sub( camera.position ).normalize(); var distance = - camera.position.z / dir.z; zoomPlaneUpperCorner = camera.position.clone().add( dir.multiplyScalar( distance ) ); innerPlane.style.display = "block"; innerPlane.style.top = event.clientY + "px"; innerPlane.style.left = event.clientX + "px"; } if(mouseButton === 3){ plane.style.display = "none"; innerPlane.style.display = "none"; } }; var onZoomPlaneMouseUp = function(event){ event.preventDefault(); var plane = document.getElementById("zoomPlane"); var innerPlane = document.getElementById("innerZoomPlane"); var mouseButton = event.keyCode || event.which; mouse.x = ( event.clientX / WIDTH ) * 2 - 1; mouse.y = - ( event.clientY / HEIGHT ) * 2 + 1; var vector = new THREE.Vector3( mouse.x, mouse.y, 0.5 ); projector.unprojectVector( vector, camera ); var dir = vector.sub( camera.position ).normalize(); var distance = - camera.position.z / dir.z; zoomPlaneLowerCorner = camera.position.clone().add( dir.multiplyScalar( distance ) ); if(mouseButton === 1){ plane.style.display = "none"; innerPlane.style.display = "none"; var center = new THREE.Vector3(); center.subVectors(zoomPlaneLowerCorner, zoomPlaneUpperCorner); center.multiplyScalar( 0.5 ); center.add(zoomPlaneUpperCorner); var rayDir = new THREE.Vector3(); rayDir.subVectors(center, camera.position ).normalize(); controls.target = center; var height = zoomPlaneUpperCorner.y - zoomPlaneLowerCorner.y; var distanceToCenter = camera.position.distanceTo(center); var minDist = (height / 2) / (Math.tan((camera.fov/2)*Math.PI/180)); camera.translateOnAxis(rayDir, (distanceToCenter - minDist)); } };

    Read the article

  • How should backbone.js handle a GET request that returns no results?

    - by Nyxynyx
    I have a number of text input elements that when its values are changed, will trigger a fetch on listingListView's collection listingCollection, which then updates listingListView with the new data via the function listingListView.refreshList as shown below. I am using PHP/Codeigniter to expose a RESTful API. Problem: Everything works fine if there are results retrieved from the fetch(). However, when the filters results in no result being returned, how should the server side and the client side handle it? Currently Chrome's javascript console displays a 404 error and in the Network tab, the XHR request is highlighted in red. All I want to do in the event of zero results returned, is to blank the listingListView and show a message like (No results returned) and not throw any errors in the javascript console. Thanks! PHP Code function listings_get() { // Get filters $price_min = $this->get('price_min'); $this->load->model('app_model'); $results = $this->app_model->get_listings($price_min); if($results) $this->response($results); else $this->response(NULL); } JS Code window.ListingListView = Backbone.View.extend({ tagName: 'table', initialize: function() { this.model.bind('reset', this.refreshList, this); this.model.bind('add', function(listing) { $(this.el).append(new ListingListItemView({ model: listing }).render().el); }, this); }, render: function() { _.each(this.model.models, function(listing) { $(this.el).append(new ListingListItemView({ model: listing }).render().el); }, this); return this; }, close: function() { $(this.el).unbind(); $(this.el).empty(); }, refreshList: function() { $(this.el).empty(); this.render(); } });

    Read the article

  • Zoom on multiple areas in d3.js

    - by t2k32316
    I'm planning to have a geoJSON map inside my svg alongside other svg elements. I would like to be able to zoom (zoom+pan) in the map and keep the map in the same location with a bounding box. I can accomplish this by using a clipPath to keep the map within a rectangular area. The problem is that I also want to enable zooming and panning on my entire svg. If I do d3.select("svg").call(myzoom); this overrides any zoom I applied to my map. How can I apply zoom to both my entire svg and to my map? That is, I want to be able to zoom+pan on my map when my mouse is in the map's bounding box, and when the mouse is outside the bounding box, zoom+pan on the entire svg. Here's example code: http://bl.ocks.org/nuernber/aeaac0e8edcf7ca93ade. (how do I get around the cross domain issue to load the map?) <svg id="svg" width="640" height="480" xmlns="http://www.w3.org/2000/svg" version="1.1"> <defs> <clipPath id="rectClip"> <rect x="150" y="25" width="400" height="400" style="stroke: gray; fill: none;"/> </clipPath> </defs> <g id="outer_group"> <circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red" /> <g id="svg_map" style="clip-path: url(#rectClip);"> </g> </g> </svg><br/> <script type="text/javascript"> var svg = d3.select("#svg_map"); var mapGroup = svg.append("g"); var projection = d3.geo.mercator(); var path = d3.geo.path().projection(projection); var zoom = d3.behavior.zoom() .translate(projection.translate()) .scale(projection.scale()) .on("zoom", zoomed); mapGroup.call(zoom); var pan = d3.behavior.zoom() .on("zoom", panned); d3.select("svg").call(pan); mapGroup.attr("transform", "translate(200,0) scale(2,2)"); d3.json("ne_110m_admin_0_countries/ne_110m_admin_0_countries.geojson", function(collection) { mapGroup.selectAll("path").data(collection.features) .enter().append("path") .attr("d", path) .attr("id", function(d) { return d.properties.name.replace(/\s+/g, "")}) .style("fill", "gray").style("stroke", "white").style("stroke-width",1); } ); function panned() { var x = d3.event.translate[0]; var y = d3.event.translate[1]; d3.select("#outer_group").attr("transform", "translate("+x+","+y+") scale(" + d3.event.scale + ")"); } function zoomed() { previousScale = d3.event.scale; projection.translate(d3.event.translate).scale(d3.event.scale); translationOffset = d3.event.translate; mapGroup.selectAll("path").attr("d", path); } </script>

    Read the article

  • Using Knockout.js to bind bootstrap daterange picker and parse span contents

    - by jmkr
    I'm new to knockout and trying to get what should be a simple task up and running. I'm working on an MVC4 .NET app with the intention of binding a date range picker to make ajax requests for updating Highchart graph data. I'm using Dan Grossman's bootstrap-themed date picker and it's been great so far (https://github.com/dangrossman/bootstrap-daterangepicker). The basic goal is to watch the span that this jQuery date ranger picker updates, and then use knockout to pass this value to another part of the app for the ajax request. I've tried everything I can find online.. valueUpdate:change on the span to using some jQuery within knockout to get the same goal done, to using a subscribe function to watch the value of the span before and after the date picker is used. Apparently this uses the jQuery .change() event handler, which is only good on inputs, selects, and textareas.. not spans. Here's the fiddle of what I have so far: http://jsfiddle.net/eyygK/9/ Appreciate any help and input.

    Read the article

  • How can I have HTML tab expansion in ST2 w/ Emmet inside Handlebars templates(emberjs)?

    - by Zuko
    Okay, so I'm using Sublime Text 2 with Emmet. But "Tab" expansion of HTML snippets doesn't work inside a script because of the scope. Example: In HTML, I can type "h1" and then hit tab, and it will generate "" When using Ember.js, and more specifically Handlebars, it doesn't work. <script type="text/x-handlebars"> h1 </script> Pressing tab after that "h1" doesn't expand it because it's inside a script; Emmet turns this off. I can press Ctrl+E, which is the "expand anywhere" hotkey, and that works just fine. However, that is uncomfortable and prone to missing and hitting things like Ctrl+S or Ctrl+D which have undesired effects. So, how can I change this? I tweeted at the developer, and got a reply, https://twitter.com/chikuyonok/status/398708331969540096 But couldn't understand what to do.

    Read the article

  • nodejs daemon wrong architecture

    - by Greg Pagendam-Turner
    I'm trying to run 'dali' a highcharts exporter from nodejs on my Mac under OSX Mountain Lion I'm getting the following error: module.js:485 process.dlopen(filename, module.exports); ^ Error: dlopen(/Users/greg/node_modules/daemon/lib/daemon.v0.8.8.node, 1): no suitable image found. Did find: /Users/greg/node_modules/daemon/lib/daemon.v0.8.8.node: mach-o, but wrong architecture at Object.Module._extensions..node (module.js:485:11) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:362:17) at require (module.js:378:17) at Object.<anonymous> (/Users/greg/node_modules/daemon/lib/daemon.js:12:11) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) The key part is: "wrong architecture" If I run: lipo -info /Users/greg/node_modules/daemon/lib/daemon.v0.8.8.node It returns: Non-fat file: /Users/greg/node_modules/daemon/lib/daemon.v0.8.8.node is architecture: i386 I'm guessing a x64 version is requried. How do I get and install the 64 bit version of this lib?

    Read the article

  • science.js’s loess() output is identical to input

    - by user3710111
    Rendered project available here. The line is supposed to be a trend line (as rendered with LOESS), but it merely follows each data point instead. I am no stats wonk, so maybe it makes sense that a LOESS function’s output would match the input as seen in the above example, but it strikes me as being wrong. Here is the relevant bit of code: var loess = science.stats.loess().bandwidth(.2); var xVal = data.map(function(d) { return d.date; }); var yVal = data.map(function(d) { return d.A; }); var loessData = loess([xVal], [yVal])[0]; console.log(yVal); console.log(loessData);

    Read the article

  • d3.js force layout increase linkDistance

    - by user1159833
    How to increase linkDistance without affecting the node alignment, example: http://mbostock.github.com/d3/talk/20110921/force.html when I try to increase the circle radius and linkDistance the it collapse <script type="text/javascript"> var w = 1280, h = 800, z = d3.scale.category20c(); var force = d3.layout.force() .size([w, h]); var svg = d3.select("#chart").append("svg:svg") .attr("width", w) .attr("height", h); svg.append("svg:rect") .attr("width", w) .attr("height", h); d3.json("flare.json", function(root) { var nodes = flatten(root), links = d3.layout.tree().links(nodes); force .nodes(nodes) .links(links) .start(); var link = svg.selectAll("line") .data(links) .enter().insert("svg:line") .style("stroke", "#999") .style("stroke-width", "1px"); var node = svg.selectAll("circle.node") .data(nodes) .enter().append("svg:circle") .attr("r", 4.5) .style("fill", function(d) { return z(d.parent && d.parent.name); }) .style("stroke", "#000") .call(force.drag); force.on("tick", function(e) { link.attr("x1", function(d) { return d.source.x; }) .attr("y1", function(d) { return d.source.y; }) .attr("x2", function(d) { return d.target.x; }) .attr("y2", function(d) { return d.target.y; }); node.attr("cx", function(d) { return d.x; }) .attr("cy", function(d) { return d.y; }); }); }); function flatten(root) { var nodes = []; function recurse(node, depth) { if (node.children) { node.children.forEach(function(child) { child.parent = node; recurse(child, depth + 1); }); } node.depth = depth; nodes.push(node); } recurse(root, 1); return nodes; } </script>

    Read the article

  • D3.js transition callback on frame

    - by brenjt
    Does anyone know how I could accomplish a per frame callback for a transition with D3. Here is and example of what I am doing currently. link.transition() .duration(duration) .attr("d", diagonal) .each("end",function(e) { if(e.target.id == current) show_tooltip(e.target) }); This currently calls the anonymous function for each element at the end of the animation. I would like to call it for every frame.

    Read the article

  • constructors and inheritance in JS

    - by nandinga
    Hi all, This is about "inheritance" in JavaScript. Supose I create a constructor Bird(), and another called Parrot() which I make to "inherit" the props of Bird by asigning an instance of it to Parrot's prototype, like the following code shows: function Bird() { this.fly = function(){}; } function Parrot() { this.talk = function(){ alert("praa!!"); }; } Parrot.prototype = new Bird(); var p = new Parrot(); p.talk(); // Alerts "praa!!" alert(p.constructor); // Alerts the Bird function!?!?! After I've created an instance of Parrot, how comes that the .constructor property of it is Bird(), and not Parrot(), which is the constructor I've used to create the object? Thanks!!

    Read the article

  • JS Chrome top.document

    - by stevewk10
    What is Chrome's equivalent of 'top.document', valid in both FF and IE8. In Chrome, 'top' is valid, top.length returns 2 (frames)...as it should. But top.document returns 'undefined'. Needed to get an element. top.document.getElementById(id) works perfectly in both FF and IE8. Thanks in advance, swk

    Read the article

  • Node.js or Erlang

    - by gotts
    I really like these tools when it comes to the concurrency level it can handle. Erlang looks like much more stable solution but requires much more learning and a lot of diving into functional language paradigm. And it looks like Erlang makes it much better when it comes to multi cores CPUs(fix me if I'm wrong). But which should I choose? Which one is better in the short/long term perspective?

    Read the article

  • Filter on button click D3.js?

    - by user1461701
    I'm working on a version of this bubble chart http://vallandingham.me/vis/gates/. As I'm using a different set of data - instead of the "All Grants" and "Grants by Year" buttons - I have one for 5 consecutive years - 2010, 2009 etc. My opening graph depicts the data for 2010 which is achieved by filtering the data from the .csv file , which contains the data for all 5 years. The problem I'm having is filtering and re-rendering the graph if another year is then chosen. I'd really appreciate it if anyone has any suggestions how I could simply achieve this? Thanks, Majella

    Read the article

  • Having trouble animating Line in D3.js using and array of objects as data

    - by user1731245
    I can't seem to get an animated transition between line graphs when I pass in a new set of data. I am using an array of objects as data like this: [{ clicks: 40 installs: 10 time: "1349474400000" },{ clicks: 61 installs: 3 time: "1349478000000" }]; I am using this code to setup my ranges / axis's var xRange = d3.time.scale().range([0, w]), yRange = d3.scale.linear().range([h , 0]), xAxis = d3.svg.axis().scale(xRange).tickSize(-h).ticks(6).tickSubdivide(false), yAxis = d3.svg.axis().scale(yRange).ticks(5).tickSize(-w).orient("left"); var clicksLine = d3.svg.line() .interpolate("cardinal") .x(function(d){return xRange(d.time)}) .y(function(d){return yRange(d.clicks)}); var clickPath; function drawGraphs(data) { clickPath = svg.append("g") .append("path") .data([data]) .attr("class", "clicks") .attr("d", clicksLine); } function updateGraphs(data) { svg.select('path.clicks') .data([data]) .attr("d", clicksLine) .transition() .duration(500) .ease("linear") } I have tried just about everything to be able to pass in new data and see an animation between graph's. Not sure what I am missing? does it have something to do with using an array of objects instead of just a flat array of numbers as data?

    Read the article

  • Check if an array item is set in JS

    - by Gusepo
    Hi, I've got an array var assoc_pagine = new Array(); assoc_pagine["home"]=0; assoc_pagine["about"]=1; assoc_pagine["work"]=2; I tried if (assoc_pagine[var] != "undefined") { but it doesn't seem to work I'm using jquery, I don't know if it can help Thanks

    Read the article

  • Help on understanding JS

    - by Anonymous
    I have thos piece of code: Math&&Math.random?Math.floor(Math.random()*10000000000000):Date.getTime(); And as far as i know && is logic operator for AND, so im trying to convert this into PHP and this is where i got: intval(floor(time()/10800000)%10+(rand()?floor(rand()*10000000000000):time())) The problem is that i can't understand the first part Math&& Can anyone help with this one cause i always get negative result, when i should get positive (probably the logic rand-time is not working in my php example)

    Read the article

  • mediaelement.js play/pause on click controls don't work

    - by iKode
    I need to play and pause the video player if any part of the video is clicked, so I implemented something like: $("#promoPlayer").click(function() { $("#promoPlayer").click(function() { if(this.paused){ this.play(); } else { this.pause(); } }); ...but now the controls of the video won't pause/play. You can see it in action here(http://175.107.134.113:8080/). The video is the second slide on the main carousel at the top. I suspect I'm now getting 2 onclick events one from my code above and a second on the actual pause/play button. I don't understand how the actual video controls work, because when I inspect the element, I just see a tag. If I could differentiate the controls, then perhaps I might have figured out a solution by now. Anyone know how I should have done this, or is my solution ok. If my solutions ok, how do I intercept a click on the control, so that I only have one click event to pause / play? If you look on the media element home page, they have a big play button, complete with mouseOver, but I can't see how they have done that? Can someone else help?

    Read the article

  • How to post to a request using node.js

    - by Mr JSON
    I am trying to post some json to a URL. I saw various other questions about this on stackoverflow but none of them seemed to be clear or work. This is how far I got, I modified the example on the api docs: var http = require('http'); var google = http.createClient(80, 'server'); var request = google.request('POST', '/get_stuff', {'host': 'sever', 'content-type': 'application/json'}); request.write(JSON.stringify(some_json),encoding='utf8'); //possibly need to escape as well? request.end(); request.on('response', function (response) { console.log('STATUS: ' + response.statusCode); console.log('HEADERS: ' + JSON.stringify(response.headers)); response.setEncoding('utf8'); response.on('data', function (chunk) { console.log('BODY: ' + chunk); }); }); When I post this to the server I get an error telling me that it's not of the json format or that it's not utf8, which they should be. I tried to pull the request url but it is null. I am just starting with nodejs so please be nice.

    Read the article

  • Uncatchable errors in node.js

    - by Peter Burns
    So I'm trying to write a simple TCP socket server that broadcasts information to all connected clients. So when a user connects, they get added to the list of clients, and when the stream emits the close event, they get removed from the client list. This works well, except that sometimes I'm sending a message just as a user disconnects. I've tried wrapping stream.write() in a try/catch block, but no luck. It seems like the error is uncatchable.

    Read the article

  • JS 2 minute countdown then execute a function?

    - by Cyprus106
    I'm not that great at Javascript, for the record! I DO know how to use ajax. I just need a bit of help. I'm having a hard time figuring out how to display a 5 minute countdown, and once the countdown hits zero, to run a function. I need to pass a variable to the function that needs to run. I tried SetInterval but this isn't exactly my strong suit. Does anyone have any suggestions? I can post the code I've got, but I would equate it to a gorilla fumbling in the dark at a typewriter!

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >