javascript,rest,angularjs,angularView the original page-Collection of common programming errors

UnKnown Error


  • spike
    javascript browser-detection 2014-2-16 21:38:36
    Feature detection is generally preferred over browser sniffing. What should I do in a case where certain browsers “support” the features I’m using but have javascript runtimes that are too slow?I’m using the d3 library for some complicated visualizations. The visualization is very smooth in chrome / firefox, acceptable in IE9, and slow yet working in IE8. I’d like to display a banner to IE8 users telling them to upgrade and a notice banner to IE9 users that it would be faster in chrome or FF. Is

  • Robert Harvey
    javascript jquery javascript-events firefox-addon javascript-debugger 2014-2-16 20:35:16
    I’m trying to debug a webpage that makes heavy use of JavaScript events, and so I need to monitor all JavaScript events that are fired.Most of the events are bound using jQuery. Hence, it would be particularly useful if there was a way to specifically monitor only those events.

  • PrimosK
    javascript angularjs 2014-2-16 20:24:46
    Quote from one of the comments regarding ngCloak directive (AngularJS documentation):It is only really needed on your “index.html” page, because thebrowser may try to render things before Angular has had a chance toparse/compile it. At runtime, when Angular pulls in content due tong-view, ng-include, etc., it will be processed by Angular before thebrowser renders.I created a example in jsFiddle to verify this and on my surprise the expression is not evaluated before it is rendered in the browser

  • int3
    javascript google-chrome optimization compiler v8 2014-2-16 19:48:29
    I’m optimizing an sha-256 > hmac > pbkdf2 crypto algorithm in javascript for chromehttp://jsfiddle.net/dtudury/uy3hc/if I change one line (after the comment // BREADCRUMB ) ei = (di + t1) >>> 0; to ei = (di + t1); my test still passes, but the test runtime jumps from <1s to 7sI believe the >>> 0 tells chrome that it should store the value as an (actual) int… but there’s some degree of “cargo cult” to it.My question is: “is this documented anywhere?” I’d love to verify how

  • Chantz
    javascript file-upload thumbnails filepath plupload 2014-2-16 19:01:23
    I am using plupload to let users upload images. But I also want to generate thumbnails for preview before they finally decide to keep it. I understand currently “Image preview” feature is not present in plupload. So to work around this I decided to submit a new form containing just one file for each image added, & let the server process it & return a thumbnail.Now my question is how do I get the handle on the file object from the plupload so that I can create an “input” file field dynami

  • ripper234
    javascript internet-explorer internet-explorer-8 2014-2-16 18:24:22
    I’m getting ‘unspecified error’ when reading document.namespaces in IE. I can’t seem to reproduce the problem in a standalone page, my snippet is:function addNamespace(key, value) {try {$(“html”).attr(key, value);if (document.namespaces && // This throws the error!document.namespaces[key]) {document.namespaces.add(key, value);}} catch (e) {alert(“Error: ” + e);} };Never mind right now why I’m trying to add a namespace at runtime (it has to do with Facebook Like not working properly …

  • Tyler Mitchell
    javascript c#-4.0 dll dllimport winjs 2014-2-16 17:39:53
    I am new to Windows 8 app development and professional C# dev. I have run into a problem where a client wants me to interface with a printer (DYMO 450 Turbo) and the SDK only comes with a dll that has been compiled using .net 4.0 . The samples show referencing the dll from the app which I can not do because the app is written in Javascript using WinJS. The metro apps use NETCore where the dll uses NETFramework. My best solution so far is to write the code to interface with the printer as a serve

  • user502014
    javascript performance dom custom-data-attribute 2014-2-16 17:37:21
    I have a list of books and I want to store data against each book e.g. Price, Quantity, id, catergory id, size, weight etc.I was looking at storing all this in the dom by extending the li elements representing each book in the list using data- attributes. This data could then be utilised directly with javascript.However I have read that accessing data- attributes is slow in a performance sense. In addition I can have multiple instances of the same book so am a little concerened about bloat in th

  • Steven
    javascript menu unity3d subclass 2014-2-16 16:08:10
    I am trying to set up a generic class that deals with menus within Unity3D. The following code I intend to attach to an empty game objectimport System.Collections.Generic;#pragma strictpublic enum MenuType { loadSceneOnMouseDown, enableGameObject, changeValue };public class MenuClass extends System.Object{public var menuObject : GameObject;public var menuType : MenuType;}public var menuItems = List.<MenuClass>();This results in the following within the editor: I want

  • SolessChong
    javascript scope 2014-2-16 14:14:41
    There are multiple js files and now I have to combine them into a large file.However, since these files are familiar in function, they have many variables with the same name. So I’m wondering if there is any mechanism like namespace or scoping that can incorperate multiple variables with the same name in a file.EditAnd additional question:How can I access the variabls in “ad-hoc” functions via Chrome Console?Normally I can do this in Chrome Console:[js] var car = “Model T”;[Chrome Console] >&

  • Cheryl Simon
    java spring rest spring-mvc jaxb 2014-2-16 9:08:27
    I’m trying to create a simple spring based webservice that supports a “post” with xml content.In spring, I define an AnnotationMethodHandler:<bean id=”inboundMessageAdapter” class=”org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter”><property name=”messageConverters”><util:list><bean class=”org.springframework.http.converter.xml.MarshallingHttpMessageConverter”><property name=”marshaller” ref=”xmlMarshaller”/><property name=”unmarshalle

  • NagyI
    java generics rest jersey 2014-2-16 4:00:40
    I’m trying to write a generic function in Jersey which can be used to fetch a List of objects of the same type through REST. I based it on the informations found in this forum: link@Override public <T> List<T> fetchResourceAsList(String url) {ClientConfig cc = new DefaultClientConfig();Client c = Client.create(cc);if (userName!=null && password!=null) {c.addFilter(new HTTPBasicAuthFilter(userName, password)); }WebResource resource = c.resource(url);return resource.get(new Gen

  • Eugen
    rest uri restful-url hateoas discoverability 2014-2-15 4:15:07
    I’m trying to clarify a concept related to REST discoverability – that is whether or not satisfying the HATEOAS constraint for a RESTful service means that now the URIs can change, because they are discoverable and not documented. That seems to not follow the concept of Cool URIs – the fact that URIs don’t change, ever. It is also somewhat uncongruent with the model of the web itself (which REST should essentially fit perfectly) – the fact that URLs are bookmarkable and never change, and the fac

  • Mark Seemann
    wcf rest responseformat 2014-2-14 19:18:06
    I have a WCF restul service and I want to allow the user to choose what request format they want, i have the decorations[OperationContract][WebInvoke(Method = “GET”, ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = “getstreamurl?ch={ch}&format=xml”)][WebInvoke(Method = “GET”,ResponseFormat = WebMessageFormat.Json,BodyStyle = WebMessageBodyStyle.Wrapped,UriTemplate = “getstreamurl?ch={ch}&format=json”)]First of, is there a way to specify the Re

  • Knubo
    java rest model data-migration 2014-2-11 13:16:36
    I am looking for good tools to support support changing the version of the model used in REST services. My dream tools would do something like:My pojo + version 1.0 config/transformer => Service available with 1.0 of my model My pojo + version 1.1 config/transformer => Service available with 1.1 of my modelIn my particular case I do not need to do the reverse transformation as my REST service will only provide lookup of data and never store stuff, but I don’t mind using a tool doing both:-)A sol

  • IceFossil
    wcf iis rest 2014-2-11 9:05:21
    I cannot access my WCF service in IIS 6.0 when running on a VM (Windows 2003 64 bit server).I have a local IIS as well on where I developed the service, and I can access my service fine over there. I built a deployment package and deployed it to the VM, however I just cannot get to it.Particulars about the WCF service:1 – Its REST based 2 – Using SSLIf I place a static HTML file in the directory where my service.svc file is, I am able to access that but I cannot access the service.svc file. I am

  • rem
    wcf web-services entity-framework rest wcf-data-services 2014-2-11 2:25:56
    I’m trying to expose data from SQL Server database by Entity Framework plus WCF DataService. All is ok as long as I don’t add a table with a field of “Time” datatype to the EF model. In this case I get a runtime error:The property ‘Time’ on type ‘XXX’ is of type ‘Time’ which is not a supported primitive typeIs there a fix for this issue or should I use a traditional web service in this case?

  • Henry
    c# wcf rest 2014-2-10 15:41:41
    I am trying to upload an image as an attachment in REST WCF Service and I am getting the following error. “Access to path “C:\ImageUpload” is denied” I have enabled Full Contorl permissions to this folder. I dont understand why I am getting this error. I am new to WCF, and the most of the code I gathered from online resources. Appreciate if you could let me know If there is any mistake in my code. Here is my code.REST WCF Service Code:[OperationContract][WebInvoke(UriTemplate = “uploadImage/{par

  • Olly
    wcf web-services rest .net-4.0 web-config 2014-2-9 6:54:45
    We have a WCF REST service that connects to a database. In fact, we have several instances of the database, all with the same schema.We would like to set up one endpoint for each database instance and associate a connection string with the endpoint. The service would read the connection string and connect to the appropriate SQL Server instance.I’m sure this is possible; is it a good idea? How do I set it up? Is there documentation on MSDN?Edit: I found this question, where the answer suggest

  • Ladislav Mrnka
    wcf rest reflection silverlight-4.0 reflection.emit 2014-2-8 21:32:05
    This question follows upon someone else’s question because the asker never accepted or said the solution to his problem, if he found one.Whats the most portable way to make a Silverlight & Regular .NET REST clientIf you’re familiar with WebChannelFactory from .NET, it provides a clean way to create a client to access WCF Web Http (REST) services. There is no such class in Silverlight 4, so it might be worth creating a class that acts like it.How would you get started in creating such as clas

  • PrimosK
    javascript angularjs 2014-2-16 20:24:46
    Quote from one of the comments regarding ngCloak directive (AngularJS documentation):It is only really needed on your “index.html” page, because thebrowser may try to render things before Angular has had a chance toparse/compile it. At runtime, when Angular pulls in content due tong-view, ng-include, etc., it will be processed by Angular before thebrowser renders.I created a example in jsFiddle to verify this and on my surprise the expression is not evaluated before it is rendered in the browser

  • user1876508
    angularjs angularjs-directive 2014-2-14 5:09:28
    I have begun to learn about Angular.JS and am confused about what the difference are between the ng-app and data-ng-app directives.

  • neeraj
    .net visual-studio-2010 angularjs 2014-2-13 8:54:48
    I have Dropdown control like this :<select class=”input-large” id=”BloombergYellowKeyID” name=”BloombergYellowKeyID”ng-model=”instType.BloombergYellowKeyID”ng-options=”instType.BloombergYellowKeyID as instType.BloombergYellowKey for instType in instTypes | unique:’BloombergYellowKeyID'” required><option value=””>Please Select…</option></select>$scope.instTypes show data like this on runTimeBloombergYellowKey :”Mtge”BloombergYellowKeyID” :3(i can’t post Image as i dont h

  • mcv
    http angularjs jsonp angularjs-resource 2014-2-12 10:03:12
    I’m trying to access a REST service I don’t control. First problem is that the service doesn’t include a Access-Control-Allow-Origin header, which is a problem that, if I understand correctly, immediately limits me to JSONP.Also, by default, this service sends XML rather than JSON, though it’s capable of sending JSON. I think it should respond to my Accept header, the people responsible for the service say it looks at my Content-Type. That would mean I’d need to do a POST rather than a GET (thou

  • Dis Shishkov
    angularjs angularjs-directive simplemodal 2014-2-12 9:59:38
    Am new to AngularJS and I am trying to use a $modal popup from bootstrap. I also follow this article and wrapping it with an Service.in my modal.html template file I want to include a custom directive dynamically at run-time. To add more details,I created modalService, which takes a directive name as an argument and needs to get that added at runtime.e.g. in my controller modalService.showModal(“ngMyDirective”, modalOptions).then(function (result) {…modal.html:<div class=”modal-body”> &l

  • user1604473
    jquery jquery-ui angularjs 2014-2-11 22:28:28
    I am using jquery UI tab in angularJS and used ng-repeat to generate list items and tab containers. Tabs are working but the tab containers are not working properly. template – tabs.html<ul ng-sortable=”pages”><li ng-controller=”pageCtrl” ng-repeat=”page in pages”><a class=”pageName” href=”#{{page.id}}”>{{page.name}}</a></li> </ul> <div id=”{{page.id}}” ng-repeat=”page in pages”><p>{{page.id}}</p> </div>Directive.directive(‘ngTabs’, fun

  • synergetic
    angularjs 2014-2-10 20:49:13
    I have the following twitter bootstrap navbar html:<ul class=”nav”><li ng-repeat=”module in modules” ng-class=”{active: (‘{{ ‘/’ + view.name }}’ == ‘{{ module.url }}’)}”><a ng-href=”#{{ module.url }}”>{{ module.name }}</a></li> </ul>As Chrome inspection shows at runtime it becomes:AngularJS version is 1.0.6.As you see, the first <li> tag’s class is “active” when the page first time loaded. After that ng-class is not re-evaluated, even if url has changed

  • user1609682
    angularjs angularjs-directive angularjs-scope 2014-2-10 0:22:17
    I’ve been working on my first angular app all day and have a basic question.The goal is to create a text field with two strings describing the current url route and action like the following:You are on: {{urlRoute}} / {{urlAction}} This information will be in the header bar for all pages of the application and needs to be updated as the user visits pages.How can I run a string .split(“/”) on the output of $location.path() and return it to the view as two strings, urlRoute, urlAction in the root

  • Perroloco
    javascript angularjs angularjs-directive 2014-2-9 16:47:24
    I am using AngularJS, and I want to add a lightbox for showing images. My lightbox code works like this (I am using shadowbox):<a href=”myimage.jpg” rel=”shadowbox”>image name</a>But when I want to use the shadowbox with AngularJS like this:<a ng-repeat=”pic in pics” href=”{{pic}}” rel=”shadowbox”>image name</a>the shadowbox will be ignored, and it works like a normal link. What is the best way to make this work?I may have to write a directive, but I’m not familiar with i

  • redben

  • Dev555
    javascript debugging angularjs angular 2013-11-7 7:30:39
    I am having problem in integrating AngularJS UI tinymce in the app however it is working fine in jsbin demo:http://jsbin.com/itevos/2However in app I receive this error when I load the app:Uncaught TypeError: Cannot read property ‘form’ of nullwhich references tiny_mce_jquery_src.js:11955 with that line number being:var n = t.getElement().form;In the app, I checked all js/css files are loaded fine. This is what I have:var app_htmleditor_module = angular.module(‘app_htmleditor’, [‘ui’, ‘component

  • Lightbulb1
    javascript json angularjs angular 2013-11-7 6:10:18
    I’m writing a directive in angular to help validate fields. It is working up to the point of storing the result of the validation. I want to store it in an object like error.password.oldthe code to do this looks like this:if(!(typeof iAttrs.ngModel == “undefined”)) {var model = iAttrs.ngModel.split(‘.’);var length = model.length;var target = scope.error;if(typeof validation[iAttrs.validate] == “function”){for(var index = 0; index < length; index++){target = target[model[index]];}target = vali

  • Noah Freitas
    angularjs angular 2013-11-5 18:30:55
    I am still very new to Angular.js and am working through setting up my first application. I would like to be able to do the following:angular.module(‘App.controllers’, []).controller(‘home’, function () {$scope.property = true;}]);angular.module(‘App’, [‘App.controllers’]).config([‘$routeProvider’, function($routeProvider) {$routeProvider.when(‘/’, {templateUrl: ‘partials/home.html’, controller: home});}]);Using this setup the following error is generated:Uncaught ReferenceError: home is not de

  • Thomas Kremmel
    django json resources angularjs angular 2013-9-30 5:14:34
    I’m trying to make a post call using resources from angular.js and adding a success and error callback. wbsModule.factory(‘gridData’, function($resource) {//define resource classvar root = {{ root.pk }};var csrf = ‘{{ csrf_token }}’;return $resource(‘{% url getJSON4SlickGrid root.pk %}:wpID’, {wpID:’@id’},{get: {method:’GET’, params:{root : root }, isArray:true},update:{method:’POST’, headers: {‘X-CSRFToken’ : csrf }},}); });I’m calling the update action like this:args.item.$update([], successUp

  • mawo
    javascript angularjs angular directive 2013-9-28 10:15:39
    I created a custom directive for the following widget attribute:Basically the directive just creates some template code and puts the html inside the widget-tag. Here’s the directive:skdApp.directive(“widget”, function() {return {restrict: ‘A’,template: htmlTemplate,link: function($scope, element, attri) {/** setup event handler and twitter bootstrap components here*/}}The htmlTemplate is basic html code which also uses custom directives (e.g. the <seal> tag):var htmlTemplate = ‘<div ng-

  • Amir
    javascript rest angularjs angular 2013-9-13 21:46:11
    i’m trying to use angular with django i’ve implemented a REST api with django tastypie, here’s the code for the angular resource:angular.module(‘CourseServices’, [‘ngResource’]).factory(‘Course’, function($resource){return $resource(‘api/v1/course/:courseId/?format=json’, {}, {query: {method:’GET’, params:{courseId:’1′}, isArray:true}}); });and here is where i’m trying to get it:var course = Course.get({courseId:$routeParams.courseId}); console.log(course);this code logs this in the browser:Reso

  • Dustin
    javascript angularjs angular 2013-9-12 2:18:00
    I have a directive that looks like this:app.directive(‘fieldsetCollapse’, function() { return {restrict: ‘A’,scope: {},compile: function(tElement, tAttrs, transclude) {var wrapperElement = angular.element(‘<div ng-show=”isOpen”></div>’),legendElement = tElement.find(‘legend’),collapsibleContent = tElement.children().not(‘legend’),toggleBtn = angular.element(‘<a href=”#” class=”twisty” ng-class=”{ true: \’twisty-open\’, false: \’twisty-closed\’ }[isOpen]” ng-click=”toggle()”><

  • Noel Yap
    js-test-driver angular 2013-9-9 16:48:37
    I have the following code:function TestStats($xhr) {$xhr(‘GET’,’/test-dashboard/get-projects.json’,angular.bind(this, function(code, response) {this.projects = response.projects;this.projects.splice(0, 0, undefined);}));this.$watch(‘project’, angular.bind(this, function() {this.testClassStats = undefined;if (this.project) {$xhr(‘GET’,’/test-dashboard/get-test-stats.json?project=’ + this.project,angular.bind(this, function(code, response) {this.testClassStats = response.testClassStats;}));}})); }

  • Endless
    jquery jquery-ajax jsonp angularjs angular 2013-9-9 4:32:29
    I tried out one of Angulars demo and wanted to play with jsonp. And i could not get it to work, so i pasted the same code into jsbin so i can ask you guys whats wrong with it. And notice that it worked.Tried the exact same code again on my dev-site. and it dose not work. i can see the network log in webkit that i get a valid json back with http code 200. but no callback is executed.I ended up trying out jQuery-Ajax on the same request and that worked fine. for me$(document).ready(function() {$.g

  • matsko
    angularjs angular 2013-9-8 20:56:03
    I have an expensive function call that gets called once per loop, but I would like to set the return value of that to be a temporary variable that can be used directly within the loop.This works by setting {{ val=fn(…) }}, but it also prints to the screen. Is it possible to do this without printing the value?I’ve tried using one set of curly braces {} but it doesn’t work.Any ideas on how to do this?