• Breaking News

    Thursday, February 3, 2022

    Best way to host website + api + database Ask Programming

    Best way to host website + api + database Ask Programming


    Best way to host website + api + database

    Posted: 03 Feb 2022 03:15 AM PST

    I seem to have some gap in my knowledge. For years I used LAMP stack and I just always used some webhost that had a mysql database easily available.

    Now I'm building a project using javascript/html, aspnet core web api, and sqlite. I host the aspnet core API as a docker. But that has been very problematic with the sqlite database. It looks like it's easier to host the database separately to keep the data on each deployment.

    So should I host a website + docker with api + MS sql database? That's three different sources as I see it. Is this okay?

    This is so easy at work where we use a full stack framework and someone else does the database stuff. But this is a hobby project. I just need a website, that calls an api, that stores/gets things from a database. What's the best way of hosting all three?

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

    Is there a best practice for running maintenance code in production

    Posted: 03 Feb 2022 03:59 AM PST

    During my career there always was a need to run some kind of servicing code one time or in specific intervals. Things like: recalculating data after a breaking change, recreating permissions, clearing/rebuilding caches etc. Since I mostly done web applications I would usually resort to creating specific endpoints within my application. This would allow me to use all the existing code that was already built I.e. I could use a class like UserPermissionEvaluator to recreate permissions instead of figuring them out myself and preparing an SQL script to update the data directly in database. I even wrote a cli tool for asp.net applications once that would allow to annotate such endpoints with an attribute and then list them and run the methods from cli. I always expected that this would be a common problem and that there would be a lot of tools to support such ad hoc code that needs to be run. However, I didn't really find any useful tools for the technologies I worked with. What is your experience with creating and running ad hoc maintenance code? How do you do this? Do you have best practices? Do you use any tools to speed that up?

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

    How can a hash lookup be O(1) if I still have to traverse the physical memory of the array?

    Posted: 03 Feb 2022 09:35 AM PST

    If I understand correctly, a hash map allows me to find a value in an array as follows:

    1. I pass a key as an argument to the hash function.
    2. The hash function calculates a (hopefully unique) result, which is an array index.
    3. I visit that index in the array, and there is the value that I wanted to look up.

    I get that this is faster than iterating through the array looking at each value, comparing its key to my lookup key, seeing if they match, and returning the result at that index. But I don't see why it's O(1) vs O(n) for a linear search. On a pure machine code level, don't I still have to cross through all the memory of the array anyways? That is, if I know that my array occupies the memory block at addresses 101 - 1110, and my hash function returns an address value of 1101 for the location of my hashed value, it seems like there must be some address reader that starts at 101, and then slides through 110, 111, 1000, etc until it reaches 1101 to retrieve the value, so it's still crossing O(n) space to get to the value.

    Or is there something about how memory physically works that makes moving between the addresses instantaneous regardless of the distance, and we only spend O(n) time if we actually stop to read the contents at a given address?

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

    How to create user input in the JavaScript console?

    Posted: 03 Feb 2022 01:39 AM PST

    I'm creating a short game in the JavaScript console, and for inspiration, I looked at google's easter egg version (if you search text adventure then press f12 you can see it). I wanted input, the only way I could figure out how to have input was by having functions, so for instance:

    console.log('Do you like chocolate ice cream?'); function yes() { console.log('I don't like chocolate ice cream.'); } function no() { console.log('Yeah, I agree. Who even likes chocolate ice cream anyways?'); } 

    But in google's version, you can just type yes, and it returns a bunch of text, no parentheses. I tried with variables but it didn't really look nice and it turned out green. Does anybody know how to make it google's way?

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

    What skills are necessary to try out the 'AI learns to play video game' tools?

    Posted: 03 Feb 2022 09:45 AM PST

    I've seen a number of videos on YouTube for people who have tasked 'Machine Learning' of various levels of complexity to brute force learn a game. For example, MarI/O, World's Hardest Game, Super Mario Bros. I've been interested in trying it out for myself on some other very simple games, but my googling has not found what I'm looking for.

    In essence my question is: If I wanted to create the most basic kind of 'machine learning' to play something like Noughts & Crosses aka Tic Tac Toe, what would be the best way to do it? Are there any tools I can use and adjust to my needs, or do I need to build something from scratch?

    To start off I don't need the most robust solution that provides perfect results, but ideally I'd be able to get something I can iterate on pretty quickly and learn as i go.

    I wouldn't consider myself an experienced software developer, but I'm not opposed to learning anything necessary, as long as it's achievable in a modest amount of time (days or weeks). If it turns out the answer is "first complete a degree in computer science" I'll probably just abandon the project :(

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

    Why is clangd not recognizing standard libraries like "iostream"

    Posted: 03 Feb 2022 05:15 AM PST

    So I was trying to install clangd as a lsp for my text editor and noticed, that clangd does not recognize iostream or stdio.h. After trying to google a solution only found something that related to clang as a compiler and not a fix for the language server.

    So is there a reason clangd is behaving this way and how does one fix it ?

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

    Is there a code that can generate a custom number of jpgs with a single color, but each colour has to be different? If so, do you mind to share/say where you got it?

    Posted: 03 Feb 2022 08:56 AM PST

    Me and my friend are coding a achievement clicker game with 10k achievements(we know it's a lot)and we were just planning on making a simple jpg image with a single colour on it, and it would then obviously be awesome to have a code that does it for me, also what language do I need to use? And also, do you mind share the script or where you got it from?

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

    Do I need to study Physics to be a good programmer?

    Posted: 03 Feb 2022 08:15 AM PST

    Hi everyone! I was wondering if it is necessary to study physics to be a good programmer in the remote work field.

    Currently I'm living in South America, and I wanted to know how beneficial it would be for me to invest the extra time and money in a university that includes Physics in their CS program. I plan to apply for remote work once I've learnt enough.

    Feel free to also give me any advice you consider I should know.

    Thanks in advance!

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

    JS/React.JS or Kotlin

    Posted: 03 Feb 2022 07:12 AM PST

    So I just started a new job as a Front End Junior Developer and my manager has laid out two paths in front of me for the next few months and I don't really know what to pick.

    First option: JS Focused with React/Redux, Graphql

    Second option: JS and Kotlin

    I find both pathways interesting, but my main focus is I'm just curious about the career implications of both pathways.

    Any knowledge in this area would be greatly thanks!

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

    Trying to make an autofill submission form

    Posted: 03 Feb 2022 06:56 AM PST

    So, I am very much not a programmer, but I've got a problem I think a program could solve. at my job we have to make entries into several different spreadsheets and chats. I want to streamline things for my team so we can put the information in one spot and have it go out across multiple sheets and chats without us having to waste time putting it there manually. Has anyone solved an issue like this before? to my laypersons perspective this shouldnt be to hard to solve, but again, I'm not a programmer.

    submitted by /u/Pancake-4-Dinner
    [link] [comments]

    any advice for naming things

    Posted: 02 Feb 2022 10:57 PM PST

    freshmanjstudying computer science, just over a year of python experience. So a beginner, but past basic syntax

    Ive read a few articles, and really didnt learn much. I did learn to name boolean with the prefix is, which is clever, but that was it

    and a friend said "Sometimes when I'm feeling crazy I name them after politicians" which I know isnt great advice but Its worth sharing cause its funny

    submitted by /u/Mission-Guard5348
    [link] [comments]

    While loop

    Posted: 03 Feb 2022 03:36 AM PST

    why does my while loop stops at "5"? is it because i started at index 2(1)?
    here's my loop:

    int i = 1;

    while(i<6){

    System.out.println(i);

    i++;

    }

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

    Is it possible to make a tool that'll send me notifications when new files in folder are larger than x amount of megabytes, if yes then how?

    Posted: 02 Feb 2022 11:37 AM PST

    Let's say I that I have already tool that makes screenshots and save them on in one folder but I want to get notification when screenshot is different from last one which basically means that it'll include more pixels so basically more bites.

    I am sorry I am not a programmer but I still tried to explain it in easiest way. I hope that I can find an answer on my question

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

    Why vim/emacs???

    Posted: 02 Feb 2022 11:45 AM PST

    I came to programming through physics, started using editors like sublime and atom.
    Then I did internships in industry, and came across the whole 'emacs vs vim' debate.

    My question is, why in the name of god would anyone use either of these??

    Out of necessity I have learned vim, but every time I do something like press 'y' to copy or 'd' to cut (y of course is short for 'yank', 'd' short for delete -- fucking really?), or type ":wq" to save and exit, I have to sit back for a moment and just shake my head.

    THIS MAKES NO SENSE
    WHY ARE WE DOING THIS
    WHY WOULD WE NOT JUST USE ANYTHING ELSE IN THE GOD DAMN WORLD OTHER THAN THESE???

    Is this just momentum from the coders of the early 90's, who were fine with impossible user interfaces? Or is there a real benefit I am missing out on, which could possibly overcome the immense downside of having to learn a whole new user interface language.

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

    Creating a form/generator on Wix

    Posted: 03 Feb 2022 02:09 AM PST

    I'm trying to create a LinkedIn job update generator (just for lolz) and I have no idea how to do it.

    Right now using Wix, first step is I've created a form where you enter your data (1. Past company, 2. New job, 3. Name of new company) and now I need to figure out how that data get's into a pre-written text (the generator part).

    Pretty open question, do you have any idea how to do that?

    Just an example:

    1. past company = ISIS
    2. New job = DICTATOR
    3. Name of new company = WALMART

    Generated copy, after you've entered your data, just a shitty example:

    Everybody, stop what you're doing and read about me. Yesterday I quit my dream job at ISIS. Now I'm looking forward to start at WALMART. It's a new challenge, but I love challenges, especially when it means a pay rise. I'll be starting as a DICTATOR, just so you know. Remember to like everybody, that would raise my self-esteem extremely much <3.

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

    Request approval workflow

    Posted: 02 Feb 2022 11:22 PM PST

    Good morning/evening everyone!

    I'm a little lost right now as Its been requested of me to make a webapp that users can fill in forms, with data and files, Then submit them to be approved along a certain path. And I have to use ASP.NET which I have zero experience with but I know C# well.

    Anyways, I'd appreciate if anyone could help guide me down the right path and not keep running around like a headless chicken.

    Edit: Oh and I forgot to mention that the usernames are coming from an AD so I don't have a db that contains all users within the app.

    Thanks

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

    What is the best way to earn money with coding ?

    Posted: 03 Feb 2022 05:16 AM PST

    Hey, I would like to know what's your opinion on this.

    What's the best way to make money with coding except working a job. I'm asking for something more on the side hustle side.

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

    Confused on making an API with existing database/webscrapper

    Posted: 02 Feb 2022 11:00 PM PST

    Hey guys apologies if this is a stupid question. I'm a data science student, basically as a side project I have a Python webscrapper that gets sports data. I run it manually every week and the data goes to a Postgre SQL database with about 3-4 tables.

    Any suggestions on how to make this into an API and run the Python script on a schedule? Could I convert my Postgre database into a CSV then JSON and make it into firebase database to make things easier? Or just make the API through python (Django/Flask)? Maybe Express.js?

    Basically I want a simple website that shows the data in a few tables for now, which I plan on expanding later. I know I could just connect my Postgre database to a website but isn't it better practice to have API calls to reference the data on the client side? Apologies if I'm all over the place just looking for advice on how to get started on this and what makes the most sense.

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

    I want to automate actions in an old program designed for manual entry. Where do I start?

    Posted: 02 Feb 2022 04:52 PM PST

    I would like to automate some tedious data entry tasks for my job. The catch is, I need to input data into an ancient program specific to my industry. It was likely built decades ago and hasn't been updated much since.

    Here are some actions you CANNOT perform in said program: * Search or filter a dropdown list (gotta scroll) * Copy/cut/paste. Really.

    For starters, is there any way to automate an action that selects and copies text from a spreadsheet and then TYPES the word out in the adjacent fields?

    If so, how?

    I'm not much of a programmer and was hoping to hack something together with the mac's built in script editor. If this isn't possible, what is?

    Thanks for any help! Even pointing out a relevant YouTube video could go a long way.

    submitted by /u/Walks-into-walls
    [link] [comments]

    If the class only provides the function to other classes, is it better to always provide the function using the interface to make a loose coupling?

    Posted: 02 Feb 2022 06:41 PM PST

    Example code

    Player(class user)

    class Player:MonoBehaviour { IControl controller = new Controller(); void Move() { controller.Move(this.gameObject); } void Attack() { } } 

    Controller(Function provider)

    public interface IControl { public void Move(GameObject gameObj); } class Controller : IControl { public void Move(GameObject gameObj) { if (Input.GetKey(KeyCode.A)) { gameObj.transform.position = new Vector3(0f, gameObj.transform.position.x - 0.1f, 0f); } if (Input.GetKey(KeyCode.D)) { gameObj.transform.position = new Vector3(0f, gameObj.transform.position.x + 0.1f, 0f); } etc..... } } 
    submitted by /u/user927310931
    [link] [comments]

    Creating passive income as a developer?

    Posted: 02 Feb 2022 03:15 PM PST

    I am looking to use my programming skills to develop something to create a passive income stream. But I am struggling to come up with a great idea. Please help?

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

    How to Edit Unreal Engine Plugin Source Code

    Posted: 02 Feb 2022 04:29 PM PST

    I am working on UnrealEngine, and one of the plugins is not working on Mac. In this link someone was able to edit the source code of the plugin to get it to work on Linux, because the original code only says "WhitelistPlatforms": [ "Win64" ]. Here is the link to what he did.

    https://www.babaei.net/blog/unreal-engine-modeling-tools-editor-mode-plugin-not-showing-up-linux-macos-workaround/

    I tried to do the same, but for Mac, although it isn't working. Here is the original source code for the plugin:

    {

    "FileVersion": 3, "Version": 1, "VersionName": "0.1", "FriendlyName": "Modeling Tools Editor Mode", "Description": "Modeling Tools Mode includes a suite of interactive tools for creating and editing meshes in the Editor", "Category": "Editor", "CreatedBy": "Epic Games, Inc.", "CreatedByURL": "[http://epicgames.com](http://epicgames.com)", "DocsURL": "", "MarketplaceURL": "", "SupportURL": "", "CanContainContent": true, "IsBetaVersion": true, "Installed": false, "Modules": \[ { "Name": "ModelingToolsEditorMode", "Type": "Editor", "LoadingPhase": "Default", **"WhitelistPlatforms": \[ "Win64" \]** } \], "Plugins": \[ { "Name": "MeshModelingToolset", "Enabled": true }, { "Name": "StylusInput", "Enabled": true } \] 

    }

    It is probably an easy fix, but I am not a programmer, so any help would be appreciated!

    submitted by /u/Professional-Name363
    [link] [comments]

    Unable to execute main method from src but able to run class from jar file by specifying classpath

    Posted: 02 Feb 2022 07:58 PM PST

    Hello, I'm new to java, maven and eclipse

    Below are the steps I followed and questions at the end
    1. ran git clone 'remoteurl.git' 'local folder name'
    2. cd to 'local folder name' (this folder has LICENSE, pom.xml files, quality-enforcement and src folders)
    3. ran mvn clean install (after this step a new folder called target gets created under 'local folder name')

    1. Then I cd to the target folder and ran the below command
      java -cp 'myfile.jar;./lib/\' com.aa.bb.cc.ClassName 'argument1' 'argument2'*

    I'm able to execute the main method of ClassName and get the expected results. However, after importing the whole project (local folder name) into eclipse, I went to ClassName -> right-click and selected 'Run as' and I got a few compilation errors.

    questions:
    1. what does the command mvn clean install do?

    1. are the .class files generated under target folder the compiled result of the .java files under the src folder?
    2. if #2 above is correct, why am I able to execute the class properly via command prompt (step 4) but not able to run /debug the corresponding .java file in eclipse?
    submitted by /u/factCheek
    [link] [comments]

    Setting up local programming environment for Python

    Posted: 02 Feb 2022 03:44 PM PST

    How necessary is this? I've never considered this and have just written in visual studio, no libraries (Idk what these are either) or nothing. I'm now a senior in college, and tasked with setting up a local programming environment for Python. Do I need to uninstall Python in order to set this up properly? I not only faked it til I made it I did so with A's and can't fail in the final semester.

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

    Anybody have any recommended ways to learn VIM?

    Posted: 02 Feb 2022 02:24 AM PST

    Been trying and I just dont get it. Im the only one on my team using nano and I feel like a pleb

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

    No comments:

    Post a Comment