• Breaking News

    Friday, November 30, 2018

    I made a Python web scraping guide for beginners learn programming

    I made a Python web scraping guide for beginners learn programming


    I made a Python web scraping guide for beginners

    Posted: 30 Nov 2018 03:39 AM PST

    I've been web scraping professionally for a few years and decided to make a series of web scraping tutorials that I wish I had when I started.

    The series will follow a large project I'm building that analyzes political rhetoric in the news.

    Part 1 is about collecting media bias data: https://www.learndatasci.com/tutorials/ultimate-guide-web-scraping-w-python-requests-and-beautifulsoup/

    I would really like to improve the article and give new Python learners 100% of what they need, so please feel free to let me know your thoughts.

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

    What covariance, contravariance, and invariance are and why you should know them to write better code. Multiple Python examples included

    Posted: 30 Nov 2018 10:06 PM PST

    You can found the blog post here. I tried to explain everything in detail and give multiple straightforward Python examples. All feedback is welcome, as always :)

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

    Seriously considering transitioning into a new career path from current one in my mid-30's, have a couple questions for people that have traveled this path.

    Posted: 30 Nov 2018 07:13 PM PST

    A bit about me, I am a college graduate with a business degree. I have always had an affinity towards computers and tinkering with tech stuff. In my current profession, I have been able to automate and streamline some of the company's tasks through different Excel spreadsheets and macros. I know it's not "programming" but it got me on the path to realize it was a fun challenge and very rewarding once I was able to get things to work the way I envisioned. As a hobby, I recently built a "Magic Mirror". I went into the project with no real coding knowledge. I learned so much during trial and error, as well as reading forum after forum when things didn't work properly, and I had a blast doing it. Turns out I was figuring out some basic coding as well as some CSS without even realizing that's what it was called.

    Well recently I have been thinking about my future and what would be best for myself and my family. I am tired of working weekends, holidays and evenings. I want to be there for my kid growing up. Earlier this month I came across a post on this subreddit about someone thinking about changing professions and learning programming. I read nearly all of the comments and it inspired me. So many people were supportive and encouraging, it honestly made me think to myself, why not me? Since then, I have been learning on my free time on sites like codeacademy.com and freecodecamp.org. I have made it through introductory HTML and am pretty far along CSS. My next goal will be JavaScript and maybe others after, depending on how well I do on it. From my research, these skills are the basics to get into a Front End Web Developer position. I know I have a long path ahead before the career change but I had a few questions and no one in my real life to ask.

    1. Is it worth pursuing a position like Front End Web Developing if I do not live in or very close to a large city? I see that a lot of the well-paying jobs are in larger companies which tend to be located in the large cities.
    2. Has anyone ever telecommuted in their first position? Would it be more beneficial to be in an office surrounded by co-workers?
    3. Am I following the right path in learning?
    4. On resumes in the future, should I put down that I am self taught from sites like codeacademy and freecodecamp, or is that kind of a joke from a hirer's perspective?
    5. Does anyone have any tips about changing careers? It's a bit nerve wracking leaving my comfort zone, but I still have another 30 or so years in the workforce that I think will be worth it in the long run.

    Thank you for taking the time in reading this wall of text. I am excited for this journey, just have a lot of questions.

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

    [C++] Having trouble with overloaded << friend function.

    Posted: 30 Nov 2018 09:03 PM PST

    Hello,

    I am trying to make an aggregate class called Pile that takes a vector of Cards (another class I made) as its data. I am having trouble with my overloaded << friend function and I'm puzzled as to what the issue is. I am trying to display the cards in the pile in the following format:

    3H 2D QS KC 4H 8S JC 9D AS 6D 6H 7S KS AD 6C 2S 4C 5D 10H 9D 

    The rank is displayed then the suit. I have tested everything in my Card class alone and the card class is working as intended. The Card class uses the same kind of overloaded << friend function to display the card.

    Here is how the function is formatted in my Pile.h :

    friend ostream& operator << (ostream& out, const Pile& b);

    and here is my code in Pile.cpp

    ostream& operator << (ostream& out, const Pile& b) { int count = 0; int index = 0; int max = b.p.size(); for(int i = 0; i < max; i++) { out << b.p[index] << setw(2); count++; index++; if(count == 10) { out << endl; count = 0; } } } 

    With the way the code is set up currently I can get it to compile but when I test it in main and it gets to that line I get the message:

    RUN FAILED (exit value 1, total time: 119ms)

    Everything else displays fine before that. I have also tried changing it so that max uses a function I made for my pile class, getCount(), which does the same thing, calls the vectors .size() function. When I try this the program doesn't compile and gives me the error:

    cd 'C:\Users\npods\Desktop\Card Game' C:\cygwin64\bin\make.exe -f Makefile CONF=Debug "/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf make[1]: Entering directory '/cygdrive/c/Users/npods/Desktop/Card Game' "/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin-Windows/card_game.exe make[2]: Entering directory '/cygdrive/c/Users/npods/Desktop/Card Game' mkdir -p build/Debug/Cygwin-Windows rm -f "build/Debug/Cygwin-Windows/Pile.o.d" g++ -c -g -MMD -MP -MF "build/Debug/Cygwin-Windows/Pile.o.d" -o build/Debug/Cygwin-Windows/Pile.o Pile.cpp Pile.cpp: In function 'std::ostream& operator<<(std::ostream&, const Pile&)': Pile.cpp:83:26: error: passing 'const Pile' as 'this' argument discards qualifiers [-fpermissive] int max = b.getCount(); ^ Pile.cpp:43:5: note: in call to 'int Pile::getCount()' int Pile:: getCount() ^~~~ make[2]: *** [nbproject/Makefile-Debug.mk:87: build/Debug/Cygwin-Windows/Pile.o] Error 1 make[2]: Leaving directory '/cygdrive/c/Users/npods/Desktop/Card Game' make[1]: *** [nbproject/Makefile-Debug.mk:62: .build-conf] Error 2 make[1]: Leaving directory '/cygdrive/c/Users/npods/Desktop/Card Game' make: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2 BUILD FAILED (exit value 2, total time: 2s) 

    So I am assuming this error "passing ... as 'this' argument discards qualifiers" is whats causing my issue.

    If I change the function so that the for loop takes an int like 7 for example, instead of max it compiles and the function works. Example output with a pile that has 7 cards in it with the for loop taking a 7 as its max.

    4H AD 5D QC KS 4H 4C 

    Any ideas whats going on?

    EDIT:

    Here is all of the code:

    Card.h

    Card.cpp

    Pile.h

    Pile.cpp

    Main.cpp

    and here is my current output in main:

    9S 5D QC 4 1 0 1 0 1 -------------- 7 RUN FAILED (exit value 1, total time: 107ms) 

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

    Ideas to create actually useful programs?

    Posted: 30 Nov 2018 02:45 PM PST

    I am a beginner-ish programmer, only really knowing enough to get by on python and C++. I enjoy programming but have found it hard to come up with ideas for what to program. I mean sure I could program a cute little game with a simple GUI, or generator of some sort but I don't find it very beneficial. Instead, I would like to make a code that I would actually use, like a tool that makes my life easier, like coding is supposed to. I currently only know the two languages above but am willing to try other languages. Maybe something to do with files/ file systems, because I do own a Raspberry Pi and I am searching for projects for that as well. Thanks in advance for your help, and also let me know what language I should learn next!

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

    I created a guide with useful VSCode tips, features, and shortcuts for blazing fast programming

    Posted: 30 Nov 2018 11:46 PM PST

    SubReddit Comment:Upvote Ratio w/ Programming?

    Posted: 30 Nov 2018 11:45 PM PST

    Question: Is there some tool out there that I can use to search for how engaging a subreddit is? Walk with my theory for a second. Please try not to lose me here.

    I define engagement to be measured by the average comment/upvote ratio. A post with 20 upvotes and 5 comments is more engaging that 10 upvotes and 3 comments, because of the ratios.

    If there is a tool out there that can rank subreddits by average engagement, is there a tool to analyze the comment/upvote ratio of many many posts within any subreddit so that I can find posts with small comment/upvote ratio relative to the subreddits average comment/upvote ratio? This would allow me to find posts that I could comment on, knowing that I will likely stand out and get some sweet KAAARRRRMMMMAAAAA.

    For example, if a post has 300 upvotes, but only 3 comments, and the average comment/upvote ratio for that subreddit was 0.2, this would mean that the number of comments is relatively low, and will therefore likely increase in the number of comments. If I comment on that post first, I am more likely to increase muh <<<KAKAKAKAKAKAKAAAAAAAAARRRRRMMMMMMMAAAAAAA>>>

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

    Using Flask, how would I go about grabbing data from a python file and putting it into an HTML?

    Posted: 30 Nov 2018 11:39 PM PST

    Basically, I have a Python file/app that filters through some data for me and gives an array of numbers in JSON, like [12,16,17,17], using a function called Filter() with no input.

    I want my Flask.py file to grab the output of that Python file, and put it into a variable on my HTML website. How would I go about doing that?

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

    Has anyone used Lua for a website using something like Lapis as a framework?

    Posted: 30 Nov 2018 10:35 PM PST

    Nodejs require and export

    Posted: 30 Nov 2018 10:21 PM PST

    I have multiple questions. Can you require whole files and what does that do? Based on this, it seems you can require whole files. Based on this, it seems you can't.

    Currently, I have a web app where all my javascript is disgustingly on one single index.js page. I would like to start separating my code into different files, but I'm unsure how to do this properly.

    One webpage in my web app uses input from the previous page, fetches data from a database based on user input, creates custom class objects based on returned data, and spits out results. Many of my functions depend on smaller functions, outside (not within the scope of the individual function) queries, and other variables like "var mysql = require('mysql');" So if I export individual functions, I'm afraid they won't work (I assume the other functions or variables they rely on won't be within the scope of the exported function). Is there any way I can export my dependency-reliant functions so that they work?

    However, in the specific case I'm talking about, these functions are only called once upon loading a page. In that case, do I wrap my entire file in one big function and just export that and just require the function/result in my main index.js file?

    Lastly, multiple files may require the same basic things like "var express = require('express');". Do I just copy paste these things into all the relevant files or is it best practice to just include them once in my main server index.js file?

    I'm sorry if this was a big incoherent. I feel I lack enough knowledge on this subject to form proper, direct questions.

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

    How can I learn more about computers in general (hardware, software, operating systems, etc)

    Posted: 30 Nov 2018 10:12 PM PST

    I feel I am lacking a lot of basic terminology, I've found professor messers courses to be good on YouTube, what else do you guys recommend?

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

    Work is giving me $1000 to spend on career development. How do I invest it?

    Posted: 30 Nov 2018 01:55 PM PST

    I'm a Business Ops guy. All my work is in Excel, managing and updating models. I want to learn some programming so that I can better analyze data, automate some repetitive processes, and help me make business decisions.

    From convos with friends who are programmers, they are saying start with Python - do you agree?

    If you had $1000 and my goal, how would you spend it?

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

    Which language should I use for 2D game development?

    Posted: 30 Nov 2018 09:08 PM PST

    I've used the Java LibGDX library for creating 2D desktop games, but I'm not sure if there are better options out there.

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

    [js] What is happening with this write in for loop segment

    Posted: 30 Nov 2018 09:00 PM PST

    I'm continuing my work with writhe in and adding on for loops and I've tried consulting W3 but I don't know that I'm advanced enough in JS to really follow what's happening in this program. What should happen is that I make this array, I populate it using the forloop and the randInt function (previously tested so that's definitely not the problem), then print it out to the page with 3 numbers in the array each seperated by ten spaces; now I can't get anything to appear on my screen and i'm especially not sure if that's because I've somehow messed up my for loop or if something is going on with either/both of the document.write statments; I especially don't actually follow what either of those are trying to say. My CSS sheet contains rules for .slot1 so I'm thinking that's supposed to be my output but I don't see how things connect here.

     var numbers = [0,0,0] var i; for (i = 0; i < numbers.length; i++) { numbers[i] = randInt(7); } document.write("<h1 class='slot1'>"); //Display of the three numbers on the slot machine. var j; for (j = 0; i < numbers.length; j++) { var slot1 += numbers[j] + " "; } document.write("</h1>" slot1); 

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

    Advice for someone totally new in web programming.

    Posted: 30 Nov 2018 12:13 PM PST

    Where should i start Im very excited to learn so i dont need short tutoriarls or easy things im willing to spend lots of hours learning but i dont know where to start. What im planning to do is an interactive website for a specific videogame where there is a map and you and your friends at the same time can deeply interact with it (something to plan strategies and all that stuff) Thanks beforehand!

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

    What are some keyboard shortcuts to know?

    Posted: 30 Nov 2018 08:55 PM PST

    I'm new to programming, and for the past three days I've been trying to learn Java using IntelliJ Idea. I noticed the program will give me suggestions when typing code, but what are some keyboard shortcuts or tips do you guys use to type code faster? Also, what helped you memorize the syntax for code?

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

    iOS ELM327 development tips OBD2 Car

    Posted: 30 Nov 2018 08:42 PM PST

    In the past, I have successfully created a C# windows 10 UWP app and a partially functioning android version.

    This iOS port is seeming much more difficult to me. 1. Can I use a simulator to connect to the OBD2 adapter during testing? 2. Are there any recommended tutorials for me to follow? 3. Can someone point me in the right direction when it comes to iOS networking and async tasks? 4. Are there any libraries that could make this much easier

    I have this adapter BTW : Veepeak WiFi OBD2 Scanner for iPhone iPad, Mini OBDII Diagnostic Adapter, Car OBD2 Code Reader Scan Tool for Check Engine Light (MIL) Trouble Code & Live Sensor Data, Support iOS & Android

    Thanks

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

    Any good resources for learning git command line...

    Posted: 30 Nov 2018 08:41 PM PST

    I'm new to web dev learning but I feel kinda dirty using github's desktop app. I tried git from command line but was lost and I felt like I could destroy my own computer doing that. Then I decided to just try the github desktop app.

    Anyway, I want to learn how to use git like a good programmer should. Please help me find a good resource!

    Note: I'm doing front end stuff mostly if that changes the approach...

    submitted by /u/01123581321AhFuckIt
    [link] [comments]

    Database for iOS Schedule App?

    Posted: 30 Nov 2018 04:23 PM PST

    So I'm doing my final year project and have decided to make an app with swift where a work schedule can be posted to and viewed by the employees. I'm not that best at programming but can learn what's necessary. Now I need a backend database that can be linked to the app where the schedule can be created (via algorithm ideally rather than manually creating it). I was wondering what is the best way I can go about this for free? I've heard about Firebase from my lecturer but want to see if there are any alternatives which are 100% free or if this is the best option for what I need to do. Any help is appreciated!

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

    2 exactly same functions, but one with Numpy not working

    Posted: 30 Nov 2018 07:21 PM PST

    x = [[1,2],[2,3],[10,1],[10,10]] def duplicatingRows(x, l): severity = x[l][1] if severity == 1 or severity == 2: for k in range(1,6): x.append(x[l]) for l in range(len(x)): duplicatingRows(x,l) print(x) x = np.array([[1,2],[2,3],[10,1],[10,10]]) def duplicatingRows1(x, l): severity = x[l][1] if severity == 1 or severity == 2: for k in range(1,6): x = np.append(x, [x[l]], axis=0) return(x) for l in range(len(x)): duplicatingRows1(x,l) print(x) 

    So here's my code, I'm not the best with editing. I want to duplicate the rows with the element in the second column equal to 1 or 2. The first function without the use of Numpy works, whereas the second one prints the original x, without any change. Why? How? I am confused af.

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

    How are you supposed to implement automation for projects/repos

    Posted: 30 Nov 2018 07:18 PM PST

    For example:

    • when I make a folder for a new project, I want to easily / automatically add default .gitignore & LICENSE.md

    • when I make a new .js file, I want to automatically add a comment at the top that says it's name and a few other things.

    • when I make a new user.js file, fill in the name, namespace, author.

    • when I update a file in a repo, update a .html file that has last updated <date> on it.

    • automation for updating the README.md with regards to thinks like version numbers & change logs.


    I see a lot of repos that have things like this & I'm having trouble finding guides on how they do this, or how it's supposed to be done.

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

    How to reset working directory to a certain commit without removing any commits in the tree?

    Posted: 30 Nov 2018 01:03 PM PST

    I am using Git. I want to keep the HEAD at current commit, but change the working directory's content to a certain commit in the past. Like git reset --hard <commit> but without changing the branch's tip or HEAD.

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

    Why aren’t more developers/engineers going into business for themselves?

    Posted: 30 Nov 2018 06:59 PM PST

    I realize it isn't easy whatsoever to go into business and become an instant hit. However, I've always wondered why those that have the engineering chops aren't more consistently going into business for themselves. Is it because some have above average coding ability but aren't as well rounded in other areas(ex. leadership, "creativity", endurance)? What was it that kept you from exploring startup land or turned you away from it?

    Software development/ engineering is, imo, the most innovative and consistently expanding field there is, so why aren't those who excel in that field taking part in startups?

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

    Finding the closest value to a given number (Python)

    Posted: 30 Nov 2018 06:24 PM PST

    Hey Reddit! Quick question,

    So given that I have a randomly generated list of 5 numbers, is there anyway to find out which one is closest to a specific value? For example, let's say that my list comprises of the following numbers, [23, 42, 55, 72, 94] and I want to find out which value is closest to 30, how could a write a function that would go about doing that?

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

    No comments:

    Post a Comment