Search Results

Search found 7781 results on 312 pages for 'd3 js'.

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

  • 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

  • only update certain model attributes using Backbone.js

    - by Drew Dara-Abrams
    With Backbone, I'm trying to update and save to the server just one attribute: currentUser.save({hide_explorer_tutorial: 'true'}); but I don't want to send all the other attributes. Some of them are actually the output of methods on the server-side and so they are not actually true attributes with setter functions. Currently I'm using unset(attribute_name) to remove all the attributes that I don't want to update on the server. Problem is those attributes are then no longer available for local use. Suggestions on how to only save certain attributes to the server?

    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

  • 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

  • backbone.js removing template from DOM upon success

    - by timpone
    I'm writing a simple message board app to learn backbone. It's going ok (a lot of the use of this isn't making sense) but am a little stuck in terms of how I would remove a form / html from the dom. I have included most of the code but you can see about 4 lines up from the bottom, the part that isn't working. How would I remove this from the DOM? thx in advance var MbForm=Backbone.View.extend({ events: { 'click button.add-new-post': 'savePost' }, el: $('#detail'), template:_.template($('#post-add-edit-tmpl').html()), render: function(){ var compiled_template = this.template(); this.$el.html(compiled_template); return this; }, savePost: function(e){ //var self=this; //console.log("I want you to say Hello!"); data={ header: $('#post_header').val(), detail: $('#post_detail').val(), forum_id: $('#forum_id').val(), post_id: $('#post_id').val(), parent_id: $('#parent_id').val() }; this.model.save(data, { success: function(){ alert('this saved'); //$(this.el).html('this is what i want'); this.$el.remove();// <- this is the part that isn't working /* none of these worked - error Uncaught TypeError: Cannot call method 'unbind' of undefined this.$el.unbind(); this.$el.empty(); this.el.unbind(); this.el.empty(); */ //this.unbind(); //self.append('this is appended'); } });

    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

  • 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

  • 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

  • Node.js Creating and Deleting a File Recursively

    - by Matt
    I thought it would be a cool experiment to have a for loop and create a file hello.txt and then delete it with unlink. I figured that if fs.unlink is the delete file procedure in Node, then fs.link must be the create file. However, my code will only delete, and it will not create, not even once. Even if I separate the fs.link code into a separate file, it still will not create my file hello.txt. Below is my code: var fs = require('fs'), for(var i=1;i<=10;i++){ fs.unlink('./hello.txt', function (err) { if (err){ throw err; } else { console.log('successfully deleted file'); } fs.link('./hello.txt', function (err) { if (err){ throw err; } else { console.log('successfully created file'); } }); }); } http://nodejs.org/api/fs.html#fs_fs_link_srcpath_dstpath_callback Thank you!

    Read the article

  • How to GZIP my JS und CSS Files

    - by Fincha
    Hello everyone, I habe a Problem, I have to gzip a prototype Lib, but i totaly have no idea how to do this, where to start und how does it works :) I find some tutorials but that wasn't helpfull... So I have a folder with my JS Files /compressed/js/ 1.js 2.js 3.js I caling this files for a test in this file /compresses/index.php <link rel="javascript" type="text/js" href="js/tabs.js" /> <link rel="javascript" type="text/js" href="js/fb.js" /> So what I have to do? :)

    Read the article

  • Node.js, Cygwin and Socket.io walk into a bar... Node.js throws ENOBUFS and everyone dies...

    - by A Wizard Did It
    I'm hoping someone here can help me out, I'm not having much luck figuring this out myself. I'm running node.js version 0.3.1 on Cygwin. I'm using Connect and Socket.io. I seem to be having some random problems with DNS or something, I haven't quite figured it out. The end result is that I the server is running fine, but when a browser attempts to connect to it the initial HTTP Request works, Socket.io connects, and then the server dies (output below). I don't think it has anything to do with the HTTP request because the server gets a lot data posted to it, and it was receiving requests and responding up until my connection that killed it. I've googled around and the closest thing I've found is DNS being set improperly. It's a network program meant to run only on an internal network, so I've set the nameserver x.x.x.x in my /etc/resolv.conf to the internal DNS. I've also added nameserver 8.8.8.8 in addition. I'm not sure what else to check, but would be grateful of any help. In node.exe.stackdump Exception: STATUS_ACCESS_VIOLATION at eip=610C51B9 eax=00000000 ebx=00000001 ecx=00000000 edx=00000308 esi=00000000 edi=010FCCB0 ebp=010FCAEC esp=010FCAC4 program=\\?\E:\cygwin\usr\local\bin\node.exe, pid 3296, thread unknown (0xBEC) cs=0023 ds=002B es=002B fs=0053 gs=002B ss=002B Stack trace: Frame Function Args 010FCAEC 610C51B9 (00000000, 00000000, 00000000, 00000000) 010FCBFC 610C5B55 (00000000, 00000000, 00000000, 00000000) 010FCCBC 610C693A (FFFFFFFF, FFFFFFFF, 750334F3, FFFFFFFE) 010FCD0C 61027CB2 (00000002, F4B994D5, 010FCE64, 00000002) 010FCD98 76306B59 (00000002, 010FCDD4, 763069A4, 00000002) End of stack trace Node Output: node.js:50 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: ENOBUFS, No buffer space available at doConnect (net.js:642:19) at net.js:803:9 at dns.js:166:30 at IOWatcher.callback (dns.js:48:15) EDIT I'm hitting an LDAP server using http.createClient immediately after a client connects to get information, and that seems to be where the problem is that is causing ENOBUFS. I've edited the source to include && errno != ENOBUFS which now prevents the server from dying, however now the LDAP request isn't working. I'm not sure what the problem is that would cause that though. As I mentioned this is an internal only application, so I set the DNS servers in /etc/resolv.conf to the DNS servers that are being applied to the host machine. Not sure if this is part of the issue? EDIT 2 Here's some output from gdb --args ./node_g --debug ../myscript.js. I'm not sure if this is related to ENOBUFS, however, as it seems to be disconnecting immediately after connection with Socket.io [New thread 672.0x100] Error: dll starting at 0x76e30000 not found. Error: dll starting at 0x76250000 not found. Error: dll starting at 0x76e30000 not found. Error: dll starting at 0x76f50000 not found. [New thread 672.0xc90] [New thread 672.0x448] debugger listening on port 5858 [New thread 672.0xbf4] 14 Jan 18:48:57 - socket.io ready - accepting connections [New thread 672.0xed4] [New thread 672.0xd68] [New thread 672.0x1244] [New thread 672.0xf14] 14 Jan 18:49:02 - Initializing client with transport "websocket" assertion "b[1] == 0" failed: file "../src/node.cc", line 933, function: ssize_t node::DecodeWrite(char*, size_t, v8::Handle<v8::Value>, node::encoding) Program received signal SIGABRT, Aborted. 0x7724f861 in ntdll!RtlUpdateClonedSRWLock () from /cygdrive/c/Windows/system32/ntdll.dll (gdb) backtrace #0 0x7724f861 in ntdll!RtlUpdateClonedSRWLock () from /cygdrive/c/Windows/system32/ntdll.dll #1 0x7724f861 in ntdll!RtlUpdateClonedSRWLock () from /cygdrive/c/Windows/system32/ntdll.dll #2 0x75030816 in WaitForSingleObjectEx () from /cygdrive/c/Windows/syswow64/KernelBase.dll #3 0x0000035c in ?? () #4 0x00000000 in ?? () (gdb)

    Read the article

  • Get and Set a Single Cookie with Node.js HTTP Server

    - by Corey Hart
    I want to be able to set a single cookie, and read that single cookie with each request made to the nodejs server instance. Can it be done in a few lines of code, without the need to pull in a third party lib? var http = require('http'); http.createServer(function (request, response) { response.writeHead(200, {'Content-Type': 'text/plain'}); response.end('Hello World\n'); }).listen(8124); console.log('Server running at http://127.0.0.1:8124/'); Just trying to take the above code directly from nodejs.org, and work a cookie into it.

    Read the article

  • What is the scope of JS variables in anonymous functions

    - by smorhaim
    Why does this code returns $products empty? If I test for $products inside the function it does show data... but once it finishes I can't seem to get the data. var $products = new Array(); connection.query($sql, function(err, rows, fields) { if (err) throw err; for(i=0; i< rows.length; i++) { $products[rows[i].source_identifier] = "xyz"; } }); connection.end(); console.log($products); // Shows empty.

    Read the article

  • Replace several tags from a text js

    - by Blanca
    Hi! I have this pice of text I would like to change: [¿Cómo se procede cuando la mujer o pareja de un < bfallecido< /b pide la congelación del semen] So I would like to remove ], [ and < b< /b Is there any way to change it everything in the same time?? I tried: function replaceThings(){ jQuery(".summary").each(function(){ var t = jQuery(this).text(); jQuery(this).text(t.replace(/& lt;/g, '')); jQuery(this).text(t.replace('[', '')); jQuery(this).text(t.replace(']', '')); }); But only replaces ]. Thanks in advance

    Read the article

  • MongoDB query against geospatial index with maxDistance fails from node.js client

    - by user1735497
    I want to query against a geospatial index in mongo-db (designed after this tutorial http://www.mongodb.org/display/DOCS/Geospatial+Indexing). So when I execute this from the shell everything works fine: db.sellingpoints.find(( { location : { $near: [48.190120, 16.270895], $maxDistance: 7 / 111.2 } } ); but the same query from my nodejs application (using mongoskin or mongoose), won't return any results until i set the distance-value to a very high number (5690) db.collection('sellingpoints') .find({ location: { $near: [lat,lng], $maxDistance: distance / 111.2} }) .limit(limit) .toArray(callback); Has someone any idea how to fix that?

    Read the article

  • Should I use parameters in template scripting to control the output, or a separate specialized template?

    - by asawyer
    Would it be considered best practice to use a single template that changes it's output based on script values, or have multiple templates, and use the view to pick the correct one instead? For example, in this underscope template: <script type="text/template" id="SkillsetTemplate"> <div class='RegularMode <%= (skillset.get('InEditMode')===false)?'show':'hide' %>'> </div> <div class='EditMode <%= (skillset.get('InEditMode')===true)?'show':'hide' %>'> </div> </script> I use a backbone model to bind against, and use the InEditMode attribute to pick which content to render. Should I instead have a normal mode, and an edit mode template, and use the attribute on the model to pick the template ? For background purposes, I am using backbone.js with underscore templates and an MVC3 backend.

    Read the article

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