javascript,angularjs,node.js,gruntjs,bower , grunt bower:install error


grunt bower:install error

Question:

Tag: javascript,angularjs,node.js,gruntjs,bower

I am a beginner in angularJS, and i want to start node server with npm start on a bitbucket cloned project but I get an error when doing this.

I tried a couple of things, unblock port 22 from the firewall in-going and out-going settings and run this command npm install -g grunt-cli but with no effect, i still get this error

this is my npm-debug file:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install' ]
2 info using [email protected]
3 info using [email protected]
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 warn package.json [email protected] No repository field.
6 warn package.json [email protected] No README data
7 verbose readDependencies using package.json deps
8 verbose install where, deps [ 'C:\\angular_project\\wkfs-demo',
8 verbose install   [ 'grunt',
8 verbose install     'grunt-typescript',
8 verbose install     'grunt-tslint',
8 verbose install     'grunt-tsd',
8 verbose install     'grunt-angular-templates',
8 verbose install     'grunt-bower-task',
8 verbose install     'grunt-eslint',
8 verbose install     'grunt-contrib-clean',
8 verbose install     'grunt-contrib-concat',
8 verbose install     'grunt-contrib-copy',
8 verbose install     'grunt-contrib-uglify',
8 verbose install     'grunt-contrib-cssmin',
8 verbose install     'grunt-ng-annotate',
8 verbose install     'grunt-usemin',
8 verbose install     'time-grunt',
8 verbose install     'grunt-karma',
8 verbose install     'grunt-protractor-runner',
8 verbose install     'grunt-protractor-webdriver',
8 verbose install     'karma-chrome-launcher',
8 verbose install     'karma-coverage',
8 verbose install     'karma-html-reporter',
8 verbose install     'karma-jasmine',
8 verbose install     'karma-ng-html2js-preprocessor',
8 verbose install     'karma-phantomjs-launcher',
8 verbose install     'protractor',
8 verbose install     'http-server' ] ]
9 info preinstall [email protected]
10 verbose readDependencies using package.json deps
11 verbose already installed skipping [email protected]~0.4.5 C:\angular_project\wkfs-demo
12 verbose already installed skipping [email protected]~0.4.6 C:\angular_project\wkfs-demo
13 verbose already installed skipping [email protected]^1.0.1 C:\angular_project\wkfs-demo
14 verbose cache add [ '[email protected]', null ]
15 verbose cache add name=undefined spec="[email protected]" args=["[email protected]",null]
16 verbose parsed url { protocol: null,
16 verbose parsed url   slashes: null,
16 verbose parsed url   auth: null,
16 verbose parsed url   host: null,
16 verbose parsed url   port: null,
16 verbose parsed url   hostname: null,
16 verbose parsed url   hash: null,
16 verbose parsed url   search: null,
16 verbose parsed url   query: null,
16 verbose parsed url   pathname: '[email protected]',
16 verbose parsed url   path: '[email protected]',
16 verbose parsed url   href: '[email protected]' }
17 verbose already installed skipping [email protected]~0.5.7 C:\angular_project\wkfs-demo
18 verbose already installed skipping [email protected]^0.4.0 C:\angular_project\wkfs-demo
19 verbose already installed skipping [email protected]^2.0.0 C:\angular_project\wkfs-demo
20 verbose already installed skipping [email protected]^0.6.0 C:\angular_project\wkfs-demo
21 verbose already installed skipping [email protected]^0.5.0 C:\angular_project\wkfs-demo
22 verbose already installed skipping [email protected]^0.7.0 C:\angular_project\wkfs-demo
23 verbose already installed skipping [email protected]^0.6.0 C:\angular_project\wkfs-demo
24 verbose already installed skipping [email protected]^0.10.0 C:\angular_project\wkfs-demo
25 verbose already installed skipping [email protected]^0.7.0 C:\angular_project\wkfs-demo
26 verbose already installed skipping [email protected]^2.6.2 C:\angular_project\wkfs-demo
27 verbose already installed skipping [email protected]^1.0.0 C:\angular_project\wkfs-demo
28 verbose already installed skipping [email protected] C:\angular_project\wkfs-demo
29 verbose already installed skipping [email protected]^1.1.4 C:\angular_project\wkfs-demo
30 verbose cache add name="grunt-tsd" spec="next" args=["grunt-tsd","next"]
31 verbose parsed url { protocol: null,
31 verbose parsed url   slashes: null,
31 verbose parsed url   auth: null,
31 verbose parsed url   host: null,
31 verbose parsed url   port: null,
31 verbose parsed url   hostname: null,
31 verbose parsed url   hash: null,
31 verbose parsed url   search: null,
31 verbose parsed url   query: null,
31 verbose parsed url   pathname: 'next',
31 verbose parsed url   path: 'next',
31 verbose parsed url   href: 'next' }
32 verbose addNamed [ 'grunt-tsd', 'next' ]
33 verbose addNamed [ null, null ]
34 silly lockFile f5640f9e-grunt-tsd-next [email protected]
35 verbose lock [email protected] C:\Users\aurel.deac\AppData\Roaming\npm-cache\f5640f9e-grunt-tsd-next.lock
36 info addNameTag [ 'grunt-tsd', 'next' ]
37 verbose request where is /grunt-tsd
38 verbose request registry http://int-build.wkfs-frc.local:4873/
39 verbose request id d2a1ac53e4175bbc
40 verbose url raw /grunt-tsd
41 verbose url resolving [ 'http://int-build.wkfs-frc.local:4873/', './grunt-tsd' ]
42 verbose url resolved http://int-build.wkfs-frc.local:4873/grunt-tsd
43 verbose request where is http://int-build.wkfs-frc.local:4873/grunt-tsd
44 info trying registry request attempt 1 at 12:20:54
45 verbose etag "e12d92cab773b8405bf82b2507fb6c5f"
46 http GET http://int-build.wkfs-frc.local:4873/grunt-tsd
47 verbose already installed skipping [email protected]^0.1.9 C:\angular_project\wkfs-demo
48 verbose already installed skipping [email protected]^0.1.5 C:\angular_project\wkfs-demo
49 verbose already installed skipping [email protected]^0.2.6 C:\angular_project\wkfs-demo
50 verbose already installed skipping [email protected]^0.2.4 C:\angular_project\wkfs-demo
51 verbose already installed skipping [email protected]^0.2.3 C:\angular_project\wkfs-demo
52 verbose already installed skipping [email protected]~0.1 C:\angular_project\wkfs-demo
53 verbose already installed skipping [email protected]^0.1.4 C:\angular_project\wkfs-demo
54 verbose already installed skipping [email protected]^1.3.1 C:\angular_project\wkfs-demo
55 verbose already installed skipping [email protected]^0.7.4 C:\angular_project\wkfs-demo
56 http 304 http://int-build.wkfs-frc.local:4873/grunt-tsd
57 silly registry.get cb [ 304,
57 silly registry.get   { 'x-powered-by': 'Sinopia/1.0.1',
57 silly registry.get     etag: '"e12d92cab773b8405bf82b2507fb6c5f"',
57 silly registry.get     'x-status-cat': 'http://flic.kr/p/aXY3dH',
57 silly registry.get     date: 'Tue, 10 Mar 2015 10:19:35 GMT',
57 silly registry.get     connection: 'keep-alive' } ]
58 verbose etag http://int-build.wkfs-frc.local:4873/grunt-tsd from cache
59 verbose addNamed [ 'grunt-tsd', '0.2.0-beta.1' ]
60 verbose addNamed [ '0.2.0-beta.1', '0.2.0-beta.1' ]
61 silly lockFile 18eefc5b-grunt-tsd-0-2-0-beta-1 [email protected]
62 verbose lock [email protected] C:\Users\aurel.deac\AppData\Roaming\npm-cache\18eefc5b-grunt-tsd-0-2-0-beta-1.lock
63 silly lockFile 18eefc5b-grunt-tsd-0-2-0-beta-1 [email protected]
64 silly lockFile 18eefc5b-grunt-tsd-0-2-0-beta-1 [email protected]
65 silly lockFile f5640f9e-grunt-tsd-next [email protected]
66 silly lockFile f5640f9e-grunt-tsd-next [email protected]
67 info already installed [email protected]
68 silly resolved []
69 info build C:\angular_project\wkfs-demo
70 verbose linkStuff [ false, false, false, 'C:\\angular_project' ]
71 info linkStuff [email protected]
72 verbose linkBins [email protected]
73 verbose linkMans [email protected]
74 verbose rebuildBundles [email protected]
75 verbose rebuildBundles [ '.bin',
75 verbose rebuildBundles   'bower',
75 verbose rebuildBundles   'grunt',
75 verbose rebuildBundles   'grunt-angular-templates',
75 verbose rebuildBundles   'grunt-bower-task',
75 verbose rebuildBundles   'grunt-contrib-clean',
75 verbose rebuildBundles   'grunt-contrib-concat',
75 verbose rebuildBundles   'grunt-contrib-copy',
75 verbose rebuildBundles   'grunt-contrib-cssmin',
75 verbose rebuildBundles   'grunt-contrib-uglify',
75 verbose rebuildBundles   'grunt-eslint',
75 verbose rebuildBundles   'grunt-karma',
75 verbose rebuildBundles   'grunt-ng-annotate',
75 verbose rebuildBundles   'grunt-protractor-runner',
75 verbose rebuildBundles   'grunt-protractor-webdriver',
75 verbose rebuildBundles   'grunt-tsd',
75 verbose rebuildBundles   'grunt-tslint',
75 verbose rebuildBundles   'grunt-typescript',
75 verbose rebuildBundles   'grunt-usemin',
75 verbose rebuildBundles   'http-server',
75 verbose rebuildBundles   'karma',
75 verbose rebuildBundles   'karma-chrome-launcher',
75 verbose rebuildBundles   'karma-coverage',
75 verbose rebuildBundles   'karma-html-reporter',
75 verbose rebuildBundles   'karma-jasmine',
75 verbose rebuildBundles   'karma-ng-html2js-preprocessor',
75 verbose rebuildBundles   'karma-phantomjs-launcher',
75 verbose rebuildBundles   'protractor',
75 verbose rebuildBundles   'time-grunt',
75 verbose rebuildBundles   'typescript' ]
76 verbose rebuild bundle C:\angular_project\wkfs-demo\node_modules\bower
77 info build C:\angular_project\wkfs-demo\node_modules\bower
78 info preinstall [email protected]
79 verbose linkStuff [ false,
79 verbose linkStuff   false,
79 verbose linkStuff   false,
79 verbose linkStuff   'C:\\angular_project\\wkfs-demo\\node_modules' ]
80 info linkStuff [email protected]
81 warn prefer global [email protected] should be installed with -g
82 verbose linkBins [email protected]
83 verbose link bins [ { bower: 'bin/bower' },
83 verbose link bins   'C:\\angular_project\\wkfs-demo\\node_modules\\.bin',
83 verbose link bins   false ]
84 verbose linkMans [email protected]
85 verbose rebuildBundles [email protected]
86 verbose rebuildBundles [ '.bin',
86 verbose rebuildBundles   'abbrev',
86 verbose rebuildBundles   'archy',
86 verbose rebuildBundles   'bower-config',
86 verbose rebuildBundles   'bower-endpoint-parser',
86 verbose rebuildBundles   'bower-json',
86 verbose rebuildBundles   'bower-logger',
86 verbose rebuildBundles   'bower-registry-client',
86 verbose rebuildBundles   'cardinal',
86 verbose rebuildBundles   'chalk',
86 verbose rebuildBundles   'chmodr',
86 verbose rebuildBundles   'decompress-zip',
86 verbose rebuildBundles   'fstream',
86 verbose rebuildBundles   'fstream-ignore',
86 verbose rebuildBundles   'glob',
86 verbose rebuildBundles   'graceful-fs',
86 verbose rebuildBundles   'handlebars',
86 verbose rebuildBundles   'inquirer',
86 verbose rebuildBundles   'insight',
86 verbose rebuildBundles   'is-root',
86 verbose rebuildBundles   'junk',
86 verbose rebuildBundles   'lockfile',
86 verbose rebuildBundles   'lru-cache',
86 verbose rebuildBundles   'mkdirp',
86 verbose rebuildBundles   'mout',
86 verbose rebuildBundles   'nopt',
86 verbose rebuildBundles   'opn',
86 verbose rebuildBundles   'osenv',
86 verbose rebuildBundles   'p-throttler',
86 verbose rebuildBundles   'promptly',
86 verbose rebuildBundles   'q',
86 verbose rebuildBundles   'request',
86 verbose rebuildBundles   'request-progress',
86 verbose rebuildBundles   'retry',
86 verbose rebuildBundles   'rimraf',
86 verbose rebuildBundles   'semver',
86 verbose rebuildBundles   'shell-quote',
86 verbose rebuildBundles   'stringify-object',
86 verbose rebuildBundles   'tar-fs',
86 verbose rebuildBundles   'tmp',
86 verbose rebuildBundles   'update-notifier',
86 verbose rebuildBundles   'which' ]
87 info install [email protected]
88 info postinstall [email protected]
89 verbose rebuild bundle C:\angular_project\wkfs-demo\node_modules\karma
90 info build C:\angular_project\wkfs-demo\node_modules\karma
91 info preinstall [email protected]
92 verbose linkStuff [ false,
92 verbose linkStuff   false,
92 verbose linkStuff   false,
92 verbose linkStuff   'C:\\angular_project\\wkfs-demo\\node_modules' ]
93 info linkStuff [email protected]
94 verbose linkBins [email protected]
95 verbose link bins [ {},
95 verbose link bins   'C:\\angular_project\\wkfs-demo\\node_modules\\.bin',
95 verbose link bins   false ]
96 verbose linkMans [email protected]
97 verbose rebuildBundles [email protected]
98 verbose rebuildBundles [ '.bin',
98 verbose rebuildBundles   'chokidar',
98 verbose rebuildBundles   'colors',
98 verbose rebuildBundles   'connect',
98 verbose rebuildBundles   'di',
98 verbose rebuildBundles   'glob',
98 verbose rebuildBundles   'graceful-fs',
98 verbose rebuildBundles   'http-proxy',
98 verbose rebuildBundles   'lodash',
98 verbose rebuildBundles   'log4js',
98 verbose rebuildBundles   'mime',
98 verbose rebuildBundles   'minimatch',
98 verbose rebuildBundles   'optimist',
98 verbose rebuildBundles   'q',
98 verbose rebuildBundles   'rimraf',
98 verbose rebuildBundles   'socket.io',
98 verbose rebuildBundles   'source-map',
98 verbose rebuildBundles   'useragent' ]
99 info install [email protected]
100 info postinstall [email protected]
101 verbose rebuild bundle C:\angular_project\wkfs-demo\node_modules\typescript
102 info build C:\angular_project\wkfs-demo\node_modules\typescript
103 info preinstall [email protected]
104 verbose linkStuff [ false,
104 verbose linkStuff   false,
104 verbose linkStuff   false,
104 verbose linkStuff   'C:\\angular_project\\wkfs-demo\\node_modules' ]
105 info linkStuff [email protected]
106 warn prefer global [email protected] should be installed with -g
107 verbose linkBins [email protected]
108 verbose link bins [ { tsc: './bin/tsc' },
108 verbose link bins   'C:\\angular_project\\wkfs-demo\\node_modules\\.bin',
108 verbose link bins   false ]
109 verbose linkMans [email protected]
110 verbose rebuildBundles [email protected]
111 info install [email protected]
112 info postinstall [email protected]
113 info install [email protected]
114 info postinstall [email protected]
115 verbose unsafe-perm in lifecycle true
116 info [email protected] Failed to exec postinstall script
117 error [email protected] postinstall: `grunt bower:install`
117 error Exit status 1
118 error Failed at the [email protected] postinstall script.
118 error This is most likely a problem with the wkfs-demo package,
118 error not with npm itself.
118 error Tell the author that this fails on your system:
118 error     grunt bower:install
118 error You can get their info via:
118 error     npm owner ls wkfs-demo
118 error There is likely additional logging output above.
119 error System Windows_NT 6.1.7601
120 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
121 error cwd C:\angular_project\wkfs-demo
122 error node -v v0.10.36
123 error npm -v 1.4.28
124 error code ELIFECYCLE
125 verbose exit [ 1, true ]

