raddevon

1

votes
2

answer
427

views

Django: How to nicely format an address in a template without knowing how much information is available?

I have a table with address information. It has these fields. address_1 address_2 city state zip No field is required. I want to display this in a template and format it nicely. I want line breaks between address_1, address_2, and the city/state/zip line for any of those that exists. I also want a c...
raddevon
1

votes
2

answer
104

views

How do I run client-side code after a new collection item has been added to a Meteor view?

In my template, I call a server-side method to add an item to a collection. This collection is displayed on the page. Once the new item is rendered, I want to focus it for the user. Here's the helper that fires the server method. 'click .add-post-button': function(e) { var userId = Template.parentDa...
raddevon
2

votes
1

answer
1.6k

views

JSON call inside object failing. Uncaught Reference: data is not defined

When I instantiate an object, it should fetch data using jQuery's getJSON method and fill the object's properties from that data. Instead, I get Uncaught Reference: data is not defined on the AJAX call. data, in this case, is the name of the JSON data object argument I'm passing to my callback funct...
raddevon
2

votes
1

answer
815

views

Can I iterate over NEW in a PostgreSQL trigger function?

I've written a trigger function hoping to iterate over NEW and check all its values. CREATE OR REPLACE FUNCTION fix_nulls() RETURNS TRIGGER AS $_$ BEGIN FOR val IN NEW LOOP IF val = '{x:Null}' val := ''; ENDIF; ENDLOOP; RETURN NEW; END $_$ LANGUAGE 'plpgsql'; CREATE TRIGGER prevent_nulls_sitei...
raddevon
1

votes
1

answer
780

views

How do I re-run my Meteor publication to refresh the contents of a collection on the client?

I'm creating a quiz app. I want to show a single random question, take the user's answer, show feedback, and move to another random question. I'm using this to publish a single random question: getRandomInt = function(min, max) { return Math.floor(Math.random() * (max - min + 1) + min); }; randomize...
raddevon
4

votes
1

answer
1.8k

views

django: How do I hash a URL from the database object's primary key?

I'm trying to generate URLs for my database objects. I've read I should not use the primary key for URLs, and a stub is not a good option for this particular model. Based on the advice in that link, I played around with zlib.crc32() in a Python interpreter and found that values often return negative...
raddevon
2

votes
1

answer
530

views

How do I identify the current page in a page collection?

I'm configuring a static site generator using Grunt's Assemble.io. I'm using the Pages Collection to build a navigation list like so: {{#each pages }} {{{title}} } {{/each }} I would also like to apply class="active" to the navigation item for the current page, but I'm not sure how to approach this....
raddevon
2

votes
2

answer
5.3k

views

“Object reference not set to an instance of an object” when I try to deploy my Azure Cloud Service via CLI

I'm running this command in the Azure PowerShell to deploy my node project: Publish-AzureServiceProject -ServiceName -Location "East US" Using my service name instead of . Each time I run this, I get an error: Publish-AzureServiceProject : Object reference not set to an instance of an object. At li...
raddevon
1

votes
4

answer
144

views

New to async programming. How do I get things to happen in proper sequence across different objects?

I'm trying to refactor my program. I had made it work by making the AJAX calls synchronous, but now I'd like to do it the proper way. What's happening is that headline is instantiated with a new headline from headlines which contains a list of headlines. headlines.getRandom() selects a random headli...
raddevon
7

votes
2

answer
6.4k

views

Why does Gulp not complete my 'clean' task before running the tasks that depend on it?

I have a gulpfile that should clean out my dist directory before minifying code. Sometimes, the clean task is still running while code is being minified resulting in some missing files. What's causing it to do that? My understanding is that the dependencies for a task will be completed before the t...
raddevon
2

votes
2

answer
537

views

Routes using cookie authentication from previous version of Paw no longer work on new version

I have a route that uses an authentication cookie set by another route. I've created it like this: This method no longer works in the new version. Paw complains that there is no set-cookie header in the response from the Authenticate request. It seems this is because Paw now takes the cookies and ha...
raddevon
2

votes
1

answer
340

views

Change Azure Cloud Service environment variable without publishing

Is it possible to change an environment variable on an Azure Cloud Service without publishing? I'd like to be able to change a variable and then restart my app, but I don't need to re-deploy.
raddevon
5

votes
2

answer
2.2k

