Отправляет email-рассылки с помощью сервиса Sendsay

RSS-канал «Recent Questions - Stack Overflow»

Доступ к архиву новостей RSS-канала возможен только после подписки.

Как подписчик, вы получите в своё распоряжение бесплатный веб-агрегатор новостей доступный с любого компьютера в котором сможете просматривать и группировать каналы на свой вкус. А, так же, указывать какие из каналов вы захотите читать на вебе, а какие получать по электронной почте.

   

Подписаться на другой RSS-канал, зная только его адрес или адрес сайта.

Код формы подписки на этот канал для вашего сайта:

Форма для любого другого канала

Последние новости

No hosts matched for localhost when running ansible playbook with aws_ec2 dynamic inventory
2024-04-24 20:52 user24647888

I'm running an ansible playbook which calls an initial task that runs on localhost to add known_hosts ssh keys for all hosts returned by the inventory. This playbook runs fine if I use an explicit inventory list.

However, if I run the same playbook using aws_ec2.yml dynamic inventory and limit it to a single host or group it does not resolve localhost.

How can I configure an explicit localhost for ansible to resolve?

Here is what I run...

ansible-playbook build.yml -i ../inventories/DYNAMIC/aws_ec2.yml --limit HOST104

PLAY [Write key to known hosts] **********************************************************************************************************************************************************
skipping: no hosts matched

-----------------------------------------------------------------------------------------------------

Here is my playbook.


- name: Wait for connection to host
  hosts: localhost
  connection: local
  gather_facts: no
  become: true

  tasks:
    - name: Write Keys to known_hosts
      include_tasks: ../tasks/add-known-hosts.yml



I tried to call the aws_ec2.yml dynamically and specifically add localhost to the limit which does resolve the localhost. 

However, then it tries to write the ssh keys to known_hosts for ALL hosts instead of limiting to just a single host or group.

ansible-playbook build.yml -i ../inventories/DYNAMIC/aws_ec2.yml --limit HOST104:localhost

TASK [Write key to known hosts] *************************************************************************************************************************************************************
changed: [localhost -> 127.0.0.1] => (item=HOST100)
changed: [localhost -> 127.0.0.1] => (item=HOST101)
changed: [localhost -> 127.0.0.1] => (item=HOST102)
changed: [localhost -> 127.0.0.1] => (item=HOST103)
changed: [localhost -> 127.0.0.1] => (item=HOST104)


Here is my task to write keys to known_hosts...


- name: Write key to known hosts
  shell: "ssh-keyscan {{ hostvars[item].ansible_host }} >> ~/.ssh/known_hosts"
  when: hostvars[item].ansible_host is defined
  with_items: "{{ groups['all'] }}"

Why the discrepancy between my trapezoidal and numpy's trapezoidal integration?
2024-04-24 20:51 roundofferror

I wrote my trapezoidal integration function to approximate the area under the curve for vehicle crash analysis. The function will take in two numpy vectors: (1) time vector and (2) acceleration or force. Thus, when I integrate, I'll get velocity (if I put in acceleration vector) or total impulse exerted on the vehicle (if I put in the force).

