qarthandso

0

votes
0

answer
6

views

Vue.js Transitions - 1st Entrance Not Working

I made a Code Sandbox snippet to illustrate a vue transition not working on its initial appearance. I'm using the following css to achieve the slide-in-slide-out effect: .slide-fade-enter-active transition: all 2s ease; .slide-fade-leave-active transition: all 2s ease; .slide-fade-enter // /* .slid...
qarthandso
1

votes
1

answer
1.9k

views

Docker RUN Command

I'm confused about this following passage in the article about Docker's CMD vs. RUN vs. ENTRYPOINT. Note that apt-get update and apt-get install are executed in a single RUN instruction. This is done to make sure that the latest packages will be installed. If apt-get install were in a separate RUN i...
qarthandso
1

votes
0

answer
57

views

Axios not setup properly in Vuex Store - Vue.js & Electron

I'm using electron-vue to build a simple desktop app. I used all of the standard configurations at the beginning (including adding axios), but I'm currently having an issue getting Part of my file structure is this: My main file looks like this: (src/renderer/main): import Vue from 'vue' import axi...
qarthandso
1

votes
1

answer
211

views

Trying to Implement Python-Style len() in JavaScript

I've been reading a lot about call() and bind() in JavaScript, specifically the Creating Shorcuts section on this MDN article. I'm trying to implement the following Python-esque function in JS: var arr = [1,2,3]; len(arr); // 3 I do realize this is a contrived example, but I'm trying to wrap my head...
qarthandso
1

votes
1

answer
36

views

Simple Django Aggregation - Optimization

I'm reading the beginnings of annotating and aggregating and I'm wondering which way is best to complete the following situation: You want to count the number of authors for each book in a queryset. The tutorial suggests the following with annotate: Book.objects.annotate(Count('authors')) My questio...
qarthandso
1

votes
1

answer
49

views

Simple JavaScript Object Constructor

I'm reading a beginner's guide on machine learning from scratch with JavaScript. About a 1/4 way down the page is the section titled 'THE CODE'. Right under that section heading is the code in question. var Node = function(object) { for (var key in object) { this[key] = object[key]; } }; I realize...
qarthandso
1

votes
1

answer
161

views

SQL Timestamp in PostgreSQL

I'm trying to understand the raw manner in which PostgreSQL saves timestamp data types. I get 2 different results depending on the client I use: 1. psql # SELECT date_incorporated FROM client; date_incorporated ------------------------ 2017-06-14 19:42:15-04 2. records python module rows = db.qu...
qarthandso
1

votes
2

answer
0

views

Simple IAM Issue with CodeDeploy

I'm having an issue with a seemingly trivial task of getting CodeDeploy to deploy Github code to an AutoScaling Group in a Blue/Green Deployment. I have a Pipeline setup, a Deployment Group setup, and the AutoScaling Group, but it fails when it gets to the actual deployment: I went to my role and it...
qarthandso
1

votes
1

answer
197

views

Django REST Framework - Tutorial - Confused

I'm going over Serializers (serializers.Serializer, not serializers.ModelSerializer) in the Tutorials and I'm confused about one thing. First off, we serialize the data into Python native datatypes: >>> snippet = Snippet(code='print('hello' + ' world'\n)') >>> snippet.save() >>> serializer = Snippet...
qarthandso
1

votes
1

answer
208

views

Django Grappelli Autocomplete M2M

I followed the docs down to the letter and can't get the M2M autocomplete lookup to work in Grappelli. #models.py #main model class Entry(models.Model): title = models.CharField(max_length=60) content = models.TextField() keywords = models.ManyToManyField(Keyword, blank=True) #model I want to be sea...
qarthandso
1

votes
1

answer
49

views

CSS Showing on Every Other Element

I have an effect that I'm trying to reproduce, a subtle shadow under an element. I have a JSFiddle that illustrates what I'm trying to accomplish. This bit of code makes the shadow, but awkwardly enough it only appears on select elements, and even adjusts when the window is resized and then appears...
qarthandso
1

votes
1

answer
94

views

API Service Architecture vs Browser - Using Workers and Queues

I'm reading this article on Heroku about the proper architecture of handling requests and using polling on the browser side if the requests will take longer than a few milliseconds. It is clear and makes sense. My issue is, I'm in the planning stage of a commercial API service, which is the app, whe...
qarthandso
1

votes
1

answer
57

views

Simple HTML to PDF python library error

I'm using this pydf to convert HTML to a PDF on our server. This is an example that comes right from their docs that illustrates the problem: import pydf pdf = pydf.generate_pdf('this is html') with open('test_doc.pdf', 'wb') as f: f.write(pdf) When I go to run this file, I get the same error everyt...
qarthandso
1

