Search Results

Search found 15743 results on 630 pages for 'js is bad'.

Page 8/630 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • D3.js: "NS_ERROR_DOM_BAD_URI: Access to restricted URI denied"

    - by user2102328
    I have an html-file with several d3-graphs directly written in script tags into it. When I outsource one of the graphs into an external js file I get this message "NS_ERROR_DOM_BAD_URI: Access to restricted URI denied". If I delete the code with d3.json where it reads a local json file the error disappears. But it has to be possible to load a json file in an external js which is embedded into an html, right? d3.json("forcetree.json", function(json) { root = json; update(); });

    Read the article

  • Using a C#.net DLL in Node.js / serverside javascript

    - by Dve
    I have spent a while playing with node.js and exploring related frameworks such as express and geddy... and I am very impressed, especially with the WebSockets implementation in socket.io. I have a pet project that is an online game, the entire game engine is written in C# and I would like to know if there is anyway I can call the functions of this existing dll from a solution built using node.js, socket.io, express etc? The game engine itself is pretty complete; tested and robust. I am hoping there is some neat way of exposing its functionality without to much overhead. Thanks

    Read the article

  • Namespaced Backbone.js Views not firing events

    - by Stasio
    I'm currently getting started with Backbone.js. I've wrote some examples with Backbone and they are working fine. But now I need to use Backbone.js with Rails 3.1 and CoffeeScript. I took my well-working examples and rewrote on CoffeeScript using backbone-rails gem. And got the following problem. I've simplyfied code, but the problem is still remaining I've got the following files: Here I'm starting my Backbone app at main.js.coffee file according to my main_controller in rails app: $ = jQuery $-> CsfTaskManager.init() Here is backbone app description: #= require_self #= require_tree ./templates #= require_tree ./models #= require_tree ./views #= require_tree ./routers window.CsfTaskManager = Models: {} Collections: {} Routers: {} Views: {} init: -> new CsfTaskManager.Routers.AppRouter() Backbone.history.start() This is my apps' router: class CsfTaskManager.Routers.AppRouter extends Backbone.Router initialize: (options) -> goalsBlock = new CsfTaskManager.Views.goalsView() routes: "!/": "root", some other routes... And finally view: class CsfTaskManager.Views.goalsView extends Backbone.View initialize: -> this.goals = new CsfTaskManager.Collections.GoalsCollection() el: $('div#app'), events: "click .add-btn": "addGoal" addGoal: -> alert('ji') HTML page has such code: <div id="app"> <div class="app-screen hidden" id="goal-form" style="display: block; "> <button class="btn" id="load"> Load </button> <h3> New Goal </h3> <div class="form-stacked"> <form accept-charset="UTF-8" action="/goals" class="new_goal" id="new_goal" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="?"><input name="authenticity_token" type="hidden" value="Pnt+V/tS1/b079M/1ZIRdw2ss1D6bvJKVh868DXRjUg="></div> <label for="goal_title">Title</label> <p></p> <input class="goal-title" id="goal_title" name="goal[title]" size="30" type="text"> <p></p> <label for="goal_note">Note</label> <p></p> <input class="goal-note" id="goal_note" name="goal[note]" size="30" type="text"> </form> </div> <p> <button class="add-btn btn"> Add </button> </p> <ul id="goals-list"></ul> </div> <table class="app-screen bordered-table" id="calendar-grid" style="display: none; "> <tbody><tr> <td colspan="2"> week </td> </tr> <tr> <td> day </td> <td> <div id="calendar"></div> </td> </tr> </tbody></table> <div class="app-screen hidden" id="role-form" style="display: none; "> <h3> New User Role </h3> <div class="form-stacked"> <form accept-charset="UTF-8" action="/roles" class="new_role" id="new_role" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="?"><input name="authenticity_token" type="hidden" value="Pnt+V/tS1/b079M/1ZIRdw2ss1D6bvJKVh868DXRjUg="></div> <label for="role_title">Title</label> <p></p> <input class="role-title" id="role_name" name="role[name]" size="30" type="text"> <p></p> <label for="role_note">Note</label> <p></p> <input class="role-note" id="role_description" name="role[description]" size="30" type="text"> </form> </div> <p> <button class="add-btn btn"> Add </button> </p> </div> </div> So .add-btn element is nested in #app, but click on this button doesn't fire event. Where can be a trouble? Before, when I had the same app in one .js file, without of coffeescript, namespacing and backbone-rails gem, everything was allright. Bytheway, appRouter works fine, goalsView object is created successfully too, but events don't fire for some reasons. Please give me some hint, because I'm really got stuck...

    Read the article

  • What is node.js?

    - by Jeffrey
    I don't fully get what node.js is all about. Maybe it's because I am mainly a web based business app developer. Can someone please explain what it is and the use of it? Thanks. My understanding so far is that: The programming model is event driven, especially the way it handles IO. It uses javascript and the parser is V8. It can be easily used to create concurrent server apps. Are my understandings correct? If yes, then what are the benefits of evented IO, is it just more for the concurrency stuffs? Also is the direction of node.js to become a framework like, javascript based (v8 based) programming model?

    Read the article

  • Is it possible to use JavaScript inside handlebars.js template

    - by Gleeb
    The description says it all. How to put a JavaScript script inside handlebars template. I want to make a dynamic Paypal button for my website. <script type="text/x-mustache-template" id="product-item-thumbnail-template"> <h2>{{title}}</h2> <p>{{message}}</p> <p><a class="btn" href="#">View details &raquo;</a></p> <p><script src="resources/js-frameworks/[email protected]" data-button="buynow" data-name="My product" data-amount="1.00"></script></p> </script> But this produces an error because of the tag. it closes the template script and not the paypal script Thanks

    Read the article

  • Node.js and wss://

    - by CNelson
    I'm looking to start using javascript on the server, most likely with node.js, as well as use websockets to communicate with clients. However, there doesn't seem to be a lot of information about encrypted websocket communication using TLS and the wss:// handler. In fact the only server that I've seen explicitly support wss:// is Kaazing. This TODO is the only reference I've been able to find in the various node implementations. Am I missing something or are the websocket js servers not ready for encrypted communication yet? Another option could be using something like lighttpd or apache to proxy to a node listener, has anyone had success there?

    Read the article

  • crunching multiple js files during development

    - by Yaron Naveh
    I'm writing a backbone.js app. I have multiple js, css and html template files. I also have a script to crunch them into a single file so it is faster to download. How should I work during development: Add a listener to the file system and after every change compile the files so I can see it in a browser. This implies a 1-2 seconds overhead before I can see what I did, which is annoying for html fine-tuning. Somehow browse using the multiple files during development and only crunch before going to production. This means I need to have a separate index.html for dev and prod. What's your take?

    Read the article

  • Core Animation bad access on device

    - by user1595102
    I'm trying to do a frame by frame animation with CAlayers. I'm doing this with this tutorial http://mysterycoconut.com/blog/2011/01/cag1/ but everything works with disable ARC, when I'm try to rewrite code with ARC, it's works on simulator perfectly but on device I got a bad access memory. Layer Class interface #import <Foundation/Foundation.h> #import <QuartzCore/QuartzCore.h> @interface MCSpriteLayer : CALayer { unsigned int sampleIndex; } // SampleIndex needs to be > 0 @property (readwrite, nonatomic) unsigned int sampleIndex; // For use with sample rects set by the delegate + (id)layerWithImage:(CGImageRef)img; - (id)initWithImage:(CGImageRef)img; // If all samples are the same size + (id)layerWithImage:(CGImageRef)img sampleSize:(CGSize)size; - (id)initWithImage:(CGImageRef)img sampleSize:(CGSize)size; // Use this method instead of sprite.sampleIndex to obtain the index currently displayed on screen - (unsigned int)currentSampleIndex; @end Layer Class implementation @implementation MCSpriteLayer @synthesize sampleIndex; - (id)initWithImage:(CGImageRef)img; { self = [super init]; if (self != nil) { self.contents = (__bridge id)img; sampleIndex = 1; } return self; } + (id)layerWithImage:(CGImageRef)img; { MCSpriteLayer *layer = [(MCSpriteLayer*)[self alloc] initWithImage:img]; return layer ; } - (id)initWithImage:(CGImageRef)img sampleSize:(CGSize)size; { self = [self initWithImage:img]; if (self != nil) { CGSize sampleSizeNormalized = CGSizeMake(size.width/CGImageGetWidth(img), size.height/CGImageGetHeight(img)); self.bounds = CGRectMake( 0, 0, size.width, size.height ); self.contentsRect = CGRectMake( 0, 0, sampleSizeNormalized.width, sampleSizeNormalized.height ); } return self; } + (id)layerWithImage:(CGImageRef)img sampleSize:(CGSize)size; { MCSpriteLayer *layer = [[self alloc] initWithImage:img sampleSize:size]; return layer; } + (BOOL)needsDisplayForKey:(NSString *)key; { return [key isEqualToString:@"sampleIndex"]; } // contentsRect or bounds changes are not animated + (id < CAAction >)defaultActionForKey:(NSString *)aKey; { if ([aKey isEqualToString:@"contentsRect"] || [aKey isEqualToString:@"bounds"]) return (id < CAAction >)[NSNull null]; return [super defaultActionForKey:aKey]; } - (unsigned int)currentSampleIndex; { return ((MCSpriteLayer*)[self presentationLayer]).sampleIndex; } // Implement displayLayer: on the delegate to override how sample rectangles are calculated; remember to use currentSampleIndex, ignore sampleIndex == 0, and set the layer's bounds - (void)display; { if ([self.delegate respondsToSelector:@selector(displayLayer:)]) { [self.delegate displayLayer:self]; return; } unsigned int currentSampleIndex = [self currentSampleIndex]; if (!currentSampleIndex) return; CGSize sampleSize = self.contentsRect.size; self.contentsRect = CGRectMake( ((currentSampleIndex - 1) % (int)(1/sampleSize.width)) * sampleSize.width, ((currentSampleIndex - 1) / (int)(1/sampleSize.width)) * sampleSize.height, sampleSize.width, sampleSize.height ); } @end I create the layer on viewDidAppear and start animate by clicking on button, but after init I got a bad access error -(void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; NSString *path = [[NSBundle mainBundle] pathForResource:@"mama_default.png" ofType:nil]; CGImageRef richterImg = [UIImage imageWithContentsOfFile:path].CGImage; CGSize fixedSize = animacja.frame.size; NSLog(@"wid: %f, heigh: %f", animacja.frame.size.width, animacja.frame.size.height); NSLog(@"%f", animacja.frame.size.width); richter = [MCSpriteLayer layerWithImage:richterImg sampleSize:fixedSize]; animacja.hidden = 1; richter.position = animacja.center; [self.view.layer addSublayer:richter]; } -(IBAction)animacja:(id)sender { if ([richter animationForKey:@"sampleIndex"]) {NSLog(@"jest"); } if (! [richter animationForKey:@"sampleIndex"]) { CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"sampleIndex"]; anim.fromValue = [NSNumber numberWithInt:0]; anim.toValue = [NSNumber numberWithInt:22]; anim.duration = 4; anim.repeatCount = 1; [richter addAnimation:anim forKey:@"sampleIndex"]; } } Have you got any idea how to fix it? Thanks a lot.

    Read the article

  • Load Globalize cultures with Node.js?

    - by Xeon06
    I'm using jQuery Globalize with Node.js. They have a package.json file so I can simply use it as a module and require it. However, it doesn't load all cultures by default. I was wondering what the proper way to load a culture would be? I could go and do something like require('./node_modules/globalize/lib/cultures/globalize.culture.es-US.js') and load the file directly, but that doesn't seem too elegant. Is there a "proper" way to do this?

    Read the article

  • Syncing JS+PHP time

    - by meder
    Since the Date constructor is based on your PC's timezone and server-side is obviously dependent on the server's time settings... What procedures can I do to ensure that the timestamps I generate are consistent on both ends? I have a jQuery datepicker setup and I do a lot of work, I also have my own datepicker that's generated from server-side code which looks up db availability for bookings. I'm saving arrival/departure times on the server-side and the days are off by one because the JS is local timezone ( mine is Eastern ) . Is my only option doing something like making the JS call PHP to grab a timestamp?

    Read the article

  • Why exactly is server side HTML rendering faster than client side?

    - by mvbl fst
    I am working on a large web site, and we're moving a lot of functionality to the client side (Require.js, Backbone and Handlebars stack). There are even discussions about possibly moving all rendering to the client side. But reading some articles, especially ones about Twitter moving away from client side rendering, which mention that server side is faster / more reliable, I begin to have questions. I don't understand how rendering fairly simple HTML widgets in JS from JSON and templates is a contemporary browser on a dual core CPU with 4-8 GB RAM is any slower than making dozens of includes in your server side app. Are there any actual real life benchmarking figures regarding this? Also, it seems like parsing HTML templates by server side templating engines can't be any faster than rendering same HTML code from a Handlebars template, especially if this is a precomp JS function?

    Read the article

  • Build divs JS functions included in JS or jQuery from ajax & php data

    - by dstonek
    If a user checks a form checkbox I want to create a new div. Dynamic data is loaded from ajax and php. I am asking how to create it with JS or jQuery. A simplified version will look something like <div id="ajaxSRC1" class="CLASS"> <a href="javascript:void(0)" onmouseover="return myFunction('ajaxSRC5', 'ajaxSRC6')"> <img src="ajaxSRC2" width="ajaxSRC3" height="ajaxSRC4" alt="..." /> </a> </div>

    Read the article

  • Jquery loaded? Colorbox is available? Calling some js file via $.getScript are always downloading fr

    - by uzay95
    I am dynamically load js files with _tumIsler.js (_allStuff.js) <script src="../js/_tumJsler.js" type="text/javascript"></script> It contains: // url=> http: + // + localhost:4399 + /yabant/ // ---- ---- -------------- -------- // protocol + "//" + host + '/virtualDirectory/' var baseUrl = document.location.protocol + "//" + document.location.host + '/yabant/'; // If there is "~/" at the begining of url, replace it with baseUrl function ResolveUrl(url) { if (url.indexOf("~/") == 0) { url = baseUrl + url.substring(2); } return url; } // Attaching scripts to any tag function addJavascript(jsname, pos) { var th = document.getElementsByTagName(pos)[0]; var s = document.createElement('script'); s.setAttribute('type', 'text/javascript'); s.setAttribute('src', jsname); th.appendChild(s); } // I want to make sure jQuery is loaded? addJavascript(ResolveUrl('~/js/1_jquery-1.4.2.min.js'), 'head'); var loaded = false; // assume it didn't first and if it is change it to true function fControl() { // alert("JQUERY is loaded?"); if (typeof jQuery == 'undefined') { loaded = false; fTry2LoadJquery(); } else { loaded = true; fGetOtherScripts(); } } // Check is jQuery loaded fControl(); function fTry2LoadJquery() { // alert("JQUERY didn't load! Trying to reload..."); if (loaded == false) { setTimeout("fControl()", 1000); } else { return; } } function getJavascript(jsname, pos) { // I want to retrieve every script one by one $.ajaxSetup({ async: false, beforeSend: function() { $.ajaxSetup({ async: false, cache: true }); }, complete: function() { $.ajaxSetup({ async: false, cache: true }); }, success: function() { // } }); $.getScript(ResolveUrl(jsname), function() { /* ok! */ }); } function fGetOtherScripts() { // alert("Other js files will be load in this function"); getJavascript(ResolveUrl('~/js/5_json_parse.js'), 'head'); getJavascript(ResolveUrl('~/js/3_jquery.colorbox-min.js'), 'head'); getJavascript(ResolveUrl('~/js/4_AjaxErrorHandling.js'), 'head'); getJavascript(ResolveUrl('~/js/6_jsSiniflar.js'), 'head'); getJavascript(ResolveUrl('~/js/yabanYeni.js'), 'head'); getJavascript(ResolveUrl('~/js/7_ResimBul.js'), 'head'); getJavascript(ResolveUrl('~/js/8_HaberEkle.js'), 'head'); getJavascript(ResolveUrl('~/js/9_etiketIslemleri.js'), 'head'); getJavascript(ResolveUrl('~/js/bugun.js'), 'head'); getJavascript(ResolveUrl('~/js/yaban.js'), 'head'); getJavascript(ResolveUrl('~/embed/bitgravity/functions.js'), 'head'); } After all these js files are loaded, this line is executing to show UploadFile page inside the page when clicked to the button which id is "btnResimYukle" . <script type="text/javascript"> if (jQuery().colorbox) { alert("colorbox exists"); } else { alert("colorbox doesn't exist"); $.ajaxSetup({ cache: true, async: false }); $.getScript(ResolveUrl('~/js/3_jquery.colorbox-min.js'), function() { alert("Loaded ! "); $('#btnResimYukle').live('click', function() { $.fn.colorbox({ iframe: true, width: 700, height: 600, href: ResolveUrl('~/Yonetim/DosyaYukle.aspx') }); return false; }); }); } </script> First i want to ask you very good people, i am always calling js files with $.getScript function. Are they always downloading in every $.getScript requests? And if it is so, how can i prevent that? is this work: $.ajaxSetup({ cache: true, async: false }); Second, i am always getting this error when i press F5 or Ctrl+F5 : But when i press enter key on url, there is no error :s

    Read the article

  • CGContextDrawImage returning bad access

    - by Marcelo
    Hello guys, I've been trying to blend two UIImage for about 2 days now and I've been getting some BAD_ACCESS errors. First of all, I have two images that have the same orientation, basically I'm using the CoreGraphics to do the blending. One curious detail, everytime I modify the code, the first time I compile and run it on device, I get to do everything I want without any sort of trouble. Once I restart the application, I get error and the program shuts down. Can anyone give me a light? I tried accessing the baseImage sizes dynamically, but it gives me bad access too. Here's a snippet of how I'm doing the blending. UIGraphicsBeginImageContext(CGSizeMake(320, 480)); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextTranslateCTM(context, 0, 480); CGContextScaleCTM(context, 1.0, -1.0); CGContextDrawImage(context, rect, [baseImage CGImage]); CGContextSetBlendMode(context, kCGBlendModeOverlay); CGContextDrawImage(context, rect, [tmpImage CGImage]); [transformationView setImage:UIGraphicsGetImageFromCurrentImageContext()]; UIGraphicsEndImageContext();

    Read the article

  • APress Deal of the Day 16/August/2014 - Node.js Recipes

    - by TATWORTH
    Originally posted on: http://geekswithblogs.net/TATWORTH/archive/2014/08/15/apress-deal-of-the-day-16august2014---node.js-recipes.aspxToday’s $10 Deal of the Day from APress at http://www.apress.com/9781430260585 is Node.js Recipes. “Node.js Recipes is your one-stop reference for solving Node.js problems. Filled with useful recipes that follow a problem/solution format, you can look up recipes for many situations that you may come across in your day-to-day server-side development. ”

    Read the article

  • APress Deal of the Day 20/August/2014 - Node.js Recipes

    - by TATWORTH
    Originally posted on: http://geekswithblogs.net/TATWORTH/archive/2014/08/20/apress-deal-of-the-day-20august2014---node.js-recipes.aspxToday’s $10 Deal of the Day from APress at http://www.apress.com/9781430260585 is Node.js Recipes. “Node.js Recipes is your one-stop reference for solving Node.js problems. Filled with useful recipes that follow a problem/solution format, you can look up recipes for many situations that you may come across in your day-to-day server-side development. ”

    Read the article

  • proper way to dynamically assign backbone.js view el

    - by kikuchiyo
    I would like to create two ( or more ) view instances, each with different el attributes, and have events bound to them via backbone.js view's events hash ( not through jQuery ). Getting events to trigger when all instantiations have the same el is easy: someView = Backbone.View.extend({ el: '#someDiv', events: { 'click': 'someFunction' }, someFunction: function(){ //Do something here } }); So far, if I assign el in the initialize function, and set events normally as follows, events do not trigger: someView = Backbone.View.extend({ events: { 'click': 'someFunction' }, initialize: function( options ){ this.el = options.el }, someFunction: function(){ //Do something here } }); My first instinct was to have el be a function that returns the string representation of the dom element of interest: someView = Backbone.View.extend({ el: function(){ return '#someDiv-' + this.someNumber }, events: { 'click': 'someFunction' }, initialize: function( options ){ this.someNumber = options.someNumber }, someFunction: function(){ //Do something here } }); However, this triggers someFunction x times if I have x instantiations of someView. Next I tried setting both the el and events attributes in initialize: someView = Backbone.View.extend({ initialize: function( options ){ this.el = options.el this.events = { 'click': 'someFunction' } }, someFunction: function(){ //Do something here } }); but this does not trigger events. At this point I'm pretty much fishing. Does anyone know how instantiate a backbone.js view with an el specific to that instance that has events that only trigger for that instance, and not other instances of the View?

    Read the article

  • Send post request from client to node.js

    - by Husar
    In order to learn node.js I have built a very simple guestbook app. There is basically just a comment form and a list of previous comments. Currently the app is client side only and the items are stored within local storage. What I want to do is send the items to node where I will save them using Mongo DB. The problem is I have not yet found a way to establish a connection to send data back and forth the client and node.js using POST requests. What I do now is add listeners to the request and wait for data I send: request.addListener('data', function(chunk) { console.log("Received POST data chunk '"+ chunk + "'."); }); On the client side I send the data using a simple AJAX request: $.ajax({ url: '/', type: 'post', dataType: 'json', data: 'test' }) This does not work at all in them moment. It could be that I don't know what url to place in the AJAX request 'url' parameter. Or the whole thing might just be the build using the wrong approach. I have also tried implementing the method described here, but also with no success. It would really help if anyone can share some tips on how to make this work (sending POST request from the client side to node and back) or share any good tutorials. thanks.

    Read the article

  • Adding select menu default value via JS?

    - by purpler
    Hi, i'm developing a meta search engine website, Soogle and i've used JS to populate select menu.. Now, after the page is loaded none of engines is loaded by default, user needs to select it on his own or [TAB] to it.. Is there a possibility to preselect one value from the menu via JS after the page loads? This is the code: Javascript: // SEARCH FORM INIT function addOptions(){ var sel=document.searchForm.whichEngine;for(var i=0;i<arr.length;i++){ sel.options[i]=new Option(arr[i][0],i)}} function startSearch(){ searchString=document.searchForm.searchText.value;if(searchString!=""){ var searchEngine=document.searchForm.whichEngine.selectedIndex; var finalSearchString=arr[searchEngine][1]+searchString;location.href=finalSearchString}return false} function checkKey(e){ var character=(e.which)?e.which:event.keyCode;if(character=='13'){ return startSearch()}} // SEARCH ENGINES INIT var arr = new Array(); arr[arr.length] = new Array("Web", "http://www.google.com/search?q="); arr[arr.length] = new Array("Images", "http://images.google.com/images?q="); arr[arr.length] = new Array("Knoweledge","http://en.wikipedia.org/wiki/Special:Search?search="); arr[arr.length] = new Array("Videos","http://www.youtube.com/results?search_query="); arr[arr.length] = new Array("Movies", "http://www.imdb.com/find?q="); arr[arr.length] = new Array("Torrents", "http://thepiratebay.org/search/"); HTML: <body onload="addOptions();document.forms.searchForm.searchText.focus()"> <div id="wrapper"> <div id="logo"></div> <form name="searchForm" method="POST" action="javascript:void(0)"> <input name="searchText" type="text" onkeypress="checkKey(event);"/> <span id="color"></span> <select tabindex="1" name="whichEngine" selected="Web"></select> <br /> <input tabindex="2" type="button" onClick="return startSearch()" value="Search"/> </form> </div> </body>

    Read the article

  • How to handle duplicate values in d3.js

    - by Mario
    First I'm a d3.js noob :) How you can see from the title I've got a problem with duplicated data and aggregate the values is no option, because the name represent different bus stops. In this example maybe the stops are on the fron side and the back side of a building. And of course I like to show the names on the x-axis. If i created an example and the result is a bloody mess, see jsFiddel. x = index name = bus stop name n = value I've got a json e.g.: [{ "x": 0, "name": "Corniche St / Abu Dhabi Police GHQ", "n": 113 }, { "x": 1, "name": "Corniche St / Nation Towers", "n": 116 }, { "x": 2, "name": "Zayed 1st St / Al Khalidiya Public Garden", "n": 146 }, ... { "x": 49, "name": "Hamdan St / Tariq Bin Zeyad Mosque", "n": 55 }] The problem: It is possible that the name could appear more then once e.g. { "x": 1, "name": "Corniche St / Nation Towers", "n": 116 } and { "x": 4, "name": "Corniche St / Nation Towers", "n": 105 } I like to know is there a way to tell d3.js not to use distinct names and instead just show all names in sequence with their values. Any ideas or suggestions are very welcome :) If you need more information let me know. Thanks in advanced Mario

    Read the article

  • Why Backbone.js isn't binding my event

    - by Saif Bechan
    I have a router like this, as main entry point: window.AppRouter = Backbone.Router.extend({ routes: { '': 'login' }, login: function(){ userLoginView = new UserLoginView(); } }); var appRouter = new AppRouter; Backbone.history.start({pushState: true}); I have a model/collection/view like this: window.User = Backbone.Model.extend({}); window.Users = Backbone.Collection.extend({ model: User }); window.UserLoginView = Backbone.View.extend({ events: { 'click #login-button': 'loginAction' }, initialize: function(){ _.bindAll(this, 'render', 'loginAction'); }, loginAction: function(){ var uid = $("#login-username").val(); var pwd = $("#login-password").val(); var user = new User({uid:uid, pwd:pwd}); } }); And body of my HTML looks like this: <form action="#" method="POST" id="login-form"> <p> <label for="login-username">username</label> <input type="text" id="login-username" autofocus /> </p> <p> <label for="login-password">password</label> <input type="password" id="login-password" /> </p> <a id="login-button" href="#">Inloggen</a> </form> Note: The HTML comes from Node.js using express.js, should I maybe wait for a document ready event somewhere? Edit: I have tried this, create the view when ready, did not solve the problem. $(function(){ userLoginView = new UserLoginView(); });

    Read the article

  • Defining and using controller methods in ember.js

    - by OriginalEXE
    first of all, I am total noob when it comes to OOP in JS, this is new to me so treat me like a noob. I am building my first ember.js application and I am stuck (not the first time but I would get unstuck by myself, this is a tough one though). I have two models: forms entries Entries is of course in (one to many) relationship to forms, so each form can have as many properties. Form properties: id : DS.attr( 'number' ), title : DS.attr( 'string' ), views : DS.attr( 'number' ), conversion : DS.attr( 'number' ), entries : DS.hasMany( 'entry' ) Entry properties: id : DS.attr( 'number' ), parent_id: DS.belongsTo( 'form' ) Now, I have forms route that displays all forms in tabled view, and each table row has some info like form id, name etc. and that works great. What I wanted to do is display the number of entries each form has. I figured I should do that via controller, so here is my controller now: // Form controller App.FormController = Ember.ObjectController.extend({ entriescount: function() { var entries = this.get( 'store').find( 'entry' ); return entries.filterBy( 'parent_id', this.get( 'id' ) ).get( 'length' ); }.property( '[email protected]_id') }); Now for some reason, when I use {{entriescount}} in {{#each}} loop, this returns nothing. It also returns nothing in single form route. Note that in both cases, {{title}} for example works. I am wondering, am I going the right way by using controller for this, and how do I get controller to output the data. Thanks

    Read the article

  • problems piping in node.js

    - by alvaizq
    We have the following example in node.js var http = require('http'); http.createServer(function(request, response) { var proxy = http.createClient(8083, '127.0.0.1') var proxy_request = proxy.request(request.method, request.url, request.headers); proxy_request.on('response', function (proxy_response) { proxy_response.pipe(response); response.writeHead(proxy_response.statusCode, proxy_response.headers); }); setTimeout(function(){ request.pipe(proxy_request); },3000); }).listen(8081, '127.0.0.1'); The example listen to a request in 127.0.0.1:8081 and sends it to a dummy server (always return 200 OK status code) in 127.0.0.1:8083. The problem is in the pipe among the input stream (readable) and output stream (writable) when we have a async module before (in this case the setTimeOut timing). The pipe doesn't work and nothing is sent to dummy server in 8083 port. Maybe, when we have a async call (in this case the setTimeOut) before the pipe call, the inputstream change to a state "not readable", and after the async call the pipe doesn't send anything. This is just an example...we test it with more async modules from node.js community with the same result (ldapjs, etc)... We try to fix it with: - request.readable =true; //before pipe call - request.pipe(proxy_request, {end : false}); with the same result (the pipe doesn't work). Can anybody help us? Many thanks in advanced and best regards,

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >