r/StackoverReddit • • Jul 25 '24

Question Fetching from a DB

2 Upvotes

I’m looking for a method or tutorial to allow fetching of data either from a database or google sheets.

The premise is that the data is text only, for example sports results, simple housing information.

The front end is just a basic search bar that can query and pull info out of the DB and display it.


r/StackoverReddit • • Jul 23 '24

Question how to continuously update an image

Thumbnail self.csharp
2 Upvotes

r/StackoverReddit • • Jul 20 '24

Question does any body know if there is a stack overflow extension or something like it for vs code ?

2 Upvotes

r/StackoverReddit • • Jul 18 '24

Javascript How do I set my Discord online status via JS in Chrome?

Thumbnail
self.learnjavascript
2 Upvotes

r/StackoverReddit • • Jul 17 '24

Question Customize Haproxy router configuration in openshift 4

2 Upvotes

I have a java web app deployed in payara server as a multi instance solution in openshift.

  • I have exposed my application pods via a service, which is exposed to the outside world using a load balanced route. Currently, its using the source ip of the clients requests to assign a cookie and figure out which backend application pod the request goes to, enabling stickiness so that the clients communicate with the same application pod until failure.

  • My application has not enabled session replication due to some issues with web sockets, so I cannot use the "leastconn" load balancer by disabling cookies. I am forced to choose either source or random for my load balancer configuration, and this is not optimal for my web application since most of my clients sit behind a reverse proxy, so when they are accessing the application their source ip is the same, and all of them are being routed to the same application pod, which defeats the purpose of the load balancer and the multi instance deployment.

I found that you cannot manually configure the HAProxy router since openshift 4, Is there any workaround so that I could manually configure the settings for the router in such a way that it use the Jsessionid cookie generated by my web app to in the least randomly assign backend application pods so that the traffic is atleast distributed among the backend application pod?.


r/StackoverReddit • • Jul 17 '24

C++ Is there a way to run vcpkg without visual studio on windows?

2 Upvotes

I don't like the Visual Studio editor, so I installed MSVC via PortableBuildTools. For package management, I installed vcpkg, but every time I try to install a package, this error message appears:

-- Running vcpkg install
Fetching registry information from https://github.com/microsoft/vcpkg (HEAD)...
error: in triplet x64-windows: Unable to find a valid Visual Studio instance
Could not locate a complete Visual Studio instance

-- Running vcpkg install - failed
CMake Error at %VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake:902 (message):
  vcpkg install failed.  See logs for more information:
  .\build\vcpkg-manifest-install.log

The message is not exactly the same because I shortened paths for where vcpkg is installed and the location of the log file. Everything else is the same. Vcpkg is installed from the official repo, and PortabeBuildTools just installs proper MSVC in a custom location.

OK, I found out why I didn't notice that the Visual Studio installer doesn't force you to install the IDE. You need to launch the executable and delete any instance of the ide or build tools (installed via the installer), and the build tools don't appear on the available tab.


r/StackoverReddit • • Jul 15 '24

Other Code Can anyone tell me how can I host my website

2 Upvotes

r/StackoverReddit • • Jul 12 '24

Question Is VPS a Good Option for a Small CRM with Low Traffic?

2 Upvotes

Hi everyone,

I'm working on a small CRM project and considering using a VPS for hosting. Here are some details about the project:

  • Backend: Node.js

  • Frontend: Vue or React

  • Database: PostgreSQL or MongoDB

We expect low traffic initially, and we are working with a small budget, so cost is a major factor for us. I've been looking into VPS options due to their low price and flexibility. Hostinger seems like a good fit, especially with their great support.

My questions are:

  1. Is a VPS a good option for a small CRM with low traffic?

  2. If yes, what VPS plans would you recommend?

  3. Has anyone had experience with Hostinger's VPS services? Are they reliable?

Any advice or recommendations would be greatly appreciated!

Thanks in advance for your help!


r/StackoverReddit • • Jul 11 '24

Python which is the best python course

2 Upvotes

I want to create automation softwares and web apps


r/StackoverReddit • • Jul 09 '24

Python How to solve this linear system with python?

2 Upvotes

I have a system with 3M equations and 3M + 3 variables such as:

https://imgur.com/a/pykWzAq

Assuming all coefficients a, b, c, d, e, f and g are known.

