on-internet

How to resolve ERROR: You're not authorized to run analysis. Please contact the project administrator in GitLab Integration

I am configuring a GitLab ci pipeline for a .NET project. I am trying to run the code analysis using the sonar cloud. When I run the analysis I’m stuck at the error saying ERROR: You’re not authorized to run analysis. Please contact the project administrator. , Seems like the analysis report is generated and when it’s trying to upload the analysis report to sonar cloud the execution is getting failed with the error. Please suggest how to overcome this error and run the analysis successfully. Commands used in the PowerShell script to run the analysis : echo "sonarqube installation" dotnet tool

Join the discussion →

TypeORM save nested objects

I'm working on a express (with TypeORM) + ReactJS app. The problem is that I have 3 entities linked by OneToMany relationship like this: customer product(linked to customer) model(linked to product) import { Product } from './product.entity' @Entity('customer') export class Customer extends BaseEntity{ @PrimaryGeneratedColumn() readonly id: number; @Column ({name: 'name'}) name : string; @Column ({name: 'test', nullable: true}) test : string; @OneToMany(() => Product, product => product.customer) // @JoinColumn({ name: 'product_id' }) products: Product[] } import {Customer} from './customer.en

Join the discussion →

search for parameters with square brackets in an access query

I try to identify in C# ,a DB Access with thousands of queries, only the queries with fictitious parameters, (eg. Select id, Nation, Name from someTable where Nation = [Give a Nation]). I tried with GetOleDbSchemaTable but with no luck. I also tried to use MSysQueries and MSysObjects from Access and then retrieve the info in C # but with no luck. How can you help me?

Join the discussion →

registerForActivityResult not working when second activity orientation changes

I am calling activity B from activity A using the ActivityResultLauncher and setting the result from activity B when the task is done. This works perfectly if orientation is not changed. The problem is when I change orientation from activity B and then setting the result, then registerForActivityResult of activity A is not called. Could someone let me know, what could be the issue? Note: I do not face this issue if I am using startActivityForResult and onActivityResult. I changed this to ActivityResultLauncher as startActivityForResult became deprecated. activity A sample code: private lateini

Join the discussion →

Could missiles replace guns at the personal level?

Could small guided missiles become a practical replacement for conventional guns at the personal level? I was thinking about the evolution of aerial warfare, and the nature of how missiles have almost entirely replaced guns for fighters. It occurred to me that the same basic concept could almost work at the personal level if the technology could be made small enough on a practical level. The traditional problem with aerial warfare was that traditional gunnery is hard and thus missiles became more effective over time to the point at which they utterly dominated as they allowed longer ranged eng

Join the discussion →

Cannot use a scalar value as an array after using pluck()

I'm trying to send an array of my Model Role to Blade like this: public function create() { $roles = Role::pluck('name','id'); return view('admin.users.create', compact(['roles'])); } And on the Blade, I added this: <div class="form-group"> {!! Form::label('roles', 'Role:') !!} {!! Form::text('roles[]', $roles, null, ['multiple' => 'multiple', 'class' => 'form-control']) !!} </div> Now I get this error: ErrorException Cannot use a scalar value as an array on create.blade.php However, when I add {{ dd($roles) }}, I get this as result: Illuminate\Support\Collection {#1155 ▼ #items: array:1 [▼ 1

Join the discussion →

Not able to understand Verilog Code for parameterized N-bit adder

I recently got a code for parameterized n-bit adder, but I didn't understand the meaning behind the code. I know that an n-bit full adder without input carry has a half adder and N-1 full adders. Have a look at the code: module nbitadder (input1, input2, sum); parameter N = 10; input [N-1:0] input1, input2; output [N-1:0] sum; wire carry_out; wire [N-1:0] carry; genvar i; generate for (i=0; i<N; i=i+1) begin: generate_N_bit_Adder if (i==0) Halfadder f (input1[0], input2[0], carry[0], sum[0]); else Fulladder f (input1[i], input2[i], carry[i-1], carry[i], sum[i]); end assign carry_out = carry[N-

Join the discussion →

How to wait in p5.js