def numerical_integration(x: np.array, fx: np.array, initial_value: float = 0.0):
    """
    Performs numerical integration using trapzeoidal integration function. 
    Returns newly integrated data points + total area under the curve..

    Here is a representation of the calculation of the distance traveled at the end of each time interval, showing the concept of keeping a running total of the are
    ��(10) = ��1
    ��(20) = ��1 + ��2
    ��(30) = ��1 + ��2 + ��3
    .
    .
    .
    ��(90) = ��1 + ��2 + ��3 + ⋯ + ��8 + ��9
    ��(100) = ��1 + ��2 + ��3 + ⋯ + ��8 + ��9 + ��10
    """
    # error checking:
    if len(x) != len(fx):
        sys.exit("ERROR: x and y vectors are not the same length.")

    # array to keep track of integration value at each intervals:
    areas = np.zeros(len(fx), dtype = float)
    # we already have initial velocity so set that equal to initial area
    areas[0] = initial_value # total_area is used to keep track of total area under the curve
    total_area = initial_value
    
    # we'll interate for each value in x-data while keep the running total.
    for pos in range(1, len(x)):
        # 1: calculate the small (incremental) trapezoid area and add it to the total area
        # formula for trapezoid area is: width / 2 * (height1 + height2)
        total_area += 0.5 * (x[pos] - x[pos - 1]) * (fx[pos] + fx[pos - 1])
        # 2: assign the newly updated integration value to the areas array:
        areas[pos] = total_area
    
    # return the newly integrated data points:
    return areas, total_area```

The problem is when I compare my function to the numpy's trapezoidal function, np.trapz(), I get different results - very similar but noticeably off. If i run the following code in my main():

######################## START: IMPULSE AND MOMENTUM ANALYSIS ########################
    # TODO 1: Determine the momentum of the vehicle prior to impact, p1 , for each case
    p0_1 = mass * v0_1
    p0_2 = mass * v0_2
    
    # TODO 2: Determine the momentum of the vehicle after impact, p2 , for each case
    # plot_data(times_1, mass * velocities_1, times_2, mass * velocities_2, "MOMENTUM VS TIME", 'Time ($s$)', 'Momentum ($N-s$)', 'Case 1', 'Case 2')
    pf_1 = mass * velocities_1[-1]
    pf_2 = mass * velocities_2[-1]

    # TODO 3: Determine the total impulse imparted on the vehicle as a result of the collision for both cases 
            # – you should use the numerical integration algorithm discussed in class.
    # total impulse is the area under the curve of Force VS Time
    _ , impulse_1 = numerical_integration(times_1, forces_1, forces_1[0]) # FIXME
    _ , impulse_2 = numerical_integration(times_2, forces_2, forces_2[0]) # FIXME

    print('-' * 55)
    print(f"Momentum before impact: CASE 1: {p0_1}, CASE 2: {p0_2}")
    print(f"Momentum after  impact: CASE 1: {pf_1}, CASE 2: {pf_2}")
    print(f"\nDelta P (not integration):\nCase 1: {pf_1-p0_1}, Case 2: {pf_2-p0_2}")
    print(f"\nTotal Impulse Case 1: {impulse_1}\nTotal Impulse Case 2: {impulse_2}")
    print(f"\nNumpy's Integration:\nCase 1: {np.trapz(forces_1,times_1)}, Case 2: {np.trapz(forces_2, times_2)}")
    print('-' * 55)
######################## END: IMPULSE AND MOMENTUM ANALYSIS ########################

I get following output:

-------------------------------------------------------

Momentum before impact: CASE 1: 0.7200000000000001, CASE 2: 0.6400000000000001 Momentum after impact: CASE 1: -0.37721155161600284, CASE 2: -0.050379520229791856

Delta P (not integration): Case 1: -1.0972115516160028, Case 2: -0.690379520229792

Total Impulse Case 1: -1.097211551616002 Total Impulse Case 2: -0.6903794111388608

Numpy's Integration: Case 1: -1.0972115516160028, Case 2: -0.6903795202297909

-------------------------------------------------------

Why such discrepancy between my trapezoidal and numpy's trapezoidal integration? And why is numpy's output closer to the actual value than mine? What am i doing wrong in my numerical integration function?

Thank you in advance!

Programmatically add (and activate Elevation and Extrusion) 3d layer to local Scene Using ArcPy
2024-04-24 20:51 Dinosaur Reporter

I have been unable to programmatically add (and activate Elevation and Extrusion properties) a layer to the 3d section of a local Scene Using ArcPy.

I am able to programmatically set elevation and extrusion properties for layers in a scene, but I have not been able to programmatically add these layers to a 3d scene. Despite setting the elevation and extrusion properties, the layers do not display in 3D until I manually move them from the "2d" section to the "3d" section. Then to activate the elevation properties so they display appropriately I must open the layer properties dialog, go to the Elevation tab, open the expression dialog where I see my programmatically set expression and click OK. (without making any changes to the expression).


aprx = arcpy.mp.ArcGISProject("CURRENT")
local_scene = next((scene for scene in aprx.listMaps() if scene.name == "The3DSceneName" and scene.mapType == "SCENE"), None)
group_layer = local_scene.createGroupLayer("TheGroupName")

group_layer_cim = group_layer.getDefinition('V3')
    
group_layer_cim.layer3DProperties = arcpy.cim.CIM3DLayerProperties()

# Setting the layer3DProperties properties
group_layer_cim.layer3DProperties.castShadows = True
#... ect set layer3DProperties
# Push the updated CIM definition back to the group layer
group_layer.setDefinition(group_layer_cim)

#'partition_layer' is previously defined and configured
cim_definition = partition_layer.getDefinition('V3')
cim_definition.layer3DProperties = arcpy.cim.CIM3DLayerProperties()
cim_definition.layer3DProperties.applyAsElevationLayer = True


# Additional code for setting extrusion and elevation...
elevation_definition = arcpy.cim.CIMSymbolizers.CIMExpressionInfo()
elevation_definition.title = "Custom"
elevation_definition.expression = f"$feature.{field2_name} / {user_defined_number}" 
elevation_definition.name = ""
elevation_definition.returnType = "Default"

cim_definition.featureElevationExpressionInfo = elevation_definition


partition_layer.setDefinition(cim_definition)

extrusion_expression = f"([{field1_name}] - [{field2_name}]) / {user_defined_number_meters}"
partition_layer.extrusion('BASE_HEIGHT', extrusion_expression)

local_scene.addLayerToGroup(group_layer, partition_layer, "BOTTOM")

Again, when I inspect the properties of the layer, the elevation and extrusion properties are set correctly, but it's like they are not activated (especially in the case of elevation, as I have to click OK through the elevation dialogs without changing anything for it to take effect. )

  • How can I ensure that the elevation and extrusion settings take effect programmatically without needing to open and close the properties dialog?
  • Is there a specific property or method call I am missing that activates or refreshes these settings within a 3D scene?
  • By setting the group layer's 3d properties group_layer_cim.layer3DProperties in the CIM I am able to programmatically add all layers to the 3d section of the Scene, but the layers within the group are only rendered as 2d, despite having their extrusion properties set. How can I render all in the 3d Scene as 3d programmatically?
    Any insights or suggestions on how to resolve these issues would be greatly appreciated!

How to get all possible indices of arrays as number union type?
2024-04-24 20:51 qweezz

How can I get all possible indices of array as number union type?

Expected result a number union type:

type VoiceSettings = {
    similarityLevel: 0 | 1 | 2 | 3 | 4 | 5;
    stabilityLevel: 0 | 1 | 2 | 3 | 4;
}

Actual result:

type VoiceSettings = {
    similarityLevel: "0" | "1" | "2" | "3" | "4";
    stabilityLevel: "0" | "1" | "2" | "3" | "4";
}

Code:

const VALUES_MAP = {
  similarityLevel: [0, 15, 30, 50, 75, 90],
  stabilityLevel: [15, 30, 60, 75, 90],
} as const;

type ValuesTypes = keyof typeof VALUES_MAP;

type VoiceSettings = {
  [key in ValuesTypes]: Exclude<keyof (typeof VALUES_MAP)[ValuesTypes], keyof []>;
};

Here's a TS playground

if else not working as expected in SASViya
2024-04-24 20:51 user3812673

i am new to SAS Viya and trying to write a if else statement but its not working as expecting.

%let qtr=%sysfunc(date(),qtr);

%if &qtr=1 %then 

%do;

%let qtr=4;

%else %do;

%let qtr=&qtr-1;

%end;

proc print &qtr;

Its printing the current quarter value of 2 instead of 1.

Can I use Redux-Saga and UseQuery together?
2024-04-24 20:51 wiem khardani

I need to know If I can work with Redux Saga and UseQuery together. I'm working on a big project and I'm setting up the Redux-Saga architecture and I would make API calls using UseQuery. Is it possible to do this? Here's an example of the code.

service.js

export const getUsersRequest =  () =>   ApiConfig.get(`URL.............`);

saga.js

function* getUsersSaga() {

try {

const response = yield call(getUsersRequest) ;

yield put({ type: GET_USERS_SUCCESS, payload: response.data });

} catch (errors) {

yield put({ type: GET_USERS_FAILED, payload: errors.message });

}}

In my situation, I can use UseQuery for API calls ?

Map Array of objects to Dictionary in Swift
2024-04-24 20:51 iOSGeek

I have a Person Type, and an Array of them:

class Person {
   let name:String
   let position:Int
}

let myArray: [Person] = [p1, p1, p3]

I want to map myArray to be a Dictionary of [position:name]. The classic solution is:

var myDictionary = [Int:String]()
        
for person in myArray {
    myDictionary[person.position] = person.name
}

Is there an elegant alternative in Swift via a functional programming approach using map, flatMap, or any other modern Swift style?

why does `std::views::iota` bracket initialization not work?
2024-04-24 20:50 Cherif

why is this an illegal declaration?

> std::views::iota r(0, 10);
error: expected ‘;’ before ‘r’

but this works

> auto r = std::views::iota(0, 10);

how to pass the data from the parent component to the modal in ngZorros
2024-04-24 20:50 manigandan

Iam new to the ant ng-Zorros, where i need to send the data from the component to the modal , i tried to use the documentation of ngzorros ,but not able to send data .I have a table component where iam having column called color, if we click the showmore in color column modal have to open ,in that modal i need to show the color data in the modal, modal is opening but didn't find anything to send data from the table component to the modal component .any suggestions would be helpful

item-table.html
----------------
   <td  ><a  nz-tooltip="Click To Open" class="text-color" (click)="showModal(data.color)">Show More </a></td>

item-table.ts
----------------
   showModal(data:any) {
      console.log(data);
      
      const modal = this.modal.create({
        nzTitle: '',
        nzContent: ItemModalComponent,
        nzViewContainerRef: this.viewContainerRef,
        nzClosable: false,
       
      })
    }

item.modal.ts
-------------------
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-item-modal',
  templateUrl: './item-modal.component.html',
  styleUrls: ['./item-modal.component.less']
})
export class ItemModalComponent implements OnInit {

  constructor() { }

  ngOnInit(): void {
    
  }

}

Improve GeSHi syntax highlighting for T-SQL
2024-04-24 20:49 Aaron Bertrand

I'm using WP-GeSHi in WordPress, and largely I'm very happy with it. There are, however, a few minor scenarios where the color highlighting is too aggressive when a keyword is:

  1. a variable name (denoted by a leading @)
  2. part of another word (e.g. IN in INSERTED)
  3. the combination (part of a variable name, e.g. JOIN and IN in @JOINBING)
  4. inside square brackets (e.g. [status])

Certain keywords are case sensitive, and others are not. The below screenshot sums up the various cases where this goes wrong:

enter image description here

Now, the code in GeSHi.php is pretty verbose, and I am by no means a PHP expert. I'm not afraid to get my hands a little dirty here, but I'm hoping someone else has made corrections to this code and can provide some pointers. I already implemented a workaround to prevent @@ROWCOUNT from being highlighted incorrectly, but this was easy, since @@ROWCOUNT is defined - I just shuffled the arrays around so that it was found before ROWCOUNT.

What I'd like is for GeSHi to completely ignore keywords that aren't whole words (whether they are prefixed by @ or immediately surrounded by other letters/numbers). JOIN should be grey, but @JOIN and JOINS should not. I'd also like it to ignore keywords that are inside square brackets (after all, this is how we tell Management Studio to not color highlight it, and it's also how we tell the SQL engine to ignore reserved words, keywords, and invalid identifiers).

Move whole row to new sheet if column is filled out?
2024-04-24 20:48 Whitney

We have a spreadsheet with an “Active” sheet and “Closed” sheet. Is it possible to have an entire row moved from Active to Closed if a date is input in column “I”?

We have been unsuccessful creating a VBA that completes this.

Stop chrome devtools logging mouse events temporarily
2024-04-24 20:48 Andrew

I'm trying to log a specific mouse event, which is being sent from an onMouseMove event. I'm absolutely positive that I've seen some sort of keyboard shortcut that you can use inside of chrome devtools to stop chrome from logging keyboard events after one has been sent that you're interested in inspecting, but for the life of me I can't remember or find it in the docs anywhere. In my case, I'm trying to log event in the center of the object I'm targeting so I can see what certain values are at that location, but when I move the mouse out of the object that event is buried under dozens of other mouseMove events. Thanks in advance!

Problems adding an animated HTML canvas background to webpage
2024-04-24 20:48 akhil vaid

I am trying to add the following animation to my webpage background link to the background, the problem i'm facing is that the background loads on top of all the content of my webpage, as to by becoming the first top layer hiding all my content beneath it and z-index is not working either? Please advise a solution

i tried z-index and positioning of the canvas and the container divs

function hideOtherImages(clickedImage) {
  var images = document.getElementsByClassName("gallery-image");
  var h5s = document.getElementsByTagName("h5");

  for (var i = 0; i < images.length; i++) {
    if (images[i] !== clickedImage) {
      images[i].style.display = "none";
      h5s[i].style.display = "none"; // Hide the h5 element corresponding to the image
    }
  }
}
<canvas id="canvas">
  <h1>Explore what your star sign means and has for you!</h1>
  <div id="container">
    <div class="one">
      <figure><img src="https://picsum.photos/100/100?aries" alt="" class="gallery-image" onclick="hideOtherImages(this)" ><h5>March 21 – April 19</h5></figure>


      <figure><img src="https://picsum.photos/100/100?taurus" alt="" class="gallery-image" onclick="hideOtherImages(this)" ><h5>April 20 – May 20</h5></figure>
      <figure><img src="https://picsum.photos/100/100?gemini" alt="" class="gallery-image" onclick="hideOtherImages(this)"><h5>May 21 – June 20</h5></figure>
      <figure><img src="https://picsum.photos/100/100?cancer" alt="" class="gallery-image" onclick="hideOtherImages(this)"><h5>June 21 – July 22</h5></figure>
      <figure><img src="https://picsum.photos/100/100?leo" alt="" class="gallery-image" onclick="hideOtherImages(this)"><h5>July 23 – August 22</h5></figure>
      <figure><img src="https://picsum.photos/100/100?virgo" alt="" class="gallery-image" onclick="hideOtherImages(this)"><h5>August 23 – September 22</h5></figure>
    </div>
    <div class="two" >
      <figure><img src="https://picsum.photos/100/100?libra" alt="" class="gallery-image" onclick="hideOtherImages(this)"><h5>September 23 – October 22</h5></figure>
      <figure><img src="https://picsum.photos/100/100?scorpio" alt="" class="gallery-image" onclick="hideOtherImages(this)"><h5>October 23 – November 21</h5></figure>
      <figure><img src="https://picsum.photos/100/100?sagittarius" alt="" class="gallery-image" onclick="hideOtherImages(this)"><h5>November 22 – December 21</h5></figure>
      <figure><img src="https://picsum.photos/100/100?capricorn" alt="" class="gallery-image" onclick="hideOtherImages(this)"><h5>December 22 – January 19</h5></figure>
      <figure><img src="https://picsum.photos/100/100?aquarius" alt="" class="gallery-image" onclick="hideOtherImages(this)"><h5>January 20 – February 18</h5></figure>
      <figure><img src="https://picsum.photos/100/100?pisces" alt="" class="gallery-image" onclick="hideOtherImages(this)"><h5>February 19 – March 20</h5></figure>
    </div>
  </div>
</canvas>

URL Redirect but preserves only any part of URL, its possible?
2024-04-24 20:48 Informatica Bocanegra

Whell, the example is simple, i've a web what shows a elearning courses catalog named privado.recursosimpulsa.com/catalogo_hijo/56

The proporuse of this web is, modifiying last parameter, serve to diferent clients, for example:

privado.recursosimpulsa.com/catalogo_hijo/56 <- One client privado.recursosimpulsa.com/catalogo_hijo/1363 <- Another client

The app changes desing depens parameters entered, like logos, colors, etc.

Now, I wish to create different subdomains for these clients, like

privado.recursosimpulsa.com/catalogo_hijo/56 -> example1.recursosimpulsa.com privado.recursosimpulsa.com/catalogo_hijo/1363 -> example2.recursosimpulsa.com

With frame redirect works but i've a litte problem. For example, any course detail like this url for client 56 privado.recursosimpulsa.com/product_detail_child/id_product=38273/client=56 and I want that in the brownser show example1.recursosimpulsa.com/product_detail_child/id_product=38273/client=56, and can share this link and works (actually, return 404 not found, logical why example1.recursosimpulsa.com/product_detail_child/idproduct=38273/client=56 does not exist)

It's is possible with .htaccess or another url-rewriting technique? Thanks in advance.

I've tried with frame redirect and .htaccess 301 redirect

How to test the function that calles the action creators and wait for that to resolve
2024-04-24 20:48 vaibhav

I have trouble testing the react function that is calling the action. below is the function -

const sendForm = () => {
    Promise.resolve(dispatch(updateBase(a,b,c)))
    .then(res => {
        if(!res.payload.errMessage){
            dispatch(fetchLogic(d,e,f))
        }
    })
}

Here is the react action that it is calling -

const updateBase = (a,b,c) => (dispatch) => {
    return apiURL.post(...)
        .then(res => dispatch(yetAnotherAction()))
        .catch(err => dispatch(errorAction()))
}

I want to test the success scenario for sendForm Function, how can we do so?

python cprofile shows lot of information. Can it be limited to only my code
2024-04-24 20:48 sjd

cProfile shows lot of built-in function calls in the output. Can we limit the output only to the code I have written. So in the below example, can i see only the lines from testrun or the functions called from testrun() which resides in the same script. Or may be limit the level of calls logged to 2 or 3 ?

pr = cProfile.Profile()
pr.enable()
testrun()
pr.disable()
pr.print_stats(sort='time')

Cannot use p5.js in typeScript and Webpack
2024-04-24 20:48 Andry

I have a project for a library using p5.js.

Details

My Webpack config is:

const path = require('path');

module.exports = {
    entry: './start.ts',
    output: {
        filename: 'start.js',
        path: path.resolve(__dirname, 'out'),
        libraryTarget: "var",
        library: "at",
    },
    resolve: {
        extensions: ['.ts', '.tsx', '.js', '.jsx']
    },
    module: {
        rules: [
            {
                test: /\.ts$/,
                loader: "awesome-typescript-loader"
            }
        ]
    }
};

My package.json is:

{
  ...,
  "scripts": {
    "build": "./node_modules/.bin/webpack --config webpack.config.js"
  },
  "devDependencies": {
    "awesome-typescript-loader": "5.0.0",
    "typescript": "2.8.3",
    "webpack": "4.9.1",
    "webpack-cli": "2.1.4"
  },
  "dependencies": {
    "p5": "0.6.1"
  }
}

I want to use typescript, so tsconfig.json is:

{
  "compilerOptions": {
    "noImplicitAny": true,
    "noEmit": true,
    "sourceMap": true,
    "target": "es5",
    "module": "es2015",
    "lib": [ "dom", "es5" ],
    "baseUrl": "."
  },
  "include": [
    "start.ts",
  ],
  "exclude": [
    "out"
  ]
}

And entry point start.ts is:

import * as p5 from "p5";

class entry {
    // Some
}

Problem

Get this also in intellisense in VSCode, but basically the problem is that p5 cannot be found. When I run npm run build I get:

> webpack --config webpack.config.js

[at-loader] Using typescript@2.8.3 from typescript and "tsconfig.json" from C:\Users\me\Documents\GitHub\myproj/tsconfig.json.


[at-loader] Checking started in a separate process...

[at-loader] Checking finished with 1 errors
Hash: 1ef5f8c2b136b8718342
Version: webpack 4.9.1
Time: 1214ms
Built at: 05/26/2018 8:23:35 AM
 1 asset
Entrypoint main = start.js
[0] ./start.ts 93 bytes {0} [built]

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/

ERROR in [at-loader] ./start.ts:1:21
    TS2307: Cannot find module 'p5'.

npm ERR! Windows_NT 10.0.16299
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! node v6.3.1
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! andry-tino@0.1.0 build: `webpack --config webpack.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the me@0.1.0 build script 'webpack --config webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the myproj package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack --config webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs myproj
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls andry-tino
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\antino\Documents\GitHub\myproj\npm-debug.log