votes
1

answer
67

views

Simple Ember.js `has-many` relationship not working

I'm running into an issue of querying data against Ember data. I have three models: media: which multiple models inherit from image: which inherits from media note: which is a standard model. I'm trying to get all of the notes of an image but the query I'm trying isn't working. // imageModel.js impo...
qarthandso
1

votes
1

answer
589

views

Simple Vue.js Computed Properties Clarification

I'm not new to Vue.js, but I'm going through the docs again, trying to pick up on anything I missed the first time. I came across this statement in basic example section of using computed properties: You can data-bind to computed properties in templates just like a normal property. Vue is aware that...
qarthandso
2

votes
2

answer
62

views

How an extremely simple implementation of a Promise works

I'm reading through this article on the inner workings of a promise. To do that, the author showcases a simplified implementation of a promise working properly. The code is as follows: class PromiseSimple { constructor(executionFunction) { this.promiseChain = []; this.handleError = () => {}; this.on...
qarthandso
4

votes
3

answer
47

views

Simple JS array `concat` clarification

I understand how the concat method works, but I had one question about a line in the MDN docs. It says: The concat methods does not alter this or any of the arrays provided as arguments but instead returns a shallow copy that contains copies of the same elements combined from the original arrays. My...
qarthandso
3

votes
2

answer
55

views

Simple Reduce Function - JavaScript

I'm working with the reduce function on a super simple data set, and I'm getting NaN as the result when I didn't expect it: let students = [{name: 'Leah', grade: 94},{name: 'Savannah', grade: 73},{name: 'Killian', grade: 38}]; let highest = students.reduce( (high, current) => Math.max(high.grade, cu...
qarthandso
2

votes
1

answer
62

views

Basic use of `this` in Ember.js

