• Breaking News

    Friday, September 27, 2019

    VisuAlgo - visualising data structures and algorithms through animation learn programming

    VisuAlgo - visualising data structures and algorithms through animation learn programming


    VisuAlgo - visualising data structures and algorithms through animation

    Posted: 26 Sep 2019 06:29 PM PDT

    A resource I used to use. Forgot about. Found again. Thought others might find useful. It looks as though there are many more now.

    https://visualgo.net/

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

    Just wanted to say thanks

    Posted: 26 Sep 2019 08:09 PM PDT

    I am currently studying Software Development at school and today I wrote my first C# program that I actually understood what I was writing and only had to look up one thing. While I learned most OOP concepts in school, I didnt really understand that well. Using resources I've seen posted here really has helped with my learning and understanding of programming. Also seeing all the posts about people who are/were in similar situations makes me feel like Im not alone.

    I dont post much and Im a general lurker on most subs but I appreciate everyone in this community! :)

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

    Can someone please help me with this pattern question?

    Posted: 26 Sep 2019 04:25 AM PDT

    So a few days ago a friend of mine was asked to code this pattern:

    2 4 6 6 10 8 8 16 18 10 10 20 26 46 12 .....goes on infinitely 

    They couldn't and then they asked me to do the same later. Now, I'm generally alright with patterns but this one is driving me mad at this point. I just can't figure it out. At first, I thought it was a weird pascal triangle of sorts but that fails on the 5th line.

    Can anyone spot any pattern here?

    I get that it could be removed from here but I don't exactly know which subreddit will fulfill the requirement so I am just seeking help at the big subs I know. So mods, if possible please do not remove, or if you do, if possible kindly point me towards what sub would be appropriate.

    EDIT: Okay, so looks like a user was able to finally come up with a solution!

    I had a chat with u/de0x_ and they seem to have come up with a solution that works.

    So here is that solution:

    The First and Last elements of every row are fairly straight forward as everyone that attempted this has realized by now, the problem is the middle elements:

    So the algorithm for the middle elements is as follows:

    int i=0; if(element != first_element && element != last_element) { i++; if(i%2==0) current_element = element[current_element_position-1] + element[current_position-2]; else current_element = element[current_element_position-1-((i-1)/2)] + element[current_position-1-2-((i-1)/2)]; } //here all the elements are being treated as being in a consistent queue of sorts. 

    This solution remains logically consistent with the given pattern. Translating this into code, however, is another thing. In any case huge shoutout to the genius u/de0x_ for noticing the pattern. And kindly some rich Redditor guild his comment!

    Do come up with your solutions as well, and a HUGE thank you to everyone who participated in this thread! You guys are awesome! :)

    EDIT 2: For the people that are finding the solution a bit hard to grasp (and I agree I wrote it in a rather crappy manner), here is a comment of mine explaining the same. Hopefully, this makes it clear:

    https://www.reddit.com/r/learnprogramming/comments/d9iaid/can_someone_please_help_me_with_this_pattern/f1jutfc?utm_source=share&utm_medium=web2x

    EDIT 3: Also according to the logic the user came up with the next line will be:

    12 36 48 66 114 14

    and so on...

    EDIT 4: Here is the above algorithm implemented in python:

    def series(rows=10): pascal_index = 0 current_index = 0 elements = [] for row in range(rows): row_min_idx = int(row*(row+1)/2) row_max_idx = int(row*(row+3)/2) for idx in range(row_min_idx,row_max_idx+1): if idx == row_min_idx: elements.append(2*(row+1)) current_index += 1 elif idx == row_max_idx and idx != 0: elements.append(2*(row+2)) current_index += 1 elif idx != row_min_idx or idx != row_max_idx: pascal_index += 1 if pascal_index % 2==0: element = elements[idx-1] + elements[idx-2] elements.append(element) current_index += 1 else: element = elements[idx-1-(int((pascal_index-1)/2))] + \ elements[idx-3-(int((pascal_index-1)/2))] elements.append(element) current_index += 1 print(elements[row_min_idx:row_max_idx+1]) if __name__ == '__main__': series(rows=10) 

    Here, is the output generated:

    [2] [4, 6] [6, 10, 8] [8, 16, 18, 10] [10, 20, 26, 46, 12] [12, 36, 48, 66, 114, 14] [14, 48, 62, 60, 122, 102, 16] [16, 32, 128, 160, 62, 222, 76, 18] [18, 36, 162, 198, 138, 336, 118, 454, 20] [20, 192, 212, 190, 402, 382, 784, 138, 922, 22] 

    Credit for the above code: the amazing u/hangryusprime!

    FINAL EDIT: And finally here is a really crappy Java implementation for the java people by your's truly! :)

    import java.util.*; import static java.lang.System.*; public class Test{ public static void main(String...args){ series(10); } private static void series(int rows){ int pascalIndex=0; int currentIndex=0; ArrayList<Integer> elements = new ArrayList<>(); for(int row = 0; row < rows; row++){ int rowMinIdx = (row*(row+1)/2); int rowMaxIdx = (row*(row+3)/2); for (int idx = rowMinIdx; idx<rowMaxIdx+1;idx++){ if (idx == rowMinIdx){ elements.add(2*(row+1)); currentIndex += 1; } else if (idx == rowMaxIdx && idx != 0){ elements.add(2*(row+2)); currentIndex += 1; } else if (idx != rowMinIdx || idx != rowMaxIdx){ pascalIndex += 1; if (pascalIndex % 2==0){ int element = elements.get(idx-1) + elements.get(idx-2); elements.add(element); currentIndex += 1; } else{ int element = elements.get(idx-1-((pascalIndex-1)/2)) + elements.get(idx-3-((pascalIndex-1)/2)); elements.add(element); currentIndex += 1; } } } for(int i=rowMinIdx; i<rowMaxIdx+1;i++) out.print(elements.get(i)+" "); out.println(); } } } 

    And here is the output:

    2 4 6 6 10 8 8 16 18 10 10 20 26 46 12 12 36 48 66 114 14 14 48 62 60 122 102 16 16 32 128 160 62 222 76 18 18 36 162 198 138 336 118 454 20 20 192 212 190 402 382 784 138 922 22 

    Again thanks to everyone who helped and I hope you people have a good day/night wherever you are! :)

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

    New to programming. I'm stuck learning Javascript since I don't have anything to apply it to. Any basic project ideas you could suggest I try as a beginner?

    Posted: 26 Sep 2019 03:19 PM PDT

    Hiya,

    I started learning HTML and CSS almost a month ago now, and I've got them down for the most part (maybe there's more complex stuff I don't know about them yet?), but now I'm moving onto Javascript, and I'm at a complete loss of what to actually make with it.

    With HTML and CSS it was easy, just make a cool looking website. But with JS I don't even know what can be done, let alone where to start. Could anyone here please elaborate or give ideas to point me in the right direction so I can apply what I am learning?

    Thanks in advance.

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

    What's my best bet to practice programming at work?

    Posted: 26 Sep 2019 01:55 PM PDT

    I have a lot of downtime. I'm given a computer but can't download anything. I can't use my personal laptop either. Is there like a practice space online? Leetcode only lets you do specific problems - I want just a blank template, to have free reign over it and to be able to run it and see the output.

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

    How can you let people download your program?

    Posted: 26 Sep 2019 06:16 AM PDT

    This seems like it would be easy to find online, but I couldn't find much information about it for some reason. How does letting people download your software online work? If i wanted to put a program on my website for others to download, how does this work?

    Do you some how need to create an installer for your software and upload that, and if so how does one create an installer for a program? Or do you just upload the program files?

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

    How much math and stats do I have to know to do a fun AI project?

    Posted: 26 Sep 2019 06:02 AM PDT

    I would assume all of that stuff is abstracted out by some sort of AI library? I'd like to do a project like this one with no prior AI experience but decent Java experience and I've programmed apps and websites before. Is it feasible to make something like that or even this flappy bird AI as a fun AI project?

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

    Looking to do in text interview someone working professionally in a CS career (15m)

    Posted: 26 Sep 2019 06:58 PM PDT

    Hello, I am a 15 year old Canadian highschool student. In Canada, we have a class called careers where you basically look into your future and what you will be doing then. Part of my final project is to do an online interview with someone who works in a field you are interested in. All I will need from them are 5 simple questions, a legal name (verifiability), credentials if possible (Reddit has a lot of trolls that fake information) and maybe some optional extra questions for additonal information or notes. If someone is willing to help please reply or direct message me.

    EDIT; I understand these proof requirements are very sketchy and I also like nonamimity on the internet myself. They were put to me on the assignment. I understand if someone is not willing to give it up, but your answers are still valuable to me.

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

    Custom domain on PythonAnywhere?

    Posted: 26 Sep 2019 07:11 PM PDT

    this may be an obscure question but I have a web dev account and am looking to run my second website on it, so I have to use a separate registered domain. Below are screenshots of the message I'm getting on the DNS setup on PythonAnywhere, and below that the DNS records for my site on my domain host site (domains.com). Is this the right setup, and am I only getting this message because I added the www CNAME an hour or two ago? If not, what do I need to change? Thanks a ton

    https://imgur.com/a/k72DoT3

    https://imgur.com/a/5ZYA5Z4

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

    Racket - Is it useful for anything?

    Posted: 27 Sep 2019 12:22 AM PDT

    I'm a CS major at school and for the intro course which is notoriously difficult and meant to weed people out, we use racket. I had some experience with C++ prior to beginning, and just find the language wholly frustrating. Things I could do very simply in C++ seem to require more steps and considerably more time. The assignments being given to me I feel like I could bang out quickly in C++ but a homework assignment will take me 6+ hours in racket. It's impossibly frustrating and is discouraging me from continuing in CS. So my question is, is racket used anywhere else?

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

    Wanting to make an app / software for desktop and mobile. Where do I start?

    Posted: 26 Sep 2019 12:38 PM PDT

    Hey guys hope all is well.

    I want to learn programming. More specifically I want to make an invoicing and stock managment app as SaaS. The idea is that they can login on there device and use the app which would be connected to a remote server & database.

    My question is which language would be your go to weapon and which libraries would you use? The more detail the better. I'm committed!

    Thank you!

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

    [HTML/Javascript] How can I transfer form data to a google sheet?

    Posted: 26 Sep 2019 07:16 PM PDT

    I'm currently using this: https://github.com/jamiewilson/form-to-google-sheets but how can I modify the code to use different sheets within the same spread sheet for different forms? would the fetch function be able to take inputs for the different sheets?

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

    Beginner questions about stacks.

    Posted: 26 Sep 2019 10:52 PM PDT

    Given its speed. Why is the maximum stack size so small?

    Since the stack is often very small. Would there be any benefit to putting it on the CPU Cache when it is small enough in size?

    Are there other reasons why the stack is faster than the heap other than its FIFO making it always know where next is?

    Is the heap ever defragmented or reorganized? If so when? By who? How?

    Are the heap and the stack congruent in memory? i.e. the stack grows downwards and the heap needs more room, does that mean the stack has to reposition itself upwards in memory? Or is the connection between the two illusional in that they can reside far apart in memory?

    Why can't the heap and the stack both grow in the same direction?

    What part of the OS manages the heap and the stack of each application?

    Would there be any benefit to introducing a 3rd level of memory with a lifetime between the heap and the stack? There is the short term the stack. The heap is forever. Perhaps a level where there is a timeout associated with the memory block allocated.

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

    A few questions about Python

    Posted: 26 Sep 2019 04:35 PM PDT

    IM HAVING A BLAST LEARNING THIS STUFF!

    I'm still new to this world (about a week in) but started learning Python (afterwards SQL, then HTML/CSS, etc.) I'm nowhere near ready to start my own projects but today I decided to check out all the "other stuff". Not sure what else to call it.

    With reddit as my right hand, I've ended up downloading the following: Python3, GitKraken, Atom text editor, script runner for atom, and Kite for Atom.

    Anyway my questions are:

    What is GitKraken for? (Or any Git thing)

    What do I do in the Python cmd? Do I just need it installed or do I have to go into it and enter the code for something to happen?

    Any learning tool recommendations? (I'm using online resources, physical books, and codeacademy to learn atm.)

    I apologize for the noob questions!

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

    Basic server header files, Java

    Posted: 26 Sep 2019 10:12 PM PDT

    So, I am writing a basic server in Java and am trying to a return an index.html to the client. I need to send at header file first. Right now I only have

     pw.write("HTTP/1.1 200 OK\n" + "Content-Type: text/html\n" + "Content-Length: 123\n" + "\n"); 

    what other headers do I need? It is a simple html webpage. But i can't get it working and I think it is becuase I am missing some important headers. Also, how do I determine Content-length of my html file? Thanks!

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

    is it possible to assign a static object into a dynamic object in c++ or vice versa

    Posted: 26 Sep 2019 10:06 PM PDT

    I thought it was possible to do so but have not been able to accomplish it when trying.

    so like

    Animal a* = new Animal();

    Animal b;

    b = a; //compile-time error

    a = b; //compile-time error

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

    How might I go about replicating functionality of TVDB and IGDB? A general plan of attack as well as specifics about creating an API

    Posted: 26 Sep 2019 10:01 PM PDT

    I've had some rough, rusty experience with C# and am happy to delve beyond the basics of Python.

    I'm hoping to create my own 'agent' for Plex, to maintain records for that which don't belong on a public site. And, with IGDB being bought by Twitch, I'm very curious about creating and maintaining a similar site that will remain community-driven, for use with the likes of Playnite.

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

    Python: I'm trying to count the vowels in the user inputted words, then output the word with the most vowels back.

    Posted: 26 Sep 2019 09:56 PM PDT

    Hi! First post here of what I assume to be many.

    In this program I am trying to:

    1. Get a list of words as input from the user
    2. Count the number of vowels in each word
    3. Tell the user the word with the most vowels, and how many vowels are in that word.

    My current code:

    def vowelcount(userwords): #splits the word, checks if each character is a vowel, counts the vowels vowels = 'aeiou' count = 0 maxcount = 0 for word in userwords: for character in word.split(): if character in vowels: count += 1 if count>maxcount: maxcount = count #remembers that this word has the max vowel count maxword = word #save the current word with the max vowel count to print later return maxcount userwords = input("Enter your words here:") print(vowelcount(userwords)) print(maxword) #currently causing the program to crash not sure why 

    The result when it runs:

    Input: apple, ball

    Output: 3

    So the problem is that it counts the vowels across all the words, instead of just each word. Is saying "for word in userwords" not enough to mean that I only want each word of the list that the user inputs? The question is then how do I separate the words in the user's input? I think I would have to use the spaces between the words as a break point somehow but I'm not sure how to implement that.

    Also a second problem is that when I tried to add "print(maxword)" the program runs into an error. I'm assuming that will be fixed when the program is actually running properly but I'm not entirely sure.

    Anyways thank you and sorry if this was too much information for what is probably an obvious solution.

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

    Need help with password program in JavaScript

    Posted: 26 Sep 2019 03:32 PM PDT

    Hey guys, I'm very very new to programming and I need help with a program to verify if a password is valid.

    Basically, I have to create a program which starts with prompt("choose a password") and then make sure that the password has 5 to 10 characters, at least 1 upper case and 1 lower case, and the first character is different from the last.

    The thing is, I have no idea how to treat variables that are not numbers. I really need some hints on this!

    If anyone could help me I would be grateful 3000

    Thanks:)

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

    Where can I get project ideas to deepen my knowledge on machine learning?

    Posted: 26 Sep 2019 09:20 PM PDT

    Obligatory I'm on mobile sorry for the crappy formatting.

    I know there are some blog posts/repos like build your own x and stuff. I'm looking for something like that for machine learning.

    Preferably something more or less practical like the "make your own spam filter" that is floating around on the internet.

    As long as it's interesting and/or engaging that's good too, I actually just need something a little more engaging than "classify these flowers".

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

    Need help in chosing the right language for a program.

    Posted: 26 Sep 2019 09:16 PM PDT

    Hello! I'm not sure if this is the right place, but can anyone help me? I have an idea regarding a sports related software I could design that could fill a market gap, but I'm not well versed in programming languages. I have some outdated background in logic, DAO, MySQL, Java(minor) and Visual Studio. The thing is, I want it to have a slick transparent and Steam(metro UI) like GUI, a bit like the very own overlay of LaLiga Starting-11 line-ups or this one. I would like to design a similar interactive GUI, that would have the same feeling and visuals, but would actually respond to user input from a PC or tablet like adding information and updating the database when closing/finishing work. Is there any language that could tackle that? I would like to make it light, but that would also handle accessing database without much hassle. I mean it would need to be responsive in accessing databases and possibly in the cloud. If this is not the right place to ask this question, would you kindly point me where would I get proper guidance?

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

    Relatively new to programming and need some help!

    Posted: 26 Sep 2019 03:18 PM PDT

    So I was a business student but have swapped my major to computer science, I had a blast in my first year courses, but now ive run into something I can't wrap my mind around..

    Basically I have to make a grid and place objects onto that grid, and I don't even know where to start for that..

    I'm using visual studios for this course and I don't know where to start! I'm not looking for someone to do my work for me, just a nudge in the right direction!

    Square grid, starts in top left corner, and there will a number of objects put which will have a position on our grid( in a specific cell)

    Thanks for any help you can give me!

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

    HTML in C# MVC need to make an input for a datetime with a calendar

    Posted: 26 Sep 2019 09:11 PM PDT

    Hello everyone,

    I am writing an application currently that needs to take in both a date and time of day through an html form. In the past, I have found that if you do this for just a date, you can have a small calendar pop up for the user to select a date, but I cant find my old project or find anything on stackoverflow to do this.

    So is it possible to write a line in an HTML form that will display both a calendar and some sort of clock to force the user to give an answer in a valid form?

    Bonus points: can you make it with a min and max time?

    Current line:

    Start time: <input type="datetime" name="StartTime" value="@string.Format("{0:YYYY-MM-DDThh:mm:ss}")" /> 
    submitted by /u/-whoKnowsMan-
    [link] [comments]

    Live Streamed Intro to Machine Learning with Python Course this Sunday

    Posted: 26 Sep 2019 08:58 PM PDT

    Hi folks, I regularly run free, live programming courses for the Reddit Comunity. This Sunday, I will be offering a live Intro to Machine Learning with Python. During this class, you will build your own machine learning models and learn how to evaluate them. I have designed the class to be interactive so you will watch the live-streamed class and code along with other students.

    Who is this for? Beginners who are curious to know more about machine learning. Basic knowledge of Python such as variables and functions will be helpful.

    Interested to know more? Take a look here: https://www.hackhour.co/#Intro_to_Machine_Learning_with_Python

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

    No comments:

    Post a Comment