With the boundary conditions I add the 3 equations needed to have as many equations as variables, so I should be able to write a code on python that solves this, but I don't quite get how to do it... I would know how do it if one of the boundary conditions was tau_0 = 0 as then we just march in k, but I struggle a little bit with the boundary condition of u_k=M = 0...

I get that I have to put it in matrix notation I guess, so I should linearize it and have Ax = B where A is a matrix of 3Mx3M, x is a vector 3M, right? But even if I'm understanding the theory correctly I have no idea how to write it in python.


r/StackoverReddit • • Jul 09 '24

Javascript Building Science Simulations

2 Upvotes

Hello Everyone, i was recently hired as a Jr Technical Projects Engineer at an edtech company and one of the products underway requires integration of STEM simulations like the ones provided by https://phet.colorado.edu/ but custom made. I would like to know and get advice on which strategy or tools do i need to learn to be able to design and develop the animations.

Thank you


r/StackoverReddit • • Jul 08 '24

Question Recommendations for the Best React/Next.js Dashboard Template for Car Rental Agency CRM

2 Upvotes

Hello everyone,

I'm working on a freelance project to create a CRM for a car rental agency, To save time and ensure a professional look, I'm considering purchasing a pre-built dashboard template built with React or Next.js. I'm looking for recommendations on the best dashboard templates that would suit this type of project.

If anyone has experience with a particular template or can recommend one that fits these requirements, I would greatly appreciate your input. Links to the templates and any pros/cons based on your experience would be very helpful.

Thank you in advance for your help!


r/StackoverReddit • • Jul 08 '24

Kubernetes Help Needed: Debugging .NET Applications Running in Kubernetes with Rider

Thumbnail
self.jetbrains
2 Upvotes

r/StackoverReddit • • Jul 08 '24

Question Seeking Advice on the Best Architecture for a CRM for Rental Car Agencies

2 Upvotes

Hello everyone,

I recently landed a freelance project to create a CRM for rental car agencies. The main goal is to build a system where we can add agencies, and they can access a dashboard to manage all their services, including car inventory, bookings, and customer management.

I'm looking for advice on the best architecture for this type of project. Here's a brief overview of what I have in mind:

Frontend:

  • Next.js for a responsive and interactive UI

Backend:

  • Node.js with Express.js for handling server-side logic

Database:

  • PostgreSQL or MongoDB for storing agency and service data

Authentication:

  • Considering using Auth0 or a custom JWT-based system for user management

Deployment:

  • Docker for containerization

  • Cloud services like AWS or DigitalOcean for deployment

Questions:

  1. What architecture would you recommend for this project? Are there any best practices or design patterns I should follow?

  2. Should I use a microservices architecture or stick with a monolithic approach?

  3. What considerations should I keep in mind regarding scalability and maintainability?

  4. Are there any specific tools or libraries that you would recommend for implementing these features?

  5. What are some common pitfalls or challenges I should be aware of when building a CRM of this nature?


r/StackoverReddit • • Jul 08 '24

Question Is there a way to get fetch public events based on location?

2 Upvotes

Hi, I'm new to this and tried looking everywhere, but I cannot get a clear-cut answer. Is it possible to fetch public events based on location using Facebook API? I am trying to build an app that shows events based on the user's location.

Any help and guidance would be appreciated!


r/StackoverReddit • • Jul 06 '24

C++ How do you compile/build FFmpeg source code from git repo using vscode

2 Upvotes

Hello everyone. I downloaded the source code of FFmpeg, and I know that you have to build it but there are no step-by-step guides on how to do it using vscode. Could someone point me in the right direction thanks!


r/StackoverReddit • • Jul 05 '24

Python Adding a polkit policy to a python GTK app, what am I missing ?

2 Upvotes

Hi everyone, I'm currently making my first python+GTK4 and I need to use some pkexec command for having root permission for stuffs like dnf install, dnf list, ecc.

I'm posting because I'm trying from a few days to make the user insert the admin password just one time instead to have to do that for every command. So I maked a test python app trying to achieve it. My goal is to have a smooth and simple user experience like Gparted or Input Remapper.

I created my Polkit policy file and I place it the right place /usr/share/polkit-1/actions/ and the policy is the following with the name "com.prova.setup.app.policy" :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
        "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
        "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd"
        >
