javascript,node.js,angularjs,express,restful-authenticationRelated issues-Collection of common programming errors
Jamal
javascript jquery datetime plugin twitter
I’ve built a Twitter plugin recently and was wondering if I could get some feedback on it. There is also a PHP side that grabs the actual tweets and I can post that code if it’s needed.http://jsfiddle.net/cKfDd/;(function ( $, window, document, undefined ) { /************************************* Plugin Functions *************************************/ /*************************************/ Plugin.prototype.init = function () {var params = [ ‘?user=’ + this.options.user,’&limit=’
adambender
javascript best-practice
I come from a Java background so my desire for proper unambiguous logging is strong. I prefer using the console to using some other gui widget however, in the browser I know that I can’t always count on the console to exist or for it to have all the levels I might like. To remedy this I worked up the following console sanitizer and I was curious what drawbacks it might have.function configureConsoleLog() {“use strict”;var logMethods = [ ‘trace’, ‘debug’, ‘log’, ‘info’, ‘warn’, ‘error’ ], i;if (!
palacsint
javascript php google html5
I am newbie at JavaScript, I am using PHP to get data from a MySQL database, and use the data to drop multiple markers into google map. Please give me some suggestion to my code, really appreciate for any your advice.<?php require_once ‘Common/system_start.php’; $sql=”select * from tab_mem order by sn desc “; $result= mysql_query($sql); $data=mysql_fetch_assoc($result); $row=mysql_num_rows($result);header(“Content-type: text/xml”);// Iterate through the rows, adding XML nodes for eachwhile (
Brandon Wamboldt
javascript node.js
I’m looking for some general feedback about the layout and structure of my code. Basically just any feedback, as I’m not super happy about this code, but I’m not sure how to improve it further.’use strict’;/* jshint node: true */var fs = require(‘fs’); var os = require(‘os’); var nodemailer = require(‘nodemailer’); var rimraf = require(‘rimraf’); var config = require(‘../config’); var dropbox = require(‘../lib/dropbox-sync’); var mysql = require(‘../lib/mysql-back
user2456359
php javascript wordpress
I’m struggling with adding the jQuery to the templated I transfered to WordPress, From what I’ve already learned from WordPress you need to use WordPress functions to include js files, is that always neccasary? Could somebody please take a look at the function I’ve written?header.php<!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta http-equiv=”Content-Type” content=”<?php bloginfo(‘HTML_type’);?>” charset=”<?php bloginfo( ‘charset’ ); ?>”
Fran Verona
php javascript jquery ajax
I have a PHP file with the following code:<html><head><!– HEAD –><?php require_once ‘Language.php’; ?></head><body><script type=”text/javascript”>$.get(‘step2.php’,function(data){// Do something});</script></body> </html>As you can see, I’m trying to load some content via Ajax call. The problem is that step2.php contains some PHP code:<div class=”step-content table-bordered”><h3><?php echo $Lang->get(‘create_s2_title
Sean
javascript node.js gruntjs livereload
PC Specs: Windows 7 Enterprise x64I’m running grunt.js on a project and recently started receiving an error when attempting to run ‘grunt watch’.Grunt worked fine yesterday but today I started seeing:Running “watch” task Waiting…Fatal error: listen EACCESI read another question here: Cloud 9 and Grunt.jsthat lead me to remove ‘options: {livereload: true}’ from Gruntfile.jsrunning watch again works as intended. Is there a way to reconfigure grunt or livereload to get livereload working with G
Asenar
javascript php jquery callback
i have make an php editor with so much effort but i cant print the fatal error. and want to print the fatal error. How to do this. I have code for run the php through eval function here is my jsfiddle – **http://jsfiddle.net/3c7F6/3/** I want to print an fatal error. Please help me to do this.please check the code and give me the suggestion
Septagram
javascript fatal-error
Is it possible to terminate script on a certain condition with a specific error message? Exceptions are not an option, as they can be catched, thus avoiding termination.Update:I’d prefer the universal approach, but if there’s none, then it’s for the in-browser JavaScript. Error should be silent, and the error message should only go into the browser error log.
Ates Goral
javascript gruntjs
I removed the old grunt first,and I install the new grunt.But I got an error:D:\www\grunt-test\grunt grunt-cli: The grunt command line interface. (v0.1.4)Fatal error: Unable to find local grunt.If you’re seeing this message, either a Gruntfile wasn’t found or grunt hasn’t been installed locally to your project. For more information about installing and configuring grunt, please see the Getting Started guide: http://gruntjs.com/getting-startedIs there haven’t a grunt in my system path, or somethi
Peter Mortensen
architecture ruby-on-rails node.js rewrite
Please tell me if:Node.js will make our site faster! Node.js will consume fewer server resources, we can save money! Node.js will make us more productive! Node.js means we can share client and server side JavaScript code.To clarify, we’re rewriting a frontend server, which will talk to our existing Ruby on Rails application as an API. Meanwhile, we’ll refactor our Ruby on Rails application into services.More details on the existing architecture:Memcached for HTML partials caching Redis for sessi
David
mapnik windows node.js
I have been spending the last few days trying to get node-mapnik running but with no success.Initially inspired by Wilhelm Berg’s demo (https://www.youtube.com/watch?v=GlTaRpg3CbQ) which renders pure vector maps using node-mapnik I was interested in getting this running on a Windows Server.I have worked through all of the StackExchange issues on these topics including Wilhelm’s checklist for getting this working on Windows 7 x64 but I am at a dead end and my knowledge is really limited in being
Brandon Wamboldt
javascript node.js
I’m looking for some general feedback about the layout and structure of my code. Basically just any feedback, as I’m not super happy about this code, but I’m not sure how to improve it further.’use strict’;/* jshint node: true */var fs = require(‘fs’); var os = require(‘os’); var nodemailer = require(‘nodemailer’); var rimraf = require(‘rimraf’); var config = require(‘../config’); var dropbox = require(‘../lib/dropbox-sync’); var mysql = require(‘../lib/mysql-back
shaunthomas999
java node.js ubuntu meteor npm
I am using ‘node-excel-api’ npm package inside my Meteor application. It has dependency on ‘java’ npm package. I am getting the following error on startup of Meteor server. A fatal error has been detected by the Java Runtime Environment:Internal Error (threadLocalStorage.cpp:56), pid=3880, tid=3074959104 guarantee(get_thread() == thread) failed: must be the same thread, quicklyJRE version: (7.0_45-b18) (build ) Java VM: Java HotSpot(TM) Server VM (24.45-b08 mixed mode, sharing linux-x86 ) Faile
Sean
javascript node.js gruntjs livereload
PC Specs: Windows 7 Enterprise x64I’m running grunt.js on a project and recently started receiving an error when attempting to run ‘grunt watch’.Grunt worked fine yesterday but today I started seeing:Running “watch” task Waiting…Fatal error: listen EACCESI read another question here: Cloud 9 and Grunt.jsthat lead me to remove ‘options: {livereload: true}’ from Gruntfile.jsrunning watch again works as intended. Is there a way to reconfigure grunt or livereload to get livereload working with G
kisna
node.js gruntjs
Hi for responsive images i downloaded project from https://github.com/andismith/grunt-responsive-imagesi installed all those things what they have mentioned…whenever i say grunt it saying fallowing error:Running “jshint:all” (jshint) task>> 3 files lint free.Running “clean:tests” (clean) taskCleaning “tmp”…OKRunning “responsive_images:default_options” (responsive_images) taskFatal error: spawn ENOENTwhy i am getting this error pla tellme…Thnk you.
umerk44
node.js git
I got this error.stderr: fatal: Not a git repository: ‘C:/Users/DELL/SparkleShare/test4’When i run app.js file from command line using node command.Here is config.js file where repository is added.exports.sessionSecret = ‘JustSomeRandomString’;exports.folders = [{ type: ‘git’, name: ‘Public GIT folder’, path: ‘C:/Users/DELL/SparkleShare/test4’, pub: true } ];exports.listen = {port: 3000,host: null };exports.https = {enabled: false,key: ‘/path/to/private.key’,cert: ‘/path/to/cert.crt’ };exports.b
sobering
node.js ubuntu knockout.js gruntjs npm
Running a totally fresh instance of Ubuntu 13.10 x64 on DigitalOcean. Every time I try and build Knockout.js using npm/grunt I get the following error:Running “clean” taskRunning “checktrailingspaces:main” (checktrailingspaces) taskRunning “build:debug” (build) taskRunning “build:min” (build) task Compiling…Fatal error: spawn ENOENTThe strange part is, the Fatal error is seemingly random. It is always one of these three:Fatal error: spawn ENOENT Fatal error: spawn EPIPE Fatal error: spawn ECON
cathulhu
node.js cmd npm brackets adobe-brackets
I want to create window installer but facing some problem from last 4 days on exectuion of common.js facing this error.What i analyzed: child = child_process.spawn(cmd, args, opts); children.push(child); ..is not executing properly. Can someone help me?Regards
orustammanapov
node.js gruntjs grunt-contrib-watch
i should probably point out that i’m inexperienced user first, and my issue is that the ‘hostname’ property can’t have any values assigned except for an empty string(”), ‘0.0.0.0’ and ‘localhost’. I getting: Fatal error: getaddrinfo ENOTFOUND. What am i doing wrong?If get it right, i can change the adress that i’m usually typing in the address bar, so instead ‘localhost’ i could have typed ‘example.com’ or something like that. As i mentioned above i’ve assigned it different values but only thre
Davin Tryon
git angularjs ubuntu yeoman
I already have npm and git installed on my Ubuntu machine. When I started with Yeoman, I installed it with the following commands:npm install -g yo npm install -g generator-webapp npm install -g generator-angularThen I ran the following commands in my machine’s terminal:mkdir MyProject cd MyProject git init yo angular grunt serveand receieved the following error:Fatal error: Unable to find local gruntI thought Yeoman would automate any grunt process. Is there something that I’m doing wrong? I
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 ?ö£?öÇ?öÇ [email protected] ?ö£?öÇ?öÇ [email protected] ([email protected], [email protected]) ?ö£?öÇ?öÇ [email protected] ([email protected]) ?ö£?öÇ?öÇ [email protected] ([email protected]) ?ö£?öÇ?öÇ 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]–>
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
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
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
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
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
Blaiz
angularjs unit-testing
I’m using AngularJS and trying to test a controller that calls a factory to get some data.This is the controller code:’use strict’angular.module(‘AngularApp’).controller ‘IndexCtrl’, ($scope, session, navigation) ->session.find().then (response) ->$scope.session = response.data$scope.someOtherVariable = {}Naturally, I’d like to swap the factory with a mock to prevent calling a real API. I’m trying to use $provide.factory to inject the mock copy:’use strict’describe ‘Controller: IndexCtrl’,
Mark Simpson
angularjs
I get a module error in my app, but it fixes itself upon page refresh.Is it safe to assume (since a reload fixes the issue) that my code isn’t buggy, and there is something else causing the problem?What could possibly be the cause of the module error?EDIT: I am using AngularJS v1.2.0-rc.2 in the form of a single file (angular.min.js) containing angular.min, angular-route.min, angular-resource.min, and angular-sanitize.min.Here’s the complete error:Failed to instantiate module quoteApp due to: E
Julius F
node.js postgresql asynchronous express
One of the advantages of NodeJS is its async and non-blocking I/O, which in my case is great on the one hand, but breaks my neck every day on the other hand.I consider myself a NodeJS / Async novice and I often end up having such code:function(req, res) {req.assert(“name”, “Lobbyname is required”).notEmpty();req.assert(“name”, “Lobbyname length should be between 4 and 64 characters”).len(4, 64);req.assert(“game”, “Game not found”).isInt();req.sanitize(“game”).toInt();var userId = req.user.id;var
Asya Kamsky
javascript node.js mongodb express mongoose
I am developing a web application with Node.js and MongoDB/Mongoose. Our most used Model, Record, has many subdocument arrays. Some of these, for instance, include “Comment”, “Bookings”, and “Subscribers”. In the client side application, whenever the user hits the “delete” button it fires off an AJAX request to the delete route for that specific comment. The problem I am running into is that, when many of these AJAX calls come in at once, Mongoose fails with a “Document not found” error on some
guypursey
linux node.js express socket.io
I’ve just installed Node JS (v0.10.0) on a netbook running Linux Peppermint Three. I have a file to run which has the following at the top:var app = require(‘express’).createServer(),io = require(‘socket.io’).listen(app);app.listen(8080);// routing app.get(‘/’, function (req, res) {res.sendfile(__dirname + ‘/index.html’); });The problem is that when I visit localhost:8080 I get the following:TypeError: Arguments to path.join must be stringsat path.js:360:15at Array.filter (native)at exports.join
QlliOlli
node.js rest express mongoose
I’d need some help on setting up my rest routes in Node + Express.My problem is as follows:controller.js:module.exports = {findAll: function(req, res) {var users = User.findAll();res.json(users);}};User.js:module.exports = {findAll: function(req, res) {userModel.user.find(function(err, user) {if (!err) {console.log(user);} else {console.log(err);}});}};This console.logs me the users as expected, but if I change the console.log bit to return: findAll: function(req, res) {return userModel.user.fin
Tronic
javascript mongodb node.js express mongoose
i use express.js with mongoose for mongoDB access. i try to implement a fallback, if someone enters an url which does not exist (based on the user_id). here’s the code:app.get(‘/track/:id’, function(req, res) { var user_id = req.params.id; User.findById(user_id, function(err, user_) {if (!err) {res.render(‘track’, { pins: user_.pins, layout: false });} else {res.send(“FAIL! ” + err);} }); });when accessing http://foo.bar/track/1234 and 1234 doesn’t exist, it should print out FAIL!, if the id exi
elspiko
node.js azure express
So I’ve got an express site running on Windows Azure. I’m currently having problems submitting forms that are marked as enctype=”multipart/form-data”.The error I’m getting in the logs is: TypeError: Object # has no method ‘tmpDir’When running natively (initiated via node.exe) it works absolutely fine, its only when using the AzureEmulator or on Azure itself it fails.Now I expect this has something to do with Azure’s infrastructure, but I’m wondering whether anyone has managed to work around this
Cordon Davies
node.js mongodb express swig openshift
I am trying to get my node/mongo/express app working on Openshift. It works locally, but on Openshift I am getting an Error: Cannot find module (‘swig’) I have added it to my dependencies in the package.json as shown below.”dependencies”: { “bcrypt-nodejs”: “~0.0.3”, “consolidate”: “~0.9.1”, “express”: “>=3.x”, “mongodb”: “~1.3.9”, “swig”: “~0.14.0”, “validator”: “~1.1.3” }, “devDependencies”: {}, “bundleDependencies”: [],And I require it in my server.js like so:var swig = require(‘swig’); va
cpeele00
javascript node.js mongodb express
I’m trying to get some data to save into MongoDb. I followed the following example beforehand and verified that it works, however now that I’m trying to write my own test app using this “format” it’s not working. MongoDb does not throw any errors and I can even retrieve the doc _id from the insert callback. However when I go into the Mongo shell, the collection doesn’t even exist let alone the document.Here’s the example I followed originally just so you can get a feel for the way I tried to mim
EternallyCurious
jquery express typescript
I have a project that uses NodeJS + Express + JQuery + Typescript. I am uploading a file from the front end which happens successfully. However I’m not able to return a JSON object back from the server to the client which contains the location of the object on the server. When the JSON data returns to the client it actually renders (the JSON) on the screen instead of being received by the “success: function (response)” function on the client side.Here’s the client side code:function sendFile() {
Chakravarthy S M
javascript node.js mongodb express jade
In my Jade view I have “raw” which contains retrieved mongodb data which I have passed to my jade view by res.render(‘jadeview’,{raw:mongodbdata})body .containerh1 View Requests Pagetabletbodytrth IDth Request’sth Descriptionth Current Status – if(raw.length)each item in rawtrtd a(href=’/individualrequest/#{item._id}’, id=”idanch”) #{item._id}td a(href=’/individualrequest/#{item._id}’, id=”rqstanch”) #{item.request}tda(href=’/individualrequest/#{item._id}’, id=”descanch”) #{item.descr
ryan
session cucumber authlogic restful-authentication
I recently upgraded cucumber to version 0.8.5, but I’m getting some unexpected errors with Authlogic. As a precursor to many of my user interface tests I have a default ‘Given I am logged in’ method that logs a user in through the standard login interface and asserts that they were redirected to the home page. Prior to upgrading cucumber I had no issue with this method, but when I run my tests now I get a NoMethodError on my the current_user helper provided by Authlogic. The user seems to log in
user3235936
php rest restful-authentication controllers laravel-3
Again, with some of modification “user.php” controller, mysterious error appear:Unhandled Exception Message:syntax error, unexpected ”Please, … yes, that’s all. I only modify user.php; here be gist: https://gist.github.com/pmache/17a8d037b89f275235efWhat I tried accomplish, is to register user with user, password, email and additionally – first name and last name. Then, (if proccess go ok) send mail with confirmation link to given adress, so user got validated.
Bittercoder
wcf rest oauth restful-authentication
I’m playing around with DevDefined.OAuth – an OAuth consumer and provider implementation for .Net http://code.google.com/p/devdefined-tools/wiki/OAuth and on launching the ExampleConsumerSite project after configuring the service endpoints on my IIS 7 web server, I’m receiving the following error:Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Excep
JZ.
ruby-on-rails methods roles restful-authentication
Ignoring rolerequirement with restfulauthentication method in a subdomain scopeI have created a site which utilizes subdomains and searches whether or not the user is at: subdomain.domain.com or domain.com. If the user is in subdomain.domain.com, /views/layouts/application.html.erb appears, if the user is in domain.com /views/layouts/promo_site.html.erb appears. To accomplish this I closely followed Robby on Rails directions.Both layouts utilize the same controller. In addition I use rolerequire
couzzi
javascript node.js angularjs express restful-authentication
Angular+RESTful Client-side Communication w/ API for Auth/(re)RoutingThis has been covered in a few different questions, and in a few different tutorials, but all of the previous resources I’ve encountered don’t quite hit the nail on the head. In a nut-shell, I need toLogin via POST from http://client.foo to http://api.foo/login Have a “logged in” GUI/component state for the user that provides a logout route Be able to “update” the UI when the user logs out / logs out. This has been the most fru
mike in africa
ruby-on-rails session restful-authentication
i have a 2.2.3 app which i upgraded to 2.3.2it’s a multi-site (using subdomain) that creates one top level session for all sites.this is how i change the domain in production.rb:ActionController::Base.session_options[:domain] = “xxx.com”# in rails 2.2.2, this is what i used to do: # ActionController::Base.session_options[:session_domain] = “xxx.com”strange things started to happen after i upgraded i can no longer login using restful authentication; it does authenticate me, but as soon as i’m red
haroldcampbell
ruby-on-rails restful-authentication
My clean install of the Restful-Authentication plugin fails with the following message.undefined method `acts_as_state_machine’ for #Class:0x46edaf8Any ideas on how I can resolve this? Note: The *act_as_state_machine* plugin is installed Note: The restful-authentication plugin was installed with the following commandscript/generate authenticated user sessions –include-activation –statefulThanksH
Luca Romagnoli
ruby-on-rails cookies restful-authentication
i’m using restful-authentication plugin with rails 2.3.8i’ve problems with cookies storei’ve put a logger instruction in this function for check the cookie:def send_remember_cookie!cookies[:auth_token] = {:value => @current_user.remember_token,:expires => @current_user.remember_token_expires_at } logger.error “————–#{cookies[:auth_token].keys}” endBut when i launch the program i receive this error:undefined method `keys’ for nil:NilClasswhy?How can i set the cookie?thanks
Simone Carletti
ruby-on-rails restful-authentication
I’ve installed the restful_authentication plugin. I’m Using rails 2.2.2. However, I can’t seem to get past a certain error:”undefined method acts_as_state_machine”It doesn’t matter if I call db:migrate or script/server, everything results in this same error.Any ideas?
Kasper Nymand
ruby-on-rails ruby ruby-on-rails-3 authentication restful-authentication
After trying to install the “Restful-Authentication”-plugin on my Ruby on Rails site, I’ve been meeting some problems.I’m still new to Ruby on Rails, and programming in general, so I might probably have forgotten something, maybe.I’m running Ruby 1.9.3p125, and Rails 3.2.1When browsing to the signup page, I get this error message:uninitialized constant User::AuthenticationThen, if I refresh the page, I receive this other error message:undefined method `key?’ for nil:NilClassFull Trace:actionpack
Web site is in building