• Breaking News

    Sunday, March 10, 2019

    What have you been working on recently? [March 09, 2019] learn programming

    What have you been working on recently? [March 09, 2019] learn programming


    What have you been working on recently? [March 09, 2019]

    Posted: 09 Mar 2019 08:09 AM PST

    Hello everybody! We're running a new experiment: having weekly "what are you working on?" threads. See the proposal for more details.

    In short, this is a place to share any progress you've made related to learning programming. For example, you could share:

    1. Weekly updates on programming projects you're working on, big or small.
    2. Any major milestones you've hit: completing a challenging chapter in a tutorial, completing your first non-trivial project, getting invited to your first tech interview...
    3. Any other kind of "progress update".

    Here are a few ground rules:

    1. Always include a link to your source code when sharing a project update.

    2. Do not share projects that try doing something illegal or unethical.

    3. Focus on sharing recent updates. Remember, this is a "progress log" thread.

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

    5. 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.

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

    Wrote my first TicTacToe game in C++!!

    Posted: 09 Mar 2019 04:29 PM PST

    What should I do next I need few suggestions from you guys please.

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

    Passwords with Python

    Posted: 09 Mar 2019 07:26 AM PST

    Hi,

    I was just playing around with python and wrote some code for a password.

    The script asks the user to type his password

    if the password is right all is good.

    If not you have 2 more tries

    If your last try is unsuccesfull....XD

    # User-Password interaction in Python tries=3 while True: password= input("Please type your password:") if password == "ThEgReYeMiNence8839!": print("Welcome, grey :D") break else: tries-=1 if tries == 0: print("You have been locked out of the system!") # I intended to use "break" here but the next line fullfills same purpose! :D while True: print("THE FBI HAS BEEN INFORMED AND IS ON THEIR WAY!") print("Your Password was incorrect!", tries,"more tries left!") continue 

    Do you have any suggestions or optimizations?

    Should I leave out the infinite while and use "break" instead?

    Otherwise I planned to add other conditions:

    A username and a password associated with it.

    I excpect having to play around with "and" around

    Perhaps also replace the finite while loop with something better: like a script that creates infinite new documents with "Fbi is comming" and eats up the RAM :D

    But thats for another time Time :D

    Edit: Thanks for all the replies and suggestions!

    I am currently at work but I will read all your comments and experiment with your ideas tommorrow :)

    The password is fake so no need for worries

    To stop the infinite while loop press the following buttons: Ctrl-C

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

    So I've realized that one key to solving coding challenges is just understanding what is being asked, is there any way I can get better at this?

    Posted: 09 Mar 2019 07:39 PM PST

    I'm getting better at understanding what the person who wrote the challenge wants as a solution, however there are still times where I wildly misread and make the challenge more complicated than it usually is. Or just don't understand it at all. This is fine if you're in an interview and can ask the person, what does this question exactly mean? But most of the time I've had these things like one I took for IBM, I didn't understand the second question at all, and there was no one to ask, because it was done online at my home. What steps can I take to ensure that I am in fact reading the question properly, and understanding the moving parts?

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

    Learning Git.

    Posted: 09 Mar 2019 10:06 PM PST

    I've always wanted to learn it but never got around to it, I finally got around to using it today (less than 3 hours ago) after stumbling on the feature in the Atom text editor.

    It seems like a great tool and so far I've used the commit and add commands on my latest project.

    I'm reading the docs printed by the --help option but it seems like those docs only contain crude explanations of the Git program's commands and options.

    Are there any articles or blog posts that I can read to get a better understanding of what git is, what it's for and why it's used?

    Also, how often am I supposed to commit changes and where can I find official definitions for Git's terminology?

    E.G: push / pull what's that supposed to mean..?

    All help and advice would be greatly appreciated, thanks.

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

    Perfect number why this program dont end in C

    Posted: 09 Mar 2019 07:29 PM PST

    Hello, Im doing a program to find a perfect number and when the number is very big my program stop at the number 8128 and just stay like this the program dont end. And for this code too (from https://rosettacode.org/wiki/Perfect_numbers#C ) :

    #include "stdio.h"
    #include "math.h"

    int perfect(int n) {
    int max = (int)sqrt((double)n) + 1;
    int tot = 1;
    int i;

    for (i = 2; i < max; i++)
    if ( (n % i) == 0 ) {
    tot += i;
    int q = n / i;
    if (q > i)
    tot += q;
    }

    return tot == n;
    }

    int main() {
    int n;
    for (n = 2; n < 33550337; n++)
    if (perfect(n))
    printf("%d\n", n);

    return 0;
    }

    Can anyone tell me why the program dont stop? thanks

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

    HTML CSS GRID How do you position a title

    Posted: 09 Mar 2019 08:12 PM PST

    I want my title to sort of straddle the top of two different divs in its own div. Is there a way to do this?

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

    Online websites to learn Data Science through R, etc.?

    Posted: 09 Mar 2019 01:26 PM PST

    Hi all,

    I was just wondering what are some really good websites so I can start learning some data science/statistical applications of computer science or where I could learn some programming languages like R. (I prefer videos but anything works! Beggars can't be choosers.) Thank you all!

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

    Should new developers learn PHP?

    Posted: 09 Mar 2019 07:27 PM PST

    Is there a benefit to learning PHP first or at all, rather than just learning Node.js and ignore PHP and Ruby.

    Most modern Web Development courses don't touch PHP at all for beginners, and unless you are doing specifically freelancing, it doesn't help you to know PHP at all, even if you are working at Facebook and Wikipedia, since those companies would most likely interview you through another programming language like JS, Java, Python, or C++ anyways.

    I keep seeing YouTubers like Stefan Mischook hype up PHP as the language of the web, which is true in terms of pure statistics, but the type of websites that are made by PHP are not the type of work that a lot of Developers want to be working on, so if there a point in learning PHP at all?

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

    Am I wasting my time with python?

    Posted: 09 Mar 2019 11:55 PM PST

    I enjoy python, and i'm happy with learning it. But my problem doesnt come from the language it self. Its the fact that from most of my research everything is writen in other languages like javascript and c#. And they seem to be the only poitions in most cases that are hiring.

    I just dont want to sink so much time into learning it and find out that im not be desirable to companies.

    I guess after writing this, my problem is lack of guidance. Ultimately knowing more then one language is my goal.

    There are some question, that may give me better understanding. So the lines dont seem so blurred.

    1. What are more pratical applications in a work place for python? (I know its very good for data)

    2. Would it be a good to use it as an option in conjunction with javascript for full stack?

    3. I know you can use javascript as full stack. Would you recommend taking the basic knowledge from python and switching to javascript?

    I know a lot of this come down to whats best for me. And ultimately its my choice. But if anyone could shed some light on this for me. I would forever be greatful.

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

    How do I convert a Graph to an Adjacency Matrix in Java?

    Posted: 09 Mar 2019 05:51 PM PST

    I am trying to create the matrix to search for trios in the graph but am getting confused on how to actually put the graph's data into the matrix. Everything I've found online just details a adjacency matrix class but I am getting lost on how to actually fill the array.

    public boolean[][] matrix(Graph G) { int v = G.V(); boolean[][] adjArray = new boolean[v][v]; for(int i : G.adj(v)) { } 

    }

    private void countNumberOfTrios(Graph G) { boolean[][] arr = matrix(G); numberOfTrios = 0; int v = G.V(); for (int i = 0; i < v; i++) { for (int j = 0; j < v; j++) { for (int k=0; k<v; k++) { // check the triplet if it // satisfies the condition if (arr[i][j] == true && arr[j][k] == true && arr[k][i] == true) numberOfTrios ++; } } } 

    }

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

    Why do I get this unexpected output, regarding Threads and intrinsic locks [Java]?

    Posted: 09 Mar 2019 11:48 PM PST

    Hey guys, I am currently going through Cave of Programming multithreading course.

    In that course, in one lesson there were two methods, both had synchronized blocks inside of them (and separate objects for locks). Tutor said that if two threads call those two methods at a roughly same time (both Threads call both methods), one would be able to run first method, the other one wouldn't be able to call that method (because it didn't obtain the lock), but it would be able to call the second method (so you get the effect of simultaneous execution of methods).

    However, when I ran the program, and added some print statements I don't get the expected output.

    Code:https://pastebin.com/fLrjfS7S

    I would expect to get: Current Stage:s1, Current Thread:Thread 0 followed by Current Stage:s2, Current Thread:Thread 1, since those two methods are ran by different threads in a parallel fashion.

    What I get is: Current Stage:s1, Current Thread:Thread 0 followed by Current Stage:s1, Current Thread:Thread 1 , as if Thread 1 is waiting for Thread 0?

    What is happening?

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

    Command line to web. HOW?

    Posted: 09 Mar 2019 11:46 PM PST

    Hello everyone! So just for fun over spring break, I managed to create a program that takes several user inputs and stores them in a local data-base on my PC. Currently, my program only runs from the console screen but I want to expand it by making my program intractable via web from any device instead of just being restricted to my computer.

    The thing is I have no idea where to start! I know back-end is the right word here but where do I even start?

    I hear all these terms such as Node.js, AWS, Apache, Flask, Django, MongoDB...etc being thrown around and I have no idea where to start or what's the best for my case.

    I should mention the program is currently using Python and SQLite3, with a class I wrote in C++ that I wrapped? into Python via SWIG.

    Thank you

    submitted by /u/memhir-yasue
    [link] [comments]

    Need help finding the correct name to make it easier to google for help for my side project. And need help finding the best language to use for this project.

    Posted: 09 Mar 2019 11:42 PM PST

    I have a side project idea that I need help figuring out what language(s) I might need to use to help me put this idea to work. Also, I need help finding out the real name for the idea of my project so I can narrow down my google searches.

    So my idea is similar to a feature that is on Craigslist. It's their "Save Search" feature which allows you to be notified by email (and maybe SMS, but I'm not too sure about that) if a new listing has been created for the search term that you saved. For example, I could save a search for "mechanical keyboard". Now whenever a mechanical keyboard is posted for sale on Craigslist, I will get an email for it because the keywords "mechanical keyboard" were in the title of the listing.

    Now, I want to apply this idea to a website that I frequently visit which is Grailed. It's a men's fashion reselling website. I haven't used it a lot but I'm pretty sure there's no feature to save my keyword searches and be notified of them which I would love to see implemented someday. So I thought I would make my own if possible because I thought it would be a side project that would keep me motivated to fully finish.

    What I need help on is figuring out what can I google to find more information to help me build this? I guess this is called a "website email notifier feature"? I tried to google things along the line of "how to program email notifications for websites" but it didn't take me to the places I was looking for. Also, I'm not sure which language I should tackle this with. I've only learned Java so far because I just started learning it at my college but I'm open to exploring other languages if there's ones that suit the project better.

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

    [JS] Need help designing a sound kit via iterating through a bunch of arrays...

    Posted: 09 Mar 2019 11:21 PM PST

    Hi, I'm still fairly new to JavaScript. I'm working on making a sound-kit (similar to a drum-kit design at WesBox 30JavaScript series https://youtu.be/VuN8qwZoego ). However, I'm creating my html elements through iterating and assigning my audio in the script file. I choose to make the tags differently to better my understanding, and I wanted to make it dynamic/ flexible. I've encountered a few problems, I hope it can be addressed.

    1) I cannot make the <kbd> tag through JS.

    2) I'm having trouble making a function to check if any keys is pressed is equal to any of the 'KEY_CODES' array's object/literal. And if so, use that array and its index to play audio track.

    NB: All the arrays should have a total of 9 objects.

    JS:

    const SOUND_TRACKS = []; const KEY_LETTERS = ['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l']; // KEY_CODES ordered to match KEY_LETTERS array's values/ key pressed const KEY_CODES = [65, 83, 68, 70, 71, 72, 74, 75, 76]; const NAME_OF_SOUNDS = ['Air Horn', 'Clown Horn', 'Fart Toot', 'NikkoX2 Nii', 'Nyan Cat', 'Punchline Drum', 'Cackle', 'Sexy Hello', 'Woosh']; // List of sound tracks to be pushed into SOUND_TRACKS array, and to be iterated let airHornTrack = new Audio('audio/Air_Horn_in_Close_Hall_Series.mp3'); let clownHornTrack = new Audio('audio/Clown_Horn.mp3'); let fartTootTrack = new Audio('audio/Fart_Toot.mp3'); let nikkoNikkoNiiTrack = new Audio('audio/Nikko nikko Nii.mp3'); let nyanCatTrack = new Audio('audio/Nyan_cat_(Short Ver.).mp3'); let punchlineDrumTrack = new Audio('audio/Punchline_Drum.mp3'); let cackleTrack = new Audio('audio/Voice-Cartoon_Laugh-01.mp3'); let sexyHelloTrack = new Audio('audio/Voice-Hello-F-01.mp3'); let wooshTrack = new Audio('audio/Woosh-Light-01.mp3'); SOUND_TRACKS.push(airHornTrack, clownHornTrack, fartTootTrack, nikkoNikkoNiiTrack, nyanCatTrack, punchlineDrumTrack, cackleTrack, sexyHelloTrack, wooshTrack); // add div with... // attribute 'data-key' and keycode value // attribute 'class' named 'key' // inbetween add html tag <kbd>{keyCodes}</kbd> with keyCodes iterated in // also add html span tag with list of sound array name iterated in // Assign audio object with div // addEventListener let containerRoom = document.querySelector('.container'); // Check if key press is equal to the following keys in KEY_CODES function checkKeyCode(pressAnyKey) { for (let aKeyCode of KEY_CODES) { if (pressAnyKey === KEY_CODES) { // what is the key? return console.log("True!"); } else { return console.log("No key match!"); }; }; }; window.addEventListener('keydown',function(e) { const targetAudio = document.querySelector(`.sound[data-key="${e.keyCode}"]`); if (e == targetAudio) { checkKeyCode(e); } }); function init() { // Create new div for each object in the array for (let index in SOUND_TRACKS) { let newDiv = document.createElement('div'); // Assign class and data class newDiv.classList.add('sound'); // add keycode string to kbd tags newDiv.setAttribute('key-data', KEY_CODES[index]); newDiv.innerHTML = `<kbd>${KEY_LETTERS[index]}</kbd>`; newDiv.innerHTML = `<span>${NAME_OF_SOUNDS[index]}</span>`; containerRoom.appendChild(newDiv); //unfinished } }; init(); checkKeyCode(); 

    HTML:

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Comedic Sound Kit</title> <link rel="stylesheet" type="text/css" href="main.css"> </head> <body> <div class="container"> </div> <script type="text/javascript" src="script.js"></script> <script> </script> </body> </html> 

    CSS:

    html, body { margin: 0; padding: 0; width: 100%; height: 100%; } body { background: url("img/smiley-faces.svg"); -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } .container { margin: 0 auto; display: flex; justify-content: center; align-items: center; } .sound { color: #eee; background: #000; padding: 1rem; } 

    You can see the files at my GitHub: https://github.com/UnorthodoxThing/comedic-sound-kit

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

    Trying to tweet an image with Buffer API and Python

    Posted: 09 Mar 2019 10:52 PM PST

    I'm trying to work with Buffer API and buffer a tweet with an image. In documentation it says to pass the image link in media[] associative array as an argument for POST request. But what if I want to upload a local image? I tried an absolute and a relative paths to the local file but it doesn't work. I get an 'invalid image parameter supplied' error. Here is my code.

    POST_IMG = os.path.dirname(os.path.abspath(__file__)) + r'\output.jpg' data={'profile_ids[]': twitter_id, 'text': 'Twitter text', 'media[photo]': POST_IMG} requests.post(f'https://api.bufferapp.com/1/updates/create.json?access_token={ACCESS_TOKEN}', data=data) 
    submitted by /u/asolodoff
    [link] [comments]

    What can I do to optimize/organize this piece of code?

    Posted: 09 Mar 2019 10:46 PM PST

    I've been working on my whack a mole game project for school and I see that my code can be more optimized but I don't know how to. Is there a way to loop code that has one letter differences? Also where can I add more comments? Also I want to add a timer and counter of how many times the moles were clicked but I don't know how to. This was done in code.org

    https://pastebin.com/50iFCcR7

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

    A word of encouragement (repost from r/cscareerquestions)

    Posted: 09 Mar 2019 10:50 AM PST

    Hey guys, this is my first post here. I just wanted to share this moment of success for me and hopefully let this be an encouraging post for someone. I know I was reading a lot of posts like this during my job search, when I was feeling down about not hearing back from employers.

    A little over a year ago, I dropped out of a CS program, that I had barely started. I was really bad at programming, not putting in the time to learn, and my friend is the only reason I passed the 2nd Java course. I was going through my degree at a very slow rate, and it would have taken me 5 - 6 years to complete a 4 year degree assuming I didn't need to retake classes, while working a food service job to pay my way through college. After taking a hard look at my work ethic in formal education, I decided it was best for me to drop out and begin teaching myself programming, at least until I felt I was ready to return to taking CS classes.

    I took more hours at work and began teaching myself Python with online resources. I started to actually become passionate about programming, and I had so much more drive to learn, and general curiosity about it, versus when I was in college. After 9 months of self teaching, with a couple of projects on my GitHub, I began applying to jobs. I only heard back from one that I thought was a Wordpress job, but turned out to be a job that involved working with an archaic content management system, for a fortune 100 company that refused to upgrade their system. Nonetheless it was technically web development, so I took the job to at least get something better than barista on my resume.

    I worked this job for 5 months. During my time here I had still been working on projects for my GitHub and learning a lot in my free time. I began applying again and got an interview at a place that does quality assurance for other software companies that want to outsource that. The position was for a QA Automation Engineer, writing tests in Python. The interview was almost purely technical. Not too challenging, and I thought I only did okay. Apparently it went well enough and I received an offer!

    I haven't started yet but I'm very excited to finally have a job that actually involves programming, 14 months after I began self teaching. I know QA is not the most highly praised in subs like this, but I'm grateful for it and hope it can help me into a development role in the future. I think there's a misconception that you have to jump into a prestige development job, but you can ease your way into it like me, cause I'm no prodigy lol. I hope this is encouraging to some of you guys looking for jobs, or struggling in a CS program. I didn't go much into my learning process or how many jobs I applied to, but feel free to ask me any questions at all :)

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

    WYSIWYG editor

    Posted: 09 Mar 2019 03:24 PM PST

    Hello, I am currently practicing web development with nodejs and MongoDB. I thought it would be fun to make a little practice site with a simple WYSIWYG editor and store the data for users similar to google docs(not as good, of course). I was wondering what the best way to do this would be . I would like to customize the looks. I have looked into Quilljs and Prosemirror. Any suggestions would be greatly appreciated! Thank you so much!

    submitted by /u/2aparsec
    [link] [comments]

    Are there any open source AI projects out there?

    Posted: 09 Mar 2019 08:34 AM PST

    I've been wanting to work with AI for a while. Are there any communities or open source projects that would be a go to?

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

    How to write an auto-unzipping program?

    Posted: 09 Mar 2019 08:41 PM PST

    How would I go about writing a program to auto-unzip a .zip file? More specifically, could I do this on a flashdrive?

    Edit: auto-extract a .zip file.

    (windows 10)

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

    Trouble Studying In Front of Desm

    Posted: 09 Mar 2019 08:30 PM PST

    Yesterday afternoon, I got extemely frustrated because I could not focus on my studies. So I followed friend to a meeting, where I stayed in the car for a couple hours.

    And funny enough, I could concentrate on my work! In a car with no desk, with my laptop on my knees. I got more programming done in 3 hours than I could get in a whole day in front of my desk.

    Does this happen to anyone else? How can I make my desk a more favorable environment for concentrating?

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

    Languages

    Posted: 09 Mar 2019 08:19 PM PST

    I'm new to programming and just curious if there is a common language that people usually start on? I know there's multiple and you can start anywhere, but is one easier than another? Is one considered a "newb language"? Thanks!

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

    I know how to code but I want to learn more

    Posted: 09 Mar 2019 08:05 PM PST

    So Ive been coding for a few years and now im tired of the same old. Ive learned java, web (HTML,CSS,JS,JQuery) and a bit of DB (mongoDB, bit of mySql). I created projects separately but now I want to connect these technologies, i want to learn how to make how an app or website where i make can connect to my java built server with interacts with my DB. Ive googled it and it just seem like I dont know enough, Im told to use "LAMP" or "MERN" or "MEAN" stack and not make java server etc. and all of that confuses me, must I learn one of these stacks? Ive very lost where to start. Any help would be appreciated.

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

    No comments:

    Post a Comment