• Breaking News

    Saturday, July 31, 2021

    What have you been working on recently? [July 31, 2021] learn programming

    What have you been working on recently? [July 31, 2021] learn programming


    What have you been working on recently? [July 31, 2021]

    Posted: 30 Jul 2021 09:00 PM PDT

    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]

    Do not forget that boolean expressions such as comparisons are normal values too and can be directly compared, returned, etc

    Posted: 30 Jul 2021 02:07 PM PDT

    Often I see code that is as if boolean expressions like comparisons can only go in if statements, but this is simply not true.

    I often see code like: if (X == 10) { return true; } else { return false; } Or similar. Instead, a faster, and less verbose, and better-in-every-aspect way to achieve this is just: return X == 10; I also see: if (Condition1 && Condition2) { return true; } else if (!Condition1 && !Condition2) { return true; } else { return false; } Or similar. Why be afraid to compare booleans directly? return Condition1 == Condition2; For example: bool NumbersHaveSameSign(int X, int Y) { return (X < 0) == (Y < 0); }

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

    I can code!

    Posted: 30 Jul 2021 01:52 AM PDT

    Hello,

    I wanted to share that a pandemic and lots of MOOCs later I tested myself and am pretty proud of the results.

    I wanted to test my skills and I did a few things:

    • Fixed a bug in c++ in an open source Arduino library
    • Fixed a 4 year old bug in an open source python library
    • I published a python package to batch re-encode / manage a video library and used it to re-encode or repair thousands of videos
    • I built and published the code for a physical remote for Spotify using esp32 in c++

    And I am pretty happy that I can now say mission accomplished (learn programming). Fixing the two bugs this week was quite the confidence booster as one was first reported 4 years ago and was so annoying.

    Anyways, I felt like sharing

    Cheers

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

    Experienced programming looking for ideas on how to design a simple 1 player vs 1 player online game, can be as simple as you'd imagine. Just dont have experience with networking / stuff

    Posted: 30 Jul 2021 04:35 PM PDT

    TLDR I'm looking to build a game for me a my kid and I don't know what tech to use (I am very used to nodejs, typescript, and REST)

    I am comfortable with node and html/js stacks

    My day to day is a node developer who mostly works on REST API stuff, simple CRUD end points. I've never worked with websockets and I'd like to start designing a nodejs engine that handles a simple 2 player game online. It can be the most simple game possible, and I can expand / scale it from there. I just need to get ideas on how to cache the game state and have both players get correct updates / events during gameplay.

    Im imagining something like a nodejs server stores the state for a single game and connects to both players in such a way where , when it's there turn, they are 'told' and then send back the action they are taking. Then the server / engine handles all of the game engine stuff like determining the action is valid and then updates the state and sends the state to all players.

    it can be the simplest game where there's isn't really any 'game' to it, just 2 people sending events back and forth to start, I just need help thinking of how to architect this thing.

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

    Transitioning from vanilla JS to react

    Posted: 30 Jul 2021 10:17 PM PDT

    Hey all,

    So self taught, spent a year building a web app using the traditional front end trinity gradually using jquery more than JS. The front end makes heavy use of AJAX and template literals. I feel like it works but it's like 10 years out of date ha.

    I want to start learning React but don't want to abandon my current project ideally I'd gradually rewrite the whole thing with react but right now I'm hoping maybe I can just rewrite some of the UI using react. Is this possible? It means I'd have a mix of Js, Jquery and react. Would people advise for or against this?

    FWIW using Django on the backend.

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

    PNG image is rendered at full size

    Posted: 30 Jul 2021 10:23 PM PDT

    Hi, I've been working on this HTML project and was trying to place the website logo on the page. The image file is in png format but when I placed the logo and but a background color for the image, even the empty space in the image is registered as the part of the image which I don't want. How can I fix this?

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

    Is there like a reverse version of document.getElementById("") ?

    Posted: 30 Jul 2021 08:30 PM PDT

    I am trying to make this js tic-tac-toe game and have realized there is a problem. The line "document.getElementById("")" is basically javascript saying to HTML "hey, which line do you need me to alter?", HTML telling js the appropriate id and js modifying it accordingly.

    But now the move function doesn't know which button to alter. So in this scenario it's html that is saying to javascript "hey, which button id do you need?", and javascript saying "I don't know you tell me."

    HTML:

    <main class="container"> <h2>Tic-Tac-Toe</h2> <div class="game-board"> <div class="square sq1" onclick="move()"><button></button></div> <div class="square sq2"><button></button></div> <div class="square sq3"><button></button></div> <div class="square sq4"><button></button></div> <div class="square sq5"><button></button></div> <div class="square sq6"><button></button></div> <div class="square sq7"><button></button></div> <div class="square sq8"><button></button></div> <div class="square sq9"><button></button></div> </div> </main> 

    JS:

    let moves = 1; function move() { if (moves % 2 == 0) { } else { } } 
    submitted by /u/gtrman571
    [link] [comments]

    Clarification on interaction between ||OR and alert() function

    Posted: 30 Jul 2021 06:51 PM PDT

    Hello all!

    I am currently working through the Odin Project and have hit the Javascript section on logical operators. I've just read this particular page and am trying to figure out why the results on the second task at the bottom of the page returns "1" and then "2".

    alert( alert(1) || 2 || alert(3) );

    It's my understanding, as explained by this page, that the boolean ||OR reads from left to right and converts the first operand to boolean to check if it's true or false, then either stops and returns the original value (if true) or returns nothing and moves on to check the next operand (if false), finally returning "undefined" if none are true.

    In this example, the code checks the "alert(1)" and returns "1" and then returns "2" and stops there. If the first one (alert(1)) were true, it should return "1" and stop there. If it were false, it should return nothing and move on to the second operand where it would return "2" and stop. Does the alert() return something regardless of whether it's true or false? Is anyone able to point me to a resource that explains this so I can understand it better?

    I promise I've done my diligence in looking this up and am doing my best to avoid being a question vampire here. Thank you in advance for the help!

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

    How do different languages work together?

    Posted: 30 Jul 2021 03:47 PM PDT

    So, the support for cli apps in python is dubious. I thought that this was dealt with by writing the cli part in another language, and just, sort of, calling the necessary python scripts from there? But I'm discovering lots of info on writing cli apps in python and nothing on combining languages, and looking closer at github repos shows the same thing, so I have 2 questions:

    • Is it ever practical to do something like this? Why / why not?
    • In what cases do you use different languages? Obviously websites use html, javascript and css, but is that sort of specific set-up the only case? Is it highly frowned upon to throw languages together willy-nilly?
    submitted by /u/RichKat666
    [link] [comments]

    Frustrated and lost with deployment

    Posted: 30 Jul 2021 08:23 PM PDT

    Is it just me/my incompetence, or does anyone else just feel this way when it comes time to begin deploying your full-stack web project? I've followed many articles/tutorials for deploying my projects (to Heroku), only to run into issues that googling can't seem to solve for my case. I've also tried so many things from the stackoverflow threads I've looked at, but because of how obscure deployment is to me as a beginner, I never know if the changes/fixes I apply get me closer to the solution, or just make it worse.

    This just feels so bad. I've been getting confident in my full-stack dev skills and was going to begin to apply for jobs after I have these apps ready to show to employers. But deployment is putting a pause to all this and it's really dragging me down emotionally. I just want to move on, start applying for jobs and begin a new project in the meantime...

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

    Applied to 100 jobs and got 1 interview, and it was only because I scored well on their test

    Posted: 30 Jul 2021 06:58 AM PDT

    I was well aware that finding a job as jr dev is extremely hard.

    But this kind of hit rate seems like a monstrous waste of time. It's like I'm just waiting for someone to say "aw hell give him an interview". When I really think about it, I don't know why anyone would hire an engineer with no professional programming experience or degree. This is a problem because I need to know these reasons so I can get better at them or highlight them in my resume/portfolio.

    That job that I interviewed at was a Jr position didnt even accept resumes, and just made me take an aptitude test which I scored high on. They said there were 350 applicants. How the fuck are you supposed to stand out in that?

    What I'm doing:

    • Applying for 20 - 30 jobs a week, internships also
    • Tailoring each resume with keywords on the job posting
    • Trying to hit up someone from the company on linkedin with questions or small talk.
    • Recently started accelerating my education (instead of self-learning web dev) to finish my degree as quickly as possible, because I believe it will improve my chances. There's a slim chance I can graduate this december. But I need a job asap for reasons.
    • Building an interesting fullstack app with another dev (recruiting more), but its not in a state to have on my portfolio yet. It dwarfs all my other projects in utility and complexity.
    • Responding to every recruiter that hits me up on linkedin.

    What I'm not doing:

    • Networking. I meet other Jr devs on various platforms, but I have no idea how to go about making meaningful connections to developers who could actually get me in somewhere.
    • I don't write cover letters.
    • Trying freelancing on platforms like Upwork.
    • <Help me find more>

    I'm mostly applying for jobs across the country and willing to relocate. I'm also not totally mentally destroyed by this process yet, but I see it coming. I'm just looking for some advice that will improve my chances of getting an interview.

    I hope this doesn't break the rules but here's my portfolio https://connerlinzy.com/

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

    Looking for Comprehensive Project Tutorials

    Posted: 30 Jul 2021 11:30 PM PDT

    Hey all,

    I'm currently a uni student and I'm looking to learn more languages/technologies. I don't learn very well from online courses, but what I do learn well from is following along a project while making my own additions/changes. I was wondering if anyone had any suggestions for a comprehensive project tutorial. I'm down for any project other than a game. I'd prefer the project to heavily use Go, Rust, Elixir, Erlang, C#, Kotlin, or Scala with little to no JavaScript or Python. Additionally I have a Window's PC so I cannot make any Mac OS or IOS apps. An example of the kind of tutorial I am looking for is Ben Awad's Reddit Clone Video.

    Thanks

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

    What are people who create frameworks, programming languages, cloud computing technologies like AWS, Azure, and library like Pandas called in the IT world, and how do I become one of them?

    Posted: 30 Jul 2021 07:44 PM PDT

    What kind of experiences and tech stack should i have to build amazing programming tools... Do i become a web developer or do i become software developer

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

    �� UltimateRegexResource: Regex Syntax & Resources to Power Up Your Programming!

    Posted: 30 Jul 2021 11:05 PM PDT

    A regex cheat-sheet, video recording, powerpoint, practice lab, and gamified app all in one place! There are indeed memes.

    https://github.com/GoldinGuy/UltimateRegexResource

    After a previous resource that I put together for my Google DSC git event proved popular ( UltimateGitResource ), I figured I'd share another resource I've been working on with the hope that someone may find it useful. Thanks for checking it out! If you like, feel free to star/bookmark the repo for future reference.

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

    What could I improve in my code?

    Posted: 30 Jul 2021 07:17 PM PDT

    I recently finished a project that will allow you to simulate a coin flip in Python, what could I have improved?

    import math Tails = 0 Heads = 0 total = 0 PercentT = 0 int (Heads) int (Tails) int (total) import random print ("Coin flipping simulator") print ("By MarketingZestyclose7") print ("How many times would you like the coin to flip?") amount = input () amount = int(amount) print ("processing...") for i in range(amount): total += 1 flip = random.randint(1, 2) if flip == 1: Tails += 1 if flip == 2: Heads += 1 PercentHu = Heads/amount PercentTu = Tails/amount PercentHu = PercentHu*100 PercentTu = PercentTu*100 PercentT = math.trunc(PercentTu) PercentH = math.trunc(PercentHu) print ("The coin landed on Tails", Tails, "times (",PercentT, "percent ). It landed on Heads", Heads, "times""(", PercentH,"percent )") input("Press ENTER to exit") 
    submitted by /u/MarketingZestyclose7
    [link] [comments]

    TabError when trying to print out a Detailview model variable in terminal.

    Posted: 30 Jul 2021 10:32 PM PDT

    I'm currenty learning class based view and for learning purposes, I want to check what model variable name my detailview is passing to my template. But somehow it keeps returning TabError: inconsistent use of tabs and spaces in indentation on my views.py

    def get_context_object_name(self, obj): under PriceDetailView.

    Also when I put the print() function in the return line, it returns price.

    I was kinda expecting it to return price AND object, as when I tested both variable names in template it works. any idea why?

    I want to master class based so my dad Streetlamp would come home for once and listen to my epic tale of class based journey. Thank you in advance yall.

    views.py

    def price(request): context= { 'prices': Price.objects.all() } return render(request, 'info/price.html', context) def pricenew(request): form= PriceForm(request.POST) if not request.user.is_superuser or not request.user.is_staff: return redirect('info-home') if form.is_valid(): form.save() name= form.cleaned_data.get('name') messages.success(request, f'Hair price created for {name}!') return redirect('info-price') return render(request, 'info/pricenew.html', {'form': form}) class PriceListView(ListView): model= Price #template naming convention # <app>/<model>_<viewtype>.html #info/price_list.html class PriceDetailView(DetailView): model= Price @@@@@@@@@@@@@@@THIS IS THE ERROR CODE FOR INDENTATION def get_context_object_name(self, obj): """Get the name to use for the object.""" if self.context_object_name: print(self.context_object_name) return self.context_object_name elif isinstance(obj, Price): print(obj._meta.model_name) return obj._meta.model_name else: return None print(self.context_object_name) print(obj._meta.model_name) 

    models.py

    from django.db import models from django.utils import timezone from django.contrib.auth.models import User from django.urls import reverse class Post(models.Model): title= models.CharField(max_length=100) content= models.TextField() date_posted= models.DateTimeField(default=timezone.now) author= models.ForeignKey(User, on_delete= models.CASCADE) def __str__(self): return self.title #this method tell django how to find url to any spcific instance of a post def get_absolute_url(self): #Reverse will return full path as a string return reverse('post-detail', kwargs={'pk': self.pk}) #If u want it to go to homepage,instead of this speific post. #set an attribute in createview called suces url n set that to the homepage class Price(models.Model): name= models.CharField(max_length=50) price= models.DecimalField(max_digits= 5, decimal_places=2) def __str__(self): return self.name 

    urls.py

    from django.urls import path from . import views from .views import (PostListView, PostDetailView, PostCreateView, PostUpdateView, PostDeleteView, PriceListView, PriceDetailView ) urlpatterns = [ path('', views.PostListView.as_view() , name='info-home'), path('post/<int:pk>/', PostDetailView.as_view() , name='post-detail'), path('post/new/', PostCreateView.as_view() , name='post-create'), path('post/<int:pk>/update/', PostUpdateView.as_view() , name='post-update'), path('post/<int:pk>/delete/', PostDeleteView.as_view() , name='post-delete'), path('about/', views.about, name='info-about'), path('hometry/', views.hometry, name='info-hometry'), path('price/', views.price, name='info-price'), path('pricenew/', views.pricenew, name='info-pricenew'), path('pricelist/', PriceListView.as_view() , name='info-pricelist'), path('pricedetail/<int:pk>/', PriceDetailView.as_view() , name='info-pricedetail'), ] 

    template ### using object.name and object.price WORKS too. but it aint printing out when i test the code of """Get the name to use for the object."""

    {% extends "info/base.html" %} {% block content %} <article class="media content-section"> <div class="media-body"> <div class="article-metadata"> <a class="mr-2" href="#">{{ price.name }}</a> </div> <h2 class="article-title">{{ price.price }}</h2> </div> </article> {% endblock content %} 
    submitted by /u/ChairDeBurlap_Moose
    [link] [comments]

    programming

    Posted: 30 Jul 2021 10:31 PM PDT

    should I made 'C' as my first language? I have no idea in coding but I really want to learn code. My goal is to become a professional.

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

    Want to learn programming..

    Posted: 30 Jul 2021 10:21 PM PDT

    I have absolutely no idea as to how and where to start but I have always been fascinated with computer languages and app development, though never worked towards it due to some other reasons. Here I am tryna ask and get to understand where and how to begin taking that extra mile or well in my case the very first step towards that dream to finally make a name in this field. Looking forward to yours replies. I am 18, giving exams right now to get into a college.

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

    Cannot fix these error codes in c++ Winforms.

    Posted: 30 Jul 2021 10:00 PM PDT

    Im learning c++ with gui for the first time and I cannot fix these few errors and I honestly dont know what the fix is. I believe I also have all the right headers included in Form1.h.

    I am open to all help and suggestions on where I should be looking to fix these errors.

    Errors:

    Error (active) E0276 name followed by '::' must be a class or namespace name [Line: 248]

    Error (active) E0020 identifier "FirstRecordPointer" is undefined [Line: 291]

    Error C2653 'Directory': is not a class or namespace name [Line: 248]

    Error C3861 'GetCurrentDirectory': identifier not found [Line: 248]

    Error C2065 'FirstRecordPointer': undeclared identifier [Line: 291]

    Error C2065 'FirstRecordPointer': undeclared identifier [Line: 297]

    Here is a link form1.h of the code.

    https://gist.github.com/DaylightPenguin/f6710518c804722aedcd57c7b1253feb

    Edited post to follow subreddit rules.

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

    Python 3.5 is no longer supported in PyCharm. Confused. Question...

    Posted: 30 Jul 2021 09:59 PM PDT

    Can I continue using and learning or do I have to upgrade to newer Python. I'm using Linux. It wants me to configure Python Interpreter, but, my research found suggestions not to go messing around with Python on Linux. Should I get newer version and configure PyCharm to use it or just leave it and ignore it? I will be learning on this. Help to clarify would be greatly appreciated. Thank you.

    submitted by /u/Yes-Vey
    [link] [comments]

    How to get better in writing code with multiple conditions

    Posted: 30 Jul 2021 05:21 PM PDT

    As the title says, it takes me lot of time to write piece of code that has multiple conditions. Let's say a, b, and c could be true or false. And there could be multiple combinations of a, b and c. Like (a,b,c), (a,b), (a,c), (b,c) .... I just get overwhelmed thinking of all the conditions and tend to miss edge cases. How to get used to simplifying these conditions to become more efficient? Is there some practice problems I can do?

    Thanks!!

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

    Good language to learn to expand my skillset?

    Posted: 30 Jul 2021 12:16 PM PDT

    Hi there, sorry if this is a common question, but I was interested in learning a new language and I've been unsure of what type of language would be a good next step to become a more well rounded developer. I have a decent bit of experience with C++ and in my current job I use COBOL.

    I was thinking JavaScript would be the obvious choice as it would give me something I don't get with C++ and COBOL, but I feel like I would probably have to get more familiar with HTML and CSS to get good use out of JS.

    At the moment I can only really think of web development and I was wondering if there were any other fields/languages that people would recommend to could expand my skillset outside of web development.

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

    hashmap question help(java)

    Posted: 30 Jul 2021 08:35 PM PDT

    Given an array of non-empty strings, return a Map<String, String> with a key for every different first character seen, with the value of all the strings starting with that character appended together in the order they appear in the array.

    myCode:Map<String, String> map = new HashMap<String, String>();

    for(int i = 0; i<strings.length;i++){

    String temp = strings[i].substring(0,1);

    int count = 0;

    for(int j = 0; j<strings.length;j++){

    if(strings[j].substring(0,1).equals(temp)&&j!=i){

    if(map.containsKey(temp)){

    map.put(temp,map.get(temp)+strings[i]);

    }

    else{

    map.put(temp,strings[i]);

    }}}}

    return map;}

    thanks.

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

    I'm gonna dedicate myself but to where?

    Posted: 30 Jul 2021 10:43 AM PDT

    I want to give my all time (at least 5- 6 hours a day) for 6 to 8 months for learn programming but i don't know what am I gonna be. I just want to found a job in USA or Europe. I want to have a job without not much of need to do overtime so i can have good work- life balance and remote work if possible. I am pretty used to home office work and i recently quit my job so i have lots of time and enough resource to get through whole year without any earnings so i need to find a job within a year. What do you guys think i should choose or start to learn from?

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

    Sometimes you gotta cool off a bit

    Posted: 30 Jul 2021 06:44 AM PDT

    So I'm sure I'm not the only one who experiences difficulties while doing some tasks here and there. Today I've spent like 3 hours to figure out something. It took a while to understand what I need to do, break it down and proceed with it step by step.

    Now, here is an important part: I couldn't complete a difficult task and kept on trying for 2.5 hours. Trial and error, trial and error, trial and error. Then, I went to get some key and cool off for 10-15 minutes and to think about the task again from the very beginning. Then I came back and solved the whole thing in 15 minutes.

    So, I encourage you to take a step back when you need it. At times it makes things a lot easier.

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

    No comments:

    Post a Comment