I'm trying to create a program that does something, waits for a set amount of time does another thing, then waits again. However, what actually happens is the program waits at the beginning then does both things without any delay between them. var start, current function setup() { createCanvas(500, 550); } function draw() { background(220); print('a'); wait(500); print('b'); wait(500); } function wait(time) { start = millis() do { current = millis(); } while(current < start + time) }

Join the discussion →

using cat and echo to write to /dev/ttyUSB0

im using cat and echo to read and write to and from a usb serial device. # shell session 1 echo "send to device" >/dev/ttyUSB0 # shell session 2 cat /dev/ttyUSB0 this works great if i do this manually. when running a script, the echo command somehow looses usually the first 1-4 characters of the string and the device only received the rest example: device typically would receive "nd to device" can someone give me a hint why this is?

Join the discussion →

Talend Open Studio - an error (sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain))

For first launch Talend Open Studio have an error java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain) at java.base/java.lang.Class.getDeclaredMethod(Class.java:2613) at org.apache.webbeans.proxy.Unsafe.lambda$unsafeDefineClass$2(Unsafe.java:163) at java.base/java.security.AccessController.doPrivileged(AccessController.java:312) at org.apache.webbeans.proxy.Unsafe.unsafeDefineClass(Unsafe.java:160) at org.apache.webbeans.proxy.Unsafe.defineAndLoadClass(Unsafe.java:126) at org.apache.webbeans.proxy.Abstrac

Join the discussion →

Django Deployment - scriptProcessor could not be found in fastCGI application configuration

I am learning the process to deploy Django Project through IIS and fastCGI. However, I am facing an error <handler> scriptProcessor could not be found in <fastCGI> application configuration. After a little bit of research I've found that this error could be due to rights issue. Hence I've added permission (read, write, execute) for user DefaultAppPool in folder Python37 (contains python virtual environment) and similarly I've done this for folder wwwroot which is on C:\inetpub. Python Virtual Environment: C:\python37 Web.config file path: C:\inetpub\wwwroot\web.config Web.config <?xml version=

Join the discussion →

Measure of feature importance in PCA

I am doing principal component analysis (PCA), and I'd like to find out which features that contribute the most to the result. My intuition is to sum up all the absolute values of the individual contribution of the features to the individual components. import numpy as np from sklearn.decomposition import PCA X = np.array([[-1, -1, 4, 1], [-2, -1, 4, 2], [-3, -2, 4, 3], [1, 1, 4, 4], [2, 1, 4, 5], [3, 2, 4, 6]]) pca = PCA(n_components=0.95, whiten=True, svd_solver='full').fit(X) pca.components_ array([[ 0.71417303, 0.46711713, 0. , 0.52130459], [-0.46602418, -0.23839061, -0. , 0.85205128]]) np

Join the discussion →

How to check if process runs within a docker container (cgroup v2 linux host)

How to check if a process is running from within a Docker container? I'd like a method that works reliably, and that is future-proof. This was already asked and answered at How to determine if a process runs inside lxc/Docker?, however the answer is quite old, and it does not seem to work on a recent setup (Linux host with cgroups v2 enabled, Docker 20.10.x, kernel 5.10.x). The top-rated answer (from the link above) suggests to check for the string docker in /proc/1/cgroup, however here's what I get: # cat /proc/1/cgroup 0::/ It seems to be due to the fact that cgroups v2 is enabled on my host

Join the discussion →

How to handle errors on broken table links

I have recently updated my linked tables to use UNC links. However when I test the front end using a machine which does not have the mapped drives, my error handling procedure fails in line Set rs = CurrentDb.OpenRecordset("SELECT ItemName FROM tblDonatedItems") with error number 3044 Is there a way of trapping the error so that the procedure can keep running? Please see below: Private Sub Form_Load() On Error Resume Next Dim rs As DAO.Recordset Set rs = CurrentDb.OpenRecordset("SELECT ItemName FROM tblDonatedItems") If Err.Number <> 0 Then MsgBox "Error Number: " & Err.Number & " " & Err.Desc

Join the discussion →

How to test Reac Lazy inside an object

