• Breaking News

    Thursday, January 11, 2018

    Creating linked lists, queues and stacks (C++) learn programming

    Creating linked lists, queues and stacks (C++) learn programming


    Creating linked lists, queues and stacks (C++)

    Posted: 10 Jan 2018 09:04 PM PST

    In my first ever blog post, available here: http://www.computist.xyz/2018/01/linked-lists-queues-and-stacks.html, I've outlined how stacks and queues can be efficiently implemented using singly-linked lists for those interested in learning more about basic data structures!

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

    How long did it take you until you had that "click moment"?

    Posted: 10 Jan 2018 03:46 PM PST

    Hello r/learnprogramming ! I'm currently learning Swift 4 as my first language and so far so good. I'm taking this course for those that are curious.

    I just overcame a huge bump in the road, which was understanding how classes work and why they are so important. That said, with one bump came another bump. This bump that I'm trying to understand are optionals, which confuse the crap out of me. This is my second day of programming and I'm hoping within the next few weeks I'll understand them.

    That said, the question I have for you guys is: How long did it take you to feel all those click moments? A day, 2 days, a week? Like I said, the only click moment I've had are with classes.

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

    My code doesn't do what I want it to and I don't know why.

    Posted: 10 Jan 2018 05:45 PM PST

    The code's meant to first ask me if I know my number or if I need the calculator's help. When I enter 'Y' (I know the number) it doesn't execute the rest of the code. It skips to return 0. Why? Entering 'N' does the same. Code:

    #include <iostream> int getOperator(); int getNumber(); int calculateNumOfItems(); int determineFunct(); void calculateNumOfStax(int numOfItems); int main() { int functType = determineFunct(); if (functType == 'Y') { int numOfItems = getNumber(); calculateNumOfStax(numOfItems); } else if (functType == 'N') { int numOfItems = calculateNumOfItems(); calculateNumOfStax(numOfItems); } return 0; } void calculateNumOfStax(int numOfItems) { int numOfStax = (numOfItems - (numOfItems % 64)) / 64; int remainder = (numOfItems % 64); std::cout << "Number of stacks: " << numOfStax << std::endl; std::cout << "Remainder: " << remainder << std::endl; } int determineFunct() { std::cout << "Do you know the number of items already? If so, enter 'Y'. If not, enter 'N': \n"; int functType; std::cin >> functType; return functType; } int calculateNumOfItems() { std::cout << "Calculator Mode.\n"; int finalNum; int numOne = getNumber(); char operate = getOperator(); int numTwo = getNumber(); if (operate == '+') {std::cout << numOne << " + " << numTwo << " = " << numOne + numTwo << "\n"; finalNum = numOne + numTwo;} else if (operate == '-') {std::cout << numOne << " - " << numTwo << " = " << numOne - numTwo << "\n"; finalNum = numOne - numTwo;} else if (operate == '/') {std::cout << numOne << " / " << numTwo << " = " << numOne / numTwo << "\n"; finalNum = numOne / numTwo;} else {std::cout << numOne << " * " << numTwo << " = " << numOne * numTwo << "\n"; finalNum = numOne * numTwo;} char doAgain; std::cout << "Run calculator again? Y/N: "; std::cin >> doAgain; if (doAgain == 'Y') { std::cout << "Ok! The calculator doesn't save numbers so remember your number if you need it again later!"; std::cout << "Calculator Mode.\n"; int numOne = getNumber(); char operate = getOperator(); int numTwo = getNumber(); if (operate == '+') {std::cout << numOne << " + " << numTwo << " = " << numOne + numTwo << "\n"; finalNum = numOne + numTwo;} else if (operate == '-') {std::cout << numOne << " - " << numTwo << " = " << numOne - numTwo << "\n"; finalNum = numOne - numTwo;} else if (operate == '/') {std::cout << numOne << " / " << numTwo << " = " << numOne / numTwo << "\n"; finalNum = numOne / numTwo;} else {std::cout << numOne << " * " << numTwo << " = " << numOne * numTwo << "\n"; finalNum = numOne * numTwo;} while (doAgain == 'Y') { std::cout << "Run calculator again? Y/N: "; std::cin >> doAgain; if (doAgain == 'Y') { std::cout << "Calculator Mode.\n"; int numOne = getNumber(); char operate = getOperator(); int numTwo = getNumber(); if (operate == '+') {std::cout << numOne << " + " << numTwo << " = " << numOne + numTwo << "\n"; finalNum = numOne + numTwo;} else if (operate == '-') {std::cout << numOne << " - " << numTwo << " = " << numOne - numTwo << "\n"; finalNum = numOne - numTwo;} else if (operate == '/') {std::cout << numOne << " / " << numTwo << " = " << numOne / numTwo << "\n"; finalNum = numOne / numTwo;} else {std::cout << numOne << " * " << numTwo << " = " << numOne * numTwo << "\n"; finalNum = numOne * numTwo;} } } } return 0; } int getOperator() { std::cout << "Please enter an operator (+, -, /, *): "; char operate; std::cin >> operate; return operate; } int getNumber() { std::cout << "Please enter a number: "; double userValue; std::cin >> userValue; return userValue; } 
    submitted by /u/FactoryBuilder
    [link] [comments]

    My first react native app

    Posted: 10 Jan 2018 05:35 PM PST

    Just wanted to share this cool project with you guys, it took me around 10 days without any prior knowledge of react, this app just make some api requests and display real time stock prices, you can see it via this link That would be great if you can share some feedback. Thanks for reading

    submitted by /u/svddxnly-app
    [link] [comments]

    How does learning scripting languages (Perl, TCL, Python) compare to learning C/C++?

    Posted: 10 Jan 2018 07:21 PM PST

    So this Winter Break I made it a goal to beef up my resume by learning some more languages. In school I've taken classes in C and C++, and all of my projects so far have been in those languages. Now when I started learning Python, I felt like I picked it up pretty quick within about a week. Compared to C/C++, Python is a piece of cake. It seems like most of the language is about the wide variety of applications it can be used for instead of the structure/features of the language itself. So many useful tools are already built it, it takes so much of the burden of actually writing code off of your shoulders. Is this the way it is with Perl and TCL as well? I'm gonna try t get those on my resume as well.

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

    How do you manage to complete a side project, while you have full time work + hobbies?

    Posted: 10 Jan 2018 01:51 PM PST

    Just looking for general tips from people who completed applications while still working a full 9-5.

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

    How does mobile app source code compile code on the mobile device?

    Posted: 10 Jan 2018 10:12 PM PST

    I'm fairly new to programming, I was just wondering- when a user installs an app on the phone, does every phone come preinstalled with a compiler that converts the source code into machine code for the mobile (as in a computer) to display the app?

    How exactly does this process work/how is it different from what happens on a computer?

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

    More fun way to learn Java?

    Posted: 11 Jan 2018 12:17 AM PST

    Hey.
    Ruby guy trying to learn Java.

    TLDR: Any tutorial which teach basic Java where student has to build some application.?

    Have you come across any tutorials which teaches Java with an application in mind?

    Like the tutorial has the overall goal of getting beginners understand basic Java concepts but instead of going through bookish topics one by one, they take an example of building a practical software in the end like simple version of School Library Management and using that explaining how various things are to be used.

    Basically top down approach of teaching.

    I am currently learning from thenewboston and Derek Banas Java tutorial.

    I find them understandable and interesting but not engaging. Sometimes certain topics like building objects from inherited classes or broad topics like polymorphism just aren't clear enough. Particularly without context.

    It would be much easier to actually learn if a tutorial covers day to day scenarios like getting libraries from github and using them or organizing different files in a folder and using them together, also.

    Most Ruby tutorials actually cover Ruby gems in the first 3-4 tutorials itself or how different files are to be used in modules and classes.

    Many teach with an application in mind like building a basic Bank software which covers everything from Arrays to classes to objects to private method and encapsulation, etc.

    This gives a nice picture which topic gets used how.

    So anything like that in Java I can follow?

    I want to learn and have actual idea what to search next in a topic.

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

    UML-diagram's

    Posted: 10 Jan 2018 03:06 PM PST

    anyone got a site with excercises on uml-diagrams more specific the domain model.

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

    Going the self taught path, Need advice.

    Posted: 10 Jan 2018 11:41 PM PST

    Hello , I'm 13 years old and I really would like to get into coding and software development early and try to learn as much as possible being self taught. My school does not have any coding classes so I'm using the internet , tutorials , online classes etc as of now I'm learning processing (not p5.js yet) through a tutorials by danial shift man on YouTube and plan on also watching most of his stuff .

    As of now I'm looking to learn JavaScript , python, html5 C++ node.js and sql in the near future but I want to learn as many (useful) languages as possible

    I was looking at online courses like udemy and Udacity and plan on buying a few coding books but nothing is set in stone and am looking for general advice on what languages to learn first and how to learn them what online courses (if any) to take and what books (if any) to buy along with general tips , warnings suggestions etc Thanks!

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

    What is the fastest way to have someone send a saved video from their phone and get it on a computer? E.g. email, text options, etc.

    Posted: 10 Jan 2018 05:48 PM PST

    I hope the title gets the question across, but if not I'll try to elaborate. Say I want someone to send me a video from their smart phone and I want the video to be saved on my computer, what is the fastest and most effective way to get this done? I know they could email me the video from their phone and I could open it in my email and save it on my C: drive with some sort of scraper, but are there any faster ways? Any help is much appreciated. Thanks in advance.

    Edit: I apologize all, I should've clarified my demands better. I want a few individuals to be able to send videos from their phone quickly and in some way such that the videos end up on a server or PC. I have to assume the users are malicious and willing to share passwords, email addresses, IP addresses, etc., such that to confirm only approved people and phone numbers or devices can send videos. Again, all replies are much appreciated. Thank you!

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

    Any self-taught software engineers from and working in a third world country ?

    Posted: 10 Jan 2018 04:35 PM PST

    What stack are you working with?

    Has the lack of a CS degree affected you when trying to climb up through your career?

    And how long did it take you to get yourself into the industry ?

    Please be thorough.

    PS. I've posted this before, but I haven't gotten many responses. Maybe I'll have better luck this time.

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

    Visual Studio 2017; Start without Debugging Error

    Posted: 10 Jan 2018 05:21 PM PST

    My professor required that we use visual studio 2017 community edition for our programming class [c++].

    I have about a semester's worth of c++ although I am new to VS. In class all we had was 2012 although he prefers we download 2017. In class it works fine, but when I got home and downloaded 2017 and ran my program, the "start without debugging" opens and shuts the window almost instantly. I am not quite sure how to set it to pause like it did in 2012. If anyone could help me out really quick I would appreciate it. I'm sure the professor would help me out but that's in a few days and I thought I would ask here really quickly! I did my best to look it up, although I did not really find a solution that I could apply to give me a fix.

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

    Would love to learn C# but not sure where to start?

    Posted: 10 Jan 2018 09:53 PM PST

    So i just got laid off from a developer position and I know my lack of skills/knowledge when related to programming had a lot to do with it. If I am honest idk if entirely love programming as much as what programming can do for a person if they are good at it (high paying job/more opportunities/next zuckerberg?). That being said the language we used at my previous place was C# so if I even wanted to learn to code proficiently what are some good resources (online/books/courses?) I could look at to get started?

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

    2FA for Laptops/Desktop

    Posted: 10 Jan 2018 04:56 PM PST

    Hey Everyone,

    2FALogin : It is a program which provides 2Factor Authentication using Face recognition with the help of Kairos AP.

    https://github.com/HarshitKhurana/2FALogin

    Open to suggestions for any type of ammendments , functionality additon or improvement.

    Thanks

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

    curl google.com question

    Posted: 11 Jan 2018 12:02 AM PST

    Hello,

    I have a pretty random question about how google redirects you if you type google.com.

    so when I typed "curl -I google.com" it responded with a 301 redirection to http://www.google.com, but when I type google.com into my browser it automatically goes to the https (secured) version. But, if I do "curl -I http://www.google.com/" it returns a 200 OK response and doesn't redirect to the https one.

    What is going on? Is there something else happening beneath the hood that redirects google.com in the browser different than google.com in the terminal?

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

    Frontend vs backend development

    Posted: 11 Jan 2018 12:01 AM PST

    Does front-end development mainly involve UI/UX design whereas backend is more of the "logic" and algorithm based, that does the execution based on the interaction on UI page?

    Correct me if I'm wrong: let's say there's app -the UI design including buttons and whatever's on the UI page would come under front end development whereas the logic that gets executed upon clicking those buttons would come under back end?

    If that's the case I assume languages like C, C++, swift are backend languages?

    Would appreciate if you could provide better examples in the context of an app (and not related to web since I don't have any web dev experience).

    Thanks for your time.

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

    Hexadecimal color does not appear on mobile

    Posted: 10 Jan 2018 11:51 PM PST

    I am working on a website where I was using hexadecimal color code for some elements. The color displays perfectly on my laptop but on my mobile there is no color at all for the elements. However when I use words like dark-gray or use rgba value the color appears on all platforms.

    Is there a reason why this is happening?

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

    Trying to turn my short stories into games. I know where I want to be but not where to begin

    Posted: 10 Jan 2018 03:07 PM PST

    I've been writing short stories for a while now. I love to write, but I'm wanting to deliver my stories in an interactive format. I have zilch programming experience. I'm wanting to create a small game in the style of something like pokemon red/blue or the 90's zelda games. I know different people will have started at different points but I'm so clueless I'm open to all suggestions.

    What level of skill is require to produce something to this degree? Where do I begin, software, what kind of programming knowledge do i need? Any and all constructive advice welcome!

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

    A couple conceptual questions

    Posted: 10 Jan 2018 03:03 PM PST

    Hey all - while I have occasionally browsed this sub, this is my first time posting. I did read the "new here" sticky and the FAQ, and did some searching. Except for the portion about IDEs in the FAQ barely touching on what I want to get at, I wasn't able to find my answers.

    This all started with some random comments on reddit about a snippet of a Monte Carlo simulation. After I expressed interest in programming at home, one guy there offered to answer some questions, but has been unresponsive to my follow-up questions even after I PM'd him, so I come to this sub!

    I have some experience programming, but my environment has always been given to me. "Here's your text editor, here's the language and compiler, now go program." So while I honestly am rather good at writing code to solve a problem, I don't understand the intricacies of what's happening in the background. Now I am looking for a new job and attempting to become more software oriented, so I'm trying not to look like a fool.

    Here's our conversation:

    Me

    Trying to get into running dumb little programs. What do i need to write, compile, and run something like this?

    Him

    Here's a quick rundown if you're new to programming things like this:

    You can write with any text editor. I recommend one that has syntax highlighting. If you're on windows, try getting Notepad++. This can be used to make the source files for your C program.

    You will also need some sort of C compiler for your operating system and computer architecture. This will convert your source code into machine code that can be executed. If you are on Windows, you can use MinGW. Compile the source files into an executable file (.exe files on windows) by following the guide or online tutorials.

    Most basic programs like these run on the command line (no graphical interface). Use the command prompt in Windows to run the executable file so that you can see it print output.

    Message me any other questions.

    Me

    Ah thank you!! This is extremely helpful and exactly what I'm looking for. I have some questions now and might have some follow up questions. No rush in getting back to me.

    I should let you know where I'm at. I've programmed quite a bit in my life, so I'm not new at writing code. I've got that down pretty well. But I've always had my programming environment (is environment the right word? I think there's a technical meaning for that, so I'm not sure if it means what I want it to mean here) set up for me. Whether in college classes or at work, it's been like "here, use this stuff to do your programming, write your program in this then click compile blah blah blah and run it from this command line". But now I'd like to do my own programming to refresh and improve my skill.

    You correctly guessed I'm using Windows, but I've used Linux in the past for programming. And I've often heard it's easier to do this sort of stuff in Linux. Do you think it's worth while for me to set up my computer for dual boot into Linux?

    Is Notepad++ basically Notepad but with syntax highlighting, and maybe better formatting/tabbing? Like you said, I could use any text editor. I've used both Vim and Emacs before. I know there are passionate fans of each. I forget the differences and I forget which I liked more. Is Notepad++ similar to those?

    One more question for now, at a high level. I think I understand it, but want confirmation. I'm trying to wrap my head around where the programming language fits in. Am I correct to say the programming language is "tied" to the compiler? When we write in a text editor, we are writing with some programming language in mind. Then the compiler looks at that code, and either compiles or spits out errors based on whether we correctly stayed within the rules of the programming language's syntax?

    And doing the compiling actually converts the code into assembly language which is tied to my operating system. I could be wrong, but I think you misspoke or just kept it simple for me assuming I wouldn't know the difference, when you said it converts to machine language. Machine language is still one step removed, yes? Doesn't really matter for my purposes, of course. Out of sight, out of mind. I'd just like to be clear. When I run the executable, the OS then brings it to machine language (I'm just making an educated guess, correct me if I'm wrong).

    Thanks for all your help! First interview next week.

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

    looping through a file that doesn't always have a set patter in python

    Posted: 10 Jan 2018 12:34 PM PST

    Hi all

    So this is a more logic question then actual coding. I have an input file formatted like this:

    HostA* Date HostA Subject... http://... Date HostA Subject... http://... HostC* Date HostC Subject... http://... 

    and so on.

    I have got two input files, a file with the list of hosts and the input file. I don't know how to deal with extra lines for each host. Like at the beginning of each set of hosts there is an extra Host line. Denoted with *. In the real file the star won't be there.

    The plan is to grab the each host and their corresponding subjects and http web link.

    def main(): with open('hostlist.txt') as f: host_list =f.read().splitlines() with open('input.txt') as f: lines = f.readlines() output = dict() output = output.fromkeys(host_list) for k in output: i = i.rstrip() if k ==i: output[k]=i 

    It is here that I am getting stuck. If the line in the file matches with our key, then I want get it's subject line (including the http link) and set it as the key's value. But they aren't on the same line.

    I thought about using finding the index of the current line we are one, and then increment to get the subject line's index position and grab it that way, but the file format is non-uniform with an extra HostX for each section of the hosts.

    Thanks in advance for your help on this.

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

    C# XML url import without url ending in .xml

    Posted: 10 Jan 2018 10:11 PM PST

    Hey I'm having heaps of trouble with importing an xml page into C# app. I have tried HTTP get and parsing it to XML but had no luck. And the normal import xml functions dont seem to work because the URL doesnt end in .xml even though it is an xml page. Can anyone point me in the right direction?

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

    [JAVA] Having trouble with sqlite database being locked. Can't figure out why.

    Posted: 10 Jan 2018 06:02 PM PST

    EDIT: Is my question hard to understand? 26 views and no response. Maybe I need more detail or something?

    I have a DataBase class that I use to do all db stuff.

    My program is reading from the db every 20 seconds and sometimes there can be a write at the same time from another class. The thing is I am closing the connection, the statement and the result.

    If I put a redundant call in the catch block it will just fail over and over again. This made me think that I had not closed the db somewhere but I have close statements in every single method.

    What am I missing.

    public class Db { private static String url = "jdbc:sqlite:asi_sync.sqlite"; private String[] tables = {"events","rooms","presenters","schedule","dates", "videos"}; public Db(){} private Connection connect() { Connection conn = null; try { conn = DriverManager.getConnection(url); } catch (SQLException e) { System.out.println("could not connect db: "+e.getMessage()); } return conn; } //I have about 15 methods that operate on the db they all follow this format //-------------- public Event getEventById(int eventId) { Connection db = connect(); String sql = "SELECT * FROM events WHERE event_id=? LIMIT 1"; Event event = null; try { PreparedStatement sth = db.prepareStatement(sql); sth.setInt(1, eventId); ResultSet rs = sth.executeQuery(); while(rs.next()){ event = new Event(rs.getInt("event_id"), rs.getString("event_title"), rs.getString("event_begin_date"), rs.getString("event_end_date"), rs.getString("event_location"), rs.getString("event_city"), rs.getString("event_state"), rs.getString("event_root_folder"), null); } rs.close(); sth.close(); } catch(SQLException e){ System.out.println(e); } finally{ try { db.close(); } catch (Exception e) { /* ignored */ } } return event; } } 
    submitted by /u/swiftpants
    [link] [comments]

    Code doesn't run Properly, i don't know what happen. Just copy the existing dev work, And try to run it and getting errors.

    Posted: 10 Jan 2018 09:44 PM PST

    Here it is..

    $(document).ready(function() { // // Set Background Image;

    // var path = GetBasePath() + "images/bg.jpg"; $('body').css({ 'background': 'url("' + GetBasePath() + '/images/bg.jpg") no-repeat center fixed', 'background-size': 'cover' }); 

    function GetBasePath() {

    // var pageUrl = document.URL; // var pageUrlParts = pageUrl.split('/'); // var pageUrlPartsLength = pageUrlParts.length; var neededUrl = ''; var trigger = true; var pathArray = window.location.pathname.split('/'); neededUrl = window.location.protocol + "//" + window.location.host; // neededUrl = pageUrlParts[0]; for (var i = 1; i < pathArray.length; i++) { if (trigger) { neededUrl = neededUrl + '/' + pathArray[i]; } if (pathArray[i] == bookFolder) { trigger = false; } }; // alert(neededUrl); return neededUrl; console.log(neededUrl); 

    Every thing works good but expect this extra basepath that i didn't want.

    <body style="background: url(&quot;http://localhost/TeacherGuide/Human_Systems_Interactions/ip-screen.html/images/bg.jpg&quot;) center center / cover no-repeat fixed;">

    This will work fine if i remove ip-screen.html manually, but i don't know how to do this in js function. Need help. Any one?

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

    No comments:

    Post a Comment