views

How can I repeat a block N times in a Meteor Spacebars template?

I have this block of code in a Spacebars template: 1. {{#each choices}} {{this}} {{/each}} I would like to repeat this N times incrementing the number each time like so: 1. {{#each choices}} {{this}} {{/each}} 2. {{#each choices}} {{this}} {{/each}} 3. {{#each choices}} {{this}} {{/each}} I woul...
raddevon
2

votes
2

answer
1.9k

views

Fill the horizontal space between left and right floated elements

I found an answer here that addresses what I need to do, but it doesn't seem to work perfectly for me. I have sidebar divs floated left and right. I want to stick a div in the middle and fill the space. The technique in that answer works for the left div, but it pushes the right div down to the next...
raddevon
2

votes
0

answer
186

views

Only getting partial user publication in Meteor Jasmine test

I have a client integration test to ensure my admin user can change user roles via the user management interface in my app. However, when I query for the user I want to change, the query comes back empty even though it has been created in the fixture. describe('Admin users', function() { beforeEach(...
raddevon
4

votes
2

answer
1.4k

views

Express app throws 500 TypeError: Object #<EventEmitter> has no method 'hrtime'

The staging instance of my webapp is throwing an error: Express 500 TypeError: Object # has no method 'hrtime' at Object.logger [as handle] (F:\approot\node_modules\express\node_modules\connect\node_modules\morgan\index.js:96:28) at next (F:\approot\node_modules\express\node_modules\connect\lib\prot...
raddevon
2

votes
2

answer
984

views

AWS ECS: How do I get around “too many containers” with my microservice architecture API?

I'm working on an API with microservice architecture. I deploy to ECS via Elastic Beanstalk. Each microservice is a long-running task (which, on ECS equates to a single container). I just passed up 10 tasks, and I can no longer deploy. ERROR: Service:AmazonECS, Code:ClientException, Message:Too many...
raddevon
2

votes
1

answer
563

views

Node function on AWS Lambda can't connect to database with node-pg

My function works locally, but, when I deploy to AWS Lambda, it can't seem to connect to my postgres database. Here's the error: { [Error: connect ECONNREFUSED] code: 'ECONNREFUSED', errno: 'ECONNREFUSED', syscall: 'connect' }, isOperational: true, code: 'ECONNREFUSED', errno: 'ECONNREFUSED', syscal...
raddevon
4

votes
1

answer
3.8k

views

Homebrew: Python version still 2.7.4 after homebrew install

I've installed Python using homebrew. which python returns /usr/local/bin/python which should be the homebrew install, if I'm not mistaken. When I run python, I get Python 2.7.4 (v2.7.4:026ee0057e2d, Apr 6 2013, 11:43:10) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin which tells me I'm stil...
raddevon
1

votes
2

answer
779

views

Inline-block element gets pushed to next line [closed]

I'm building a WordPress theme (was told by WP SE to bring this question here), but I have a problem with my footer widget area. All the widgets seem to layout properly with my CSS except the Recent Posts widget. It seems to double the margin-right of the previous element. The widgets are sized to a...
raddevon
3

votes
0

answer
228

views

Can't install node 0.8.4 on OSX Mavericks

I need to run node 0.8.4 for a project, but I'm having trouble getting it to install. I've installed nvm in order to run it alongside my current system version of node, but I'm getting an error when I run nvm install 0.8.4: Node.js configure error: No acceptable C compiler found! Please make sure yo...
raddevon
2

votes
0

answer
161

views

Move query parameter value to header before auth request in NGINX?

I have a location that uses ngx_http_auth_request_module. The authorization sub-request looks for a token in an Authorization header on the original request. For this particular location, the token can only be passed as a query parameter on the request (e.g. /sites//charts/?token=). Is it possible t...
raddevon
8

votes
2

answer
5.1k

views

JSONP request gives 404 in Angular app

I'm trying to get some data from an API with a JSONP request, but I get a 404 every time. I would assume my URL is wrong, but I can hit the URL manually in Chrome and get the desired response. My $http.jsonp request always errors with a 404 showing up in my console.log in the error callback. Here's...
raddevon
3

votes
0

answer
114

views

Missing Spacebars, fast-route on deployed Telescope install

I have deployed a Telescope site to my staging DigitalOcean droplet. The site works perfectly on my local machine, but I get several errors in Dev Tools when I try to pull up the deployed copy. fast-route data found, but no collection exists for: settings a66f3d03fa0387126449a4d3022ea653e4a8d4b4.js:...
raddevon
3

votes
2

answer
853

views

How do I test an SVG fallback?

Is it possible to turn off SVG support in Chrome to test an SVG fallback? If not, what's the best way to test this on a Mac running El Capitan?
raddevon
1

votes
3

answer
6.6k

views

Windows batch scripting: compare two files' created dates

I would like to fork my Windows batch script based on a comparison of the created dates of two files, and I'm not sure where to begin. I feel like there must be a way. Any ideas? UPDATE: Tried the solution in PA's answer. I copied the code snippet verbatim to the end of my current script. Then, I ad...
raddevon
2

votes
1

answer
399

views

How can I run a command with grunt-shell with elevated privileges?

I need to run a PowerShell using Grunt. This means I will, in many cases, need to set a less restrictive execution policy so that the script can run. I believe I can do this with reg add, but I can't run that without administrator privileges. Any way to do this with the grunt-shell plugin?
raddevon
2

votes
1

answer
432

views

Can I use multiparty for a single route in my express app?

I have an Express 3 app that uses bodyParser for most routes. (Most routes only accept multipart.) I have a single route that is going to be parsing files up to 1GB in size which bodyParser can't seem to handle. I would like to use multiparty for only this route so I don't have to rewrite the whole...
raddevon
1

votes
1

answer
4.2k

views

grunt-contrib-connect not serving files from my specified base

I have a very simple configuration for grunt-contribu-connect in my Gruntfile. connect: { dev: { base: 'dist' } }, The task runs and is kept alive by my watch task, but, whenever I try to open a page from this base directory, I get error output instead of the desired page. Cannot GET /odds.html In t...
raddevon
1

votes
1

answer
2.3k

views

How do I fix this encoding error in the Python binary in my pygame project?

I'm trying to setup a project in PyCharm, but I get an error when I try to execute it. SyntaxError: Non-ASCII character '\xca' in file /Users/raddevon/PycharmProjects/pygame/env-pygame/bin/python on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details I've setup...
raddevon
2

votes
3

answer
338

views

How do I debug a non-functioning keymap in Vim?

I ask this question generally, but I will put it in terms of the specific problem I'm having. I'm using the vim-lawrencium plugin for a project under Mercurial source control. I use the :Hgstatus command to open the status buffer. The status buffer comes with some nice keymaps to make it easy to add...
raddevon
2

votes
1

answer
600

views

docker-compose ignoring startup order established by depends_on

I have a docker-compose.yml with three services: a Node app, a Mongo database, and waisbrot/wait to wait for the Mongo server to start listening before starting the app. When I run docker-compose up, compose starts building and starting the app service immediately instead of bringing up its depende...
raddevon
3

votes
2

answer
8k

views

Access child elements of a custom directive without jQuery

I've written a custom directive for a dropdown menu. The elements are absolutely positioned within a relatively positioned parent, so I need to get the height of the dropdown trigger element in order to move the actual menu below it. The trigger is a child of the directive element. I want to avoid u...
raddevon
3

votes
0

answer
401

views

Docker deployment on Elastic Beanstalk not gathering NGINX logs

According to Amazon's Elastic Beanstalk Multicontainer Docker Configuration docs, I should be able to use mount points to get NGINX logs in the location where Elastic Beanstalk expects them. Volumes from the container instance to mount and the location on the container file system at which to mount...
raddevon
4

votes
1

answer
959

views

Is it possible to run a task after the watch task?

I have a PHP-based project that won't run on grunt-php. Instead, I use grunt-exec to run my MAMP server for development. exec: { serverup: { command: '/Applications/MAMP/bin/start.sh' }, serverdown: { command: '/Applications/MAMP/bin/stop.sh' } } In my custom development task, I run the MAMP start s...
raddevon
3

votes
2

answer
14.7k

views

Simple jQuery click event bind not working in IE8

This seems to work in nearly every browser except IE8 (and probably IE7, but I haven't tried that yet), and I'm not sure why. $('body') .on('click', '.toggle', function(e){ $(this).toggleClass('active'); e.preventDefault(); e.stopPropagation(); }); I notice when I click a link classed toggle, the br...
raddevon