At the project I'm working on, there's a few named exports like the object below: export const object = { component: React.lazy(() => import('some-component')) } (They have more properties but I'll just show this one for brevity) The issue When I try to test it using Jest, I can't test inside React.lazy: I tried mocking React.lazy with no success: jest.mock('react', () => ({ lazy: () => { return 'lazy' }, })) describe('Auth route object', () => { it('', () => { expect(auth).toBeDefined() expect(auth[0].component).toBe('lazy') }) }) This returns passed but it keeps complaining about coverage. H

Join the discussion →

How to use in-memory MongoDB with Rails, Mongoid, and Rspec?

On unit or integration testing, I need to be able to use in-memory mongoDB just for convenience. Am I able to do that? I tried searching for solution and there is no tutorial in how to write mongoid.yml to use in-memory. Other than that, can I just use default env inside mongoid.yml rather than writing duplicates for both development and production? It is like moving from development: client: ... production: client: ... into default: &default client: ...

Join the discussion →

How to rename sheet and add value to the name in xlwings

I have a list of sheets and for each sheet I need to SUM float values from the column A and the SUM outcome should be added to the sheet name. For example: Sheet1 --> Sheet1 (123). import xlwings as xw wb = xw.Book(filepath) sheet_names = wb.sheets for x in sheet_names: # missing summary calculation here wb.sheets[x].name = wb.sheets[x] + str('123') # '123' should be the # outcome of the SUM so str(SUM) wb.save() wb.close() xw.App().quit()

Join the discussion →

How to Replace/Overwrite only certain values in Snowflake Table?

I have a Snowflake SQL command in the form of: CREATE TASK REPLACE_CERTAIN_ROWS WAREHOUSE=<MY_WAREHOUSE> SCHEDULE='USING CRON 0 5,17 * * * UTC' AS insert overwrite into <MY_SCHEMA>.<MY_TABLE>(FIELD1,FIELD2) <MY_SQL> And my table looks like: FIELD1|FIELD2 ABC,REPLACE DEF,REPLACE GHI,DONTREPLACE JKL,DONTREPLACE Instead of replacing the entire table how can I alter my Snowflake to only overwrite the FIELD2='REPLACE' rows? Do I have to first have a command that deletes these rows or is there a way to do it more instantaneously? I know I can only execute one command per Snowflake task so would like

Join the discussion →

How to size a view relative to its parent when the parent is inside a scrollview?

I'm trying to dynamically size some views which end up being placed inside of a scrollview. Here is the simplest sample code I can think of: struct RootView: View { var body: some View { ScrollView { VStack(alignment: .leading) { // More views above HStack(spacing: 16) { MyView() MyView() } .padding([.leading, .trailing], 16) // More views below } } } } struct MyView: View { var body: some View { VStack(alignment: .leading, spacing: 24) { Image("myImage") .resizable() .scaledToFill() VStack(alignment: .leading, spacing: 0) { Text("Text") OtherView() } } } } I think really the main issue I'm ha

Join the discussion →

maven: replace transitive dependency version

Here a mvn dependency:tree snippet: ... +- org.springframework.boot:spring-boot-starter-actuator:jar:2.1.12.RELEASE:compile [INFO] | +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.1.12.RELEASE:compile [INFO] | | \- org.springframework.boot:spring-boot-actuator:jar:2.1.12.RELEASE:compile [INFO] | \- io.micrometer:micrometer-core:jar:1.1.9:compile ... As you can see, my project is using version 1.1.9 of io.micrometer:micrometer-core. I'd like to use a most recent version of this library. This version is due to: <parent> <groupId>org.springframework.boot</groupId> <artifactI

Join the discussion →

RuntimeError: unexpected EOF, expected 3302200 more bytes. The file might be corrupted

I am trying to implement pretrained model of following repository. I need your assistance to rectify the error. RuntimeError: unexpected EOF, expected 3302200 more bytes. The file might be corrupted. I tried to implement pretrained model of CANNet present on following repo using google Collab and followed all steps of (Prerequisites, cloning, Data Preparation, and Testing) https://github.com/gjy3035/NWPU-Crowd-Sample-Code.git The detailed error is given below Traceback (most recent call last): File "test.py", line 118, in main() File "test.py", line 46, in main test(lines, model_path) File "te

Join the discussion →

Binary value representation issue [duplicate]

My task is to create a text file and put my first name as binary data in the text file, and then to read this file and convert this binary data to characters and put it in another file as characters. How do I represent my name in binary? I tried: reg [255:0] myname = 01001110011010010110101101101111011011000110111101111010; But, it did not work. The error says the number is too big. Then I tried: reg [1:0] myname1 = 2'b0100_1110_0110_1001_0110_1011_0110_1111_0110_1100_0110_1111_0111_1010; This also did not work. It always gave "_" as an output.

Join the discussion →

Express or Axios Error: socket hang up code: ECONNRESET

This is the first time I posted a question here, sorry if some data is missing. I'm trying to do some web scraping to get some info from a table. The page only responds with an index.php. When I use the search form, it makes a POST to index.php?go=le with some formData. To avoid the CORS problem, I'm making the post with my own API running in localhost. I'm pointing my frontend to my API and I get the response from localhost. No problem there. My problem appears when I try to make a second request to my API. The first GET works fine but after that response it keeps failing. When I restart the

Join the discussion →

Retrieve amino acids from fasta file and include its overall percentage for only the top 5 results

I want to display the amino acid, count and percentage for the top 5 but I can only manage the count and the amino acid with the script described below. How could I update this? L: 139002 (10.7%) A: 123885 (9.6%) G: 95475 (7.4%) V: 91683 (7.1%) I: 77836 (6.0%) #!/usr/bin/env python3 def FASTA(filename): try: f = open(filename) except IOError: print ("The file, %s, does not exist" % filename) return order = [] sequences = {} counts = {} for line in f: if line.startswith('>'): name = line[1:].rstrip('\n') # name = name.replace('_', ' ') order.append(name) sequences[name] = '' else: sequences[nam

Join the discussion →

Error: WebSocket was closed before the connection was established

I have Discord Music bot and it's been running for almost a year. Since yesterday, I got an issue that says: Unable to play a music: Error: WebSocket was closed before the connection was established Here is my code: try { var connection = await voiceChannel.join(); if(guild.me.hasPermission("DEAFEN_MEMBERS")) guild.me.voice.setDeaf(true); queueContruct.connection = connection; play(message.guild, queueContruct.songs[0], message); } catch (err) { queue.delete(message.guild.id); errorMessage(message, "1058"); console.error("Unable to play a music: "); return console.error(err); } play function:

Join the discussion →

FSM `next state` does not transition when `present state` value in next state combinatorial logic block transitions - ternary operator

In my Verilog code, the ns value does not get assigned to any of the values in the next state logic. I coded the next state logic to assign a value to the ns state variable whenever there is a transition in the ps. Here is the FSM code snippet: // State registers always @(posedge clk, negedge rst) begin if (!rst) ps <= S1; else ps <= ns; end assign present_state = ps; assign next_state = ns; // Next state logic always @(ps, start) begin case (ps) S1: ns = start ? S2 : S1; S2: ns = S3; S3: ns = S1; //default : ns = S1; endcase end Here is the tb code snippet: initial begin #0 rst = 0; start = 0

Join the discussion →

one function as a class and also instance method

This could be a so called XY problem, so let me start with what I want: ed = Edit.add(1).add(2).add(3) print(ed.op) # [1,2,3] Following is what I tried and basically I got working code, but I'm not sure if I did it right or if there are other options. The first add(1) is a class method call and the following add(2) and add(3) are instance method calls. I started here: class Edit: def __init__(self): self.op = [] @classmethod def add(cls, x): self = cls() return self.add_im(x) def add_im(self, x): # im = instance method self.op.append(x) return self ed = Edit.add(1).add_im(2).add_im(3) print(ed

Join the discussion →

Is Python's dict_items() a constructor that is inaccessible to users?

I was learning Python dictionaries at W3Schools: car = { "brand": "Ford", "model": "Mustang", "year": 1964 } x = car.items() print(x) I get: dict_items([('brand', 'Ford'), ('model', 'Mustang'), ('year', 1964)]) Demo here: https://onecompiler.com/python/459cgc42u The dict_items looks like a conversion function or class constructor, but it is not recognized at the command line: >>> dict_items([('brand', 'Ford'), ('model', 'Mustang'), ('year', 1964)]) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'dict_items' is not defined The most authoritative explanati

Join the discussion →
Older stories