What am I doing wrong?

How can I position adsterra ads on wix?
2024-04-24 20:47 Car-Oh

I was trying to link adsterra to my Wix site, and I have inserted the following adsterra snippet on custom code portion in wix website settings.

<script type="text/javascript">
    atOptions = {
        'key' : '17e6556c51be0e8cc57b2162028facc4',
        'format' : 'iframe',
        'height' : 300,
        'width' : 160,
        'params' : {}
    };
</script>
<script type="text/javascript" src="//www.topcreativeformat.com/17e6556c51be0e8cc57b2162028facc4/invoke.js"></script>

However, when the website loads, the ad appears on the top left. Is there a way to change the position of this ad?

WordPress: Elementor gallery shows on preview but not on the site
2024-04-24 20:47 Marina

The web site worked perfectly yesterday, but today it does not show a gallery in a column. The gallery is a background of the column.

However, everything still works in the Elementor's preview. In the preview, the gallery is here. But on the site address the gallery does not show. The error appears in every browser, with every Wordpress theme I tried.

I created a new page, where there is only the column with the gallery as background. This gallery shows on preview, but not on the live site.

I have WordPress version 6.5.2, every plugin is updated, theme is updated. The page, where this error appears, uses a plugin for fonts only. The rest of the site seems to be working. I did "Regenerate CSS & Data". Does not help.

