• Breaking News

    Friday, March 5, 2021

    What have you been working on recently? [March 06, 2021] learn programming

    What have you been working on recently? [March 06, 2021] learn programming


    What have you been working on recently? [March 06, 2021]

    Posted: 05 Mar 2021 09:00 PM PST

    What have you been working on recently? Feel free to share updates on projects you're working on, brag about any major milestones you've hit, grouse about a challenge you've ran into recently... Any sort of "progress report" is fair game!

    A few requests:

    1. If possible, include a link to your source code when sharing a project update. That way, others can learn from your work!

    2. If you've shared something, try commenting on at least one other update -- ask a question, give feedback, compliment something cool... We encourage discussion!

    3. If you don't consider yourself to be a beginner, include about how many years of experience you have.

    This thread will remained stickied over the weekend. Link to past threads here.

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

    Just got accepted to do a MSc in Computer Science!

    Posted: 05 Mar 2021 09:31 AM PST

    I'm doing the MSc for Computer science at the university of Liverpool! A very good university here in the UK. My previous degree is in chemistry and I also have a postgraduate teaching qualification.

    This last year has shown me that teaching isn't for me and now I can move into a different industry. I'm so happy!

    The offer was unconditional. Absolutely amazing.

    I didn't know where else to vent as my family disagrees with me moving careers.

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

    Big-Oh calculation tutorial recommendations

    Posted: 05 Mar 2021 10:09 PM PST

    I've just started an advanced algorithm analysis and design unit, I'd love if you could save me some searching and recommend some great resources to get one's head around understanding/ calculating Big-Oh (as well as omega, theta and little o). My brain is struggling a little to understand my lecturer's explanation and I want to make sure I've got a solid understanding. Thank you!

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

    Does anyone else find java incomprehensible?

    Posted: 05 Mar 2021 03:55 PM PST

    First time poster, apologies if I'm in the wrong place, But I have a massive problem with java. I'm a first year computer science student, And I can happily do the C's, Python, Web dev, SQL and all that, But I just cannot for the life of me understand java. I just can't seem to wrap my head around the whole object orientated bit, I hate things being returned from a million and one places, I hate the whole "Getters and setters" thing, I hate it for feeling like a completely unmanageable crapshoot.

    Is it just me missing a trick? I assume other people have been here before, but every time I think I'm understanding something goes off the rails and I end up worse than when I started. If I'm honest this is part venting and part asking for help. If there is anywhere that can help ease us into OOP I'd really appreciate being pointed in that direction. Cheers all.

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

    Can someone please explain what an API or REST API actually is?

    Posted: 05 Mar 2021 11:35 PM PST

    I've used many of them and I know that we fetch data from them but I don't know what they ACTUALLY are in the code base. I have a project to build one and I've been told it's essentially your backend code? So what you're telling me is backend code (ex. SQL/NoSQL) is api?

    And yes, ive heard the waiter analogy but that still doesn't articulate what it actually looks like in your code.

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

    Need some help getting started with Python

    Posted: 05 Mar 2021 06:41 PM PST

    Hi all! I'm hopefully going to be interviewing for a job later in the spring & one gap the recruiter said I had was Python. I'd like to at least get familiar with it beforehand

    In terms of my background, I'm a pretty proficient developer in C#; I mostly enjoy developing backend class libraries. I'm also getting pretty not bad with Powershell & I can at least read & understand Java. I used to know C++ but that was 20 years ago; nowadays I'm much more comfortable with managed languages

    So specifically what I'd like is: - The elevator pitch (what makes Python so great; why would I use it instead of .NET or Java for a given project - Ideas for a good starter project. Something that will help me apply Python in a practical manner - Links to any tutorials you think are good

    Thanks all!

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

    Is Ruby (Rails) still worth learning in 2021 and is it going to be demanded in the coming years?

    Posted: 05 Mar 2021 11:35 PM PST

    I am a strong junior Ruby on Rails developer. Is it going to be difficult to find a job as a Ruby developer in the years to come? Should I stick with Ruby and dig deeper into RoR ecosystem or it would wise to smoothly transition into Python development?

    submitted by /u/Objective-Bed-1807
    [link] [comments]

    Recommendation of any web development books for beginners?

    Posted: 05 Mar 2021 11:31 PM PST

    I decided to do a gap year because I have seen students tweet that Online Class is a waste and that they rarely learn anything from it. It is quite possible that my chosen school is still gonna go online this year so gap year it is. However, my parents are against it unless I can show them that I can be productive during my gap year. So I thought of self-taught and wanted to ask for recommendation of books about web development. I have little to no experience on HTML and CSS, and absolutely no idea what Javascript is but I wanted to start on those three.

    submitted by /u/4rck
    [link] [comments]

    Developing Cpp on linux

    Posted: 05 Mar 2021 05:23 PM PST

    The "get started with c++" things i've searched have been geared towards windows.

    I'm a Ubuntu user and in terms of developing c++, I want to use a text editor and compile separately. But is it much harder than an IDE? I've tried KDevelop but clicking execute to run the program makes me have no idea what its doing to build the program. I want to know what is happening so I want to use a text editor and compile separately.

    I need help with a programming environment, what to use, im thinking maybe VSCode as text editor or Vis, and how build works from a command line and not a button on an IDE

    Im coming from no low level compiled language background and some light JavaScript knowledge.

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

    What are some things that every coding and programing language has.

    Posted: 05 Mar 2021 11:21 PM PST

    I am trying to learn. And I think it will be easier if I understand all the basic and even some advance stuff. I found python easier to understand but and want to learn javascript too. And I only have a android. Can i learn and practice on my phone. I am watching some YouTube videos on python and javascript. Things I have some understanding of are Variables,Strings. I would be very thankful of some advice.

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

    For a coding app tutorial

    Posted: 05 Mar 2021 07:33 PM PST

    I need to learn to program a basic messaging app for pc with java. Can anyone help me from where can I get some tutorials and guidance to do so?

    Thank you

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

    Where do software engineers get their project ideas from?

    Posted: 05 Mar 2021 11:11 PM PST

    I was wondering whether software engineers come up with their own project ideas or are the clients who ask them to do something and then they'll be in charge of creating it?

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

    Can someone explain what people mean by "binaries" in simple terms?

    Posted: 05 Mar 2021 11:03 PM PST

    Examples:

    "Understand why we build Python packages with native binaries:"

    "Build your Python package into a portable one-file binary and deploy it just by copying it to target machine. The binary links to libc only and doesn't require Python to be installed on the machine. "

    "The binaries are compatible with the most recent official CPython distributions on Windows >=6.0. "

    "If you want to install just the GDAL Binaries for Python on a windows machine I would get the installers from the excellent GIS Internals Site."

    Binary means 0s and 1s. Can someone explain on a fifth grade level how it relates in these contexts?

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

    need help

    Posted: 05 Mar 2021 05:03 PM PST

    if(input = "Toronto"); { alert("true"); }else{ alert("false"); }

    console keeps telling me "else is an unexpected token"

    I have a feeling input is fucking but I am unsure

    submitted by /u/mach-nine
    [link] [comments]

    (C#) ASCII gifs

    Posted: 05 Mar 2021 10:48 PM PST

    Looking for input on all aspects of my program, but I have two issues I'm specifically trying to solve. If I don't compress/shrink the gif/image down to an insanely small size, I need to make the font incredibly small (5px or less) to be able to see these images. How would I go about representing larger images in a readable format with standard font sizes? Do I need to clump pixels together and represent the clumped brightness with a single ascii char? Additionally, I feel as though the way I determine which greyscale character to use is sort of weird and could definitely be better.

    I'm fairly happy with the performance, but of course I'd be glad to hear optimization critiques as well.

    using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.Text; namespace imgToAscii { class Program { static void Main(string[] args) { Bitmap img = null; Console.WindowHeight = Console.LargestWindowHeight; Console.WindowWidth = Console.LargestWindowWidth; if (args.Length == 1) { try { img = new Bitmap(@$"{args[0]}"); } catch(Exception e) { Console.WriteLine(e.Message); Console.ReadLine(); } } else { try { Console.WriteLine("please paste image path\n"); img = new Bitmap(@$"{Console.ReadLine()}"); } catch (Exception e) { Console.WriteLine(e.Message); Console.ReadLine(); } } //Bitmap img = new Bitmap(@""); - used to hardcode for faster testing. Comment all pertaining to path above for (int i = 0; i < 15; i++) //arbitrary gif repeat { if (img != null) { foreach (Bitmap map in GetGifFrames(img)) { WriteImage(map); Console.SetCursorPosition(0, 0); } } } Console.ReadLine(); } static double GetPixelBrightness(Color color) => 0.2126 * color.R + 0.7152 * color.G + 0.0722 * color.B; static IEnumerable<char> ConvertSingleImage(Bitmap image) { char[] greyScale = "$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\\|()1{}[]?-_+~<>i!lI;:,\" ^`'. ".ToCharArray(); //don't need to do this, but I coppied it backwards and was too lazy to paste reversed Array.Reverse(greyScale); for (int y = 0; y < image.Height; y++) { for (int x = 0; x < image.Width; x++) { double brightness = GetPixelBrightness(image.GetPixel(x,y)); //I feel like I overcomplicated selecting the greyscale char? yield return brightness >= 1 && 255 / (int)brightness < greyScale.Length - 1 ? greyScale[(int)Math.Floor(255 / brightness) -1] : greyScale[greyScale.Length - 1]; } } } static void WriteImage(Bitmap img) { int count = 0; List<char> buffer = new List<char>(); foreach (char c in ConvertSingleImage(img)) { buffer.Add(c); buffer.Add(' '); //padding to help widen certain images. Could add bool to decide if padding for img required count++; if (count == img.Width) { count = 0; DumpCharListToConsole(ref buffer); } } } static IEnumerable<Bitmap> GetGifFrames(Bitmap gifToSplice) { int frameCount = gifToSplice.GetFrameCount(FrameDimension.Time); for (int i = 0; i < frameCount; i++) { gifToSplice.SelectActiveFrame(FrameDimension.Time, i); yield return (Bitmap)gifToSplice.Clone(); } } static void DumpCharListToConsole(ref List<char> chars) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < chars.Count; i++) { sb.Append(chars[i]); } Console.WriteLine(sb); chars.Clear(); } } } 

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

    (0) How does someone translate physics into code?

    Posted: 05 Mar 2021 04:46 PM PST

    I'm wanting to learn physics, and then apply it to my software. (1) With that being said, how do programmers get their programs to incorporate physics? (2) Do they somehow translate formulas into code? (3) Do programmers who program physics have a great understanding of physics, or do they talk to someone else who does? (4) Since programs that have with physics usually deal with 3d models, would I have to learn how to program 3d models from scratch?

    I apologize for all the questions, but thanks in advance!

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

    Did anyone else feel like this while learning how to code?

    Posted: 05 Mar 2021 01:10 AM PST

    Hey there! My name is Mike and I've been making apps for a few years now. I am making this post because I want to get your opinion on something, so I can check whether your experience with programming is similar with mine. Here's some context:
    I am now working as a full time developer. A few days ago, I randomly thought back to the days where I first started coding.

    Interestingly enough, one of the emotions I remember most vividly from back then was feeling very, very confused. All the resources I needed to be able to become a great developer were there for free - the internet had my back on that. But there was a problem - there was so much information out there that it was hard to know where to start. Everytime I tried to learn something new, it felt like a gamble - will I learn something new that will completely change the way I write code, or will I hit a wall and be stuck for 2 months, spinning in circles, getting nothing done?

    And then I realized - in the 2 years I've been working as a full time dev, I learned more than in 6 years fooling around by myself. Why was that? The answer was pretty simple - I was surrounded by people who have already been there before. But, the fascinating thing is the following: these people never once took my keyboard and started typing away when I asked them for help with a bug. They didn't go to the closest whiteboard and hold a 45 minute seminar whenever I was confused by some obscure design pattern. They simply told me - "oh.. why don't you look X up on Google", or "check out this class, it does something similar to what you need". And that was it; they just told me where to look, and that made all the difference.

    So, this is what I want to get your opinion on. Do you relate to this as a senior developer looking back on your early days? Are you just starting out and feeling overwhelmed? Did you just save the new collague 4 hours of work by telling him where to look in the code?

    I've made a survey to see what your experience looks like. It takes around 2 minutes, here it is:

    https://forms.gle/3Wed1psohJEmfnVJ9

    Thank you for your time!

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

    Beginner - Unsure how to write SQL SELECT statement with multiple tables and conditions

    Posted: 05 Mar 2021 10:41 PM PST

    I am a beginner at php/SQL and I am stuck in writing SQL SELECT statement. Would really appreciate it if someone could guide me through this. :)

    Outcome: Produce an array with the following conditions

    • Identify all product_id bought by user (represented by checkouts.user_id and $_SESSION['id']).
      • Note: $_SESSION['id'] grabs users.id from previous page.
    • For checkouts.product_id that matches books.id, do not populate the books in the array

    How my tables are structured

    Link to tables

    My code so far:

    $booksql = "SELECT b.dp, b.image, b.id, b.price FROM books AS b"; if($bookresult = mysqli_query($link, $booksql)){ if(mysqli_num_rows($bookresult) > 0){ while ($bookrow = mysqli_fetch_array($bookresult, MYSQLI_ASSOC)) { $bookarray[] = array('book_id'=>$bookrow['id'],'book_img'=>$bookrow['image'], 'book_price'=>$bookrow['price']); } mysqli_free_result($bookresult); } else{ echo "No records matching your query were found."; } } else{ echo "ERROR: Could not able to execute $booksql. " . mysqli_error($link); } 

    Thank you!

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

    Book Suggestion to understand Web Architecture so that I can learn HTML/CSS/Javascript

    Posted: 05 Mar 2021 01:35 PM PST

    So, I have been learning Python for the last couple of weeks. Making slow yet steady progress so far. My interest in Python started cause I wanted to build a Raspberry Pi Pico board to automate my garden and for that I needed to learn MicroPython.

    Anyway, I learnt later that Python (along with Django) can be used to create back-end web servers and to create a front end-interface I in fact need to learn HTML/CSS/Javascript.

    I am only learning coding as a hobby right now and I am still in the 'honeymoon' stage, but my first long term goal is to automate my home with Rasberry Pi boards all over and make a web terminal by which my family can manage it either at home or remotely.

    In order to learn web design (either front end or back end) and create a web terminal that my boomer parents can use, I understand that I need to first understand the basics of internet/web architecture, something that I have very little clue about right now. Before I move on to learn HTML/CSS/Javascript, are there any books for n00bs that I could read to get a clear understanding of the basics before I actually start learning the languages?

    Thanks in advance.

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

    Any good resources that explain querying a MySQL database using Express / api?

    Posted: 05 Mar 2021 06:21 PM PST

    I've chosen MySQL as my dbms for a basic web app but want a resource to be able to refer to. Any suggestions?

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

    What api's should I use for gpu programming on intel?

    Posted: 05 Mar 2021 09:56 PM PST

    I wanna get into field of gpu prog. but I don't have a nvidia gpu so can't use cuda .I tried setting up opencl but just can not get it to work . What other api's should I look into , I have seen other names like openacc, openmp, ispc how are they different from cuda and opencl.

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

    The Odin Project still worth to go through in 2021?

    Posted: 05 Mar 2021 02:57 AM PST

    Hello there. I want to learn javascript. Do you think Odin Project is worth moving forward?
    Waiting for your suggestions?

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

    Choosing a web development course.

    Posted: 05 Mar 2021 12:55 PM PST

    Hey everyone, I'm 16, I have some web development experience, I can write static websites, also apps using Flask (Python). I want to continue learning web development, which course would you recommend ?

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

    (OOP) How to dynamically create a Discount functionality in a shopping cart

    Posted: 05 Mar 2021 09:27 PM PST

    I'm writing a shopping cart app. I have a discount of x% if price is greater than $500, discount of y% if # of items is greater than 10, or discount of z% if there's a buy 2 get 1 item free. The list of discount types will grow or shrink so I want to make Discount dynamic.

    I have these three methods:

    -price is greater than $500- check if total price is greater than $500 and apply discount and return total price -number of items greater than 10- check cart size and if it meets condition apply discount and return total price -buy 2 get 1 - will need product ID and it's value and if it's meets the condition subtract the value of the product from total price 

    As you can see, the input of those three methods are all different. How would I OOP(class or interface) to design a dynamic Discount and avoid making a method for each discount types?

    edit- I started to implement what spoker11 suggested but it's not really dynamic...

    public class Discount{ double discountPercent; } public class totalPriceDiscount extends Discount{ double discountPercent; public totalPriceDiscount(double discountPercent){ this.discountPercent = discountPercent; } public bool appliesToItem(double totalPrice ){ if(totalPrice > 500) return true; return false; } public double applyToItem(double totalPrice ){ return totalPrice * discountPercent; } } public class BogoDiscount extends Discount{ double discountPercent; public totalPriceDiscount(double discountPercent){ this.discountPercent = discountPercent; } public bool appliesToItem( List<string> shoppingCart){ // assuming shoppingCart is sorted. string of productId string idCount = 0; string currentId = ""; foreach(var id in shoppingCart){ if(currentId != id){ idCount = 1; currentId = id; } else{ idCount++; if(idCount > 3){ return true; } } } return false; } public double applyToItem(double totalPrice, List<string> shoppingCart, Dictionary<string,int> idToValueMap ){ // assuming shoppingCart is sorted. string of productId List<string> qualifiedIds = new List<string>(); string idCount = 0; string currentId = ""; foreach(var id in shoppingCart){ if(currentId != id){ idCount = 1; currentId = id; } else{ idCount++; if(idCount > 3){ qualifiedIds.Add(id); //add logic to skip to the next unique id } } } foreach(var uniqueId in qualifiedIds){ totalPrice -= idToValueMap[uniqueId]; } return totalPrice; } } 
    submitted by /u/jjsreddit
    [link] [comments]

    How do I write tests for something that depends on another part of the program?

    Posted: 05 Mar 2021 09:18 PM PST

    Easy example: A program that manipulates data in a database, in my case an SQLite file. I'm learning how to write tests, so the way I'm going about it is I want to write a test for adding things to the database, removing things from the database, updating things, and so on. The class these tests are for is a data access object (DAO) class.

    But all of these things seem to, in one way or another, depend on another part of the program to test, which seems like a bad way to design tests. If I want to test my add function, I need to have a way to get all the data from the DB, which would itself be a function that I would need to write tests for (i.e. to ensure that add() works, I need to assume that get_all_items() works)

    If I want to test my remove function, then I would first within this test need to add items to the database (or add items in the setUp, same difference) which obviously means this test uses a function that itself would need to be tested (i.e. to ensure that remove() works, I need to assume that add() works)

    How do I go about this? If it makes any difference, I'm doing this in Python

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

    No comments:

    Post a Comment