Lance

1

votes
1

answer
484

views

Django QuerySet.union() -or- QuerySet.raw() to Achieve Case-Insensitive Mutli-Search

Given a URL like this: http://..../search/?foo=a&foo=B&bar=whatever In my View, I want to filter the QuerySet for CASE-INSENSITIVE matches of 'foo'. There's a handy 'in' operator that I could use on my list of 'foo', but it doesn't support case-insensitivity. To be clear, this (elegant code) perfor...
Lance E.T. Compte
1

votes
2

answer
152

views

Django Template Attributes of QuerySet for ManyToMany with “Through” Class

I've got roughly models like these: class Person(models.Model): ... name = models.CharField(max_length=40) eyes = models.CharField(max_length=12) ... relationships = models.ManyToManyField('self', through='Relationship', symmetrical=False, related_name='related_to') class Relationship(models.Model):...
Lance E.T. Compte
1

votes
1

answer
38

views

How to flush stdout in ATS

I am trying to do animation in the terminal by printing and flushing repeatedly. Is there a way to flush the standard output after writing to it in ATS? Thank you!
Galletti_Lance
1

votes
0

answer
292

views

How to get nodemailer to work with 2LO for service accounts?

I have followed the instructions on the nodemailer site to the letter, but OAuth2 for google service accounts simply does not work for me. Either I get ECONN timeouts when setting 'host' to mail.google.com or some combination of '401, user/pwd not accepted, can not create access token' errors when...
Lance Massey
1

votes
1

answer
37

views

In React js, what is the elegant way to add page message after potentially any input field

