• Breaking News

    Saturday, November 17, 2018

    Bill Gates said that "after the first three or four years, its pretty cast in concrete whether youre a good programmer or not". How much truth is to that? learn programming

    Bill Gates said that "after the first three or four years, its pretty cast in concrete whether youre a good programmer or not". How much truth is to that? learn programming


    Bill Gates said that "after the first three or four years, its pretty cast in concrete whether youre a good programmer or not". How much truth is to that?

    Posted: 17 Nov 2018 10:03 AM PST

    From "Coding Horror"

    https://blog.codinghorror.com/how-to-become-a-better-programmer-by-not-programming/

    Does accumulating experience through the years necessarily make programming easier?

    Bill Gates: No. I think after the first three or four years, it's pretty cast in concrete whether you're a good programmer or not. After a few more years, you may know more about managing large projects and personalities, but after three or four years, it's clear what you're going to be. There's no one at Microsoft who was just kind of mediocre for a couple of years, and then just out of the blue started optimizing everything in sight. I can talk to somebody about a program that he's written and know right away whether he's really a good programmer.

    This narrative of "Hard work won't necessarily make you a great developer" is being promoted in many posts on coding horror. From studies showing great disparity in coding ability 25:1 between the best and worst, to how there is no correlation between years of experience and skill. Furthermore, we are talking about Jeff Atwood (the writer of coding horror) here, the one who co-founded SO, so he knows a thing or two about the industry.

    Personally, I am a little demotivated. From a young age we are reared to the notion of hard work = growth, but Jeff (and Bill) make it seem like software engineering is more a talent in need of polishing than a skillset that can be built.

    I have read "Outliers" and the "The Talent Code" so I am familiar with "practice makes perfect", "hard work beats talent when talent stops working hard" and all that stuff. This is why these blog posts come as such a surprise to me. What do you think? Any data to debunk what Gates and Atwood say?

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

    SQL Exercises

    Posted: 17 Nov 2018 12:20 PM PST

    Hey everyone. I just posted a list of SQL exercises for anyone learning SQL. These exercises have full solutions available, some hints, and the expected results. They can be found at this GitHub repository.

    I also released a video tutorial explaining all of the concepts you need to know in order to complete these exercises, which can be found here.

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

    Why is this statement not true?

    Posted: 17 Nov 2018 11:05 PM PST

    Guess who's back!

    JSfiddle link

    Before, I used a button to switch from display:none to display:block but I wanted to increase to cool factor so I used a transition instead.

    CSS:

    #answer{ opacity:0; visibility:hidden; background-color:palevioletred; width:50%; margin:auto; margin-top:10px; margin-bottom:10px; font-family: "lato"; padding:10px; -webkit-transition: opacity 1s, visibility 1s; border-radius: 10px; } 

    JS:

    <script> function giveAnswer(){ var x = document.getElementById("answer"); console.log(x); console.log(x.style.opacity === "0" && x.style.visibility === "hidden"); if (x.style.opacity === "0" && x.style.visibility === "hidden"){ x.style.visibility = "visible"; x.style.opacity = "1"; } else { x.style.visibility = "hidden"; x.style.opacity = "0"; } }; </script> 

    HTML:

    <button onclick="giveAnswer()">Click here for the answer!</button> <div id="answer">False! The character Rosie the Riveter was the creation of songwriters John Jacob Loeb and Redd Evans in 1942, initially published as sheet music. It was recorded by the Four Vagabonds in 1943 and became a hit song, which inspired Rockwell's version.</div> 

    I'm just know realizing that I really don't have to transition both visibility and opacity, but eh. I wanna learn.

    As you can see, I did console.log() and it returned false so I know I'm not going insane.

    Why is the if statement returning false?

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

    Sometimes the hardest part of learning to code is digesting what you learn and putting it into practice. Only coding 30 minutes can make it more palatable.

    Posted: 17 Nov 2018 08:50 PM PST

    Here's a free resource (free until 11/22) for learning programming in a functional way with 30 minute daily lessons.

    https://www.amazon.com/dp/B07KBV2PF2

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

    C++: Should an overloaded pre and postfix increment or decrement function provide different outputs respectively?

    Posted: 17 Nov 2018 10:27 PM PST

    Link to code of my example: https://pastebin.com/gQntrN8g

    The function definition for the overloaded prefix and postfix increment operators are from line 181-199, and decrement just below that.

    The driver which tests them are on line 130-137.

    The assignment is strange. It's listed at the top starting at line 1. Should my pre or postfix function be returning a copy of *this before the hours stored in *this was incremented? Or do both the prefix and postfix return *this after hours was incremented? I've read that both prefix and postfix should perform the same exact function, but I can't think of any conceivable reason as to why.

    Thanks

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

    Hey fellow CS Majors, how do you manage to find time to program with hard math courses and other courses that require a lot of time?

    Posted: 17 Nov 2018 09:55 PM PST

    I'm maintaining an excellent GPA because it helps with getting internships and what not, but I am finding it hard to find time to really get down to coding (I'd like to be doing it for 2+ hours a day). As of right now I am still a sophomore finishing up general eds, so next semester I'll be taking two CS classes which will help a lot, but this semester I'm doing C++, calc, bioscience, and anthro, and can only do the required C++ readings (I'd like to really get ahead and start getting my feet wet before classes get harder). My main time sink is literally just math classes being depressingly hard, idk if it's just me, but I'd love to hear your strategies for time management :)

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

    What's the easiest way to parse JSON into a table in google sheets or excel?

    Posted: 17 Nov 2018 05:48 PM PST

    I have a data file with a bunch of JSON data. I'd like to convert it to a table that is easier for me to manage.

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

    Feeling low

    Posted: 17 Nov 2018 05:41 PM PST

    Hi all. I'm in the midst of finishing up an app I built for a boot camp I'm in and I'm feeling pretty low. Though I know I need to push through feelings of inadequacy while learning, I'm having a hard time at the moment. I'm flooded with those feelings of "you're not good enough", "your app sucks", "it took you way longer to do simple things than it should have", "you did everything ass backwards." I fought through these thoughts in the past, but this time seems harder. Anyway, and encouragement or words of advice would be much appreciated.

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

    Where to go next and how to pick a path in learning to code

    Posted: 17 Nov 2018 09:06 PM PST

    So I learned the basics of Python and am now trying to work on some projects, but I don't really know the right course to take, now that I'm not being guided by Codecademy. Is there a good book or a website that lays out a path for learning beyond just understanding the syntax? I'm struggling to actually be able to use apply Python to projects and real uses because I haven't found a good way to learn how to use APIs, libraries, setting up a proper coding environment, and other things that I'm sure exist, but I don't know about yet. I'm just not being very successful at trying to take it one problem at a time because I don't know what the reasonable progression of skills to learn is. Any suggestions? Thanks.

    -for reference I am junior in highschool and would like to learn to code for personal projects, and am also working towards a possible career in computer science

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

    Bridging the Gap Between Programming within Console and Building Actual Apps

    Posted: 17 Nov 2018 09:22 AM PST

    So there is no shortage of guides for all languages teaching the fundamentals of variables, loops, functions, etc. There is even an abundance of websites that provide challenges that require creative use of these methods to solve complex algorithmic problems.

    I've gone through the process of learning these fundamentals in several languages, but I find once I've completed the introductory material and various challenges, there is this massive gap to writing actual usable code.

    In my experience, after the fundamentals, there is this leap right into setting up IDE's and virtual workspaces, downloading and employing various libraries, establishing strange folder hierarchies and required files.... It's all very overwhelming!

    I've given it my best effort to look for myself, but it's hard as a beginner to distinguish between which guides are providing a straightforward basic approach to building your first web app (working with Python at the moment) and which are incorporating too much stuff at once because they assume you're just new to a LANGUAGE and not to the entire concept.

    So, does anyone have any recommendations for someone with basic HTML/CSS/JS and Python (no clue how servers, hosting, etc works) skills to follow a tutorial to set up a basic website/app that I can slowly add more and more features to and play around with?

    An example project I would like to make is something simple like a website that my roommates and I can use to keep each other updated on whether or not the dog has been fed, when it was last let out, etc. A simple responsive web app that loads fast and is easy to use.

    Thanks.

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

    [C++/CLI] Trying to paint a line on a panel

    Posted: 17 Nov 2018 11:47 PM PST

    I'm creating a simple CLR app and I'm trying to draw a line on a panel. this is the code that runs on the paint event:

    private: System::Void pnlTop\_Paint(System::Object\^ sender, System::Windows::Forms::PaintEventArgs\^ e) { System::Drawing::Graphics \^g = e->Graphics; System::Drawing::Pen \^p = System::Drawing::Pens::Black; g->DrawLine(p, this->pnlTop->Left, this->pnlTop->Top, this->pnlTop->Right, this->pnlTop->Bottom); System::Diagnostics::Debug::WriteLine("top panel draw"); } 

    I can see the "top panel draw" in the debug output, but the line never gets drawn.

    I recreated the code in C#:

    private void panel1_Paint(object sender, PaintEventArgs e)

    {

    System.Drawing.Graphics g = e.Graphics;

    System.Drawing.Pen p = System.Drawing.Pens.Black;

    g.DrawLine(p, this.panel1.Left, this.panel1.Top, this.panel1.Right, this.panel1.Bottom);

    System.Diagnostics.Debug.WriteLine("top panel draw");

    }

    And it works perfectly, so I'm guessing I'm missing some extra step specific to CLR that I don't know about. If anyone has some insight that could help I'd appreciate it. thanks for reading!

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

    Matlab for loop

    Posted: 17 Nov 2018 11:44 PM PST

    Hey,

    I have an assignment with Matlab, but unfortunately I have no prior programming experience... Maybe you can help me, as I have tried to figure this out, but just can't seem to grasp the concept.

    I want to write a for loop:

    I have a vector x with the dimensions 1x13, and I have the start values s which are 0 and 0.2 . I need a for loop which takes the prior value and adds it to 20% of itself so the vector at the end should look something like this:

    x = [0, 0.2, 0.24, 0.288, 0.3456, ...]

    Can you help me with this?

    Thank you so much!

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

    When should we use pointers?

    Posted: 17 Nov 2018 11:33 PM PST

    I have been googling this and so far all answers tell that I should only use pointers with data structures like struct, arrays, class objects etc and never with int, float etc. But what I don't understand is that why shouldn't I use it in case of int, float as well. Also, does that mean pointers are only useful when passing a reference to variables in a function and otherwise they have no use. I am quite new to programming so all of this stuff still sounds strange to me.

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

    what syntax error am I making here?

    Posted: 17 Nov 2018 11:16 PM PST

    remote: SyntaxError: /tmp/build_45d3283f2575f3c9051ab0d39512de1d/config/routes.rb:59: syntax error, unexpected keyword_end, expecting end-of-input

    Rails.application.routes.draw do root 'cars#index' resources :cars # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". # You can have the root of your site routed with "root" # root 'welcome#index' # Example of regular route: # get 'products/:id' => 'catalog#view' # Example of named route that can be invoked with purchase_url(id: product.id) # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase # Example resource route (maps HTTP verbs to controller actions automatically): # resources :products # Example resource route with options: # resources :products do # member do # get 'short' # post 'toggle' # end # # collection do # get 'sold' # end # end # Example resource route with sub-resources: # resources :products do # resources :comments, :sales # resource :seller # end # Example resource route with more complex sub-resources: # resources :products do # resources :comments # resources :sales do # get 'recent', on: :collection # end # end # Example resource route with concerns: # concern :toggleable do # post 'toggle' # end # resources :posts, concerns: :toggleable # resources :photos, concerns: :toggleable # Example resource route within a namespace: # namespace :admin do # # Directs /admin/products/* to Admin::ProductsController # # (app/controllers/admin/products_controller.rb) # resources :products # end end 

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

    MySQL - Update table by inserting new rows with same values except for one column

    Posted: 17 Nov 2018 03:28 PM PST

    Hello! I am trying to populate a fact table for a college project. The fact table has unequal number of rows.

    I have a table that looks something like this.

    City Connector CarBrand
    City1 Type3 Brand1
    City1 Type2 Brand2
    City1 Type1 Brand3
    City2 Type4 Brand4
    City2 Type2 NULL
    .. .. ..
    .. .. ..
    CityN Type4 NULL

    There are no null values in City & Connector columns. CarBrand table has 8 distinct values in the table having >500 rows.

    I want to update the fact table such that, say if Brand 1 and Brand 3 require 'Type 2' connector, then there should be 2 rows for that occurrence of 'Type 2' connector. Rows should look like

    City N| Type 2 | Brand 1

    City N| Type 2 | Brand 3

    Is this possible at all?

    Edit: A word.

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

    vectors c++

    Posted: 17 Nov 2018 03:12 PM PST

    I'm writing a text based game where a player has a user-inputted crew with him.

    I'm trying to figure out how to 'kill off' the last person (element wise) in the crew and display the new crew. So far I have:

    (the player created this crew at the beginning of the game)

    void DeveloperTesting::testCrew() { vector<string> Crew; cout << "Enter the names of your three crew members." << endl; string name; for (int i = 0; i < 3; i++) //adds name into vector { cout << "Crew Member " << i + 1 << ": "; cin >> name; Crew.push_back(name); } cout << endl; cout << "Your crew members are" << endl; for (unsigned int i = 0; i < Crew.size(); i++) //displays name in vector { cout << Crew[i] << endl; } } 

    (somewhere along the line in the game)

    void GameEvents::event10() { cout << "Your crew has become sick, would you like to do? " << endl; cout << "Your crew member, " << Crew.back() << " has died" << endl; //tells you the person in the last element has died Crew.pop_back(); //deleted person in last element cout << "Your crew is now: " << endl; cout << endl; //displays new crew for (unsigned int i = 0; i < Crew.size(); i++) { cout << Crew[i] << endl; } } 

    Is the crew vector deleted once the testCrew function ends? What am I doing wrong?

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

    [HOMEWORK] for c programming

    Posted: 17 Nov 2018 10:33 PM PST

    tbh i dont understand the question properly. If you can explain, it would be appreciated.

    "Write function to get an array, a number and two variable addresses (pointers/references). The function then counts the number of cells that are smaller than and bigger than the given number parameter and returns these two counts in the two provided addresses" suggested function: void largesmall(int* array, int size, int num, int* small, int * large)

    This is my code so far and I would appreciate it if you tell my what to remove. Don't want my code solved.

    #include <stdio.h>

    #include <stdlib.h>

    void largesmall(int* array, int size, int num, int* small, int * large)

    int main()

    {

    printf("enter a num: ");

    scanf("%d", num);

    }

    void largesmall(int* array, int size, int num, int* small, int * large)

    {

    int array[5] = {6,5,9,8,1};

    int count = 0;

    int i;

    for (i = 0 ; i =< size; i++)

    {

    if (ar[i] > num)

    small[i]++;

    printf("There are %d numbers greater than your number");

    count++;

    if (ar[i] < num)

    large[i]++;

    printf("There are %d numbers less than your number");

    count++;

    }

    }

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

    Can I learn UWP with C# but apply it to C++?

    Posted: 17 Nov 2018 10:24 PM PST

    Since there are zero books that deal with UWP C++, I thought I'd download a UWP C# book, but translate the codes to C++. I have worked with C# a little, about two years ago it was. I've also taken a C# class 5 years ago but I can't remember anything from it. What do you think? Will it disturb my C++ learning process or not?

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

    [HOMEWORK] Using Java Eclipse Windowbuilder, how can I add a jPanel I've already made into Windowbuilder so that I can use cards to swap between them?

    Posted: 17 Nov 2018 10:13 PM PST

    This is for schoolwork, by the way.

    I have 4 different classes: Racket, Game, Ball, and GUI for a Pong game. I made the first 3 of them and got the game running properly, but now I want to create a GUI for the game. All my GUI needs is a Label and a play button, which when pressed, would hopefully bring you to the jPanel with the game on it.

    What I don't understand is how to actually integrate my jPanel with the game into the same getContentPane as my GUI jPanel.

    I spent a lot of time googling this but I can't find anything, but I'm pretty sure it's a really simple fix.

    This is my game class. It's not going to work without the other classes, but you can see the code at least. This is my GUI class

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

    Trying to learn how to code on my own

    Posted: 17 Nov 2018 07:10 AM PST

    I'm a sophomore in college studying computer science and basically the department here is complete shit. I'm not learning anything and anything I do learn it on my own. I feel like I'm not going to be able to get an internship or job anywhere at the rate I'm going so I was hoping to get some tips on how to start learning to code on your own. Any book recommendations or YouTube channels that are really good? Also are websites like code academy and solo learn worth it?? Or are there any better websites? So far I only know C++ and Java but I'm open to learning any other languages. Thanks

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

    Implementing AbstractFactory with prototypes in Smalltalk - example from Gang of Four

    Posted: 17 Nov 2018 09:40 PM PST

    I've been reading through the Design Patterns (Gang of Four) book and am having some difficulty understanding the example for implementing a Prototype based AbstractFactory in small talk. The prototype pattern of implementing a concrete factory seems to involve storing a prototype in a catalog, and then instantiating the object by cloning the prototype with the make method. I am confused by the two addPart methods though.

    make: partName ^ (partCatalog at: partName) copy 

    'The concrete factory has a method for adding parts to the catalog'.

    addPart: partTemplate named: partName partCatalog at: partName put: partTemplate 

    'Prototypes are added to the factory by identifying them with a symbol' aFactory addPart: aPrototype named: #ACMEWidget Chapter 3 - Creational Patterns Pg 90

    I'm not sure what the difference is between a partTemplate and aPrototype. It isn't clear to me what the difference is between adding parts to the catalog and adding a prototype to the factory. Lastly, I am having a lot of difficulty with the Smalltalk syntax. It isn't entirely clear to me what the arguments, types and return types are for these methods. Any help would be greatly appreciated!

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

    Why doesn't reversing the actions of a button with 'else' not work?

    Posted: 17 Nov 2018 09:35 PM PST

    This was initially something I did for fun but I adapted the site to work with a project I have due monday, so it is homework.

    JSfiddle link

    Button: <button onclick="giveAnswer()">Click here for the answer!</button> Answer:

     <div id="answer">False! The character Rosie the Riveter was the creation of songwriters John Jacob Loeb and Redd Evans in 1942, initially published as sheet music. It was recorded by the Four Vagabonds in 1943 and became a hit song, which inspired Rockwell's version.</div> 

    Function:

    <script> function giveAnswer(){ var x = document.getElementById("answer"); console.log(x); if (x.style.display = "none"){ x.style.display = "block"; } else { x.style.display = "none"; } }; </script> 

    Theoretically, this means that the second time I clicked on the button the answer would go away, but this doesn't happen. I haven't practiced Javascript in a while though, so while I knew something was wrong I didn't know why.

    1. Why was this wrong?
    2. What would be a better way of doing this?
    submitted by /u/twitineverytense
    [link] [comments]

    [Java] If a and b are distinct integers, and c = (a ^ b) & -(a ^ b), why will only one of c & a == 0 or c & b == 0 be true?

    Posted: 17 Nov 2018 05:17 PM PST

    I understand the case if a is odd and b is even, or vice versa; c will be 1 and the even number & 1 will be 0. I don't get the cases if both a and b are odd or even though.

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

    I have an error declaring driveService.Files.Get() in Google Drive API

    Posted: 17 Nov 2018 08:56 PM PST

    I cannot call driveService.Files.Get(fileId) and I cannot find it in Using Google.Api;

    Thank you for the help. They said Google API has a problem in documentation.

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

    No comments:

    Post a Comment