when i run grunt bower:install I am getting

Fatal error: Failed to execute "git ls-remote --tags --heads git://github.com/angular/bowler-angular-route.git", exit code of #128

this is the package.json file:

    {
  "name": "wkfs-demo",
  "namelower": "wkfs-demo",
  "version": "0.1.0",
  "description": "WKFS Angular.js Demo",
  "author": "wkfs-frc",
  "main": " ",
  "dependencies": {
  },
  "devDependencies": {
    "grunt": "~0.4.5",
    "grunt-typescript": "~0.4.6",
    "grunt-tslint": "^1.0.1",
    "grunt-tsd": "next",
    "grunt-angular-templates": "~0.5.7",
    "grunt-bower-task": "^0.4.0",
    "grunt-eslint": "^2.0.0",
    "grunt-contrib-clean": "^0.6.0",
    "grunt-contrib-concat": "^0.5.0",
    "grunt-contrib-copy": "^0.7.0",
    "grunt-contrib-uglify": "^0.6.0",
    "grunt-contrib-cssmin": "^0.10.0",
    "grunt-ng-annotate": "^0.7.0",
    "grunt-usemin": "^2.6.2",
    "time-grunt": "^1.0.0",
    "grunt-karma": "0.9.0",
    "grunt-protractor-runner": "^1.1.4",
    "grunt-protractor-webdriver": "^0.1.9",
    "karma-chrome-launcher": "^0.1.5",
    "karma-coverage": "^0.2.6",
    "karma-html-reporter": "^0.2.4",
    "karma-jasmine": "^0.2.3",
    "karma-ng-html2js-preprocessor": "~0.1",
    "karma-phantomjs-launcher": "^0.1.4",
    "protractor": "^1.3.1",
    "http-server": "^0.7.4"
  },
  "scripts": {
    "postinstall": "grunt bower:install",

    "prestart": "npm install",
    "start": "http-server -a 0.0.0.0 -p 8000"
  }
}

