• Breaking News

    Wednesday, August 25, 2021

    Why is double free() an error? Why couldn't the OS check during freeing memory if it's already free? Ask Programming

    Why is double free() an error? Why couldn't the OS check during freeing memory if it's already free? Ask Programming


    Why is double free() an error? Why couldn't the OS check during freeing memory if it's already free?

    Posted: 25 Aug 2021 01:49 PM PDT

    Why some programs (mostly games) are trying to contact tcp://0.0.0.0 ? (as my firewall shows)

    Posted: 25 Aug 2021 03:03 PM PDT

    Do you pronounce 1.5.1 one dot five dot one, or one point five point one?

    Posted: 25 Aug 2021 08:28 PM PDT

    NGINX, DigitalOcean, Nodejs, and making requests from 2 different sources

    Posted: 25 Aug 2021 11:10 AM PDT

    EDIT 2: I think it works, and I'm so fucking happy. This was the working key, needed to specify further where the API requests were coming from.

    upstream app_competitivecoder.com { server 127.0.0.1:3000; keepalive 8; } server { listen 80; listen [::]:80; root /var/www/competitivecoder.com/html; index index.html index.htm index.nginx-debian.html; server_name www.competitivecoder.com competitivecoder.com; location /api/users { proxy_pass http://localhost:5000/api/users; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } error_page 405 =200 $uri; location ~* \.io { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy false; proxy_pass http://localhost:5000; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } 

    Using NGINX and DigitalOcean for my MERN stack app. I have two sources that I want to allow to send API requests to my proxy, one being the axios requests I myself coded(login, register, etc), and the other being Socket.io. The problem comes that it seems I can't get both of them to work at the same time. Below you'll see code where my Socket.io requests work just fine, but any of my normal API requests to say, login, do not, and instead result in a 403 error. If it remove the location / block, I'll instead get a 404 response on those requests. I can also swap the locations a bit so my regular API requests work, but my Socket.io requests don't.

    upstream app_competitivecoder.com { server 127.0.0.1:3000; keepalive 8; } server { listen 80; listen [::]:80; root /var/www/competitivecoder.com/html; index index.html index.htm index.nginx-debian.html; server_name www.competitivecoder.com competitivecoder.com; location / { try_files $uri $uri/ /index.html; } location ~* \.io { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy false; proxy_pass http://localhost:5000; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } 

    Here's my server.js file, minus all the socket.io methods that take up about 500 lines.

    const config = require('dotenv').config(); const express = require("express"); const mongoose = require("mongoose"); const cors = require("cors"); const passport = require("passport"); const path = require('path'); const app = express(); const http = require("http"); const server = http.createServer(app); const socketIO = require("socket.io"); const io = socketIO(server, { cors: { origin: "http://localhost:3000", methods: ["GET", "POST"] } }); var rooms = 0; var namesToLobbies = []; var compList = []; var socketsToRooms = []; const users = require("./routes/api/users"); // Cors middleware app.use(cors({ origin: "http://competitivecoder.com" })); app.use(express.json()); //Added //End added // DB Config const db = require("./config/keys").mongoURI; // Connect to MongoDB mongoose .connect( db, { useNewUrlParser: true } ) .then(() => console.log("MongoDB successfully connected")) .catch(err => console.log(err)); // Passport middleware app.use(passport.initialize()); // Passport config require("./config/passport")(passport); // Routes app.use("/api/users", users); app.use(express.static(path.join(__dirname, "client/build"))); app.get("*", (req, res) => res.sendFile(path.join(__dirname, "client/build", "index.html")) ); const port = process.env.PORT || 5000; server.listen(port, () => console.log(`Server up and running on port ${port} !`)); 

    And finally, my clientside code that creates a socket for each end user

    import {io} from "socket.io-client"; const socket = io(); export default socket; 

    I feel like the problem lies in my NGINX config, specifically how I set up the locations, not sure exactly what though.

    submitted by /u/g3org3costanza
    [link] [comments]

    How important is it for Web Developers to learn Data Structures and Algorithms?

    Posted: 25 Aug 2021 01:57 AM PDT

    First of all, sorry if my English is not on point. I'm from Mexico, currently trying to learn web development on my own. I started out with HTML, CSS and now I'm 2 hours into a javascript course. Right after finishing it my initial plan was to learn version control with Github, but I have never taken a course specifically on DSA and I hear a lot about this topic, mostly on how important it is on job interviews. Should I learn about DSA? Is it really necessary or does it depend whether I want to go into front-end or back-end?

    submitted by /u/ExpNot30
    [link] [comments]

    Retrieving from Amazon S3 Bucket - 400 Bad Error

    Posted: 25 Aug 2021 05:11 PM PDT

    I have a file stored in an Amazon S3 bucket following a url similar to something like the following:

    https://my-bucket-name.s3.amazonaws.com//thefilehere?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-

    Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=ASIAVEENPDKJRUDZKEVM%2F20180812%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20180812T005443Z&X-Amz-Expires=432000&X-Amz-Security-

    Token=FQoGZXIvYXdzEBoaDIVdv9t408gWWi9vvSLjAaa0pZNA%2BXu83%2FFSyng4XvFdv5%2B7nRB%2FQydMLyi%2BBS84yXqwP6VYn7VlInw4ip1M0lkjHRXQf8OAvQLPrIl%2FQZoTe%2Fy3N6bqhLDOnFVJ3UZzYDQ4%2FbX%2Brc6mvVb

    khRsQPiarKBuLYDiOD%2FNoSaItMwI9FsMDknw1qX0Pf%2BZ5La0GmanHrTt9YUI01cIUKJ40No5mKJIwcXw3%2F5QOpUc59rZ2zEzlWP9OXeEwWKp%2Bog5P0v7ABX1lRPsCx4HGEstKhw3ZWmJfQhAcAvhrjmXIMqGNKkaCI5L0ap23jf4GvPM

    Gd4%2BcKIKKvtsF&X-Amz-SignedHeaders=host&X-Amz-Signature=82dfb9b392b5e1ef44c7140259ad884e696b48f8094bdd2d223b8650ebdf59f7`

    Basically, here is my problem. I use Ruby to upload the file to S3, retrieve the url, and save it in an instance of my video model like: @video.captions_url_s3 = getS3Link(). Then, if I log the link in my terminal, copy and paste it into my browser it will take me to my file.

    However, when I try to use it in my HAML template, it converts all the & characters to & amp; and when trying get the file via the NEW url (with the & amp;) it fails to retrieve and gives a 400 Bad Error. I've also tried replacing all & with %26 but that also gives 400 Bad Error. Basically I need to keep the & signs when making the request.

    As context, I'm trying to add an uploaded .vtt file (for captions) into my video-js element.

    %track{:src => "#{@video.captions_url_s3}"

    submitted by /u/InvictusJoker
    [link] [comments]

    Why is reddit so shit?

    Posted: 25 Aug 2021 03:38 PM PDT

    It seems like a common complaint that reddit servers are equal to that of a pile of whale shit. I figured you guys would have some insight as to why that is. Thanks.

    submitted by /u/Hrd_Dck_Drgn_Slayr
    [link] [comments]

    I see AWS/Azure for a lot of jobs, what are they and how can I learn them (the specifics of them that coding employers want)

    Posted: 25 Aug 2021 01:33 AM PDT

    I looked over their respective sites but they have a lot of sub-fields like database, network, etc... I want to know which one(s) I should learn and how. Or if you think that I shouldn't and why....

    submitted by /u/YoureAVegetable
    [link] [comments]

    Display a std::string in a QLineEdit in QT

    Posted: 25 Aug 2021 09:45 AM PDT

    Hello

    I'm making a c++ program that searches inside files.

    I'm using std::ifstream and std::find() to search, so the positions i get are the byte positions of the words found.

    if i want to display the results in a QLineEdit for example, i'd have to convert to QString, which is utf16, which means that the byte position i got before with std::find() will be useless, specially if the text has special characters.

    So is there a way to display a std::string on a QLineEdit without converting to QString?

    thanks

    submitted by /u/anandmohandas
    [link] [comments]

    What are the best learning resources for the HTTP protocol?(Books, websites, etc)

    Posted: 25 Aug 2021 11:22 AM PDT

    Need it primarily for API testing and reverse engineering API's

    submitted by /u/daddyclappingcheeks
    [link] [comments]

    Module (textract PDF-extractor) runs differently when running in console vs PyCharm

    Posted: 25 Aug 2021 09:12 AM PDT

    I am writing a script that extracts and filters questions from old swedish med school exams from a certain university, based on words entered as filter. Things have been going relatively smoothly but I've run into a very strange problem while trying to make the script into a CLI-tool.

    The script runs fine in PyCharm, and ran fine in terminal as well up until recently. Now the script parses questions differently in terminal vs PyCharm.

    The error I'm getting in terminal is on a line for parsing the question answer based on certain character in the question using re.search. In terminal, the answer alternatives (and the special character I'm using to identify the correct answer) is gone from the full exam text and as an effect also gone from the parsed question. I'm using the module textract to extract the exam text from a PDF file.

    I'm wondering if this could be because PyCharm maybe uses a different version of textract, or runs it in a different way, or something similar?

    The line that is giving different text extraction depending on if it is run in terminal or PyCharm is this one:

    exams.append(Exam(textract.process(filename).decode('utf-8'), filename)) 

    The question which is being shortened when the script is run in terminal is this one:

    Question 22
    Vid separation av proteiner med SDS-polyakrylamidelektrofores utnyttjar man att SDS kan denaturera proteinerna. Man utnyttjar också en annan effekt av SDS på proteinerna för att separera dem. Vilken?
     [correct answer character]
    Effekt på laddning
     [incorrect answer character]
    Effekt på amfifilitet
     [incorrect answer character]
    Effekt på isoelektrisk punkt
     [incorrect answer character]
    Effekt på hydrofobicitet

    And the way it is parsed when the script is run in terminal looks like this:

    22
    Vid separation av proteiner med SDS-polyakrylamidelektrofores utnyttjar man att SDS kan denaturera proteinerna. Man utnyttjar också en annan effekt av SDS på proteinerna för att separera dem.

    The full script (≈ 150 lines of code) is here: https://github.com/emileberhard/MedTentaScanner

    I also checked the python version being used in both terminal and PyCharm and both are using Python 3.9.6.

    submitted by /u/emileberhard
    [link] [comments]

    Custom ROM

    Posted: 25 Aug 2021 08:20 AM PDT

    hey programers, i am just a noob enthusiast who wants to know what cuatom roms are good for oneplus 7t pro? i looked into graphene and calyx but they don't support oneplus.

    submitted by /u/Thelast_n_thecurious
    [link] [comments]

    [Visual Studio 2008] Can't add reference

    Posted: 25 Aug 2021 08:04 AM PDT

    I'm getting an error when trying to add Enum.NET.

    I've tried everything that I can think of:

    • Signing it before building in VS2019 with multiple different certs.
    • Downloading from NuGet, un-archiving, and adding from there.
    • Signing with SignTool.

    I don't understand why this is happening. It doesn't happen with any other .dll I've added.

    Any advice would be appreciated.

    Thanks in advance!

    submitted by /u/emblivestudio
    [link] [comments]

    I have an error of "MouoseX/MouseY does not exist in the current context" in Unity. Can someone help, please? Here is the code:

    Posted: 25 Aug 2021 05:53 AM PDT

    using System.Collections;

    using System.Collections.Generic;

    using UnityEngine;

    public class NewBehaviourScript : MonoBehaviour

    {

    [SerializeField] private float sensX;

    [SerializeField] private float sensY;

    Camera cam;

    float MouseX;

    float MouseY;

    float multiplier = 0.01f;

    float xRotation;

    float yRotation;

    private void Start()

    {

    cam = GetComponentInChildren<Camera>();

    }

    private void Update()

    {

    MyInput();

    cam.transform.localRotation = Quaternion.Euler(xRotation, 0, 0);

    transform.rotation = Quaternion.Euler(0, yRotation, 0);

    }

    void MyInput()

    {

    mouseX = Input.GetAxisRaw("Mouse X");

    mouseY = Input.GetAxisRaw("Mouse Y");

    yRotation += mouseX * sensX * multiplier;

    xRotation -= mouseY * sensY * multiplier;

    xRotation = Mathf.Clamp(xRotation, -90, 90);

    }

    }

    submitted by /u/FreddieOnReddit
    [link] [comments]

    How do I get a high quality stack trace on a program run through SSH?

    Posted: 25 Aug 2021 05:09 AM PDT

    I've written a server in C++. I've fixed all the low-hanging bugs I can find using Xcode's stack traces.

    Porting to my Raspberry Pi and running through SSH, I get infrequent crashes. I'd love to know where my program is crashing.

    How can I get a stack trace over SSH?

    submitted by /u/XiPingTing
    [link] [comments]

    what should i look for in a programmer to finish my project?

    Posted: 25 Aug 2021 09:47 AM PDT

    trying to create

    very similar to the current google chrome page monitor extension. been using that free program since it's inception and never ran into issue until they stop making updates and now it's buggy.

    Need an extension or simple program that allows my browser to monitor changes to web pages for you. It can inform you whenever a particular page changes without you having to go and check every time.

    must:

    ✓ Monitor any number of pages for changes (no limits)
    ✓ Add pages with two clicks.
    ✓ Visually select parts of a page to track/ or entire page
    ✓ Smart comparison system that ignores ads and code changes.
    ✓ Highlighting of changes that happened to a page since the last check.
    ✓ Set separate check interval for each page.
    ✓ Set a sound alert when a page change is detected.
    ✓ Custom sound alerts.
    ✓ Desktop notifications.
    ✓ Import and export the monitored pages list.
    ✓must be able to handle 30 secs-1 minute checking intervals
    ✓must not be detected as an automated bot when accessing the website
    ✓able to send notification to mobile device/ email in REAL time

    and anything else that I might have missed, but may be useful

    NOTE:
    my previous freelancer completed a good portion of the job, but had to discontinue it due to other circumstances, so a file will be provided to you and I just need tweaking and adjustments handled and finish touches

    i believe a server is needed? Heroku from git repo

    so far the program is able to do

    -Project inception, includes sliding panel with list of monitored pages, and a way to add/edit/remove pages, select interval

    -Page check and comparison core, uses smart approach to ignore design changes, will run at specified interval, will send desktop notifications and show as list in separate tab of the panel

    -Ability to specify keywords and ability to select specific page element/area

    -Tracking visual changes before/after by capturing elements 'screenshot' and attaching to notification

    submitted by /u/Registeelurgirl
    [link] [comments]

    What the hell does "land" mean?

    Posted: 25 Aug 2021 01:54 AM PDT

    People keep saying "land" certain tasks. It's so common, I'm too afraid to ask

    submitted by /u/greywolf_18
    [link] [comments]

    How to write an app for Desktop+Web+iOS

    Posted: 24 Aug 2021 11:20 PM PDT

    Hey, I'm currently developing a to-do list app for desktop in Python. Eventually I want to add a website interface and an iOS app, that will all allow the user access to their lists.

    I could simply write three different apps, and just have them all share the same remote database (like Firebase). I'm asking if there's a technology / language / service that'll allow me to share as much programming-code between those interfaces?

    I'd also appreciate any advice on doing this project.

    submitted by /u/twiddlebum
    [link] [comments]

    No comments:

    Post a Comment