• Breaking News

    Sunday, October 31, 2021

    Learning more about SSH Ask Programming

    Learning more about SSH Ask Programming


    Learning more about SSH

    Posted: 31 Oct 2021 01:14 PM PDT

    I use SSH in my daily work but I've never taken the time to do a deep dive.

    Are there any good resources out there? Kind of like cloudflare's learning center?

    https://www.cloudflare.com/learning/

    Or Youtube series or udemy courses?

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

    Valid differences between tabs and spaces in 2021? Genuine question.

    Posted: 31 Oct 2021 10:47 AM PDT

    Hi all,

    I have been writing software/websites for a while now and recently came across the mire that is tabs vs spaces. As the majority of my code was written in Python I stuck to 4 spaces per level of indentation and left the rest to autoformat. However now moving onto programming some projects in C, V and Go I would like to understand the debate objectively so that I can create a style guide for personal use.

    I have no issue using the style outlined in any pre-existing projects that I work on, but it would appear that everyone has different reasons for using one or the other in circumstances where the choice is up to them (i.e solo projects or when defining styles at new company).

    Does a list of valid differences between tabs and spaces exist in 2021 so that a newish programmer like myself can decide between one or the other? I have tried looking at older threads but they seem to decend quite quickly into a mire of hate as opposed to constructive converstation thus making it hard few new comers to understand what is going on.

    It is NOT my intention to start a war here.

    Thanks in advance!

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

    Handling front end facing identifiers for clients best practice?

    Posted: 31 Oct 2021 12:55 PM PDT

    In my app I need to expose some identifiers to my backend for CRUD, lets use a client account as an example, realistically I would want to use the primary key to identify the reference `<a href="account-edit{{ id }">` but I really don't want to expose the id to the user, so I would think I would use a UUID, but the issue I'm thinking is I'm going to get a huge hit in my DB performance if I use the UID to do my query.

    What's my solution here? Am I overthinking or is there an elegant way to handle this?

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

    Is it possible for a Discord bot to interface with a Powershell window and do things like enter commands and parse text that's displayed in the window?

    Posted: 31 Oct 2021 09:50 PM PDT

    I have a dedicated game server for Halo 2 that runs on a VPS and I'd like to create a Discord bot so people can interact with the server to a certain degree and do things like send commands (to change the map for example) or maybe have the bot show who's currently playing every so often. Is this even possible?

    Here's a short video hopefully showing what I talk about. To start the server I open up Powershell and run the server's executable. Then in that same Powershell window I can issue commands like "status" (which then displays the players currently connected), and change the map and other things like that.

    Is it possible to have a Discord bot interface with a Powershell window like this? For example, in discord if you type !status the bot will enter "status" into Powershell and then copy/paste the information that's returned and display it in the Discord server?

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

    How to build the right abstraction?

    Posted: 31 Oct 2021 06:30 AM PDT

    We have two types of vehicles – cars and trucks. Trucks have an initial tax of 2000 dollars and cars 1000 dollars. For every 500 miles traveled, trucks are charged 200 dollars and cars 100 dollars.

    For every year the vehicle is used, it's charged:

    Trucks – 300 dollars per year

    Cars - 150 dollars per year

    I need to create an app that accepts inputs for vehicle type, purchase year, tax Calc year, and miles traveled and returns the total taxes.

    Let's say we have a truck bought in 2010 and has traveled 1500 miles. In 2021 the total taxes would be:

    2000 + (3 * 200) + (11 * 300) = 5900 dollars.

    How to approach this? I started by creating a Vehicle base class and classes that derive from it (Truck, Car). My idea was to create a TaxCalculator that accepts Vehicle (or an interface IVehicle) as a parameter, but i am confused where to put the input values and the ones that are predefined like taxes. I want to do the abstraction correctly, so that if I decide to add a new vehicle like a motorcycle, I don't have to change the calculation logic. Аny advice would be helpful!

    submitted by /u/Sea-Plan
    [link] [comments]

    Guidance for a non-developer managing devs

    Posted: 31 Oct 2021 08:39 AM PDT

    I recently accepted a position with a company as a Technical Support Manager. The team I'll be managing has two sub-teams, one is the TSE team and the other is made up of developers working on internal projects.

    I have an extensive software support background, so that part I feel equipped to handle, but I have never managed devs before. I wouldn't consider myself non-technical, as I do have a lot of relevant experience in both front end and back end systems, but I don't know how to actually code in any language (outside of SQL lol).

    So I am looking for some help on how to best manage and support my new dev team. I have always been a fairly hands-off, trusting manager. No micro-managing from me. What should I make sure to do so that I gain their trust and get the best out of them?

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

    What Programming language should I learn

    Posted: 31 Oct 2021 03:16 PM PDT

    What programming language should I learn?I am 15 going into High School and I was wondering which Programming language should I learn.I've learned a little bit about python in middle school and i dont know should I keep pursuing it or to learn another programming language. Can anyone please give me some suggestions?Thank you.

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

    If the requirement is to update the secondary database right away after certain action in primary? Should I use a custom code or replication in this scenario?

    Posted: 31 Oct 2021 12:34 PM PDT

    hi,

    I have two servers and each has 1 database. Now, e.g. from a webpage I reject the record then the entry shall also go to the RejectedRecords and few others child tables in the secondary database.

    Also, if the records is reinstated then the record status shall also be changed to reinstated in the secondary database.

    Now, my idea is to write a 2nd insert query using entity framework under the transaction that would insert into the secondary database also.

    or

    should the replication be used in this case?

    Note: The effect should be right away and immediate.

    submitted by /u/Dangerous-Pizza-1496
    [link] [comments]

    [C] Background and child processes in my built Linux shell

    Posted: 31 Oct 2021 03:26 PM PDT

    I'm creating a simple C shell in Linux currently and it needs to have foreground and background processes. When I run a foreground process it uses waitpid to wait until that command is executed before returning the pid, and background processes would allow for it to continue. From my understanding I can use WNOHANG within my waitpid function if the process is a background process. However, I want to be able to notify the user when the background process has ended. How would I go about checking this case?

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

    Why do people hate/dislike class components in react and rather prefer functional components ?

    Posted: 31 Oct 2021 07:35 AM PDT

    So i learned Java a long time ago and have strong grasp over it . I used to build small proejcts using JSP . Since i know java my understanding of OOP is good . When i started learning react i used to use class based components but as i learned more i came across the fact people like to use functional components over class based components . Is there any special reason to use functional component over class component or is it just that people just can't seem to wrap their head around OOP concepts ? I personally like class based components but learning about using functional components now .

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

    "Semi-colon expected" error despite copying code from a tutorial

    Posted: 31 Oct 2021 10:43 AM PDT

    Hey all. I'm learning HTML and CSS and really enjoying it so far. I followed a project from youtube tit for tat but I can't get CSS to alter my html elements/classes. In my main.scss file i get two errors (shown in the picture).

    https://imgur.com/gallery/RwVcGdZ (Screenshot of problem)

    I have no installed prettier yet. Just live server and live sass.

    Any idea how I can solve this?

    solved I put css/main.scss but the video he changed it to css/main.css. Thank you all for your help.

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

    How can I sort an array in PHP to match the new index position of a different array sorted by its key?

    Posted: 31 Oct 2021 12:24 PM PDT

    So let's say I have two arrays:

    $array1= [4, "Dogs"], [3, "Cats"], [1, "Horses"], [2, "Chickens"]

    $array2= 10, " ", 22, 55

    If I want array one to be sorted by its key in ascending order (meaning it'll be 1, 2, 3, 4 for $array1 using ksort), how could I make it so that $array2 matches the new index positioning of that ksort for $array1 (meaning that $array2 would now be in the order of: 22, 55, "", 10) ?

    I'm using this in the context of making a table with two columns for array 1 (one for the key, and the second for the value), and the third column for array 2. Could this be done with having to create one big array that merges the two?

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

    Do eBook readers specifically for programming language tutorials exist?

    Posted: 31 Oct 2021 09:57 AM PDT

    Do any eBook readers that read ePub specialize in coding books? specifically to show the code examples correctly? I've tried Calibre on MacOS and Moon+ Reader on Android and both are terrible displaying the code sections. Or is it the ePub format that is the problem so no reader will work?

    thanks.

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

    Where is the file/executable run on boot located on a Windows machine?

    Posted: 31 Oct 2021 06:11 AM PDT

    A computer is switched on. It runs the bios, then some boot loader, then some code for the operating system to start up; is that right? Where are these files stored?

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

    Please help!!

    Posted: 31 Oct 2021 08:39 AM PDT

    Hello everyone, in a previous post I asked how I could improve in c++ and few people suggested competitive programming. So I decided to try some at my level of coding

    (This might be the dumbest question ever , and I apologise if this is a trivial question)

    I don't understand how to use the interface in leetcode and codeforces! For example in the intersection of 2 arrays question, I was able to figure out the logic and even code it on my turbo c++ without using any functions ie in int main . But what do I do in leetcode? What is class solution? I tried copying and pasting but it returned errors and I'm confused.

    If anyone can tell me what I'm supposed to do it'll be helpful!! Again, I'm sorry if im dumb (I am ,but still)

    submitted by /u/Brilliant-Drive3344
    [link] [comments]

    Is it possible to create an html meeting scheduler in email without using external software?

    Posted: 31 Oct 2021 08:35 AM PDT

    I'm an economist and I have to send marketing emails to sampled survey respondents to set up appointments for data collection interviews with me.

    I would like to create an email template with clickable buttons to schedule a meeting with me. Something similar to vaccine or passport schedulers where you can see what's available, you click it, and then give info and it schedules the appointment:

    https://www.us-passport-service-guide.com/image-files/onlineappointmentsystem-regionalpassportagency-step3-timeslots.jpg

    (something like this except instead of having a multi step process like this (unless it's possible by email without hosting somewhere else) I'd like them to click a time and then have it bring up a meeting scheduler invite to me for that date and time)

    I've been experimenting with different marketing/behavioral economics methods and think that making it as simple as clicking and reserving a time slot might make the respondents more incentivized to engage with me.

    So far I've only found a way for a new email to my email address to be populated when clicking one of the appointment slot buttons.

    I found another tutorial online about how to have a "Meet with me Button" that shares my Outlook calendar but doesn't show anyway to click and select a meeting. I could even make do with this if they could select and request but all it does is show my calendar and I think they wouldn't take the added step of sending an invite.

    Is this possible without paying for an external software? I work with confidential data so it can't be run through software that would store data on an external server.

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

    What alternatives are there with Electron for Desktop Development?

    Posted: 31 Oct 2021 07:32 AM PDT

    Best "maze solver" algorithm to implement in this case

    Posted: 31 Oct 2021 07:30 AM PDT

    I have the following maze that always uses the same color pattern. Blue dot must reach the green dot and white walls must be avoided. The red area can be fully used.

    Therefore, a pixel approach must be used since it is a picture of the maze.

    https://i.imgur.com/dTITUaf.png

    I searched and found that there are some methods to solve mazes (A*, Dijkstra's algorithm, Recursive methods, Graphs, etc). Since they might take a while for me to learn, can someone point me which method would work very well here but also isn't overkill (which would probably be harder to implement than others) ?

    Even using only "4 directions - up, down, left, right" (no diagonals) is good enough.

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

    Best way to do something as a batch job

    Posted: 31 Oct 2021 06:00 AM PDT

    Hi, I'm a intermediate dev at my second job. I recently got an issue that requires me to do something as a batch job. There is already something in place that does the thing as a single thing (takes an id, connects to a database and adds something to table related to the id), but sticking it in a foreach loop, which was my first idea, has some problems.

    There is some kind of ajax based error returning functionality that returns an error, after exiting the method, if something goes wrong. The problem is, if I run this from the foreach loop, which is run in my batch method, the program just exits, and the method with the foreach loop is none the wiser. On top of that, the error doesn't show because we somehow are not originally in the method the error is generated at.

    I guess an option could be to write a separate method for the batch stuff, based on the code for the single use functionality. I don't think this is a good idea though. I'm wondering if there is some kind of strategy that is commonly used to do this kind of thing. Even if I have to rewrite the single use method. Perhaps always run it as a batch job, with the single instance being a batch of just a single item?

    Any advice from more senior devs? If it's useful, I'm using PHP 7.3 or 7.4.

    Thanks.

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

    How do I clone this website: https://rangelands.app/rap/

    Posted: 31 Oct 2021 10:09 AM PDT

    How do you clone the raw code files for a website? I found this website (https://rangelands.app/rap/) has features I want to replicate, but I couldn't figure out how to clone the site without all the spaghetti code.

    I also don't know what language(s) the site is written in, but I believe they used some of the Google Earth Engine javascript and python API. I appreciate any help.

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

    Best database/approach for creating a local currency for my apartment building?

    Posted: 31 Oct 2021 03:09 AM PDT

    I have a website for my apartment building that provides some details about the building and the area and allows for booking car park spaces amongst other things.

    I like the idea of encouraging more local community and interactions by having a local currency for the building where people can trade favours and help each other out in exchange for simple tokens. The idea is the abstract the reward/exchange a little bit without going all the way to actual cash which can provide a different kind of valuation around these things.

    I could possible fashion some physical tokens and hand them out but I like the idea of a digital ledger. I'm not particular into crypto-currency and my understanding is that there is no need for a mining-type mechanism in this situation. I can provide enough tokens for circulation and then add more if needed for some reason (eg. people leaving the building and their assigned tokens being lost.)

    I'm reasonably familiar with postgres from a number of standard web apps over the years. I imagine I could write something that kept a log of transactions and a current totals table but I also quite like the tamper proof properties of a merkle-tree-type implementation. I could just track everything in a git repo with the transactions being new commits and the totals being JSON/CSV file in `main` but that seems like reaching for the only tool I know that is a merkle-tree rather than using the best solution.

    Does anyone have any recommendations in this space? There might be something simple staring me in the face but I'm not really sure right now. Thanks!

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

    Java Code Issue

    Posted: 31 Oct 2021 04:40 AM PDT

    Hi, I am working on a java code where I should create two classes Vehicle and SecondHandVehicle, and create a main to test them and in my main, I should: Write a tester class that includes a main() method to create and fill V an array of 50 vehicles and SHV an array of 50 second-hand vehicles, The main() should include a menu with the following options: 1. Add a vehicle to the list V 2. Display the details of all vehicles available in V 3. Add a second-hand vehicle to the list SHV 4. Display the details of all second-hand vehicles available in SHV with only one owner and I should write recursive methods for both options 2 and 4.

    Vehicle class:

    public class Vehicle{ public String regNo; public String make; public int yearOfManufacture; public double value; public Vehicle(String regNo, String make, int yearOfManufacture, double value){ this.regNo = regNo; this.make = make; this.yearOfManufacture = yearOfManufacture; this.value = value; } public String getRegNo(){ return regNo; } public String getMake(){ return make; } public int getYearOfManufacture(){ return yearOfManufacture; } public double getValue(){ return value; } public void setValue(double value){ this.value = value; } public int calculateAge(int currentYear){ int age; age = currentYear - yearOfManufacture; return age; } public String toString(){ String V = "Register number is " +regNo+ ", make " +make+ ", year of manufacture " +yearOfManufacture+ ", and it costs " +value; return V; } } 

    SecondHandVehicle class:

    public class SecondHandVehicle extends Vehicle{ private int numberOfOwners; public SecondHandVehicle(String regNo, String make, int yearOfManufacture, double value, int numberOfOwners){ super(regNo, make, yearOfManufacture, value); this.numberOfOwners = numberOfOwners; } public int getNumberOfOwners(){ return numberOfOwners; } public boolean hasMultipleOwners(){ if (numberOfOwners > 1) return true; else return false; } public String toString(){ String SHV = "Number of owners" +numberOfOwners; return SHV; } } 

    Tester class (main):

    import java.util.*; public class tester{ public static void main(String [] args){ Scanner scnr = new Scanner(System.in); String make; int numberOfOwners, i, n, num, SHV; int choice = 0; while (choice != 5){ System.out.println("What do you want to do?"); System.out.println("1. Add a vehicle to the list V."); System.out.println("2. Display the details of all vehicles available in V"); System.out.println("3. Add a second-hand vehicle to the list SHV."); System.out.println("4. Display the details of all second-hand vehicles available in SHV with only one owner."); System.out.println("5. Exit the program."); choice = scnr.nextInt(); if (choice ==1){ System.out.println("Enter the size of the array: "); n = scnr.nextInt(); Vehicle [] V = new Vehicle[n]; System.out.println("Enter the name of vehicles to add: "); for( i = 0; i < n; i++){ V[i] = scnr.next(); } } else if(choice == 2){ System.out.println("Vehicles are: " +String.valueOf(printVehicles(V, 0, n))); } else if(choice == 3){ System.out.println("Enter the size of the array: "); num = scnr.nextInt(); SecondHandVehicle [] S = new SecondHandVehicle[num]; System.out.println("Enter the name and the number of owners of the second hand vehicle: "); for( SHV = 0; SHV < num; SHV++){ S[SHV] = scnr.next(); numberOfOwners = scnr.nextInt(); } } else if(choice == 4){ System.out.println("Vehicles with only one owner: " +String.valueOf(printSHV(S, 0, num))); } else if(choice == 5){ System.out.println("Thank you. "); } else{ System.out.println("Wrong choice.. Try again"); } } } static void printVehicles(Vehicle V[], int i, int n){ if(i >= n) return; System.out.println(V[i] + ""); printVehicles(V, i + 1, n); } static void printSHV(SecondHandVehicle S[], int SHV, int num){ if(SHV >= num) return; System.out.println(S[SHV] + ""); printSHV(S, SHV + 1, num); } } 

    I have been getting these errors:

    tester.java:22: error: incompatible types: String cannot be converted to Vehicle

    V[i] = scnr.next();

    ^

    tester.java:26: error: cannot find symbol

    System.out.println("Vehicles are: " +String.valueOf(printVehicles(V, 0, n)));

    ^

    symbol: variable V

    location: class tester

    tester.java:34: error: incompatible types: String cannot be converted to SecondHandVehicle

    S[SHV] = scnr.next();

    ^

    tester.java:39: error: cannot find symbol

    System.out.println("Vehicles with only one owner: " +String.valueOf(printSHV(S, 0, num)));

    ^

    symbol: variable S

    location: class tester

    4 errors

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

    A few questions about computer science degree

    Posted: 30 Oct 2021 11:55 PM PDT

    I consider buying one.

    1) Would associate degree be enough for freelance or a junior position soon after completion (like after few months)?

    2) What do you think about self study after associate degree with one or more years of experience, in comparison to a cheap online bachelor degree? Self study seems more desired because of lack of reliance on random teachers (some of which I read were pure academics), and also by having great books and projects from the internet.

    submitted by /u/1kIncome
    [link] [comments]

    No comments:

    Post a Comment