and bower.json file:

{
  "name": "wkfs-demo",
  "version": "0.0.1",
  "description": "WKFS Angular.js Demo",
  "authors": [
    "wkfs-frc"
  ],
  "private": true,
  "ignore": [
  ],
  "dependencies": {
    "angular": "1.3.0",
    "angular-resource": "1.3.0",
    "angular-route": "1.3.0",
    "jquery": "2.1.1",
    "bootstrap": "~3.3.1"
  },
  "devDependencies": {
    "angular-mocks": "1.3.0"
  }
}

Thanks for your help!


Answer:

the answer was git config --global url."https://".insteadOf git:// which means that you make git replace the protocol. I think that this configures git to use the https port and not the default git port which is 22 which is blocked or something. I would appreciate a much clearer explanation.


Related:


KnockoutJS custom component loader not executing `loadViewModel`


javascript,knockout.js,requirejs,knockout-components
Context I have been fiddling around and trying to create my own (just another) SPA framework. In this framework I've been trying to create a custom component loader to be able to do some dependency injection 'n stuff on the viewModels I'm loading. Used KnockoutJS version: 3.3.0 Problem The loadViewModel...

Parsing XML array using Jquery


javascript,jquery,xml,jquery-mobile
I have stuck up with an issue of passing XML using Jquery. I am getting empty array while traversing to jquery.Please help me how to get datas from XML array. I have mentioned my code below. XML <?xml version="1.0" encoding="UTF-8"?> <json> <json> <CustomerName>999GIZA MID INSURANCEAND SERVICES PVT LTD</CustomerName> <mobiLastReceiptDate>null</mobiLastReceiptDate> </json>...