Suppose I am having a page message: {this.props.message} I can potentially show this page message before or after any input field in my form, based on which field has caused the issue. In jQuery, this is easy to achieve via simply append. But how do we achieve this is react? By adding a {this.sta...
Lance Shi
1

votes
0

answer
154

views

Googletest: Duplicate symbols linker error

I have tests for my classes ArithmeticSvc and BigNumber. Both header files have their respective header guards. My tests for ArithmeticSvc throw a duplicate symbol error when including BigNumber in its header file. The relevant files are below: BigNumber.h #ifndef BIG_NUMBER_H #define BIG_NUMBER_H #...
Lance Hardwood
1

votes
0

answer
134

views

Box2D rigid bodies vs. LiquidFun particles

Prior to LiquidFun, the only way developers could simulate particle-like bodies in vanilla-Box2D was by creating dynamic circular fixtures. What are the main advantages of using LiquidFun over the old method? Does it look better? Is it computationally more efficient? Or is it just a simplification (...
P. Lance
1

votes
0

answer
508

views

Swift iOS -How to scroll Sticky Header to top of screen when there aren't any cells inside CollectionView?

FYI this question is for manual scrolling when the user swipes up to see more cells. I followed this tutorial and made a sticky header. Everything works fine and the sticky header scrolls to the top of the screen underneath the Nav Bar when the CollectionView has enough cells inside of it to fill up...
Lance Samaria
1

votes
0

answer
30

views

Structure of a malloc block

Reading here it says malloc can't allocate less than 32 bytes. I have also seen somewhere saying 16 bytes is the minimum. This diagram shows generally what malloc block looks like, but is not detailed enough. The first link suggests there is an 8-byte minimum required to store the size of the block....
Lance Pollard
1

votes
0

answer
24

views

cartalyst extensions' routes only set after first test

Please help I'm using Laravel 5.5 with Cartalyst Platform 7.0 and Phpunit 6.0. I have been trying a lot to install extensions in a testing environment but when the first test runs the extensions routes are not defined so the test returns 404. The second test and the rest of the tests pass because th...
Lance
1

votes
2

answer
110

views

Swift iOS - How to put timer on Firebase TransactionBlock to prevent it from increasing within a certain time period

Every time different users post something (let's say a color) I get the color they posted, the postID, their userId, the date in secs, and how many times that post was viewed. A different user can look through a tableView and view different cells with every color that every user posted . Every time...
Lance Samaria
1

votes
2

answer
219

views

Firebase databaseAuthVariableOverride not working

I followed these Firebase directions and over the past few weeks I've been using the databaseAuthVariableOverride to let users use Algolia to run search results in my app and access the database. I changed my Firebase Service Account API key earlier today and now the databaseAuthVariableOverride no...
Lance Samaria
1

votes
2

answer
314

views

How to tell the difference between Heroku Config Variables vs .Env Variables

I'm a native iOS Swift dev and I have lightly dabbled in Node.js so this process is a little foreign to me. Using node if I want to hide my variables I first import the dotenv module, require it in my app.js file, set .env variables, add it to a .gitignore file, and then use the dotenv module to acc...
Lance Samaria
1

votes
0

answer
94

views

Automatically convert recursion to iteration

I have seen these questions: Can and do compilers convert recursive logic to equivalent non-recursive logic? Way to go from recursion to iteration Do any programming language compilers automatically convert recursion to iteration? These all mention tail-call optimization. I am wondering though if, g...
Lance Pollard
1

votes
0

answer
388

views

Swift iOS -How to get tabBar height inside app delegate or a cell

I know how to get the height of a tabBar inside a view controller: // 49 points tabBarController?.tabBar.frame.height How would I get it inside AppDelegate or even a UICollectionViewCell?
Lance Samaria
1

votes
0

answer
10

views

Update GoogleMaps Fragment with changes (or lack thereof)

My application has 5 fragments on a tab display, with one being a GoogleMaps Fragment that does work in displaying the map, a location blip of where the user is, and a camera update on that location. However, upon switching between fragments, my location blip is lost. Here is my code, so I can bett...
Lance Raju
1

votes
1

answer
164

views

How to Write a String to Memory in WebAssembly

I started off working like this: // example.wast (module (memory (export 'mem') 1)) // example.js WebAssembly.instantiateStreaming(fetch('example.wasm'), {}).then(mod => { var exports = mod.instance.exports var i8 = new Uint8Array(exports.mem) var ra = 100 var rb = 500 var rc = 1000 var rd = 1200 va...
Lance Pollard
1

votes
2

answer
142

views

iOS Firebase -What's the best way to query several levels down? 'InvalidQueryParameter', reason: 'Cannot use multiple queryOrderedBy calls!'

I'm using a UISearchController and I want to query 2 nodes down from root on a comment key. It would be root > posts > uid > postId > comment root | @--posts | @--uid123 | @--postId987 | |-comment: 'I like pizza' I tried chaining multiple queries let commentRef = postsRef.queryOrderedByKey().queryOr...
Lance Samaria
1

votes
2

answer
49

views

How to structure AndroidManifest.xml with custom directory structure

I have a directory structure like this: build.gradle module/ build.gradle pack/ AndroidManifest.xml src/ com/ example/ sub/ main/ index.java foo/ index.java bar/ index.java I am not quite sure that is right in the first place (too many top-level folders it seems like). It seems like it should be mor...
Lance Pollard
1

votes
0

answer
31

views

Oauth on iOS for Facebook/GitHub/Twitter/etc. through WebView/WebKit

So it turns out that, for Facebook and Twitter at least, you can't do OAuth on iOS without using their SDK. I'm wondering though if it would be possible to do an OAuth flow through the web, using either WebView or WebKit, inside an iOS app. That way you can capture the appropriate session/token data...
Lance Pollard
1

votes
0

answer
149

views

cordova-plugin-bluetoothle initialize method not working in ionic

For some reason, initialize method does not work constructor( public navCtrl: NavController, public platform: Platform, private toastCtrl: ToastController ) { platform.ready().then( () => { let initializeResult: object; let params: object = { 'request': true, 'statusReceiver': false, 'restoreKey':...
2

votes
2

answer
29

views

How to add padding to centered background-image on html element

Right now I am doing this: html { width: 100%; height: 100%; background: url(/icon.png) center center no-repeat; box-sizing: border-box; background-origin: content-box; padding: 100px; } The image is 3000x1500px let's say. I would like for it to be centered with 100px of padding, and for it to scale...
Lance Pollard
1

votes
0

answer
95

views

How do I use hashids on angular?

Answer This is the only port to angular that I've seen. The thing is, it is no longer maintained and it doesn't provide a quick getting started tutorial on its read.me in GitHub. I also thought of using hashids.js directly but I am confused with the steps I follow. So I would like to know if anyone...
Justine Lance T. Mojal
1

votes
1

answer
27

views

Creating external JS page to build google charts with dynamic number of and types of charts

I am trying to use the google chart api to display a number of charts. The number of charts is dynamic as is the chart type. Currently, I am only using the pie chart type but will be adding to it. The page is loaded and the number/type of charts (widgets in code) looks like this: var widgets = {};...
Lance
1

votes
0

answer
78

views

Lucee S3 NullPointerException with no further error info

We are using Lucee and S3 and in our development and testing we had no problems. We have now moved this code live and are getting a lot of errors.That look like this : In the application.cfc in OnError I have a chuck of code that will usually send me an email with some detail Error message#Except...
Lance
1

votes
1

answer
60

views

How do I get this type of obj [{…}, {…}] and not this [] array?

My goal is to display events I get from firestore using ng-fullcalendar. But the problem is, it doesn't show up in the calendar. If used mock data it works, but on data I got from firestore doesn't So here's the working calendar with mock data The function public getEvents(): Observable { const date...
Justine Lance T. Mojal
1

votes
1

answer
110

views

How can a UIButton listen to changes to other Buttons, a change to a UILabel's text, and a change to a UITextView all at the same time

My vc contains: -1 name textView -1 label // for flavors -2 radio buttons // yes and no -1 nextButton What I want to do is keep the nextButton disabled until the textView is filled out, the label's text value is changed from its initial title of 'Pick a Flavor' to whatever flavor they pick, and 1 of...
Lance Samaria
1

votes
0

answer
243

views

Net Core Identity 2.1 Authentication Not Working Correctly Accessing Protected Endpoints

The problem to be described is where an application is intended to be used to authenticate another application and a Login page does not successfully authenticate then correct credentials are entered. The endpoints in several applications are protected by [Authorize] to ensure the challenge is exec...
Lance Parkington
1

votes
0

answer
56

views

How to get selected element in debugger in chrome extension

Say I click on an element in the debug panel: I can access the currently selected element using $0 in the debugger console. However, what I would like to do is, in a chrome extension, listen for when I click on an element in the debugger. So when I click the element in the DOM tree in the debugger,...
Lance Pollard
1

votes
1

answer
28

views

Debugging Issue on Assemble Code by using GDB

I tried to use gdb to debug the Assemble code but got error message,it said: (gdb) run Starting program: /root/assembler_program/bsawp.o /bin/bash: /root/assembler_program/bsawp.o: cannot execute binary file The code: .section .text .globl _start _start: nop movl 0x12345678 , %ebx bswap %ebx mo...
Lance
1

votes
1

answer
219

views

Cocapods -Can't Update pod ObjectMapper to version 3.3 error [!] Unknown command: `ObjectMapper,`

I just updated to Xcode 10.1 Swift version 4.2.1 and I have several build errors of: Invalid redeclaration of ' 'https://github.com/firebase/geofire-objc.git' pod 'GooglePlacesAPI' pod ‘GoogleMaps’ pod 'GooglePlaces' pod 'GooglePlacePicker' pod 'ReachabilitySwift' post_install do |installer| ins...
Lance Samaria
1

votes
0

answer
42

views

why is 8 Bytes incrementation in ESP register needed?

Recently I saw a small assembly code,but I am not quite clear of the reason that the incrementation of esp register is needed. Please review the code below: .section .data values: .int 21,15,23,44,1,2,54,24,33,2 output: .asciz 'The number is %d\n' .section .text .globl _start _start: nop movl %9,%ed...
Lance
1

votes
0

answer
39

views

Struggling to call method to another class

I am very new to programming and im trying to call a method from one class to another class. I keep getting the error, 'name 'quad' is not defined. class problem(object): def ask(problem): problem = input('What type of problem are you trying to solve? Quadratic, ').capitalize() #add more if problem...
Lance Davenport
1

votes
0

answer
56

views

How would I implement this code into my Wordpress site using WPbakery

I have this codepen which is an altered version of the parallax code from firewatch. https://codepen.io/Lancewalker/pen/EGqVZe function castParallax() { var opThresh = 350; var opFactor = 750; window.addEventListener('scroll', function(event){ var top = this.pageYOffset; var layers = document....
Lance Walker
1

votes
0

answer
23

views

How deeply nested threads are managed in multi-threaded architecture

I just have a quick question. Say you start a program, then create 5 threads, then each of those create 5 threads, then each of those create 5 threads. Say they are each doing a variety of different activities, that is, they aren't just clones of simple processes running in parallel or something. Th...
Lance Pollard
1

votes
0

answer
30

views

The 2D and 3D graphics engines that Chrome and Servo use

I learned a while back (after many hours searching) that Chrome/Webkit uses Cairo graphics for it's (at least) 2D drawing. I am not sure what it does for 3D. But if you search for 'graphics engine used by chrome' you get a bunch of stuff about Blink, but this is not what you want.... Looking briefly...
Lance Pollard
1

votes
0

answer
40

views

Encode ArrayBuffer of arbitrary length to custom alphabet

I have had a few questions about how to convert integers into custom alphabet, and some stuff about encoding which I still don't fully understand yet, but I'm getting there. What I'm wondering about now though is how to convert an arbitrary-length ArrayBuffer (basically just a bunch of bits of arbit...
Lance Pollard
1

votes
0

answer
16

views

Sharepoint Slider Webpart not showing up

I am new to Sharepoint and HTML coding, but I am trying to upload this slick slider (from Ken woods) html into a Sharepoint webpart. FOr some reason it works on my local machine but it does not work on an internal webpart that I'm trying to upload into. I went in to Site Assets and downloaded/up Her...
Lance Liu
1

votes
1

answer
43

views

How to read and write bits in a chunk of memory in Swift

I would like to know how to read a binary file into memory (writing it to memory like an 'Array Buffer' from JavaScript), and write to different parts of memory 8-bit, 16-bit, 32-bit etc. values, even 5 bit or 10 bit values. extension Binary { static func readFileToMemory(_ file) -> ArrayBuffer {...
Lance Pollard
1

votes
0

answer
23

views

How to use AWS Amplify or non python SDK's to make API calls to AWS Personalize?

I was following the AWS personalize docs, when I reached the section on making api calls to get recommendations from the campaign (https://docs.aws.amazon.com/personalize/latest/dg/API_RS_GetRecommendations.html), the docs have examples for making these calls with their python sdk and CLI, but not f...
Lance Pereira

View additional