• Breaking News

    Thursday, November 5, 2020

    wtf is kwargs and foo and why do they show up everywhere learn programming

    wtf is kwargs and foo and why do they show up everywhere learn programming


    wtf is kwargs and foo and why do they show up everywhere

    Posted: 04 Nov 2020 08:19 PM PST

    I feel stupid ive been learning programming for like 2 years but every time I see those words I get so lost

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

    C++ Learning Resources

    Posted: 04 Nov 2020 03:14 AM PST

    I'm a Java programmer and I want to transfer to C++, reason being Java doesn't really offer what C++ offers performance-wise, and it seems like it's easier to apply your ideas in it when you know it well.
    I've been trying to learn about it, but it's different:

    The OOP there is more complicated than Java, and has new stuff like memory managing, etc.
    Does anyone know of a good resource that explains OOP, the uses of pointers, memory.......
    I don't need a resource that goes over the basics of stuff like variables, loops and stuff like that, I only really need a good deep explanation of how things work differently and how it's written.

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

    [Python] password validation function

    Posted: 04 Nov 2020 07:42 PM PST

    Hi I'm learning python atm and im having trouble writing a function for validating passwords.

    The conditions for the password are

    1. at least 1 lowercase alphabet
    2. at least 1 integer
    3. at least 1 special case letters: ! " # $ % & ' ( ) *

    I wrote my code like this and it always returns False. I tried putting a while loop over the for loop to maybe solve the problem but it doesn't seem to work. I've searched google for some hints but they all seem to use regex and "any" function. I want to stick to for and while loops for now and no matter what I change I can't seem to make the function return True. Any idea on this?

    def pw_validation(user_input):

    specialCase=['!','"','#','$','%','&',''','(',')','*']

    flag=False

    while flag:

    ...for i in range(len(user_input)):

    ......if not user_input[i] in specialCase:

    .........flag = False

    ......if ord(user_input[i])<97 and ord(user\_input\[i\])>122:

    .........flag = False

    ......if not user_input[i].isdigit():

    .........flag = False

    ......else:

    .........flag = True

    return flag

    user_input=input('Enter your password: ')

    print(pw_validation(user_input))

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

    REGEX for removing the ~#~ at the end of filenames and placing the number back before the extension

    Posted: 04 Nov 2020 08:53 PM PST

    So... Many... Files...

    Hey everyone. I'm going through an old external drive that I used to dump loads of files into when I moved from computer to computer back in the day and I came across a directory with many thousand files (I'm literally still waiting on ls -l | wc -l to finish) that are named in the format of

    [originalNameOfFile maybe with spaces].[extension].~[number]~.

    For example, a file name that I just grabbed from the output of my still running tar process is

    "/media/dante/My Passport /tild/CemeteryGates-Pantera.flac.~2~"

    My guess is that at some point many years ago while I was learning to use Linux, I (for some reason) opened my root directory with a text editor without knowing what I was doing, leaving myself with ungodly numbers of backup files. No clue how they ended up where they are now. I want to go through these for the sake of searching for anything that I might want to keep and organizing them.

    Step one of this process is going to be to remove the trailing tildes then moving the number back into the filename in case files with the same name aren't duplicates and, as far as I can tell, this is a perfect job for regex. For the sake of simplicity, I think I want to use Python. I don't have much experience with it, but I heard that its regex implementations are spot on and, from what I've done in it, it seems very useful.

    Now, on to the questions:

    1. What would be the most efficient use of resources when it comes to slogging through this? I guess I could just hammer out a BASH script, but when I start trying to do more organizational things with the data, I may want more control and a BASH script would get messy. On the other hand, I'm also not about to use a low level programming language for this, either. More to that point, even though it's not like I can't just get up and go play with the puppy, I'd rather have this finish in one day.
    2. What is the safest expression I could use that wouldn't leave a chance of me accidentally writing ten thousand copies of the same file over and over again (not that I've ever done that before :) )?
    3. How hard would it be to, say, get a hash of each file and compare it to others with the same name to make sure they're duplicates and can safely be discarded?

    Thank you all in advance. I know that this was a lot, but I'm genuinely a bit exited to take on this kind of mundane exercise. It seems like a pretty good learning experience.

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

    Any reliable total course advice for learning Computer Vision with using dlib, OpenCV, face_recognition libraries for beginners

    Posted: 04 Nov 2020 07:00 PM PST

    I'm kinda beginner, I started to learn Python for about 3 weeks ago and write my first script about 1 week ago. It was about object recognition, I used HAAR Cascade method and trained my own classifier. I added some codelines in my script to extract detected objects as an another file to train my classifier better.

    Now I want to make this further and better. I want to learn how to use libraries that I mentioned in the title and create reliable multiobject/face detector script to use with my drone.

    Is there any video tutorial series or anyone interested to work with me and teach to me?

    Thanks in advance.

    Edit: I'm a student with nearly no money for courses, so it would be awesome if the resources you suggest be free. I believe there is a lot of people who needs/interested with this, so we accept resources as some github repos with detailed projects or free udemy courses or youtube channels or free pdf's etc

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

    C# help (Danger Beginner behind the wheel)

    Posted: 04 Nov 2020 07:30 PM PST

    Hi, guys, i started learning to code (have like a week in) in C# and I'm trying to make a basic console program that allows the user to input an X amount of pairs of values that correspond to triangles base and height.

    Then the program has to print:
    1-The base, height and area of each triangle.

    2-The amount of triangles that have an area<12.

    This is what i got so far (i think it kinda does the job, but the problem is that its repeating the same value to calculate the area instead of using the values of the next iteration.

    I apologize before hand, for the following code may make sick a good amount of you guys.

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _2doParcial_EJ1 { class Program { static void Main(string[] args) { int duos = 0, b = 0, a = 0; double area = 0; Console.WriteLine("Insert the number of triangle you wish to work with: \n"); duos = int.Parse(Console.ReadLine()); Console.WriteLine("Insert the values corresponding to the triangles bases: \n"); for (int i = 0; i < duos; i++) { b = int.Parse(Console.ReadLine()); } Console.WriteLine("Insert the values corresponding to the triangles heights: \n"); for (int i = 0; i < duos; i++) { a = int.Parse(Console.ReadLine()); } for (int i = 0; i < duos; i++) { area = (b * a) / 2; Console.WriteLine("The triangle number: " + i + " has a base of " + b + ", a height of " + a + " and an area of " + area + "."); } } } } 
    submitted by /u/Luima27
    [link] [comments]

    Why does GitHub still not have a download button to download files, subdirectories etc?

    Posted: 04 Nov 2020 09:46 PM PST

    Why can I not download individual files and directories instead of the entire repository? I'm aware of extensions that do this but it just seems like such a simple yet much needed feature to implement. Why has it not been done? What am I missing?

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

    How much JS should I learn for Node?

    Posted: 04 Nov 2020 10:26 PM PST

    Hey guys, I was curious about how much JS I should learn before trying to tackle Node.js. Honestly, I'm super, super new to JS(like 3 days). But I'm pretty familiar(on a beginner level) with C/C++, python, java, html, css so I know the fundamentals of programming. I've learned about callbacks/js function notations/asynchronous functions so far. Should I bother spending time taking a JS course or just learn JS along the way with Node? Specifically, I'm trying to build an API for a discord bot so admittedly it is quite a big project but I'm pretty excited for it so I don't want to waste time.

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

    Making a Discord for Data Science Beginners (community hub)

    Posted: 04 Nov 2020 11:47 PM PST

    I have nobody. In my experience, to be good at something you need to surround yourself with it, and I'm looking for fellow students with their eyes set on Data Science. I myself am a 28 year old in Florida, going to undergrad for computer science degree, with intentions of going into graduate school for data science. Anyways, I think it's healthy for people without that special circle to be able to communicate with other budding wiz's. I made a Discord on this subreddit before for beginner programmers in general, and it was such a big success that I had to ditch it because I had no idea how to run a server with 500+ people. I want this Discord to be for people interested in data science, however.

    If you're super new, I'm with you. I'm still reading through a beginner's Python book. Intermediate+ veterans are also welcome to help out.

    Thank you.

    https://discord.gg/kdgsnm4qX8

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

    C# Web Development

    Posted: 04 Nov 2020 08:47 PM PST

    So I am interested in web development with c#, I usually use php but once I figured out that it is *possible* to make websites etc with c# I was curious and wanted to try. I have a few questions about it if anyone can answer them please!

    So first off, is web-dev possible to do this with vanilla c# or will a framework be necessary?

    I skimmed over something saying that c# can replace JavaScript, but could also directly interact with JavaScript, is that true?

    If the ASP.Net framework is the only one for c# web development then any good tutorials or anything to learn to use this? I created a quick project in visual studio but couldnt figure out how it is routing to display the pages.

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

    Can programming become a hobby if you learn it well enough?

    Posted: 05 Nov 2020 12:00 AM PST

    Hobbies are usually stuff you do that isn't your daily work. It usually is simple but repetitive and so becomes a bunch of habits that the body can turn to in relaxation mode. I am wondering if something like programming where you got simple stuff and then complicated stuff can be something you can kind of do in the relaxation mode if you learn it well enough and it becomes second nature? Does it depend on what you are actually making for your hobby, is some stuff easier than others?

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

    Angular and .Net Core Web API Starter Application as Template

    Posted: 04 Nov 2020 08:35 PM PST

    https://dotnetlead.com/net/angular-and-net-core-web-api-starter-application/2095/

    This is an Angular/.Net Core Web API starter application that has the basic functionality for Adding, Editing, and Deleting customers so that you can use it as a starting point for building your applications. It uses the following frameworks:

    • Angular Material
    • Bootstrap
    • .Net Core
    • Entity Frameworks
    submitted by /u/dotnetlead
    [link] [comments]

    How do I set the background of my website in CSS, rather than cover it up?

    Posted: 04 Nov 2020 10:10 PM PST

    So I'm building a React project and I found this nifty website with CSS generated backgrounds.

    https://www.magicpattern.design/tools/css-backgrounds

    But I'm at a loss how to apply it, when I copy the css into my body CSS tag, the background and pattern is there but it overlays the entire website. I can't figure out how to add it as the background, despite searching on google for a little while. Any help is appreciated!

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

    How to correctly save mongoose model after changes in an Array

    Posted: 05 Nov 2020 12:43 AM PST

    I'm trying to push a few new entries into an array and then save the model after loop completion:

    const profile = await MasterProfile.findOne({ userId: masterId });
    req.files.forEach((file) => {
    const tempPath = file.path;
    const targetPath = path.join(
    __dirname,
    `../uploads/${masterId}/${file.filename}.jpg`
    );
    if (file.mimetype.split("/")[0] === "image") {
    fs.rename(tempPath, targetPath, async (err) => {
    if (err) return handleError(err, res);
    profile.portfolio.push(file.filename + ".jpg");
    profile.markModified("portfolio");
    });
    }
    });
    await profile.save();

    But it does not seem to save changes into db at all. How can I do that correctly?

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

    Question about C# and Java docs

    Posted: 05 Nov 2020 12:41 AM PST

    In a previous thread I was told that Microsoft Docs contains 100% of C#, Does Java documentation as well?

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

    For the assembly command 'LDA #4200', which address mode is being used?

    Posted: 04 Nov 2020 06:31 PM PST

    Odd question ik but me and my friend where having a discussion about it. I said immediate but he says relative and we dont know who is right. Any help is appreciated.

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

    Personal Dashboard Help

    Posted: 04 Nov 2020 06:30 PM PST

    I'm working on building a personal dashboard, a side project to go through the process of learning and building all the pieces that go into web app development. Wondering if I can get some direction on the process to do so and some best practices. Just to clarify the main languages I know are Python and JavaScript, so I was going to do this with Flask and React.

    The overall plan:
    - Have a dashboard that pulls from either API or python scripts. Ex: pulling weather data from OpenWeather, pulling my calendar from google calendar, etc and have it displayed on one screen.
    - Have the data stored somewhere and updated every X minutes

    Questions:
    - When pulling the data from the API, is it best practice to clean up the data to only have what I need? Or just give all the data to flask/react and work with it then? (and I'm assuming this would have to be given as JSON?)
    - Where is the best place to store the data? And how do I have it updated every X minutes so the dashboard is constantly 'live' (or as close as it can be)

    Any other tips for best practices are appreciated!

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

    Why even use a semicolon in C ?

    Posted: 04 Nov 2020 01:51 PM PST

    Hello, I'm a very fresh CS freshman and got asked to remove a semicolon from some code and report the difference.

    So I did, removed one semicolon and compiled the code but besides a few warnings there's no difference..

    So I removed all of them and still no difference...this might happen because the code just declares a variable and prints it but still, why do I have to tell the compiler that a phrase ends at a certain point if the outcome doesn't change if I dont ?

    Would appreciate any insight on this

    Edit: Solved, the code doesn't even compile lol

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

    Resizing images with HTML and CSS

    Posted: 05 Nov 2020 12:19 AM PST

    I am extremely new to coding. I am following along with a Youtube Tutorial on how to make a website using HTML and CSS (link: https://youtu.be/99vHH_6F0Ko). I am stuck on 17:32 when he begins to include the images in the slider. Mine are not filling up the page for some reason.

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

    How can i push my files to git

    Posted: 05 Nov 2020 12:16 AM PST

    I anyone know how can i push my files please write it step by step

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

    Ordering System in C with CRUD feature

    Posted: 05 Nov 2020 12:04 AM PST

    Hi, I just started programming a month ago in my computer science course in college and in our school we are tasked to create a program that has a CRUD feature. Our professor said that the program should show a menu in which you can choose to either create, read, update, and delete.

    My pick is a program where the user can create an order, and then there is already a given set of items they can choose from. They can also update their order or delete them, as well as read their order. Is this easy to do for a beginner like me, How can I start with it? Thank you for the help.

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

    Wierd issue about Sequelize associations

    Posted: 04 Nov 2020 11:49 PM PST

    I have 2 functions below. If i run them they work for the first time but after each ran and then re-run any of them they fail because it tries to select a column which is in another table

    (node:8997) UnhandledPromiseRejectionWarning: SequelizeDatabaseError: column Requests.requestId does not exist

    or

    (node:8997) UnhandledPromiseRejectionWarning: SequelizeDatabaseError: column Users.verifierId does not exist

    function 1:

    Requests.hasMany(Proposals, { foreignKey: "requestId", }); Requests.hasMany(Users, { foreignKey: "id" }); Requests.findAll({ limit: perPage, offset: page == 1 ? 0 : page * perPage - perPage, include: [ { model: Proposals, on: { col1: Sequelize.where( Sequelize.col("Proposals.requestId"), "=", Sequelize.col("Requests.id") ), }, required: false, }, { model: Users, on: { col1: Sequelize.where( Sequelize.col("Users.id"), "=", Sequelize.col("Requests.verifierId") ), }, attributes: ["name"], }, ], where: { mainId: req.user.mainId, name: { [Op.iLike]: `%${search}%` } }, order: [["id", "DESC"]], }).then((data) => { res.json(data); }); 

    function 2:

    Requests.findAll({ where: { quantity: { [Op.gte]: Sequelize.col("Requests.received") }, mainId: req.user.mainId, }, attributes: ["*"], // had to add this in order to prevent using column from another table }).then((data) => { if (data) { res.json(data); } }); 
    submitted by /u/fuzunspm
    [link] [comments]

    Help with google maps javascript api (i think its javascript) programming

    Posted: 04 Nov 2020 11:37 PM PST

    Hi guys so I am trying to make a car HUD that uses a raspberry pi to project a HUD using a smart mirror called MagicMirror for a school project. (I'm not the best at programming sadly) I am trying to get a google maps javascript API working so that it displays a route between two location. My intention was to get an android phone to send its gps location in the form of a txt file. The info would then be extracted by the javascript to use the data as input which refreshes every 5 minutes.

    As of now I have been able to get the phone to send the lat and lng values of its location to the Pi using a socket and then i parsed the data so that it would just leave me with the lat and lng data as a string.
    E.g. 0 , 100
    This location is updated every 5 seconds and the prev entry gets overwritten, so the txt file only contains this string.

    I wanted to import this string into the javascript API to use it as the starting location. I have considered using readFile or JQuery but im really not sure where to start to input this data. I am referencing the code for the MagicMirror module from https://github.com/mrdis/MMM-google-route
    and I was attempting to edit the MMM-google-route.js to import in a file using readFile by doing

    <script> const fs = require('fs') fs.readFile('Input.txt', 'utf-8', (err, data) => { if (err) throw err; const gps = data; }) 

    Below here (have highlighted the parts i have edited), but instead it has caused my google map to just not load, would appreciate any help possible, thank you guys so much :)

    const fs = require('fs')

    fs.readFile('Input.txt', 'utf-8', (err, data) => {

    if (err) throw err;

    const gps = data;

    })

    function getDirections(){

    self.config.minimumRefreshPeriod &&

    (Date.now() - lastDirectionsTime < self.config.minimumRefreshPeriod * 1000 * 60)

    ) {

    return;

    }

    try{

    var dr = {

    origin: data;

    }

    if(!dr.travelMode)

    dr.travelMode="DRIVING";

    if(dr.travelMode=="DRIVING"){

    * let's set it to 1 minute from now by default

    var dfaultDepartureTime = new Date(Date.now()+60*1000);

    if(!dr.drivingOptions)

    dr.drivingOptions={};

    if(!dr.drivingOptions.departureTime)

    dr.drivingOptions.departureTime = defaultDepartureTime;

    if(dr.drivingOptions.departureTime < defaultDepartureTime)

    dr.drivingOptions.departureTime = defaultDepartureTime;

    }

    if(dr.provideRouteAlternatives===undefined)

    dr.provideRouteAlternatives=true;

    if(self.state.overrideDestination){

    dr.destination = self.state.overrideDestination;

    }

    directionsService.route(dr, function(response, status) {

    if (status === 'OK') {

    directionsDisplay1.setDirections(response);

    directionsDisplay1.setRouteIndex(1);

    directionsDisplay0.setDirections(response);

    clearInfo();

    addInfo(response,0);

    addInfo(response,1);

    wrapper.style.display="block";

    self.lastRefresh = moment();

    updateAge();

    } else {

    clearInfo();

    addError("Google directions service status: "+status);

    }

    }

    );

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

    Prep for data structures and algorithms c++

    Posted: 04 Nov 2020 11:23 PM PST

    I'm going into my second class of programming in C++ in January. I know all the basics such as functions, loops, and a little bit OOP. I'm working on pointers and references now. What are some things I should practice on so I don't get overwhelmed in class?

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

    webhost without credit card

    Posted: 04 Nov 2020 11:18 PM PST

    I have been working on a website for a while now. I've reached the point where I want to set it online. While searching for a webhost I always see they are payed or you need a credit card. Since I only am 14 and don't have a credit card. I tried to sign up for azure for students and AWS for students but for what I know both are for university/college students. I also don't really know how connect a domain name to the website itself.
    So if you know any webhosts that
    - are free
    - need no credit card or paypal for account verification
    - have mysql support
    - have nodejs support
    Please let me know.
    It would be really appreciated.

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

    No comments:

    Post a Comment