<policyconfig>
    <action id="com.prova.setup.app">
        <description>Run Input Remapper as root</description>
        <message>SE MI LEGGI VUOL DIRE CHE FUNZIONA !</message>

        <defaults>
            <allow_any>no</allow_any>
            <allow_inactive>auth_admin_keep</allow_inactive>
            <allow_active>auth_admin_keep</allow_active>
        </defaults>
        <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/python</annotate>
        <annotate key="org.freedesktop.policykit.exec.argv1">/usr/bin/prova-setup</annotate>
        <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>

</policyconfig>

This is the spec file I made to build it as an RPM to install on the Fedora system (the true program will only be for Fedora) is the following :

Name:           prova-setup
Version:        0.1
Release:        1%{?dist}
Summary:        A simple Python project

License:        MIT
URL:            https://example.com/simple_project
Source0:        %{name}-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:   gtk4-devel
BuildRequires:   libadwaita-devel

Requires:       python3
Requires:       gtk4
Requires:       libadwaita

%description
This is a simple Python project to demonstrate RPM packaging.

%prep
%setup

%build
%py3_build

%install
%py3_install

install -Dm644 desktop/prova-setup.desktop %{buildroot}%{_datadir}/applications/prova-setup.desktop
install -Dm644 desktop/prova-setup.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/prova-setup.svg
install -Dm644 desktop/prova-setup.policy %{buildroot}%{_datadir}/polkit-1/actions/prova-setup.policy

