javascript,angularjs,expression,promise,jquery-chosenRelated issues-Collection of common programming errors
Elisabeth
javascript iphone ipad orientation
I’m having the same problem that a couple of others have had with getting the correct behavior in a web app on an orientation change, and there doesn’t seem to be an obvious solution – I’ve seen this question asked a couple of times on Stack Overflow and no one’s yet been able to answer it.When I start the app in portrait mode, it works fine. Then I rotate into landscape and it’s scaled up. To get it to scale correctly for the landscape mode I have to double tap on something twice, first to zoo
Ulker Ibrahimova
javascript jquery file-get-contents
This question already has an answer here:Ways to circumvent the same-origin policy11 answersIs there any way to get full page source of snother different site? Example my site is example.com but i want to get facebook’s page source on example.com. I tired this one: http://phpjs.org/functions/file_get_contents/ And it gives me null. So anyone knows it?function file_get_contents (url, flags, context, offset, maxLen) {// Read the entire file into a string//// version: 906.111// discuss at: http://
Inator
php javascript apache nosql couchdb
I’ve recently successfully installed CouchDB version 1.2.1 and as a test I can access it using the following Apache rewrite in CentOS 6:RewriteRule couchdb/(.*)$ http://127.0.0.1:5984/$1 [QSA,P]I have a PHP authentication class that I use across a home grown API to support my mobile apps. My API accepts and authenticates each request using an HMAC signature that is included in the URL like so:https://api.domain.com/endpoint/?timestamp=[timestamp]&signature=[signature]&id=[id]…etcEach
shoriwa-shaun-benjamin
java javascript android cordova webview
I am trying to get my cordova webview to work with cordova 3.2 an use the phonegap Camera API to access the camera.Reference: Android WebViewsHere are some successful implementations of what I want to do, but these use Phonegap 1.9, i want to use Phonegap 3.2 (the latest one)Cordova WebView using AndroidAlso here’s a VideoWith the code below I am able to make the cordova webview display my index.html page without any issues but when I to access the camera by clicking on “Capture Photo” in my HTM
novicePrgrmr
java javascript ajax json jsp
I am sorry to ask this but i’ve been working on this for hours and I can’t figure it out on my own. I have to use json for part of a project and I was able to get it to work but now it’s not returning it back to the right jsp but instead just displaying the json jsp. I am pretty sure it is how I am receiving the json.here are screen shots of what is happening:this is the jsp that I need to use ajax on, I am wanting to populate the second dropdown using ajax:this is what is happening instead, (it
Andrew Whitaker
javascript regex
I am trying to build a regexp from static text plus a variable in javascript. Obviously I am missing something very basic, see comments in code below. Help is very much appreciated:var test_string = “goodweather”;// One regexp we just set: var regexp1 = /goodweather/;// The other regexp we built from a variable + static text: var regexp_part = “good”; var regexp2 = “\/” + regexp_part + “weather\/”;// These alerts now show the 2 regexp are completely identical: alert (regexp1); alert (regexp2);/
DOTang
javascript regex
I am searching for text inside of website resources (html and javascript), and need to identify 3 regular expressions that will locate this text under certain circumstances:some string of text when it is contained inside of a javascript single-quoted string some string of text when it is contained inside of a javascript double-quoted string some string of text when it is not contained inside of a javascript stringHere are some scenarios that are likely to occur (searching for the string “somestr
Andy E
javascript html
I’m building up a row to insert in a table using jQuery by creating a html string, i.e.var row = “”; row += “<tr>”; row += “<td>Name</td>”; row += “<td><input value='”+data.name+”‘/></td>”; row += “</tr>”;data.name is a string returned from an ajax call which could contain any characters. If it contains a single quote, ‘, it will break the HTML by defining the end of the attribute value. How can I ensure that the string is rendered correctly in the brow
sameer
javascript angularjs maven yeoman
I have recently integrated maven yeoman plugin with my app. I followed https://github.com/trecloux/yeoman-maven-plugin/blob/master/TUTORIAL.md My angular version is v1.2.3 . When I run the mvn clean install command, I get the following error . [email protected] node_modules\grunt-contrib-imagemin Gö£GöÇGöÇ [email protected] Gö£GöÇGöÇ [email protected] ([email protected], [email protected]) Gö£GöÇGöÇ [email protected] ([email protected]) Gö£GöÇGöÇ [email protected] ([email protected]) Gö£GöÇGöÇ p
Ronald Yeung
javascript jquery ajax json cors
What I am trying to do is to have a page on the HTTP protocol sending an AJAX call to the same Web server but using HTTPS. Both the requesting page and the AJAX handler are on the same server, having the same domain and port. (I.e., only difference is the protocol.) To illustrate,Fromhttp://www.example.com/index.phpTriggers a jQuery AJAX call tohttps://www.example.com/authenticate.php?user=123&password=456(I am hoping to pass the password through HTTPS to make it encrypted over the Internet.
sameer
javascript angularjs maven yeoman
I have recently integrated maven yeoman plugin with my app. I followed https://github.com/trecloux/yeoman-maven-plugin/blob/master/TUTORIAL.md My angular version is v1.2.3 . When I run the mvn clean install command, I get the following error . [email protected] node_modules\grunt-contrib-imagemin Gö£GöÇGöÇ [email protected] Gö£GöÇGöÇ [email protected] ([email protected], [email protected]) Gö£GöÇGöÇ [email protected] ([email protected]) Gö£GöÇGöÇ [email protected] ([email protected]) Gö£GöÇGöÇ p
ntron
android angularjs
i have a problem with my hyprid angular. if i run the app on my android phone logcat say injection errors.Thats my index.html<!doctype html> <!–[if lt IE 7]> <html class=”no-js lt-ie9 lt-ie8 lt-ie7″> <![endif]–> <!–[if IE 7]> <html class=”no-js lt-ie9 lt-ie8″> <![endif]–> <!–[if IE 8]> <html class=”no-js lt-ie9″> <![endif]–> <!–[if gt IE 8]><!–> <html class=”no-js”> <!–<![endif]–>
Connor Leech
javascript angularjs angularjs-controller mean-stack
This is a long shot, but has anyone seen this error before? I am trying to add ‘Transporters’ using express, angular and mongoDB. I get this error whenever I access a page ruled by the transporters controller:Error: [ng:areq] http://errors.angularjs.org/1.2.12/ng/areq?p0=TransportersController&p1=not%20aNaNunction%2C%20got%20undefinedat Error (native)at http://localhost:3000/lib/angular/angular.min.js:6:450at tb (http://localhost:3000/lib/angular/angular.min.js:18:360)at Pa (http://localhost
ghiscoding
angularjs angularjs-directive
So basically I’m building myself a new directive for form validation and I got it all working perfectly except for 1 thing which I believe is not properly coded. So as you know form validation with a directive is to validate an <input ngx-validation=”alpha”> how do I pass the error text, which occurs inside my directive to the other element (a Bootstrap <span class=”text-danger”>{{ validation_errors[“input1”] }}</span> that is right below my input? As for the moment, I created
tinyBIGideas
javascript performance angularjs
I’ve been battling with a large data array of varied length roughly between 100 ~ 200 items, but can be greater.The data items themselves come from a custom reporting algorithm that produces the array of objects.Object example:ts:budget: “foo” ts:category: “foo” ts:client: “foo” ts:entryTime: 14.5 ts:project: “foo (00000000)” ts:task: “foo” ts:user: “foo” ts:userGroup: “foo”Multiply that object example by 100 ~ 200 and that’s what I’m working with. Nothing massive, so I wasn’t expecting such a l
Brian S
jquery angularjs javascript-events event-handling dom-manipulation
I am attempting to reverse engineer the AngularJS tutorial example of a “Todo List” using only jQuery/native JS. I am doing this simply as a learning experience, as it is clear that AngularJS is a superior method for building this kind of an app.Here is my JSFiddleNot all functionality is in place yet (e.g. archiving finished tasks) but most of what I have put in place works as it should. The issue at hand involves the event handlers for clicking on the .unchecked and .checked checkboxes. They w
Yahya KACEM
javascript angularjs
this code is from the AngularJs docs for ngRouterangular.module(‘ngViewExample’, [‘ngRoute’, ‘ngAnimate’],function($routeProvider, $locationProvider) {$routeProvider.when(‘/Book/:bookId’, {templateUrl: ‘book.html’,controller: BookCntl,controllerAs: ‘book’});$routeProvider.when(‘/Book/:bookId/ch/:chapterId’, {templateUrl: ‘chapter.html’,controller: ChapterCntl,controllerAs: ‘chapter’});// configure html5 to get links working on jsfiddle$locationProvider.html5Mode(true); });function MainCntl($rout
Riccardo Canella
javascript angularjs angularjs-directive
i’m trying to import the angular directive ngUploadbut when open the html page i have this error:Error: [$injector:unpr] http://errors.angularjs.org/1.2.15-build.2378+sha.9335378/$injector/unpr?p0=AuthProvider%20%3C-%20Auth%20%3C-%20accessLevelDirective http://localhost:8000/components/angular/angular.min.js:32:150 c@http://localhost:8000/components/angular/angular.min.js:30:201 http://localhost:8000/components/angular/angular.min.js:32:196 c@http://localhost:8000/components/angular/angular.min.
user3530668
angularjs google-swiffy
SetupI have a directive that takes a path to a json file as attribute value, loads the json, then instantiates Swiffy:angular.module(‘myApp’).directive(‘swiffy’, function ($http) {return {restrict: ‘A’,scope: {},link: function postLink($scope, $element, attrs) {var stage;// Listen to angular destroy$scope.$on(‘$destroy’, function() {if(stage) {stage.destroy();stage = null;}});// Load swiffy json$http({method: ‘GET’,url: attrs.swiffy}).success(function(data, status, headers, config) {stage = new
sksallaj
angularjs breeze angularjs-select2
I have a project where I’m using BreezeJS to fetch data from my webserver. I’m using AngularJS with the ui-select2 module. Currently, I have it where when I load my page, breezejs makes a call to fetch the data that I dump into a scope variable. From there, select2 can easily make the reference to it and build accordingly.If I want to ajaxify things, it gets really tricky. I want to have the ability to use select2’s ajax or query support, but instead of using it to fetch data, I want to use bree
msdn
expression expression-web-and-superpreview
I’m using MS Expression Web4 to build my first ever pages. Please bear with me as I learn the hard way. If you open my page link at EAZcycle.com you will see a GIF at the top and a JPG at the bottom but only one shows up. I think it has to do with howI’m saving and uploading but not at all sure. I am trying to understand the linking process but failing so far, and I’m not able to find clear instruction in the help menu. Anyone able to help a blind man cross this street?
msdn
expression expression-web-and-superpreview
Yes, I know this has been talked about ad nauseum, but I’m completely beside myself about it.I mean, how bad is it that a piece of software is fobbed off on loyal users where you can’t properly select text in design view. Especially since it worked just fine in EW1!So, now that I’ve paid my $115, I am forced to continue using EW1 so I can actually get my work done. How ripped off do I feel!And before anyone tells me that there are various ways of selecting text, the point is that the way I do it
msdn
expression expression-web-and-superpreview
Selecting Microsoft SQL Server Database File (SqlClient) as data source and giving the .sdf file as a Database file name I get this error when testing the connection:! An attempt to attach an auto-named database fro file c:\myfile.sdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on an UNC share.Any ideas? Should it work? I get a bit worried when the browse dialog looks for .mdf files, and I have to select All files *.* in order to see my .sdf
msdn
expression expression-web-and-superpreview
Hi, wanted to know how secure links are behind a login page? Is it true that as long as links to pages do not appear anonymously they could never be viewed unless the user performs a successful login first to view aspx pages behind an initial login. Can you also place a change of password control on an initial login page. And could a user log into someone else’s account?
msdn
expression expression-web-and-superpreview
After publishing the web to the internet why would a transparent gif image display in Firefox 2 and not IE 7? The image displays fine when previewing the web in IE 7 from expression web.
msdn
expression expression-web-and-superpreview
Okay, first of all let me admit that I don’t have a clue what I’m doing. When I started redoing our web site in EW, the existing site had been created in FP. There was a “date last modified” line on each page that used a bot. Initially I just copied the code for the bot into my EW pages, and it worked fine. Then I read here that bots were going away and aren’t standards-compliant. I figured that I should use a different method.Although I know nothing about Java, it seemed to be the ans
msdn
expression expression-web-and-superpreview
I have an annoying issue with Expression Web 4 (sp2).I’m trying to disable the “automatically switch keyboard to match language of surrounding text” setting in page editor options, but seems that the value of this setting isn’t saved when app closes. Everytime expression web restarts, this specificsetting reverts to enabled.Any idea?
msdn
expression expression-web-and-superpreview
I have attempted to publish my site to the webserver and after approx three seconds I receive the following dialogue box message:’Could not find a webserver at hosting2.123-reg.co.uk on port 21. Please check to make sure that the web server name is valid and your proxy settings are set correctly or the webserver maybe temporarily out of service.I have entered the correct server info, password etc.I tried ten times over two days and also turned of my firewall and anti-virus software before tryin
msdn
expression expression-encoder
when EE 4 Pro first appeared in Microsoft online store, it was priced at $49. Now it is $199, am I missing something or there was indeed a price increase? In addition, “Expression Studio 4 Web Professional” is a super set of EE 4 Pro, yet itis priced lower at $149, why?
msdn
expression expression-web-and-superpreview
Hello everyonePlease look at my website: www.jacobaallsgt29.noWhen pressing the choices in the menu bar you will see that the page is skipping some mm to left or right.What do I have to correct in the CSS-styles to avoid this?And another question: When pressing a choice which refers to a pdf-file, f.eks. ‘Vedtekter’, I would like to have this page in the main frame area and not in a new tab. Is this possible ?Best regards
Benjamin Gruenbaum
javascript callback promise q bluebird
I want to work with promises but I have a callback API in a format like:1. DOM load or other one time event:window.onload; // set to callback … window.onload = function(){};2. Plain callback:function request(onChangeHandler){ … request(function(){// change happened });3. Node style callback (“nodeback”):function getStuff(dat,callback){ … getStuff(“dataParam”,function(err,data){}4. A whole library with node style callbacks:API; API.one(function(err,data){API.two(function(err,data2){API.thre
xmlking
java javascript angularjs groovy promise
I have to write a javaScript function that return some data to the caller.In that function I have multiple ways to retrieve data i.e., Lookup from cache Retrieve from HTML5 LocalStorage Retrieve from REST Backend (bonus: put the fresh data back into cache)Each option may take its own time to finish and it may succeed or fail.What I want to do is, to execute all those three options asynchronously/parallely and return the result whoever return first. I understand that parallel execution is not po
Darshan
javascript asynchronous jquery promise
I am building a native desktop application in javascript using CEF, And I have API to access filesystem from CEF. I have a senario, in which I need to get names of all files(there could be trees of directories) within a particular directory. I need to get result array, I am using jquery promises. I am not getting, when to resolve the promise to get final result array./*read all directories under this and get path*/var result = [];function _processEntries(dirPath) {var dirEntry = new NativeFileSy
Harry
javascript node.js callback promise
Here’s an example of my access function that I use to check whether or not the user is authenticated.access = function(id, user_id, callback) {docs.findOne({_id: id}, function(err, doc) {if (doc.user.indexOf(user_id) != -1) {callback(“authenticated”)} else {callback();}}); }I use it as with the callback pattern like this.access(id, user, function (status) {if (status == ‘authenticated’) doSomething() })I’m finding that somewhat boring to write as you really need to check the callback status ever
oberstet
javascript unit-testing jquery-deferred promise deferred
I am looking for a JavaScript test framework that natively works with Deferreds/Promises.That is: my test case functions will return a Deferred (e.g. jQuery Deferred or whenjs) that when fires will yield true or false (success/failure).A framework that only provides mechanisms to test specific async stuff like AJAX is not sufficient.
Justin
javascript promise
The specification I’m referring to is at http://promises-aplus.github.io/promises-spec/. When using then(), you can either return a promise, and reject the promise when you desire, or you can throw an exception to reject a promise. Why wasn’t the api designed in such a fashion where for the then function, it is passed a resolve and reject function like the original promise constructor? Exceptions are heavy in many languages (and I assume in javascript too) so it seems odd they are using them as
hadley
r promise
Consider the following simple function:f <- function(x, value){print(x);print(substitute(value))}Argument x will eventually be evaluated by print, but value never will. So we can get results like this:> f(a, a) Error in print(x) : object ‘a’ not found > f(3, a) [1] 3 a > f(1+1, 1+1) [1] 2 1 + 1 > f(1+1, 1+”one”) [1] 2 1 + “one”Everything as expected.Now consider the same function body in a replacement function:’g<-‘ <- function(x, value){print(x);print(su
Chen-Tsu Lin
javascript angularjs expression promise jquery-chosen
I’m trying to create a new AngularJS project, but I get some errors :(This is my app and controller;var app = angular.module(‘myApp’, [‘localytics.directives’]).config([‘$parseProvider’, function ($parseProvider) {return $parseProvider.unwrapPromises(true);}]).controller(‘myController’, function ($scope, $http, $q, $timeout) {var simulateAjax;simulateAjax = function (result) {var deferred, fn;deferred = $q.defer();fn = function () {return deferred.resolve(result);};$timeout(fn, 1000);return defe
Cheeso
node.js promise q
I have seen Chaining an arbitrary number of promises in Q ; my question is different. How can I make a variable number of calls, each of which returns asynchronously, in order? The scenario is a set of HTTP requests, the number and type of which is determined by the results of the first HTTP request.I’d like to do this simply. I have also seen this answer which suggests something like this: var q = require(‘q’),itemsToProcess = [“one”, “two”, “three”, “four”, “five”];function getDeferredResult(
Grummle
node.js loops promise q
What would be the idiomatic way to do something like a while loop with promises. So:do something if the condition still stands do it again repeat then do something else.dosomething.then(possilblydomoresomethings).then(finish)I’ve done it this way I was wondering if there were any better/more idomatic ways?var q = require(‘q’);var index = 1;var useless = function(){var currentIndex = index;console.log(currentIndex)var deferred = q.defer();setTimeout(function(){if(currentIndex > 10)deferred.re
user3207150
javascript angularjs jquery-chosen
I have read about it in other posts but couldn’t figure out. My first question is “How to select _categoryId = 1 or 2 or bla bla when category list is loading”My code here;simulateAjax = function (result) {var deferred, fn;deferred = $q.defer();fn = function () {return deferred.resolve(result);};$timeout(fn, 1000);return deferred.promise; }; function GetTagList() {$http({method: ‘Post’,url: ‘Categories’}).success(function (data, status, headers, config) {$scope.optionsFromQuery = (function () {r
user3207150
javascript jquery angularjs jquery-chosen
Im using chosen js with angularjs. Everything is going good but i got a question about chosenjs multiple select.<select id=”select_{{ item.RowId }}” class=”chosen” data-ng-model=”selectedOption” data-placeholder=”Select” multiple tabindex=”5″ data-ng-change=”Change()”chosen=”directiveOptions”ng-options=”item.Id as item.tag for item in optionsFromQuery”style=”width:100%;”><option style=”display:none” value=””>{{ item.Tags }}</option></select>It is working for normal dropdo
Chen-Tsu Lin
javascript angularjs expression promise jquery-chosen
I’m trying to create a new AngularJS project, but I get some errors :(This is my app and controller;var app = angular.module(‘myApp’, [‘localytics.directives’]).config([‘$parseProvider’, function ($parseProvider) {return $parseProvider.unwrapPromises(true);}]).controller(‘myController’, function ($scope, $http, $q, $timeout) {var simulateAjax;simulateAjax = function (result) {var deferred, fn;deferred = $q.defer();fn = function () {return deferred.resolve(result);};$timeout(fn, 1000);return defe
j0k
jquery jquery-validate jquery-chosen
I am trying to use validate and chosen plugin together. I am having the problem while validating select boxes. I found similar questions How can I use jQuery validation with the “chosen” plugin? and Chosen.js and validate jquery but I couldn’t find a way to import the solutions to my code :<form class=’myform’ id=’producteditform’><input type=’hidden’ value='<? echo $row[‘id’]; ?>’ name=’pkedit’ id=’pkedit’> <input type=’hidden’ value=’save’ name
Prem Anand
javascript jquery jquery-chosen
This is my JSFiddleMy html and js works fine in JSFiddle. But its giving error in the console in my rails appUncaught TypeError: Cannot set property ‘selected’ of undefined admin.js:1000 Chosen.result_select admin.js:1000 Chosen.search_results_mouseup admin.js:1000 (anonymous function) admin.js:1000 x.event.dispatch admin.js:6 v.handleHTML<div class=”col-xs-3 equ”><select class = “car-select col-xs-10 col-sm-10 col-sm-offset-1 center boxalign” id = “brand”><option value=”brand”>
Esteban
javascript jquery jquery-chosen
I’m getting this strange error after deploy a web app to the remote host.Uncaught TypeError: Object #<error> has no method ‘endsWith’Facts:The app works perfectly fine on my local machine as a host. The app throws this error when deployed to IIS in a remote host. The files loaded by the app are the same in both scenarios.The files loaded are these:The files are being written as follows:The methods are these:String.prototype.startsWith = function (toMatch) {var self = this;return self.index
j0k
jquery asp.net asp.net-mvc-3 jquery-chosen
In my project I have a dropdown option which displays different currency codes from around the world. This dropdown is utilising the “Chosen” jQuery plugin. On selection of a currency code, all appropriate symbols in the page change, i.e. selecting GBP will display a British pound (£) whilst USD would display a US dollar ($).On page load, the default currency of the user is so be chosen from the list based on the model. Please see below:@Html.DropDownListFor(model => model.CurrencyCode, Model
j0k
jquery jquery-chosen
I am using the chosen plugin for jQuery and love it but I am trying to create a common script to use for all SELECT within my application that have a certain class. The problem is I am trying to get the ID for the active Chosen Select. Below is my JavaScript jQuery code.$(“SELECT.editable”).chosen({create_option: function (term) {var chosen = this;chosen.append_option({value: term,text: term});var tableField = $(this).attr(‘id’); // <<<< HERE IS THE ISSUE. I am trying to get the ID
j0k
javascript jquery jquery-plugins jquery-chosen
Im trying to build my dropdown menu using the plugin Chosen for Multiple Select . Here’s to behavior I’m based on:http://jsfiddle.net/JfLvA/So, instead of having 3 harcoded < option > in my select. I want this list to be the values of a json array populated by an ajax request. This will be triggered by autocomplete.So, if the user type “car”, im sending the letter via an ajax call, and im getting back an array like that:[{“id”:”2489″,”name”:”carrie”},{“id”:”2490″,”name”:”Caroline”},{“id”:”249
Miguel
javascript jquery jquery-chosen chosen.js
strange situation happening here. I’m using the jquery plugin chosen.js. I’m updating a dropdown that is already on the page with an ajax call and jquery. here is a little bit of the sample code. here is my dropdown as shown in the page.<div id=”singleDropDownBlock” style=”display: none”><select id=”SingleDropDown” class=”chzn-select” data-placeholder=”Choose your start Location” onchange=”GetFromNodeValue();”><!–<option>select a strating locnation based on category.</
Web site is in building
I discovery a place to host code、demo、 blog and websites.
Site access is fast but not money