• Breaking News

    Wednesday, May 20, 2020

    Coding is 90% Google searching or is it? learn programming

    Coding is 90% Google searching or is it? learn programming


    Coding is 90% Google searching or is it?

    Posted: 19 May 2020 02:23 PM PDT

    As a newbie, A professional programmer once told me this. Are they bullshitting or is it really true?

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

    I was given a problem where I have to read a number between 1000 and 1 billion and prints it out with commas every 3 digits. I'm kinda confused on how to go about this problem.

    Posted: 19 May 2020 08:59 AM PDT

    not sure how to go about this. any help is appreciated :)

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

    Stupid question: how does GUI work?

    Posted: 19 May 2020 05:23 PM PDT

    Hi r/learnprogramming,

    II'm curios to know the answer of the question in my title. It seems like a stupid question, but I'll try to be as concise as possible to explain what I'm trying to figure out.

    So let's say we're looking at a Java program with a GUI made with Swing. How do those objects stay in place? How are they defined to remain at that exact position? Is there anything happening between Java and assembly?

    I can totally understand how webpages work. They use markup and style to position stuff. But what about the whole operating system? Is there some sort of intermediate markup language generated by programming languages to define where exactly they want their objects to be? Or is everything manually set to be positioned at a certain pixel coordinate?

    I really don't know what to look for, or even how to google this question. So I'd really appreciate if someone could explain. Thanks

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

    No matter how many times I try, I can't seem to understand code.

    Posted: 19 May 2020 07:26 PM PDT

    After repeatedly attempting to learn coding and repeatedly giving up, I decided I'd spend this quarantined summer dedicated to learning Java. But not even 4 hours has passed and I'm once again reminded of why I kept giving up.

    Everything is just so confusing. I can't grasp the concept of classes and objects, methods and behaviors. Everyone else seems to understand it so perfectly, saying the instructor is easy to understand while I am left clueless.

    Even setting up the workspace was a struggle and following the instructor or guides became even more difficult as I was lacking classes and folders etc.

    Never have I been able to continue with programming for more than a few weeks due to frustration and confusion and I can't seem to grasp the concepts at all. Any advice perhaps?

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

    Need Suggestions for Learning C

    Posted: 19 May 2020 02:53 PM PDT

    Hello there. I am looking for some ideas of small command line (non GUI) projects that I can work on that will help me practice learn the basics of C, but the basics I really want the ideas to emphasize on are pointers and memory management. I can't really think of one right now that would do just that.

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

    HELP: Reddit Bot - Posting Variety Of Content

    Posted: 19 May 2020 10:16 PM PDT

    Hello,

    I've recently started learning how to code in Python, and am quite enjoying it (no other coding experience). I wish to create my own subreddit as well as a bot that chooses random SFW topics, etc and posts it there. I wish to see what the bot will post overtime.

    1. Is that possible?
    2. Is there a tutorial on how I can do that?
    3. I have no intent to cause grief or malice with this, I simply wish to play with reddit bots on my personal subreddit

    Thank you for your time,

    Renrien

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

    Hungarian Notation

    Posted: 19 May 2020 05:00 PM PDT

    My Visual Basic college course required me to use hungarian notation for controls on my .NET forms and for regular type variables like strLastName. I looked up the history of this notation and realized it is heavily discouraged, so why did my professor require it? Is there an academic reason for it so I can learn it then never use it again? So many questions!

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

    Do those things that generate random string IDs have a check to prevent obscenity in the IDs?

    Posted: 19 May 2020 08:40 AM PDT

    Would be kind of awkward if the first 6 letters in your string ID was "FUCKYOU".

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

    Volunteering to be a tutor?

    Posted: 20 May 2020 12:29 AM PDT

    As someone who never learned to code until college, I only recently discovered how ridiculously expensive teen / kid coding camps are. One week long programs that meet for just a few hours each day are priced upwards of $1,000 (and up to $3,000) at the most reputable places I'm finding. Even the cheapest non-profits are at least $500 a week. The cheaper programs really do see a substantial drop-off in quality, with the best touting ex-Big N software developers as teachers, and the lower end having clunky, old websites with sparse information.

    It seems that to be able to afford to send your kid to a tech camp you have to be in tech to begin with. I don't want to get into my thoughts on how horrendous wealth-based educational disparity is in the states, but I'd love to be a part of accessible education.

    TL;DR Is anyone aware of a program or org that helps match volunteer teachers or tutors with invested children or teens who don't have families affluent enough to drop 2k for a week-long camp? I've done my own searching, but only found a few that were canceled rather than moving online (due to COVID-19 or other reasons) or weren't sufficiently cheap or sponsored programs (still charging $500+).

    In terms of qualifications, I'm a graduating senior at UCSD with two prior ML / CV internships, upcoming NASA JPL internship, attending CMU for an MS in CV in the fall, have tutored for the CSE dept at UCSD for 2 years for 4 different classes, etc, etc. Ideally, I'd be able to teach basic programming :p.

    Please lmk if there's a better sub this could go on.

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

    Setting watchpoint in a particular file with GDB

    Posted: 20 May 2020 12:20 AM PDT

    To set a breakpoint in a particular file in a project with several files, I can use break foo.cpp:21. But how can I watch a variable in a particular file?

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

    Display a splash screen for a given period of time using Python.

    Posted: 19 May 2020 06:21 PM PDT

    I would like display an image on the screen for a brief period of time. Ideally it would have no window decorations (no title bar, scroll bars) and perhaps support transparent background with a non square image via a .PNG file. I've installed the Pillow libraries and have began here:

    image1 = Image.open('image.png') image1.show() 

    Thank you in advance.

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

    What is a keyword in CSS?

    Posted: 20 May 2020 12:12 AM PDT

    I have seen keywords such as initial in CSS and understand what the initial keyword does. But what does the term keyword itself mean in CSS? I think the term relates to properties in CSS.

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

    In Java, isn't it unDRY to write a separate Comparator for every thing you might want to compare?

    Posted: 20 May 2020 12:06 AM PDT

    All the tutorials have this template of CompareByAge comparator interfaces that contain just one .compare method, even if you might want to compare between 3 or 4 values.

    Wouldn't it be better to have a PersonComparator which has compareAge, compareName, compareGender etc? Having 4 classes for 4 methods which all share the same class and problem seems to defragmented and redundant to me. Am I missing something?

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

    Any Life-Science grad here?

    Posted: 19 May 2020 11:54 PM PDT

    Hello Folks!
    I come from Life-Science domain, & have studied Biochemistry, Microbiology, Biotechnology and other allied sciences.
    I have been learning Web-Dev for 4-5 Months as of now, MERN stack, and have made some Projects too. Please reach out to me If you come from any Pure-Sciences so that we can explore some Project Ideas together and contribute to the cross-domain space of Science and Softwares.
    Stay safe, yo.

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

    tiny confusion

    Posted: 19 May 2020 11:49 PM PDT

    I started watching python tutorials due to my boredom and I have a quick question. In the video whenever he printed a string he uses double quotation marks or single quotation marks like print ("example") but when using a variable or a singular character he would not do that such as print (q). is that just how it Is?

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

    How to start learning Data Structures and Algorithms after taking AP Computer Science?

    Posted: 19 May 2020 11:39 PM PDT

    Hi,

    I am a senior in HS and will be attending a T5 CS school this fall. I have taken AP Computer Science and have a couple pretty good/impactful side projects. Let's say my resume is good enough to get me an SWE interview. What should be my next step in terms of learning algorithms and data structures? I have tons of time now.

    I have knowledge of all the AP Computer Science material (which is in java and covers up to basic oop and recursion). I really want to learn data structures and algorithms to give me an edge on coding interviews but don't know where to start. I don't feel I have enough knowledge to start doing leetcode problems yet. I watched a few lessons of a Coursera Algorithms Course from Princeton but that was a bit too advanced for me. Maybe I can try it again but all the union find stuff seemed pretty complex and the first homework assignment left me confused and I didn't at all know where to start.

    With my skillset right now, which course should I take to learn ds & algos? Or maybe should I take another CS class before I start learning ds & algos? Or what else would you recommend? I will eventually take a real data structures class during my sophmore year of college but I want to learn this earlier to maximize my chances of getting good internship opportunities earlier on (and also because I have free time). Thanks everyone!!

    TLDR: How should I go about learning ds & algos after taking AP Computer Science in High School? I don't feel I know enough to jump straight into leetcode so I would like a recommendation on what to do.

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

    I am still stuck on how to declare an answer or return value only after I have compared EVERY single element in the array...

    Posted: 19 May 2020 11:23 PM PDT

    I just tried this problem of writing a function that determines if an array is in order and then returns true or false based on that. The problem I run into is that I'm only seeing how to declare an answer after comparing only two different numbers in the array. How can I declare a value for answer only after I've compared all the elements in the array?

    #include <iostream> using namespace std; bool isInOrder(int[], int); int main() { int nums[] = {1, 2, 3, 4, 5, 6, 7}; int size = sizeof(nums) / sizeof(*nums); cout << isInOrder(nums, size); return 0; } bool isInOrder(int array[], int size){ int i =0; bool answer; // for(int i=0; i<size; i++){ // if(array[i+1] > array[i]) // answer = true; // else // answer = false; while(array[i+1] > array[i]){ answer = true; i++; } answer = false; return answer; } 
    submitted by /u/gtrman571
    [link] [comments]

    I made a little game! (Lingo!)

    Posted: 19 May 2020 07:23 PM PDT

    Hello everyone, I'm fairly new to programming and have been trying to tackle some big projects that have proved to be...too big. Today I found an old game show that I totally forgot about, and was hit with a huge wave of nostalgia: Lingo!

    I wanted to play on my own, so I wrote a little program to emulate it. At the moment, it's only one player and you can't actually get a "lingo" but instead just guess the word. Please, let me know what you think!

    Also, let this be a reminder for us beginners that you learn the best when you've got a project you're passionate about. Nostalgia hit me and I whipped out this program in a couple hours...Hopefully my skills will get better enough to where it won't take nearly as long :)

    GitHub Repository Link

    If you have any feedback, I'm all ears! Have fun!

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

    3-partition sum dynamic programming problem

    Posted: 19 May 2020 11:06 PM PDT

    Taking reference from https://en.wikipedia.org/wiki/Partition_problem I tried to code for a 3-partition sum problem by extending the dimension of the matrix and recurrence relation but my code doesn't work. No matter what my input is, the output is always zero. I'd appreciate any help with it.

    Below is a part of my code.

    int partition3(vector<int> &A) { int sum = 0; for(int i = 0;i<A.size();i++) { sum += A[i]; } int r = sum/3 + 1 ; int c = sum/3 + 1; int w = A.size() + 1; vector<vector<vector<int>>> matrix(r); for(int i = 0;i<r;i++) { matrix[i].resize(c); for(int j = 0;j<c;j++) { matrix[i][j].resize(w); } } matrix[0][0][0] = 1; for(int k = 0;k<w;k++) { matrix[0][0][k] = 1; } for(int i = 0;i<r;i++) { for(int j = 0;j<c;j++) { for(int k = 0;k<w;k++) { if(j - A[k-1] >= 0) { matrix[i][j][k] = matrix[i][j][k-1] || matrix[i][j-A[k-1]][k-1]; } else if(i - A[k-1] >= 0) { matrix[i][j][k] =matrix[i][j][k-1] || matrix[i-A[k-1]][j][k-1]; } else { matrix[i][j][k] = matrix[i][j][k-1]; } } } } return matrix[r-1][c-1][w-1]; } 
    submitted by /u/Ersa21
    [link] [comments]

    Dynamic way of creating jest test cases

    Posted: 19 May 2020 10:58 PM PDT

    My jest tests are getting kinda large and messy and I was wondering if it was possible to abstract the logic into separate files/classes.

    I'm also using/passing global variables around as some of the describe blocks are creating/updating rows in my database.

    For example:

    const variable_that_updates describe( "insert test", function () { before( () => { // run some things variable_that_updates = new_value }) // it tests here }) describe( "select test", function () { it( "test new value", async function () { expect(variable_that_updates).toBe(something); }) }) 

    What I'm trying to do

    class InsertThings { constructor (req, display_name) { this.req = req; this.display_name = display_name } createDescribe () { const theDescribe = () => { it( "display name can insert", async () => { // some code }) } return theDescribe; } } // let's assume req is properly set up const new_creator = new InsertThings(req, "new name") describe( "insert test", new_creator.createDescribe()) describe( "select test", function () { it( "test new value", async function () { expect(variable_that_updates).toBe(something); }) }) 

    But I get ` encountered a declaration exception` or `variable is undefined` depending on implementation.

    Is there anyway to do what I want?

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

    How to make sure you’re not reinventing the wheel?

    Posted: 19 May 2020 09:26 AM PDT

    Looking at getting more into scripting/programming. I've been a unix/linux admin for 9 years. I know some short hand bash scripting that I use for commandline shenanigans, and some other for some automation. I'd like to improve on both ends.

    I've been reading a and it seems like a lot of people say when starting out, pick a project and work on it. I guess how do you know if something out there already exists and you don't spend time banging your head on a wall trying to get it work, when there is something out there that's good and usable?

    For my first part of the project I'd like to work on is to take a custom static map (not on google maps) that has multiple stops. I want to be able to find the quickest route from point A to point B, or even Between A, B, and C. So on the fly I can say I want to go from point A to point D, what way is the quickest?

    I would assume there is already something (free) out there that does this, or something that's almost like this? But I'm not sure how to find it, again I don't want to spend hours recreating something that already there, worked well and is tested.

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

    PyQt5 : Method launched by another class doesn't work properly

    Posted: 19 May 2020 10:55 PM PDT

    Hi,

    I'm running PyQt5 on Spyder.

    I am calling a method in class App(QMainWindow): (self.ouvrir.triggered.connect(self.tabs.test), and the said method is located in class MyTableWidget(QWidget): (def test(self):).

    When the method is launched, it doesn't do all that it is asked to.

    I modified a program from pythonspot.com to make the problem easier to understand : As we can see, the button called self.pushButton1 in the middle of tab 1 is disabled. If we click on "File" in the toolbar and then on "test", self.pushButton1 is supposed to get activated (self.pushButton1.setEnabled(True)) and the program should print("A").

    The program does print "A", but it doesn't activate the button, which it is supposed to.

    Why is that ? Where did I go wrong ?

    Code :

    import sys from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QWidget, QAction, QTabWidget,QVBoxLayout from PyQt5.QtGui import QIcon from PyQt5.QtCore import pyqtSlot, QCoreApplication class App(QMainWindow): def __init__(self): super().__init__() self.title = 'PyQt5 tabs - pythonspot.com' self.left = 0 self.top = 0 self.width = 300 self.height = 200 self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) self.toolbar = QToolBar("Toolbar") self.tabs = MyTableWidget() self.ouvrir = QAction(QIcon("test.png"), "test", self) self.ouvrir.triggered.connect(self.tabs.test) self.addToolBar(self.toolbar) self.menuFichier = self.menuBar().addMenu("&File") self.menuFichier.addAction(self.ouvrir) self.setStatusBar(QStatusBar()) self.table_widget = MyTableWidget(self) self.setCentralWidget(self.table_widget) self.show() class MyTableWidget(QWidget): def __init__(self, parent=None): super(QWidget, self).__init__(parent) self.layout = QVBoxLayout(self) # Initialize tab screen self.tabs = QTabWidget() self.tab1 = QWidget() self.tab2 = QWidget() self.tab3 = QWidget() self.tabs.resize(300,200) # Add tabs self.tabs.addTab(self.tab1,"Tab 1") self.tabs.addTab(self.tab2,"Tab 2") self.tabs.addTab(self.tab3,"Tab 3") # Create first tab self.tab1.layout = QVBoxLayout(self) self.pushButton1 = QPushButton("PyQt5 button") self.pushButton1.setEnabled(False) self.tab1.layout.addWidget(self.pushButton1) self.tab1.setLayout(self.tab1.layout) # Add tabs to widget self.layout.addWidget(self.tabs) self.setLayout(self.layout) def test(self): print("A") self.pushButton1.setEnabled(True) app = QCoreApplication.instance() if app is None: app = QApplication(sys.argv) window = App() window.show() app.exec_() 

    Could anyone please help me ?

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

    How would the websockets work for a game like agar.io?

    Posted: 19 May 2020 10:51 PM PDT

    I guess the client would send and receive data like this:

    • username
    • coordinates of bubbles
    • sizes of bubbles
    • color
    • direction

    In that kind of the game, would the client know the coordinates of all users on the map regardless of them being locally visible? Would that be too much data?

    What's the best way to maintain state in that kind of game and transfer data to the users?

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

    No comments:

    Post a Comment