John John

38639 questions
1

votes
1

answer
298

views

How to add a custom column which is not present in table in active admin in rails?

in my rails application, i have installed active admin. in users index page, by default, all columns are getting displayed(User table columns). I want to add a custom column called 'become user' in this users index view (which is not a column in User's table). under this column i want to display use...
John
0

votes
0

answer
3

views

Is markup formatting just for Swift playgrounds?

In swift file, I don’t see editor _ show rendered markup button. For example. //: - Experiment: //: Modify the anyCommonElements(_:_:) function to make a function that returns an array of the elements that any two sequences have in common. //: How can I show this in rendered markup mode in swift f...
John
1

votes
1

answer
1.8k

views

How do I swagger generate Kotlin?

I'm trying to generate kotlin code from a swagger json file, and I can't figure out the command-line parameters that should be used. I've tried Swagger codegen v2.3.1 and v2.2.3 and both fail for kotlin, kotlin-client, and kotlin-server with the same error. What's the correct switch to generate Kot...
John Kaster
1

votes
2

answer
183

views

QUERY function with one result returns value beneath the formula cell

When I use the =QUERY function in Google Sheets, it returns the value in the cell beneath where I typed the function. I want the returned value to appear in the cell I typed the function. Currently, I have =QUERY(Data!$L:$N,'select avg(N) where L = ''&CONCATENATE(B$1,$A2)&''') in cell B2, and it is...
John Doe
1

votes
2

answer
928

views

Changing B2C Reply URL from “signin-oidc” to something else does not work

I am trying to get a ASP.NET Core 2.1 web app running with Azure AD B2C. I have this running after much reseach (and more trial and error) as the instructions found in the docs are a little off. The sign-in/sign-up process works using the default scaffolding during the project setup wizard, plus the...
John
0

votes
1

answer
11

views

Optimizing SSIS package for millions of rows with Order by / sort in SQL command and Merge Join for millions of rows

Hi i am currently trying to optimize an SSIS package when i do an Upsert/delete which handels about 93+ million rows from a table in a remote MariaDB source. The table also contains approximately 63 columns. Currently i'm using Sort and Merge Join in my package but as i've read some guides its recom...
John
1

votes
2

answer
42

views

Should multiple Spring controllers direct to same view file?

Suppose in Controller A, I have @GetMapping('/path/1') public String getIndex() { //it's own unique logic ... return 'path/to/file'; } and in Controller B, I have @GetMapping('/path/2') public String getIndex() { //It's own unique logic ... return 'path/to/file'; } Is it a good practice to have two...
John Doe
1

votes
1

answer
221

views

Thread Context and Synchronization Context

I see the use of terms Thread Context and Synchronization Context being used in documents regarding threading. Do they refer to the same thing? This is the definition for thread context by Microsoft: The thread context includes all the information the thread needs to seamlessly resume execution, i...
John L.
1

votes
1

answer
292

views

Visual Studio Code - Python debugging - Step into the code of external functions when executing

In a Python project, how do you tell the built-in VSCode debugger to step into the code of functions from other libraries on execution? I know it is possible for functions implemented in standard libraries by adding a 'debugOptions': ['DebugStdLib'] to your configuration in launch.json as specified...
John Smith
1

votes
2

answer
131

views

PhpStorm “rsa key is corrupt or has the wrong version”

I'm using PhpStorm 2018.2 and attempting to connect to remote host using SSH key (I can connect via ssh on terminal). When I enter the (newly created) rsa key into the remote host settings I get the error ''{path/to/key}_rsa' is corrupt or has unknown format' ... see image attached. I have seen some...
John Halsey
1

votes
0

answer
23

views

How to detect duplicates in large json file using PySpark HashPartitioner

I have a large json file with over 20GB of json-structured metadata. It contains simple user metadata across some application, and I would like to sift through it to detect duplicates. Here is an example of how the data looks like: {'created': '2015-08-04', 'created_at': '2010-03-15', 'username': 'k...
John Lexus
1

votes
1

answer
92

views

Net Core MVC: Name Session does not exist in Current Context

I am receiving an error in the last line. How would I resolve this? Trying to convert Net 4.6.2 Project to MVC Net Core. Last Line Error: Name Session does not exist in Current Context. public class TransferPropertyOwnershipController : Controller { public ActionResult GetNewOwnerRecord(int ownerID...
John Thomas
1

votes
1

answer
35

views

Turn str fractions to floats in pandas df

I have a really awkward pandas DataFrame that looks kind of like this: identifier per_1 per_2 per_3 per_4 per_5 'something' 124/127 100/100 24/39 14/20 10/10 'camel' 121/122 150/206 300/307 11/12 0/2 ... ... .....
John Rouhana
1

votes
1

answer
56

views

Laravel passport: Manually create access token

I'm building an SPA using VueJS and Laravel. I'm using Laravel passport for logins which works fine. However I would like the ability to send users magic links to log in with. However I'm not sure how to create an access token without sending a request with the password to the oauth route. It seems...
John Mellor
1

votes
1

answer
44

views

How can I replace values in a deeply nested but arbitrary data structure?

I have a data structure that is arbitrary. The form is usually similar in that it consists of arrays and hashes about four levels deep, with about two to six values I'd like to change. A typical example: $VAR1 = [ undef, [ { '0' => 'some string' } ], undef, [ undef, { '1033' => 'another string ' } ]...
John O
1

votes
1

answer
56

views

Map seems to drop values in recursion

I've been working on a problem and I figured I would demonstrate it using a pokemon setup. I am reading from a file, parsing the file and creating objects/structs from them. This normally isn't a problem except now I need to implement interface like inheriting of traits. I don't want there to be dup...
1

votes
1

answer
56

views

How to implement APP_USER variable in oracle apex

I have a teacher table that stores a teacher username, password, id and other things. I have a course creation page and a teacher details page. Currently, when a teacher logs in with their username and password and clicks on the teacher details page, they can see every other teachers details includi...
john leonard
1

votes
1

answer
23

views

C++: multimap custom comparator for object keys

Can I somehow use my own function for ordering the pairs in multimap? I have three classes CTimeStamp, CMail and CMailLog. And the thing is in the CMailLog I have multimap which I use because for this task I need solution which will be very fast for huge amounts of data and therefor I would need to...
John
1

votes
1

answer
21

views

How do I append MYSQL JSON

I have the following in my database when I run SELECT type FROM office; +--------------------------------------------------------+ | type | +--------------------------------------------------------+ | a:2:{i:0;s:16:'Shared Workspace';i:1;s:9:'Worksho...
John Crawford
1

votes
3

answer
73

views

Why can't a value be assigned to a property in the class body except in its declaration?

I hope this question isn't too dumb - I wasn't able to find an answer, partly because I don't know how to phrase it well, but I think a small amount of code will explain it well: class MyClass { int value = 10; } What exactly does this do? Given that class MyClass { int value; value = 10; } does...
John P
1

votes
1

answer
32

views

Why Is This Searching Algorithm Bizarrely not Working for this Case?

I am somewhat new to Java, and I was learning the concept of recursion. I was creating a recursive algorithm that checks if an element exists in a Comparable array by using the compareTo method. Although the algorithm works in most cases, for some reason it does not seem to find an element in the se...
John A.
1

votes
1

answer
34

views

How do I add a variable to the legend without including it in the graph?

I would like to add a value to the legend without adding it to the plot. library(tidyverse) gear_color % filter(gear != 4) %>% ggplot(aes(vs, fill = gear)) + geom_bar() + facet_wrap(~gear) + scale_fill_manual(values = gear_color) How would I add Gear 4 to the legend without adding it to the plot?
John-Henry
1

votes
1

answer
47

views

Simulation of AR(1) in Rcpp [duplicate]

This question already has an answer here: Calling R Function from C++ 2 answers Is there a way of calling arima.sim using Rcpp sugar? The fact that it need an R list as an argument has been my biggest stumbling block so far. I've got it to work by using a global definition as below, but would much...
John Siryj
1

votes
2

answer
40

views

Duplicating data in Controller Laravel

I am trying to duplicate data with a click of a button, in better terms, trying to reorder a previous order. This is my code $order = Order::find($id); $order_details = OrderDetail::where('order_id', $id)->get(); $reorder = $order->replicate(); $reorder_details = $order_details->replicate(); $reord...
John
1

votes
2

answer
40

views

Having two classes representing the same table in Entity Framework?

I am trying to clean up some Entity Framework data contexts that were originally created without any naming conventions. I would like to keep the old classes but also have the new, properly named class available at the same time so that all the other projects that use these data contexts don't need...
John S
1

votes
2

answer
28

views

Move directory to a new repo in github

Current repo looks like this... /ab/docter /ab/pepper /cd/.. ... I want to keep the whole history in ab and move it to a new Repo in GitHub. /doctor /pepper I tried to pull and manually move it to ab repo but the history doesn't come with the push. :(
John Baek
0

votes
0

answer
9

views

Karma, Angular 7, & FontAwesome issue Can't bind to 'icon' since it isn't a known property of 'fa-icon'

Can't bind to 'icon' since it isn't a known property of 'fa-icon'. When trying to run this test in people.component.spec.ts import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { PeopleComponent } from './people.component'; describe('PeopleComponent Unit Test', () => { le...
John Peters
0

votes
0

answer
3

views

android sdkmanager hangs in CentOS 7

When I run sdkmanager in a CentOS 7 environment with no UI, it seems to hang. I downloaded and unzipped the linux command line tools from https://developer.android.com/studio in my root directory. which sdkmanager shows tools/bin/sdkmanager. I have also tried running android list sdk and that s...
John Hazlitt
1

votes
1

answer
21

views

If statement is always run even if not true [on hold]

I want to set a powercap when the system uses more than 400 Watt. I tried to do to do that with a simple if statement but the if statement is also run when the current power is 256 Watt My code looks like this a=400 node1 = Node(0, 0, 0, 0) node1.getPowerUsage() node1.getGpuPowerUsage() node1.getCp...
John Carr
0

votes
0

answer
14

views

Not setting a properties in the state?

in all the tutorials that I have seen, the state properties are set to empty strings, arrays, ...etc so I assumed it's best practice. So is it bad practice to set the state properties by the event handler ?? class Form extends Component { state = { }; handleOptionChange = event => { this.setState({...
John Dough
0

votes
0

answer
20

views

How to loop through individual cells of array

Have inherited a macro that I'm not 100% on, and I need to fix it. Essentially it should check if each of the reference cells are populated, if true - copy to plan cell, if isEmpty, do nothing. However seems it copies regardless. Have tried adding for each loop but doesn't seem to be taking effe...
John D
1

votes
1

answer
345

views

“__gfortran_pow_c8_i4” error when linking .o files from g++ and gfortran using g++

I am trying to link a .o file generated using g++ and another .o file generated using gfortran. g++ -c mycppcode.cpp produces the file mycppcode.o and the command gfortran -c myfortrancode.f produces the file myfortrancode.o When I link these two files to get an output file g++ -O mycppcode.o myfort...
John Smith
1

votes
0

answer
14

views

SSIS Package in SSMS - ADO NET Source has failed to acquire the connection - Could not create a managed connection manager

I have some problems with getting my SSIS Packages to work from my Azure SQL SSIS DB in Azure. I built the SSIS packages in VS and they run without any problem. What i am doing is getting data from a remote MariaDB (Source) with a '.NET MySQL Data Provider (mysql-connector-net-8.0.15)' and inserting...
John
1

votes
1

answer
24

views

Generate lists of all columns in pandas dataframe

My dataframe has 40+ columns. I would like to generate lists with each list containing values from one column. Here is how I tried to do it cols= df.columns cols = cols.tolist() for col in cols: col = df.col.tolist() Error: 'DataFrame' object has no attribute 'col' So it seems loop is trying to find...
john
1

votes
1

answer
172

views

Creating a list or sequence of numbers up to a certain value in F#

Suppose I want to create a list or sequence of all cubic numbers under 5555, or fibonnacci numbers under 4500 - How would I do this? I can generate a list or sequence of these , but I don't know how to make them terminate after a certain point. In the case of the fibonacci sequence it is difficult...
Dr. John A Zoidberg
-1

votes
0

answer
13

views

What is wrong with my implementation of the BBP algorithm?

I am trying to implement the BBP Algorithm for calculating the n-th hexadecimal digit of Pi, and have gotten stuck with the implementation. I have already tried rewriting this bit two or three times, and at this point I am having a hard time figuring out what I did wrong. It's possibly (and probabl...
John Jelatis
0

votes
0

answer
5

views

Combining lists of strings in Ansible

I have two lists of strings in Ansible: vars: pre: - one - two post: - alpha - beta I can get the cartesian product of these lists easily: set_fact: prods='{{pre|product(post)|list}}' How do I then combine the individual parts to get a list like this: prods: - one-alpha - one-beta - two-alpha - two-...
John
-1

votes
0

answer
16

views

Making a new column out of specific lines from within a file?

I am trying to solve the following problem but several attempts have failed to get it right. Supposing I have the following in a file: a,b,c d,e,f g h I need some way to add g and h as a third column so that the file looks like this: a, b, c, g d, e, f, h Thanks for you help.
John Davy
3

votes
3

answer
74

views

using Julia 1.0 findmax equivalent of numpy.argmax

In Julia I want to find the column index of a matrix for the maximum value in each row, with the result being a Vector{Int}. Here is how I am doing it currently (Samples has 7 columns and 10,000 rows): mxindices = [ i[2] for i in findmax(Samples, dims = 2)[2]][:,1] This works but feels rather clumsy...
John Zicker
1

votes
2

answer
480

views

Python Kivy: unable to import main main

While reading the book, Creating Kivy apps with Python, it says to 'Next, update the imports in weather.kv to import this main module instead of the ListItemButton class; see Example 3-7. Example 3-7. Importing a custom class from main #: import main main #: import ListAdapter kivy.adapters.listadap...
John Doe

View additional