Chrome deletes cookies even after Secure and SameSite=none
2024-04-24 20:47 Andrew Marabante

I'm having a problem with deploying my website. Everything worked in development but now I'm moving to production for the first time, hosting my backend on fly.io and my frontend on vercel. I'm running into this weird issue with my jwt cookie where it just disappears... I have checked on postman and it indeed returns my jwt cookie but it won't work on my website.

I tried to pinpoint the problem and commented out my redirects so I can see what's happening.. Turns out, the jwts come back fine! then I go to any other page and my auth middleware doesn't go successfully and I get redirected by my frontend back to the login page... Apparently chrome is doing something with the cookies so I saw some other posts about setting sameSite:'None' and secure:true and tried those but it didn't work. Also!! I have tried adding this "domain: '.drew-book-jo6x-f97k35gp8-andrew-marabantes-projects.vercel.app'," to my cookie but it just glitched my res.cookie to not send anything..

Here's some of my code :

Backend Cookie Function:

const loginUser = (req, res) => {
    const username = req.body.username;
    const password = req.body.password;

    User.find({ username: username })
        .then(async (user) => {
            if (user.length === 0) {
                res.json('Wrong Username')
            } else {
                 if (!user[0].password) {
                     return res.json('google')
                }
                const hashedPass = user[0].password
                const match = await auth.bcrypt.compare(password, hashedPass);
                if (!match) {
                    res.json('Wrong Password!')
                } else {
                    const accessToken = auth.jwt.sign({ userId: user[0]._id },       process.env.SECRET, { expiresIn: '10m' });
                    res.cookie('jwt', accessToken, { httpOnly: true, path: '/', sameSite: 'None', secure: true })
                    return res.json('success')

                }
            }
        })
        .catch(err => res.json('Error'))

}

FrontEnd:

essentially, the front end is just GET fetch calls in a use-effect that fire on mount, passing the jwt in the credentials, you don't want to see all that.

I suspect that chrome is deleting my cookies but I'm so new to deploying that I don't know if it could be a vercel or fly.io thing. Please help! Thanks