require,jquery-masonry,bowerRelated issues-Collection of common programming errors


  • ???s??
    php if-statement include require
    Is it somehow possible to exclude an if statement to two different files? When I write something like the following code, it gives a parse error: syntax error, unexpected end of file. Apparently, i always have to close an if statement in the same included file. Is there a way to accomplish what i want?index.php:<?php require “top.inc.php”; // opening the if statementsome code to execute if statement in top.inc.php is true require “bottom.inc.php”; // closing the if statement ?>top.inc.php:

  • Industrial
    unit-testing node.js require
    I just found out that if I require a module and store it as a global, I can overwrite methods and properties in the module as shown below:global.passwordhelper_mock = require(“helpers/password”) sinon.stub(passwordhelper_mock, “checkPassword”).returns trueIf I then require another module which in itself utilizes the above stubbed method, my stubbed version will be used.How does the require function in node.js take notice to these globals? Why does it only work when I overwrite/stub a module tha

  • Hongliang Sun
    ruby ruby-on-rails-3 activerecord require cloudfoundry
    I hope that vcap-service-base of cloudfoundry can visit database of cloud_controller, then I need provisioner.rb in vcap-service-base to require ‘active_record’. So I added “gem “activerecord” “in the Gemfile of vcap-service-base and then ran ‘bundle install’. In the provisioner.rb, I added “require ‘active_record'”,while starting cloudfoundry, it always threw an error:in `require’: no such file to load — active_record (LoadError), as below:/root/cloudfoundry/.deployments/devbox/deploy/rubies/r

  • John Smith
    php mysql performance include require
    My db.php file connects to, selects, and creates databases and tables if they do not exist. When I require(“db.php”) at the top of every page does it re-run that code every time? Would this eventually cause a slowdown, albeit a slight one? Should I really be connecting to a database, selecting it, and checking to create new tables if they do not already exist on every single page that requires querying the database? Is there a best practice for this type of situation? Am I worrying over nothing?

  • rinogo
    php include require
    We’ve all seen this error before:Warning: require_once(test/blah.inc) [function.require-once]: failed to open stream: No such file or directory in /home/narf/narf.inc on line 3Fatal error: require_once() [function.require]: Failed opening required ‘test/blah.inc’ (include_path=’.:/usr/lib64/php:/usr/lib/php:/home/narf/inc:/home3/narf/php:/home3/narf/inc/dev:’) in /home/narf/narf.inc on line 3Super annoying.Here’s what I’m looking for: Some sort of PHP snippet that will list the paths that are be

  • Sara Comas Clonosauria
    php path require http-status-code-500
    I have a website and it connects to a mysql database and it uses some other passwords that are defined in a file located in /home/user/public_html/inc/instance-config.php. I want to keep my passwords above the /public_html directory for security. Basically I made a file called /home/user/secrets.php and the main config file should require this file and get the passwords from it. But it doesn’t.This code in my file /home/user/public_html/inc/instance-config.php gives no errors:$secrets = str_rep

  • user874774
    javascript jquery requirejs require
    I am struggling with the requirejs optimizer. This code will work if I just load it in the browser without optimization. If I run the optimizer I get : ENOENT, no such file or directory ‘C:\Users\dev\checkout\src\main\webapp\resources\scripts\ json2.js’In module tree: mainThis is the coderequirejs.config({ paths : {jquery : “lib/jquery”,bootstrap : “lib/bootstrap”,modals : “lib/modals”,tablesort : “lib/tablesort”,json2 : “lib/json2” },shim : {“bootstrap” : [ “jquery” ],”modals” : [ “jquery” ],”t

  • brian d foy
    perl runtime packages require
    I have a Perl program, that needs to use packages (that I also write). Some of those packages are only chosen in Runtime (based on some environment variable). I don’t want to put in my code a “use” line for all of those packages, of course, but only one “use” line, based on this variable, something like:use $ENV{a};Unfortunately, this doesn’t work, of course. Any ideas on how to do this?Thanks in advance, Oren

  • ZirconCode
    ruby rubygems require
    I’m developing a ruby gem, and my requires are a mess.The gem is a web Scraper, which depending on the given options, uses different methods to access the web, and thus needs to require different gems. Some users may never need some gems, or any of them.My question is, what do I put in my .gemspec:s.add_runtime_dependency #do I require all the gems here?Where do I actually require the necessary gems in my code, and how do I do testing?I don’t know the conventions on this. Thanks.*code: https://g

  • user2779891
    javascript node.js runtime require
    I’m fairly new to Node.js and am having trouble understanding the way to go about loading libraries or files, in runtime. Apparently, it is a bad idea to load files in runtime using Node.js’s native “require” function because it is blocking i/o, and therefore should not be used from within request handlers. So, I’m assuming something like this is to be avoided:var http = require(‘http’).createServer(function(req, res) { var file = require(‘./pages/’+req.url);res.end(); }).listen(8080);So then i

  • Lisa-Marie
    jquery-plugins github google-apps-script jquery-masonry google-sites
    I am trying to see if I can include JQuery plugin Masonry on a gadget on Google Sites… created from Google App script by using HtmlService to render HTML from a HTML file with:<script src=”http://code.jquery.com/jquery-1.8.2.min.js”></script> <script src=”https://github.com/desandro/masonry/blob/master/jquery.masonry.min.js”></script>However… this only renderes this result: Invalid script or HTML content: https://github.com/desandro/masonry/blob/master/jquery.masonry.

  • Peter O.
    magento jquery-masonry
    I am having trouble with masonry and Magento. I am getting a “Uncaught SyntaxError: Unexpected end of input” I cannot seem to figure out how to get rid of this issue. I am also getting a overlapping effect. I cannot figure out if I’m missing CSS or even if my JavaScript is working. I have used no conflict.I would really appreciate help on this, I’m under a bit of pressure to get this sorted now.Here is the URL:http://thecheeky.com/testhomepage

  • Jack Bonneman
    jquery twitter-bootstrap jquery-masonry jquery-isotope
    I’m stumbling many hours with the problem below, can someone help me with that please ?This is a little part of my new parallax website:http://bit.ly/1mA3wiqWhen you click on ‘Read more’, the selected blogitem should expand. The other blogitems should be arround it. (Masonry effect) (Isotope)My problemWhen you click the read more button at ‘Blog 1’ all the other blog items go under it… but it should position arround it. Like ‘Blog 2’ and ‘Blog 3’ etc..Does anybody know WHY this happens? I trie

  • Corey Trombley
    jquery jquery-masonry modernizr
    Ok so I am trying to use Masonry for the first time and I downloaded a demo from http://www.netmagazine.com/tutorials/get-started-jquery-masonry, the demo works and I followed all the directions. when I try to even just implement it into my own site the animation does not work.errorsGET file://localhost/Users/Lencor/Desktop/ElaineSite/js/modernizr-2.5.3.min.js portfolio.html:26 GET file://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js portfolio.html:26 GET file://localhost/Us

  • Mike Earley
    jquery wordpress methods jquery-masonry
    Long story short, I’m attempting to add ‘Masonry’ to my iThemes builder plugin–see this set of instructions. I’m getting uncaught TypeError: Object [object Object] has no method ‘masonry’, after having revised the code a bit to remove ‘imagesLoaded’, which isn’t in masonry anymore I guess? Anyway, I could use some help. Here is my functions.php file for the masonry extension, where the error is occurring. `_base_url = ITFileUtility::get_url_from_file( dirname( __FILE__ ) );// Calling only if no

  • Craig McDonald
    javascript ruby-on-rails-3.1 coffeescript mustache jquery-masonry
    I am implementing an endless scrolling effect heavily influenced by this tutorial: http://railscasts.com/episodes/295-sharing-mustache-templates?view=asciicastHowever, I am doing it slightly differently because I am using Jquery Masonry (http://masonry.desandro.com/demos/adding-items.html) on the front end.Anyway, when I implement this as follows:jQuery -> window.endlessScroll = () ->if $(‘#products_page’).length new ProductPagerclass ProductPager constructor: ->$(window).scroll(@chec

  • TAH
    jquery requirejs jquery-masonry
    RequireJS newbie here. Trying to convert some JQuery code I had working fine in the old way to work w/ RequireJS.Header of my page loads three JS files via script tags — require.js itself, my require.cfg.js, and boot/main.js with the site-specific functionality.Relevant require.cfg.js excerpt:,paths: {‘boot’: ‘src/boot’,’jquery’: ‘lib/jquery.min’,’jquery.masonry’: ‘lib/plugins/masonry.pkgd.min’,’jquery.imagesloaded’: ‘lib/plugins/imagesloaded.pkgd.min’ },shim: {‘jquery’: {exports: ‘jQuery’},’j

  • Everett Carney
    javascript jquery web jquery-masonry
    Web noobie here. I’m having a problem getting Masonry to work properly with the site I’m building. Here is the code I’m trying to execute:$( document ).ready(function() { … var $article_display = $(‘#article_display’);$article_display.imagesLoaded(function() {$article_display.masonry({columnWidth: Math.floor($(‘#article_display’).width() *.3) + 2,itemSelector: ‘.article’,isAnimated: !Modernizr.csstransitions});}); … });I’m getting this error: “Uncaught TypeError: Object [object Object] has n

  • XuxuBelezA
    jquery jquery-masonry
    So, I’m using Masonry to make a “fluid” layout in my site but now I’ve encountered a problem involving its hide and reveal methods.In an event, I’m making this call:$container.masonry(‘hide’, $(this));As you can see, I’m using $(this) to tell masonry what element to hide through jqueryBut apparently, this method does not work with a jquery element?The error message in my console looks like this:Uncaught TypeError: Object #<HTMLElement> has no method ‘hide’ (masonry.pkgd.min.js:9)I tried l

  • Xarcell
    jquery jquery-masonry
    I’m trying to get masonry working with jQuery using the latest instructions at: http://masonry.desandro.com/options.htmlI have included the js file before the call. The call looks like this:<script type=’text/javascript’>$(document).ready(function() {$(‘#main’).masonry({itemSelector: ‘.post-outer’,isAnimated: true,isFitWidth: true});});</script>It does not work and outputs this error in my Chrome console: Uncaught TypeError: Object [object Object] has no method ‘masonry’Any idea why

  • user1147862
    node.js bower
    I’m having trouble registering my bower.json file at Bower. Any help would be greatly appreciated.When I try to register my project at Bower usingbower register jsnlog git://github.com/mperdeck/jsnlog.js.git -VI get the error message:bower jsnlog#* EMALFORMED Failed to read C:\Users\mperdeck\AppData\Local\Temp\mperdeck-PC-mperdeck\bower\js nlog-6944-x00dtF\bower.jsonAdditional error details: Unexpected token ?The contents of my bower.json is simply (I got rid of spaces and newlines

  • Adam Lewis
    javascript html web-applications gruntjs bower
    I have been using yo / bower for a few weeks now and I am enjoying it quite a bit. However I am having troubles adding additional pages to my web app (that require JS).I am currently configuring the grunt index.html to minimize my custom JS files into a single file. This works file as long as I put them into main.js, but now I would like to break up the scripts into separate files based on the html file. Below are the build:js sections I’m trying to use to accomplish this.As of now it genera

  • brandonjschwartz
    json bower
    I have the latest version of Bower installed. I am trying the command bower register flatly-3 https://github.com/brandonjschwartz/bower-bootswatch-flatly.gitBower has the error message that the bower.json file is malformed due to an unexpected string. I have tried a number of different things (punctuation etc) but get the same error… Any help is greatly appreciated

  • Benjamin
    bower
    This is a follow-up to this question. I’m using bower 0.7.1, and still cannot get the components to be installed anywhere else than in the components folder.I tried adding the following line to my component.json, as per this PR:”componentsDirectory”: “public/components”But it will still install in ./components.I tried to create a .bowerrc file next to component.json:{“directory” : “public/components” }But I get this error when running bower install:Error: Unable to parse local .bowerrc file: Une

  • gogogadgetinternet
    windows node.js install npm bower
    I encountered the following issue when trying to install bower today in my “git shell” (windows powershell). Can anyone tell me what caused it?C:\Users\xx\desktop [master]> npm install bower-require npm http GET https://registry.npmjs.org/bower-require npm http 200 https://registry.npmjs.org/bower-require npm http GET https://registry.npmjs.org/bower-require/-/bower-require-0.6.8.tgz npm http 200 https://registry.npmjs.org/bower-require/-/bower-require-0.6.8.tgz npm http GET https://registry

  • anubiskong
    require jquery-masonry bower
    I install masonry 3.0 in my project, but got some error:GET http://localhost:3000/get-style-property/get-style-property.js 404 (Not Found) require.js:1880 Uncaught Error: Script error for: get-style-property/get-style-property http://requirejs.org/docs/errors.html#scripterror require.js:163 GET http://localhost:3000/get-size.js 404 (Not Found) require.js:1880 Uncaught Error: Script error for: get-size http://requirejs.org/docs/errors.html#scripterror require.js:163 GET http://localhost:3000/.js

  • Phil
    node.js three.js yeoman grunt bower
    I installed threejs with bower install threejsThen after this I wish to have threejs in my page, so my app.js file starts with:define([“jquery”, “three”], function() {“use strict”;However when my page loads the Chrome console showsFailed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/scripts/three.js Uncaught Error: Script errorWell, shouldn’t it be looking in components like it does for JQuery?Basically how can I get started with yeoman and install

Web site is in building