mkdir -p %{buildroot}%{_datadir}/prova-setup
cp -r  data/* %{buildroot}%{_datadir}/prova-setup/



%files
%doc README.md
%{_bindir}/prova-setup
%{python3_sitelib}/prova_setup*

%{_datadir}/applications/prova-setup.desktop
%{_datadir}/icons/hicolor/scalable/apps/prova-setup.svg
%{_datadir}/polkit-1/actions/prova-setup.policy
%{_datadir}/prova-setup/*


%post
update-desktop-database &> /dev/null || :

%changelog
* Thu Jul 01 2024 Developer <[email protected]> - 0.1-1
- Initial package

The dummy python app I wrote to learn how polkit and pkexec work is the following :

# IMPORTAZIONE DEI MODULI
import sys, gi, subprocess, time, os

# RICHIESTA DELLE VERSIONI DI GTK ED ADWAITA
gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')

# IMPORTO I MODULI GTK E ADWAITA
from gi.repository import Gtk, Adw, Gdk

print("sto funzionando")

# DEFINISCO LA SOTTO-CLASSE CHE RAPPRESENTA LA FINESTRA PRINCIPALE
class contenuto_finestra_principale(Gtk.ApplicationWindow):

    # IMPORTO GLI ATTRIBUTI E METODI DELLA CLASSE MADRE GTK.APPLICATIONWINDOW
    # UTILIZZANDO LA FUNZIONE INIT E LA SUPERCLASSE
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        
        # DEFINISCO LE DIMENSIONI DELLA FINESTRA ALL'AVVIO
        self.set_default_size(800,600)

        # DEFINISCO IL TITOLO DELLA FINESTRA
        self.set_title("Primo programma in GTK")

        # CREO IL BOX PRINCIPALE ALL'INTERNO DELLA FINESTRA
        # EGUAGLIANDO UN ATTRIBUTO DELLA CLASSE ALLA FUNZIONE CHE
        # GENERA IL WIDGET NELLA LIBRERIA GTK
        self.box_principale = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        # ASSEGNO IL BOX PRINCIPALE ALLA FINESTRA
        self.set_child(self.box_principale)

        # CREO IL PRIMO BOX INTERNO AL BOX PRINCIPALE
        self.box_1 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)

        # ASSEGNO IL BOX_ ALLA FINESTRA
        self.box_principale.append(self.box_1)

        # CREO IL SECONDO BOX INTERNO AL BOX PRINCIPALE
        self.box_2 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)

        # ASSEGNO IL BOX_2 ALLA BOX PRINCIPALE
        self.box_principale.append(self.box_2)

        # CREO IL BOTTONE 2
        self.bottone_principale = Gtk.Button(label="CLICCAMI")

        # ASSEGNO IL BOTTONE PRINCIPALE AL BOX 1
        self.box_1.append(self.bottone_principale)

        # ASSEGNO UNA FUNZIONE AL BOTTONE
        self.bottone_principale.connect('clicked', self.funzione_bottone_principale)

        # CREO IL CONTENITORE DELL'INTERRUTTORE DI PROVA
        self.box_interruttore_prova = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        self.box_interruttore_prova.set_spacing(5)

        # ASSEGNO IL BOX INTERRUTTORE DI PROVA AL BOX PRINCIPALE
        self.box_2.append(self.box_interruttore_prova)

        # CREO UN INTERRUTTORE DI PROVA
        self.interuttore_prova = Gtk.Switch()

        # ASSEGNO L'INTERRUTTORE AL BOX INTERRUTTORE DI PROVA
        self.box_interruttore_prova.append(self.interuttore_prova)

        # CREO LA TARGHETTA DI TESTO DELL'INTERRUTTORE DI PROVA
        self.tag_interruttore_prova = Gtk.Label(label="Un interruttore")


        # ASSEGNO LA TARGHETTA DI TESTO AL BOX DELL'INTERRUTTORE DI PROVA
        self.box_interruttore_prova.append(self.tag_interruttore_prova)



    # DEFINISCO LA FUNZIONE DEL BOTTONE PRINCIPALE 
    def funzione_bottone_principale(self, bottone_principale):
       
       test()



# DEFINISCO LA SOTTO-CLASSE CHE PERMETTE LA CREAZIONE E MESSA SCHERMO DELLA FINESTRA PRINCIPALE
class genera_finestra_principale(Adw.Application):

    # IMPORTO GLI ATTRIBUTI E METODI DELLA CLASSE MADRE ADW.APPLICATION
    # UTILIZZANDO LA FUNZIONE INIT E LA SUPERCLASSE
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        # VIENE RICHIAMATA LA FUNZIONE "CONNECT" UTILIZZANDO COME PARAMETRI "ACTIVATE"
        # E LA FUNZIONE DI GENERAZIONE DELLA FINESTRA PRINCIPALE 
        self.connect('activate', self.attivazione_finestra_principale)



    # DEFINISCO LA FUNZIONE / METODO DELLA CLASSE PER GENERARE LA FINESTRA PRINCIPALE
    def attivazione_finestra_principale(self, finestra):

        # CREAZIONE DELLA FINESTRA PRINCIPALE
        self.finestra_principale = contenuto_finestra_principale(application=finestra)

        # MANDO A SCHERMO LA FINESTRA CON LA FUNZIONE "PRESENT"
        self.finestra_principale.present()


def test():

    # LETTURA DELLA LISTA DELLE LIBRERIE INSTALLATE
    # READING INSTALLED LIBRARY LIST
    library_list_output = subprocess.Popen("pkexec dnf list installed | grep lib", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
    
    library_list, library_list_err = library_list_output.communicate()   
    print(library_list)

    update_list_output = subprocess.Popen(f"pkexec dnf update", shell=True,  stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
    update_list, update_list_err =update_list_output.communicate()
    print(update_list)


def main():
    
    # DEFINIZIONE DELL'ID DEL PROGRAMMA E DELLA VARIABILE CHE RAPPRESENTA LA FINESTRA DEL PROGRAMMA
    finestra = genera_finestra_principale(application_id="com.prova.setup.app")

    # AVVIO DELLA FINESTRA PRINCIPALE
    finestra.run(sys.argv)
    input("Premi un tasto qualunque per uscire ")

if __name__ == "__main__":
    main()
    input("Premi un tasto qualunque per uscire ")

The setup.py file is the following :

from setuptools import setup, find_packages

setup(
    name="prova-setup",
    version="0.1",
    packages=['prova_setup'],
    
    entry_points={
        "console_scripts": [
            "prova-setup=prova_setup.main:main",
        ],
    },
)

And here we go with the last piece, the .deskop file :

[Desktop Entry]
Type=Application
Version=0.1
Name=Prova di Setup.py
Comment=Una semplice ed umile descrizione
Exec=prova-setup
Icon=prova-setup.svg
Terminal=true
Type=Application
Categories=Utility;

Please help figure out what I'am doing wrong, this is the only way to finish my first (FOSS) app. Thank you all for reading and sorry for the bad english but I'm not a native speaker. :)


r/StackoverReddit • • Jul 04 '24

Question I need help with React/Next app that communicates with a Wordpress rest API

2 Upvotes

Hi, I don't have a lot of experience in this field and frankly I'm at the end of my rope, I'm lost and confused.

Requirement:

A client comes to us with their wordpress CMS and they want a web app that communicates with their CMS via wordpress rest API and displays everything dynamically. So posts, header and footer links, pages, everything. Since we don't know what or how they have it set up, we decided to make a somewhat generic template and for each customer we update it accordingly.

The problem:

Since everything is dynamic, we need to ask the API for everything (Like what menus do those people have in their CMS, what links are in their footer, their order, how they belong to one another, what posts, what pages, what categories, etc., I never used wordpress in my life too before so this makes it more complicated) and for that, everything has to be loaded after the app first loads itself.

I installed JWT plugin in the test CMS wordpress that we have, now when my app loads I have to first block any request till I make a request to generate a JWT, store it, then allow the rest of the app to run since every single request (other than public /posts, I guess?) need the JWT, otherwise they fail with 401.

I at first went with React, load the app, show loaders everywhere till responses come back. It worked ok but its slow and loaders (spinning circles, etc) are everywhere since every thing is dynamic.

Then I researched NextJS a little bit and how it can server-render everything before sending it back to the client, so I thought if I can render everything before showing the user anything then send it back all at once that would be great. So I spent the last few hours migrating my React template into NextJS one.

Now comes the part where I again have to fetch the dynamic data.

First, fetch the JWT and store it, I tried to store it in a cookie (NextJS middleware that runs on every request, if no JWT create one and store it, otherwise do nothing) but then Next told me that my home path is no longer static because it's using cookies so I have lost the whole server-side rendering thing (`Route / with dynamic = "error" couldn't be rendered statically because it used cookies.`). My idea was to get the JWT and store it before any other http request is made since they all rely on it so that had to happen on app load.

What do I do?

Am I over-complicating this? Are there simpler solutions? I thought about password/username auth then I can just authenticate every request on its own and there won't be an initializing/create-jwt step, but then the password and username will be easily accessible and visible in the browser. Are there frameworks to help with? Does wordpress have anything to make it work with React? Is this not how people do it? when they have a CMS and they just want a UI?

I have no senior in this company to consult, got this job recently in a startup and I am the senior, I have had this issue for a long time now, first solved it with React and now today was attempting to see if NextJS has a better solution.

I'm really lost and IDK what to do, I would highly appreciate any guidance, thank you all. If anything came from this so far is that I learned a little bit about NextJS :D


r/StackoverReddit • • Jul 01 '24

Python aiohttp websocket disconnect

Thumbnail self.learnprogramming
2 Upvotes

r/StackoverReddit • • Jun 23 '24

Question DSA course

2 Upvotes

I am just about to enter second year of engineering. My branch is Btech IT...I am planning to start learning dsa. I am wondering how to...I purchased the gfg complete interview course but i was wondering whether to follow the gfg course or strivers a2z playlist , because I heard striver does more questions from leetcode etc as well


r/StackoverReddit • • Jun 23 '24

Question Can someone recommend me a data science course

2 Upvotes

r/StackoverReddit • • Jun 23 '24

Question Looking to collaborate on a trading terminal

2 Upvotes

Hi, i freshly started to work on a trading terminal which can enable trading across multiple exchanges from the same interface, working on a fastapi backend at the moment and would like to have collaboration/coding partners


r/StackoverReddit • • Jun 21 '24

The Best Way To Map Objects in .Net in 2024

2 Upvotes

In today's blog post you will learn how to map objects in .NET using various techniques and libraries. We'll explore what is the best way to map objects in .NET in 2024.

https://antondevtips.com/blog/the-best-way-to-map-objects-in-dotnet-in-2024


r/StackoverReddit • • Jun 20 '24

Question coding Insta manager app?

2 Upvotes

For context, a couple years ago I was able to create a Snapchat manager app, where you could manage all of your friends, blocked, they added you but you didn't etc, all in one place using Snapchat's api for a Hackathon. So it wasn't super intensive, and I didn't have to go through any regulations or checks. I was wondering would I be able to do the same for Instagram as well using one of their api's such as the graphapi? Or would I still have to have it approved by Instagram for the authentication even if I'm the only one who's going to be using it? The intent is just for it to be a fun little project that would also be useful for me so I won't have to download sketch apps lol