I'm fairly adept in Javascript but I'm having a hard time understanding how Ember is handling the this context in certain scenarios. I have a component controller: import Component from '@ember/component'; export default Component.extend({ keyPress(e) { // here I want to call a method in the `acti...
qarthandso
4

votes
5

answer
450

views

JavaScript call() and Prototype - Slice Function

I'm reading the MDN Article on slice in JavaScript. I understand everything except the 2nd example in the section titled Array-Like Objects. It says we can simplify the first example by making slice our own function as so: var unboundSlice = Array.prototype.slice; var slice = Function.prototype.call...
qarthandso
2

votes
1

answer
44

views

Understanding ES6 Named Imports

I'm reading through the ES6 import statement on the MDN docs. I understand generally how it works, but wanting to dive deeper, I'm not understanding one aspect of the syntax. As stated in the MDN syntax of import, these are all of the different way to import code into the current module/scope: impor...
qarthandso
1

votes
1

answer
135

views

Advanced JavaScript Array Concatenation - Performance

I'm trying out two different ways of joining two arrays and using huge arrays to judge their performances but I'm getting an error on the second option and I don't understand why. I first filled both with 10,000,000 elements with values equal to their index. var arr1 = []; var arr2 = []; for (var i...
qarthandso
1

votes
3

answer
53

views

Basic Django Query

Simple scenario but can't figure out how to query for it: We have a Store model and Transaction model. Foreign Key on Transaction model relating back to Store. I want to query for a list of: Only stores that have done at least one transaction that day. All other stores should be excluded. Store.obje...
qarthandso
5

votes
1

answer
254

views

Poor Use Case of Object.assign() - Simple Example

I'm reading the MDN docs on Object.assign() and came across one phrase that I don't understand: The Object.assign() method only copies enumerable and own properties from a source object to a target object. It uses [[Get]] on the source and [[Set]] on the target, so it will invoke getters and setters...
qarthandso
1

votes
2

answer
66

views

Simple Docker Concept

I'm going through the getting started with Docker guide and understood most of the basics except for one concept. I get how docker/whalesay takes up 247 MB. It needs to download a few layers, including a base image of ubuntu. But hello-world should be around the same size? It's a self-contained imag...
qarthandso
2

votes
2

answer
64

views

Simple JavaScript Split Function

I'm questioning why I got the following output from this code: 'Willie'.split(/[i-l]{1}/); // [ 'W', '', '', '', 'e' ] I was expecting to get ['W', 'e']. I'm not sure why it's inserting holes in the array.
qarthandso
1

votes
2

answer
1.6k

views

Python List Comprehensions - Transposing

I'm just starting out with list comprehensions by the reading the matrix transposing tutorial here. I understand the example, but I'm trying to figure out a way to transpose the matrix without hardcoding the range in. matrix = [ [1,2,3,4], [5,6,7,8], [9,10,11,12] ] lcomp = [[row[i] for row in matrix...
qarthandso
1

votes
2

answer
190

views

Running Docker Image

The user guide states that an image should be run as follows: docker run -t -i ubuntu /bin/bash I get that -t creates the pseudo-terminal and -i makes it interactive. But it seems that the /bin/bash part is unnecessary. Whether I run it with or without /bin/bash, I'm given an interactive prompt that...
qarthandso
2

votes
2

answer
1.1k

views

How to put a JSON file's content in a response

I have a file on my computer that I'm trying to serve up as JSON from a django view. def serve(request): file = os.path.join(BASE_DIR, 'static', 'files', 'apple-app-site-association') response = HttpResponse(content=file) response['Content-Type'] = 'application/json' What I get back is the path to t...
qarthandso
1

votes
2

answer
47

views

Simple SQL Query Error

I've been trying to debug this query that I'm using to practice on. The error I'm getting when trying to build is: Schema Error: Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '); INSERT INT...
qarthandso
3

votes
1

answer
3.9k

views

Simple JavaScript ES6 vs require() importing

I'm getting ready to use ES6 module import/export via babel but came across this confusing statement in this article. It states: The power of ES6’s import and export combined with the require() method, gives us the freedom to organize all of the client-side code into modules and at the same time w...
qarthandso
2

votes
1

answer
54

views

Simple Ember.js Input Syntax

I'm seeing conflicting within the ember guides on how to go about actions syntax on an {{input}} helper. I'm referring to the key-press and key-up parameters. This section shows it without parenthesis as such: {{input value=firstName key-press='updateFirstName'}} Yet here (with the code snippet titl...
qarthandso
2

votes
1

answer
106

views

JavaScript Variable Stuck inside Loop - Can't Access

I'm doing an AJAX call to retrieve all stores in a certain state. The problem is, is that the last 2 lines can't access any of the variable content that I built up in the return function from the get call. var states = ['TX', 'AZ]; for(j = 0; j < states.length; j++) { var fullHTML = ''; var full2; $...
qarthandso
2

votes
2

answer
76

views

DevOps Simple Setup

I'm looking to start creating proper isolated environments for django web apps. My first inclination is to use Docker. Also, it's usually recommended to use virtualenv with any python project to isolate dependencies. Is virtualenv still necessary if I'm isolating projects via Docker images?
qarthandso
8

votes
1

answer
6.4k

views

Dockerfile FROM Instruction

The Dockerfile reference says the following about the FROM instruction: FROM can appear multiple times within a single Dockerfile in order to create multiple images. Simply make a note of the last image ID output by the commit before each new FROM command. I don't understand what they mean by note t...
qarthandso
1

votes
1

answer
26

views

Simple JavaScript Map - Using an Object as the Return

I'm studying the map function and tried to make a contrived example which I thought would work. This code works fine: let students = [{name: 'Susan', grades: [88, 38, 28]}, {name: 'Robert', grades: [28,97, 17]}]; let newStudents = students.map((el) => el.name); console.log(newStudents); // [ 'Susa...
qarthandso
2

votes
1

answer
162

views

Understanding Django Q - Dynamic

I'm reading this article on dynamically generating Q objects. I understand (for the most part) Q objects but I'm not understanding how the author specifically is doing this example: # string representation of our queries >>> predicates = [('question__contains', 'dinner'), ('question__contains', 'mea...
qarthandso
2

votes
0

answer
38

views

Simple `yield` in Ember.js

I'm reading this article about lessons a developer has learned over the years of working with Ember.js There's one point here that I'm curious about: Don’t {{yield this}}. Think carefully about how to yield as little as possible. I understand technically what he's saying, but what's the reasoning...
qarthandso
2

votes
2

answer
2.1k

views

Downgrade virtualenv to 2.7 from 3.5.3

My virtualenv is currently configured to python 3.5.0 while the package I need to use only supports 2.7. I need a way of downgrading my python runtime to 2.7 within my virtualenv. I do have both versions available to use: First one is in my virtualenv, second is computer-wide. (project) me-Air:eleme...
qarthandso
2

votes
1

answer
1.2k

views

Ember.js, set(), and computed properties

I'm reading through the Ember.js API reference of the set() method and I'm not understanding one particular paragraph. Computed Properties If you try to set a value on a key that has a computed property handler defined (see the get() method for an example), then set() will call that method, passing...
qarthandso

View additional