Target next instance of an element/div


javascript,jquery,html
I have the following HTML structure and JavaScript file: .html <li> <button class="show-more"></button> some more elements <div class="hidden"></div> </li> JavaScript $( ".show-more" ).click(function() { event.preventDefault(); $( this ).next().slideToggle( "fast", function() { }); }); I need the click event to toggle the next first instance of .hidden, however the click event...

session value in javascript cannot be set


javascript,function,session
I am quite new to javascript, I wonder why my session value in javascript wont be set to 1 even I tried. When call this function again, the value of the session will change again. My javascript code as below. <script type="text/javascript"> function Confirm() { alert(<%=Session["Once"]%> != 1); var value...

Javascript function to validate contents of an array


javascript,arrays
Here's what is asked: validItems(items) – this function receives a string array of items which are to be for a customer. The function returns an empty string indicating all item codes in the array are valid; otherwise the function returns the first invalid item code in the array. All item...

AngularJS: Adding ng-click within element.append


angularjs,directive
Within my directive I have the following code, which will be used to continually append to an html element. //Establishes the type of question and therefore what should be displayed app.directive('questionType', function ($http, $compile) { return { restrict: 'A', link: function (scope, element, attr, model) { switch (scope.Question.inputType) { case...

Converting “i+=n” for-loop to $.each


javascript,jquery
I have the below html structure: <div class="thumbnail"></div> <div class="thumbnail"></div> <div class="thumbnail"></div> <div class="thumbnail"></div> <div class="thumbnail"></div> <div class="thumbnail"></div> <div class="thumbnail"></div> <div class="thumbnail"></div> Now to group/wrap each 4 items in a separate div I did as below: var div=$('.thumbnail'); for(var i = 0; i < div.length; i+=4) { div.slice(i, i+4).wrapAll("<div...

How to use a service with Http request in Angular JS


javascript,angularjs
I'm using AngularJS to build my web application, I've been always using controllers to make HTTP request, which makes things easier and clear for me. But for a better code structure, and better execution for my application, I wanted to use services instead of controllers to use the web service....

How To Check Value Of String


javascript,css,string,numeric
<span id='amount'>0.00000000</span> <a class='button-withdraw' id='tombolco' href='#'>Checkout</a> <script> var amount = document.getElementById("amount").innerHTML; if (amount >= 0.001) { document.GetElementById("tombolco").style = "display:block"; } else { document.GetElementById("tombolco").style = "display:none"; } </script> Why my code doesn't work? What's wrong with it and how to solve it?...

Please can someone help me understand the exec method for regular expressions?


javascript,regex
The best place I have found for the exec method is Eloquent Javascript Chapter 9: "Regular expressions also have an exec (execute) method that will return null if no match was found and return an object with information about the match otherwise. An object returned from exec has an index...

Javascript change the souce of all images present inside a string


javascript,jquery
I have a message or string which contain both text as well as images as below. var text = '<span class="user_message">hiiiiiii <img title=":benztip" src="path../files/stickers/1427956613.gif"> <img src="path../files/stickers/416397278.gif" title=":happy"></span>'; Before appending this to the the chat div i want to replace the src of the images to a default image. How can...

Onclick add html content and remove it by clicking “delete” link


javascript,jquery
I have some issue, help me please to find where is the mistake. $(document).ready(function(){ $(function() { var scntDiv = $('#p_scents'); var i = $('#p_scents .row-wrap').size() + 1; $('body').on('click', '.add-item', function() { $('<div class="row-wrap cf"><div class="col-md-3 col-sm-3 col-xs-12"><input type="text" placeholder="Наименование" name="item_name' + i +'"></div><div class="col-md-2 col-sm-2 col-xs-12"><input type="text" placeholder="Количество" name="item_count' +...

why i don't get return value javascript


javascript,jquery,html,json,html5
When i debug my code i can see i have value but i don't get value to createCheckBoxPlatform FN function createCheckBoxPlatform(data) { var platform = ""; $.each(data, function (i, item) { platform += '<label><input type="checkbox" name="' + item.PlatformName + ' value="' + item.PlatformSK + '">' + item.PlatformName + '</label>' +...

Sockets make no sense?


javascript,node.js,sockets
I'm using the 'ws' library for Node.js. I can write code that sends data from my server to my client, posting a date and time update, and closes the socket when I click a button; var wss = new WebSocketServer({server: server}); console.log("WebSocket server created"); wss.on('connection', function(socket) { // SEND DATE...

Login Signup PopUp


javascript
When I Open Login and signUp Portal it open with the both tab contents and then when I click on Login tab it open login tab content and on click register tab it open register tab page. But again after refresh the page popup showing both tabs content together![enter image...

Replacing elements in an HTML file with JSON objects


javascript,json,replace
I am writing some Javascript to: Read in and Parse a JSON file Read in an HTML file (created as a template file) Replace elements in the HTML file with elements from the JSON file. It is only replacing the first element obj.verb. Can someone please help me figure out...

Automatically calling server side class without


javascript,html,ajax
I have an anchor which calls a server side class when clicked, but I want to modify it so that the class is called as soon as the page loads, without having to click an anchor. <a href="#" class="_repLikeMore" data-id="1234" data-type="pid" data-app="forums"> ...

How to get my node.js mocha test running?


javascript,node.js,mocha,supertest
I have developed a service in node.js and looking to create my first ever mocha test for this in a seperate file test.js, so I can run the test like this: mocha test I could not figure out how to get the reference to my app, routes.js: var _ =...

Changing interval time to random?


javascript
Im looking for a way to change the way my javascript number counter is working. Now it just counts up every second but I want it to count at random times between 1 second and 15 seconds. function startCount(){ timer = setInterval (count, 1000); } function count(){ var el =...

Can't call fetch directly in Backbone model listenTo


javascript,backbone.js,coffeescript
I'm trying to have a model listen to a collection and fetch itself when the collection changes: class Team extends Backbone.Model urlRoot: '/team', initialize: function(attributes, options) { this.listenTo(members, 'change', this.fetch) The fetch does seem to trigger, but the url is all messed up, and to get it to work I...

slideToggle state not working with multiple boxes


javascript,jquery,cookies
I'm trying to save the toggle state of collapsable boxes using cookies. Here's my code: HTML: <div class="box_container"> <div class="box_handle"> Title </div> <div class="box" data-title="admin_actions"> Content </div> </div> Javascript: $('div.box_container div.box_handle').click(function() { $(this).next('.box').slideToggle('fast'); }); $.each($('div.box_container div.box_handle'), function(index,value){ if ($.cookie('show_box_' + $(value).next('.box').attr('data-title')) != 'closed'){...

Dynamically resize side-by-side images with different dimensions to the same height


javascript,html,css,image
I have two images side-by-side within a block-level container with arbitrarily different dimensions (as in, they could be any two images) that I want to dynamically adjust the width of so that the overall height of the two images is the same. I don't think this can be done in...

show div only when printing


javascript,html,css
Let's say that I have <div id="printOnly"> <b>Title</b> <p> Printing content </p> </div> Is it possible to hide this div when page rendering and to show only when printing this div?...

Create array from another with specific indices


javascript,arrays
I have two arrays, one of data and one of indices: var data = [ 'h', 'e', 'l', 'l', 'o', ' ' ]; var indices = [ 4, 0, 5, 0, 1, 2, 2 ]; I would like to create a third array, using cells of data in order indicated...

Click on link next link should be display on same page


javascript,php,jquery,html,css3
I have a single page website and need to link the navigation to IDs in the page. I have three links: "About us", "Our Project", "contact". So if user clicks on "About ", the About section will be displayed, same with other links. Inside Our project there is Two buttons...

want to show and hide text using “this” jquery


javascript,jquery
I want to achieve this effect with this because I have several paragraphs like this so I don't wanna use id for each paragraph <p class="desc_services_subheading"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,...

Substring of a file


javascript,arrays,substring
I have a file that is structure like this : var file = "a|b|c|d, a|b|c|d, a|b|c|d, a|b|c|d, a|b|c|d"; Now I would extract all letters "c" and "d" of this file and put those letter in array, structure like this: var array = [ [a,b,1], [a,b,2], [a,b,3], [a,b,4], [a,b,5] ]; How...

JSLint error: “Expected a newline at EOF”, conflict with Beautify plugin


javascript,gruntjs,jslint,beautify
I have a problem while building the sources using Grunt, with JSLint task for error check: L177: Expected a newline at the end of the file. Warning: Formatting check failed. Use --force to continue. Aborted due to warnings. The problem is obvious, but I use also the Beautify plugin for...

Angular $http and Fusion Tables in IE9


javascript,angularjs,internet-explorer-9,google-fusion-tables
I am trying a simple get request to a google fusion table in my angular controller. $http.get(url) .success(function(data) { //Do stuff with data }) This works in firefox, chrome, safari and IE10+ however in IE9 (Which I am requried to support) the request fails to even send and the console...

calling one controller from another controller


angularjs
I have 2 controllers and I am calling the second controller from the function of first controller $scope.open = function () { var modal = $modal.open({ templateUrl: 'views/view1.html', controller: 'controller2', // other parameters }); /* some code */ } Both the controllers are in the same folder. There are similar...

Javascript: Forloop Difference between i++ and (i+1)


javascript,loops,for-loop
I was building a javascript for loop and I want to compare the value of an array to the next value in the array. If both values are not equal, I want to return true, otherwise I want to return false. In the code below I pass the string "aba",...

Saving data using promises


javascript,parse.com,promise
On Parse.com I have the following function, and my question follows: function myFunction(array, value) { var logMessage; logMessage = "array: " + array.length.toString(); console.log(logMessage); if (!array.length) return; if (!value) value = Math.min(10, array.length); if (array[array.length - 1].get("advertisePointNumber") >= value) return; var classPromise; array[array.length - 1].set("advertisePointNumber", value); logMessage = "(BIS)array: "...

Javascript sort array of objects in reverse chronological order


javascript,arrays,sorting
I have an array of objects which holds a list of jobs and I would like to sort them in reverse chronological order as they would appear on a resume for example. I came up with the below solution which 'seems' to work but I was wondering if there is...

submitting form then showing loading image by javascript


javascript,html
I am submitting a form and loading loading gif in the same div by replacing html of form by html of loading image. I am first submitting the form then loading gif, because I have to replace the content of div(in which form exist) with loading image. Logs 1,2,3 are...

Get elements containing text from array


javascript,jquery,html,arrays,contains
I want to search all the elements containing any string in the array. For example I have following list of items <ul> <li>cricket bat</li> <li>tennis ball</li> <li>golf ball</li> <li>hockey stick</li> </ul> and this array var arr = ['bat', 'ball']; It should select all the elements having text bat and ball....

Get all prices with $ from string into an array in Javascript


javascript,regex,currency
var string = 'Our Prices are $355.00 and $550, down form $999.00'; How can I get those 3 prices into an array?...

Background-image style with JS not working in ie9


javascript,jquery,html,internet-explorer
I'm working on a site and im having some issues with my slider in IE9. What I've done is that I've made a div that gets the background image changed every few seconds depending on the img tags within. You can see it in function here: http://diakondk.quine.pil.dk/ It works wonders...

REST API with token based authentication


angularjs,codeigniter,api,rest,token
I want to develop a web site with AngularJS. On the backend side I will use Codeigniter REST framework. I have some security issues and I don't want to start developing without fixing them on my mind. I don't want to use something like api key because it will be...

Error: [$injector:unpr] Unknown provider: RestangularProvider <- Restangular <- ctrlAG


javascript,angularjs,restangular
I have one app: app.js: angular.module('AngApp', [ 'angularGrid' ]); My own restangular service.js: var app = angular.module('AngApp'); app.factory('restService', ['Restangular', function (Restangular) { // make use of Restangular } ]); and controller.js: var app = angular.module('AngApp'); app.controller('ctrlAG', ['$scope', '$http', '$log', '$mdDialog', 'Restangular',function ($scope,$http, $log, $mdDialog, Restangular) { // make use of...

How to find the days b/w two long date values


javascript,jquery,date
I have two long dates value. For Ex: 1433097000000 1434479400000 Here i have to find the days between these two by jquery For Ex: 15/06/2015 - 22/06/2015 If it is more than 5 days, I want to get from is 15/06/2016, to is 19/06/2015. It is based on long values...

Teechart HTML5, line color and thickness


javascript,html5,teechart
How do you change the line color and thickness of a series in Teechart HTML5. I have been looking through the examples, but i can't find anything describing that....

Can't get angular.js to loop through array and post to html


angularjs,ng-repeat
Edit: changed ng-controller to ng-app in body tag, was typo I'm new to angular and im trying to use ng-repeat to post all items in the products[] to html but the {{expressions}} come out as text rather than computing. I don't have my laptop so I'm testing all this on...

Google map infowindow position


javascript,google-maps,events,infowindow
Here is a sample google map with three polygons. I am setting the infowindow for each polygon as, for (var i in coordinates) { arr = []; for (var j=0; j < coordinates[i].length; j++) { arr.push( new google.maps.LatLng( parseFloat(coordinates[i][j][0]), parseFloat(coordinates[i][j][1]) )); bounds.extend(arr[arr.length-1]) } // Construct the polygon. polygons.push(new google.maps.Polygon({ paths:...

Pre-Select of an option in a select not working


angularjs
I use the following select. Currently, I get empty options in my select on start. To avoid these empty options in angularJS, I want to preselect the first option in the select. But It do not work. I get an 'Cannot read property 'conditions' of undefined'. Thank you for your...

Cant submit form


javascript,php
Basically I've got a form with 5 radio buttons. No submit button. I want the form to run when the user clicks on any of the radio buttons, so this is what I did. <input id="5" type="radio" name="star" onchange="this.form.submit();" <?php if ($row["star"] =="5") echo "checked";?> value="5"/> a querystring is required...

Not able to access variables in required file


javascript,gulp,require,browserify
I'm using browserify on a project and am running in to the following: I have a file test.js. In test.js there is nothing but the following: var test = 'test'; Now, in the same directory I have my main file 'app.js'. I require test.js and try to access the 'test'...

Javscript Replace Text in tags without changing children element HTML and Content


javascript,jquery
I have a script where I'd like to replace the text anywhere in the body visible to the user like so: $("body").html($("body").html().replace(/replaced word/g,'HELLO')); This works but it works to well. Whenever "replaced word" is within a tag, like a href, or span, or div, or anything it throws off all...