• Breaking News

    Thursday, April 19, 2018

    Got absolutely slammed in an interview [Java] learn programming

    Got absolutely slammed in an interview [Java] learn programming


    Got absolutely slammed in an interview [Java]

    Posted: 18 Apr 2018 05:46 AM PDT

    Hey /r/learnprogramming,

    TL;DR - Never forget your fundamentals, don't be like me and learn "enough" to produce projects, dive deep and do things properly.

    I thought some of you might find this interesting as I was quite shocked. Turns out I don't really know as much as I thought about Java.

    Essentially my company has a Java practice, I have been pushing to maybe transition over to it from the business side and OH BOY did my software engineering degree fail me.

    I thought some of you might find it useful to know what I was asked about that I didn't know, as they seemed to be very different to what I was expecting.

    • final, finally and finalize - what are the differences and what are the best practices?
    • Java GC - when does it run? Can you force it to?
    • How does string concatenation (string1+string2) act differently to using the StringBuilder class?
    • What happens to a variable if you don't declare an access status (public, private, protected)?
    • How do each of the types of errors behave, what is a checked/unchecked method? What is the most common Error, how is it managed? What happens when there is an error during compile time vs runtime and how can you manage them? Can you ignore them? How/when?
    • What is special about the Set datatype, what happens if I put multiples of an identical object into a set instead of, say, a list?

    I will edit this post with the feedback I get from the interview tomorrow as I expect to be given a gigantic list of the things I need to learn or areas to focus on and I am sure that will be interesting for some of you.

    I know some of these things may seem basic for you, but I was legitimately never really taught the listed topics at any point in my degree (Software engineering, 1:1), I was told "You could have picked up any basic book on java and you would know that" but, alas, I did not.

    Also interesting was they were completely disinterested in anything I had made or written, it was entirely basic functionality knowledge that I slipped up on.

    I think there is a bit of misinformation in a lot of programming circles that says "If you just keep building cool things and then showing them to employers you will definitely get hired" Well yes, you might, but you also might be interviewed by someone who is going to ask you to do more than produce a few for loops and expects you to know, for instance, some things about Java's unique memory management. If you're like me and you've only really developed small-medium projects mostly solo/duo, you might struggle even with many projects.

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

    Detailed Computer Science notes

    Posted: 18 Apr 2018 09:47 PM PDT

    Wanna learn some OpenCV?

    Posted: 18 Apr 2018 11:57 PM PDT

    twitch.tv/griffithinnovate, we stream every thursday @5pm AEST (so, at the time of posting).

    Hopefully shameless self promotion is not a bannable offence!

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

    Sharing Grasshopper: Learn to Code app with y'all :)

    Posted: 18 Apr 2018 01:03 PM PDT

    Hi everyone! I wanted to share with you all what I've been working on for the last year+, that we're just announcing today: Grasshopper! It's an app that teaches adults to learn to code on Android or iOS. It's probably too basic for many of the folks in this subreddit, but I've also seen quite a few newbies here. :)

    We specifically designed it to be a way for someone with no prior experience to learn how to code on their own in those spare moments while on your commute, waiting in line, or on the couch at night. You can give it a shot at http://grasshopper.codes.

    We're still very much in an experimental phase, so any and all feedback welcome. Let me know if you have questions; happy to answer.

    Hope some of you here find if valuable, or feel like sharing with a friend who is interested in learning to code, but finds it too intimidating.

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

    Looking for JavaScript, React, React Native, Reduct, Express and NodeJS Resources

    Posted: 18 Apr 2018 10:15 PM PDT

    Hi all,

    I have an internship this summer working at a start-up company. I am a first-year computer science student, and have completed two courses in Java. I have also completed a course in Computer Graphics, mainly using THREE.JS.

    I would love some links/suggested Youtube series where I can learn. If anyone also has any ideas about projects that I could possibly work on that could combine a few of those, that would be amazing!

    submitted by /u/50mac50
    [link] [comments]

    Good resources to learn the following specifically ? ( See Description )

    Posted: 18 Apr 2018 08:03 PM PDT

    Over this span of summer I wanna learn a few stuff. I already know C++ and currently learning python. This is what I want to learn in the summer

    • C++ GUI. I'm pretty confused whether to use Qt or wxWidgets and don't know where to start ? Youtube ?
    • C# with Xamarin. Wanted to have cross platform skills .
    • Django. I'm currently learning Python from How to automate the boring stuff. But I'd like to know at least one language to build websites.
    • BASH I'm still a newbie in Linux and that's what I'm using full time instead of windows. So why not learn the scripting ?
    submitted by /u/SymmetricGandalf
    [link] [comments]

    Where would reddit ranking processing take place? (eg client vs database vs backend server program)

    Posted: 18 Apr 2018 09:00 PM PDT

    I am trying to build an app that displays comments based on virality. I have a few options in my head where this ranking computation should take place:

    Option 1

    At the client. Client requests data from server which sends back a large list of comments within certain time period. Client app ranks those comments and then displays to user.

    Option 2

    At the database. Client or web server program writes the full ranking sql query and database sends back fully ranked comments to the web server which then sends it back to the client. Client merely just displays the comments in that order.

    Option 3

    At the backend server program (eg AppEngine). Client sends a request to server program. Server program asks database to send back unranked comments in a certain time period. Server program does the ranking after it receives the comment data back from the database. Once sorted, the web server program sends it to client which merely displays it.

    So my questions are:

    Does anyone know how / where reddit does their ranking?

    What are the pros/cons of each solution or are there any solutions that really dont make sense at all?

    Thanks!

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

    What are some subreddits or places on discord and slack where there are teams of students who work on projects?

    Posted: 19 Apr 2018 12:41 AM PDT

    I want to build projects with people online. I once was in a slack which had like hundreds of people with tons of teams that were building stuff and practising etc.

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

    Python VS Code unittest Test Runner (visualstudio_py_testlauncher.py) crashing on assertEqual (ConnectionAbortedError and OSError)

    Posted: 19 Apr 2018 12:07 AM PDT

    I've asked this question on StackOverflow but got no response so I was wondering if you guys could help me with it? (Side note, why did it get downvoted on StackOverflow? I've never asked a question before and I'm not sure if it's to do with how I asked the question at all?) Nevertheless I've copied the question here as well for your ease.

    I'm using unittest for Python 3.4.4 inside VS Code and am encountering some strange test behaviour. Originally I was using Python 3.6 and the tests ran fine, if I ran all tests it would tell me which ones failed and which ones passed, then if I debugged a test with "Uncaught Exceptions" checked it would break where the exception occurred in my program.

    I then downgraded to Python 3.4.4 so I could use PySide to create a GUI for my program, everything in my program runs fine apart from my tests. Clicking all tests works fine if all tests pass, however, if just one test fails, "No tests ran, please check the configuration settings for the tests" is displayed in the bottom right hand corner instead (however discover all tests works fine).

    If I run a single test, using the lens displayed above the test, that also works fine as long as the tests pass and the tick appears next to it. However if the test fails it displays no tests ran again. When debugging a failing test, it raises a ConnectionAbortedError, here is what is displayed in the Debug Console and doesn't break on the error:

    test_simplify_regex_more (test_algorithms.test_kleenes.TestKleeneAlgebra) ... FAIL ConnectionAbortedError, [WinError 10053] An established connection was aborted by the software in your host machine 

    If I break just before the assertEqual line, then tick the "All Exceptions" box in the breakpoints dialogue, the following is output on the debug console:

    ImportError, No module named 'thread' test_simplify_regex_more (test_algorithms.test_kleenes.TestKleeneAlgebra) ... AssertionError, 'b*bb' != 'b*bbb' - b*bb + b*bbb ? + FAIL AttributeError, 'NoneType' object has no attribute '__context__' AttributeError, 'NoneType' object has no attribute '__context__' AttributeError, 'NoneType' object has no attribute '__context__' ConnectionAbortedError, [WinError 10053] An established connection was aborted by the software in your host machine AttributeError, 'NoneType' object has no attribute '__context__' OSError, [WinError 10038] An operation was attempted on something that is not a socket 

    If I break just before the assertEqual line, with only "Uncaught Exceptions" ticked, then step over it (F10), it takes me to line 317 of visualstudio_py_testlauncher.py and closes the debug (I think) socket with this code

    finally: if cov is not None: cov.stop() cov.save() cov.xml_report(outfile = opts.coverage + '.xml', omit=__file__) if _channel is not None: _channel.send_event( name='done' ) _channel.socket.close() 

    Which then causes an OSError and this is displayed in the Debug Console

    test_simplify_regex_more (test_algorithms.test_kleenes.TestKleeneAlgebra) ... FAIL ConnectionAbortedError, [WinError 10053] An established connection was aborted by the software in your host machine OSError, [WinError 10038] An operation was attempted on something that is not a socket 

    Oh and the cherry on the cake is unittest runs fine when ran on the command line with the exact same arguments. This is my settings.json file:

    { "python.unitTest.unittestEnabled": true, "python.unitTest.unittestArgs": [ "-v", "-s", "./tests", "-p", "test_*.py", ], "python.linting.pylintArgs": [ "--disable=E0611" ], "python.unitTest.debugPort": 3005, } 

    and my user settings:

    { "workbench.colorTheme": "Default Light+", "window.zoomLevel": -1, "debug.inlineValues": true, "C_Cpp.intelliSenseEngineFallback": "Disabled", "editor.autoClosingBrackets": false, } 

    If I run

    python -m unittest discover -v -s ./tests -p test_*.py 

    from the root folder of my project unittest works fine and displays an appropriate x many tests failed, x many errors type message (here is a screenshot for clarity)

    I just can not for the life of me figure out to fix this. I tried uninstalling python and vs code, installing python 3.4.4 and then vs code in case VS Code was still configured to Python 3.6 at all but that didn't work and I've messed with my settings.json file numerous times to no avail. I've searched for any answer similar to mine but I can't find anything that works! I thought I could live without it and just run it from command line but it's very cumbersome. Any help would be greatly appreciated!

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

    Issues with ArrayIndexOutOfBoundsException error in Java [Homework]

    Posted: 19 Apr 2018 12:06 AM PDT

    I'm getting a very curious error when I try to run my program. What it is supposed to do is when you load the program, you select the name of a species from a JList, which will display its location, initial population, and rate of growth over 10 generations. The information corresponding to each species of creature is in a separate class called species, and it uses a vector as opposed to an array.

    Looking at the error message, I know where the issues are, but I can't figure out why it is an issue. If anyone can help me understand why this is happening I would appreciate it.

    I apologize in advance if it looks awkward. I haven't written out code on reddit before and don't know exactly how to structure it show it shows the line number and such.

    EDIT1: I forgot to mention this, but the information is taken from a file called "growth.txt". The code should have a working BufferedReader. EDIT2: Not sure if this will help, but I'm using Eclipse Oxygen 3a. (4.7.3a) EDIT3: In case some people missed it, the errors should be on lines 81, 94, 128. They're also marked with a comment //issue

    Here is the class Stage3, the main class.

    package [REDACTED]_JavaAssignment; import java.awt.EventQueue; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.Vector; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionEvent; import javax.swing.JScrollBar; import javax.swing.JScrollPane; import javax.swing.JLabel; //Author: [REDACTED] //Date Created: 18/04/2018 //Date last changed: 18/04/2018 //This program loads data from a text file. //The data is then added to a JList drop down menu and depending //the user's input, specific information is shown in the GUI by //updating JLabels. // //Input: growth.txt //Output: GUI // edit this public class Stage3{ private JFrame frame; private JList jList_Species = null; private JScrollPane jScrollPane_Species = null; private JLabel jLabel_Location = null; private JLabel jLabel_StartPop = null; private JLabel jLabel_GrowthRate = null; private Vector<species> vecSpecies; //Vector calls values from class 'species' private JList getjList_Species() { if (jList_Species == null) { jList_Species = new JList(); jList_Species.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent arg0) { jLabel_Location.setText("Location: " + vecSpecies.get(jList_Species.getSelectedIndex()).sSpeciesLocation); jLabel_StartPop.setText("Starting Population: " + vecSpecies.get(jList_Species.getSelectedIndex()).iStartPop); jLabel_GrowthRate.setText("Growth Rates: " + vecSpecies.get(jList_Species.getSelectedIndex()).iGrowthRate1 + "%" + ", " + vecSpecies.get(jList_Species.getSelectedIndex()).iGrowthRate2 + "%" + ", " + vecSpecies.get(jList_Species.getSelectedIndex()).iGrowthRate3 + "%" + ", " + vecSpecies.get(jList_Species.getSelectedIndex()).iGrowthRate4 + "%" + ", " + vecSpecies.get(jList_Species.getSelectedIndex()).iGrowthRate5 + "%" + ", " + vecSpecies.get(jList_Species.getSelectedIndex()).iGrowthRate6 + "%" + ", " + vecSpecies.get(jList_Species.getSelectedIndex()).iGrowthRate7 + "%" + ", " + vecSpecies.get(jList_Species.getSelectedIndex()).iGrowthRate8 + "%" + ", " + vecSpecies.get(jList_Species.getSelectedIndex()).iGrowthRate9 + "%" + ", " + vecSpecies.get(jList_Species.getSelectedIndex()).iGrowthRate10 + "%"); } }); } return jList_Species; } private JScrollPane getjScrollPane_Species() { if (jScrollPane_Species == null) { jScrollPane_Species = new JScrollPane(); jScrollPane_Species.setBounds(166, 36, 247, 229); jScrollPane_Species.setViewportView(getjList_Species()); frame.getContentPane().add(jScrollPane_Species); } return jScrollPane_Species; } /** * Launch the application. */ public static void main(String[] args) throws IOException { EventQueue.invokeLater(new Runnable() { public void run() { try { Stage3 window = new Stage3(); //issue? - Can't call stage 3 window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public Stage3() { initialize(); //issue? - can't call initialize } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 760, 562); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); // Vector to hold data vecSpecies = new Vector<species>(); try { BufferedReader ReadFile = new BufferedReader((new FileReader("growth.txt"))); String sLine; String[] saLineElements = new String[13]; // Reads input in text file while ((sLine = ReadFile.readLine()) != null) { saLineElements = sLine.split(","); vecSpecies.addElement(new species( saLineElements[0], saLineElements[1], Integer.parseInt(saLineElements[2]), Integer.parseInt(saLineElements[3]), Integer.parseInt(saLineElements[4]), Integer.parseInt(saLineElements[5]), Integer.parseInt(saLineElements[6]), Integer.parseInt(saLineElements[7]), Integer.parseInt(saLineElements[8]), Integer.parseInt(saLineElements[9]), Integer.parseInt(saLineElements[10]), //issue? - this is where the main issue lies Integer.parseInt(saLineElements[11]), Integer.parseInt(saLineElements[12]) )); } // Set names in listbox String[] saNames = new String[vecSpecies.size()]; for (int iI = 0; iI < vecSpecies.size(); iI++) { saNames[iI] = vecSpecies.get(iI).sSpeciesName; jList_Species.setListData(saNames); jList_Species.setSelectedIndex(0); } // Closes file ReadFile.close(); } catch (IOException e) { System.out.println("ERROR: Could not read text file!"); } //JList here jList_Species.setBounds(15, 80, 115, 208); frame.getContentPane().add(jList_Species); //JScrollPane here jScrollPane_Species = new JScrollPane(); jScrollPane_Species.setBounds(166, 36, 247, 229); jScrollPane_Species.setViewportView(getjList_Species()); frame.getContentPane().add(jScrollPane_Species); JLabel jLabel_Location = new JLabel("Location:"); jLabel_Location.setBounds(129, 320, 210, 20); frame.getContentPane().add(jLabel_Location); JLabel jLabel_StartPop = new JLabel("Starting Population:"); jLabel_StartPop.setBounds(129, 356, 210, 20); frame.getContentPane().add(jLabel_StartPop); JLabel jLabel_GrowthRate = new JLabel("Growth Rates:"); jLabel_GrowthRate.setBounds(129, 392, 210, 20); frame.getContentPane().add(jLabel_GrowthRate); } } 

    Here is the other class species which stores all the data and is called by the above class

    package [REDACTED]_JavaAssignment; //Author: [REDACTED] //Date Created: 18/04/2018 //Date last changed: 18/04/2018 // //Data class for species. //Stores species, location, initial population, and rate of growth over 10 generations public class species { // Variables String sSpeciesName = ""; String sSpeciesLocation = ""; int iStartPop = 0; int iGrowthRate1 = 0; int iGrowthRate2 = 0; int iGrowthRate3 = 0; int iGrowthRate4 = 0; int iGrowthRate5 = 0; int iGrowthRate6 = 0; int iGrowthRate7 = 0; int iGrowthRate8 = 0; int iGrowthRate9 = 0; int iGrowthRate10 = 0; public species (String sSpeciesName, String sSpeciesLocation, int iStartPop, int iGrowthRate1, int iGrowthRate2, int iGrowthRate3, int iGrowthRate4, int iGrowthRate5, int iGrowthRate6, int iGrowthRate7, int iGrowthRate8, int iGrowthRate9, int iGrowthRate10) { this.sSpeciesName = sSpeciesName; this.sSpeciesLocation = sSpeciesLocation; this.iStartPop = iStartPop; this.iGrowthRate1 = iGrowthRate1; this.iGrowthRate2 = iGrowthRate2; this.iGrowthRate3 = iGrowthRate3; this.iGrowthRate4 = iGrowthRate4; this.iGrowthRate5 = iGrowthRate5; this.iGrowthRate6 = iGrowthRate6; this.iGrowthRate7 = iGrowthRate7; this.iGrowthRate8 = iGrowthRate8; this.iGrowthRate9 = iGrowthRate9; this.iGrowthRate10 = iGrowthRate10; } } 
    submitted by /u/RealDestroNation
    [link] [comments]

    What text editor does your company use and why?

    Posted: 18 Apr 2018 08:15 PM PDT

    Hello everyone,

    For those that work full time coding / programming for a major company.

    What text editor does our company use and why?

    Thanks in advance for sharing

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

    Coding a Platformer in C, Where to Begin/specific resources?

    Posted: 19 Apr 2018 12:01 AM PDT

    Hi,

    For a university project, we have to create a video game in two weeks, and I am really, rally motivated to create something cool. The thing is, we are only allowed to code in C and use controls from a microcontroller. I have never created a game in my life, but I am somewhat proficient in C and want to know how exactly to get started, and if there were any online resources to help me figure out how to get started. I know theoretically that I must implement physics/gravity for falls, jumps, walking, and parameters to keep characters from walking off and everything.

    The design of my game is pretty set, but I have no idea how to actually code it. How do I make a character animate on screen and go to any possible point on the screen except going through solids and whatnot?

    I know I'm asking very broad questions, but any websites or tutorials in C that cover any of this, since I have no direction on what to put in my code? No C++ or C# or objective C, I have never touched that in my life.

    Thanks!

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

    Where can I get a list of ALL reserved domain names?

    Posted: 18 Apr 2018 11:52 PM PDT

    Sorry if this question does not fit here. I've been trying to choose a domain name for a website I'm developing, and many of the names I tried seem to be reserved and not available for purchasing.

    Is there a way to get a single list of ALL reserved domain names? Not just reserved for organizations, but also things like general technical terms.

    Thanks!

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

    Decided to Build my Own DI Container from Scratch and Blog my Progress

    Posted: 18 Apr 2018 07:54 PM PDT

    Feel free to come see my progress and learn with me as I go along, I'm doing everything in C# but a lot of the principles are still the same either way.

    I start off at a high level, discussing what the Pros and Cons of DI is/are, and what kind of pitfalls you can face, along with how to use it and why you really might want it in your project!

    Let me know what you think and please feel free to ask me any questions you have, or you can ask them in the comments on the blog, or even just PM me here!

    I'm also open to hear what kind of things you'd like to see me delve into, what topics you'd like to know about, and perhaps what functionalities you'd like to see how I would approach on this project!

    Cheers!

    http://blog.technically.fun/2018/04/dependency-injection-part-0-whats-deal.html

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

    AVL Tree single-rotation messes up the root node and makes my program get stuck in a while loop

    Posted: 18 Apr 2018 11:33 PM PDT

    Right off the bat, a few details:

    This is in C#

    Code: https://pastebin.com/auCfWFW5

    The problem I have here is that in cases where I require a double-rotation to balance the tree, my code works perfectly alright. However, the single-rotation is where things get really hairy.

    My rotation functions are set to return the node to be inserted after rotation. I store this by overwriting the node that has to be rotated here: (one of the cases where the problem happens in case of single rotation)

     if (Height(node.right.right) > Height(node.right.left)) { //Left Rotation on node node = RotateLeft(node); } else { //Right Rotation on right child of node node.right = RotateRight(node.right); //Left Rotation on node parent node = RotateLeft(node._parent); } 

    After a single-rotation, if the node to be rotated was the root node, the node._parent points back to itself, because of which my code gets stuck in an infinite loop during the insertion function when I placed a while loop to ensure that the tree._root always points to the actual root node like so:

     if (new_node._parent._parent != null) { CheckBalance(ref new_node._parent._parent, 1); } while (_root._parent != null) { _root = _root._parent; //This is where the infinite loop happens } 

    Could anyone please help solve the problem? I can't figure it out because it seems that at the time of returning the node from the rotation function, the node._parent is null as it should be, but the resulting node still points to itself.

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

    How to set up email for my domain name

    Posted: 18 Apr 2018 11:32 PM PDT

    I recently purchased a domain from namecheap. They provide the service of creating emails like xyz@mydomain.com, but they charge for it. Right now I have set up my custom email using gmail, but its 10-15 days trial. Can someone suggest me some free websites that provide this service.

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

    Where is the search box of GitBook?

    Posted: 18 Apr 2018 11:16 PM PDT

    Have you anyone used Gitbook? I can't find where its search box is on its website. Or it means we can't search books about programming on it?

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

    [SQL] creating multiplicity relationships between tables in access

    Posted: 18 Apr 2018 11:16 PM PDT

    im not looking for how to do it via the wizards, im looking for how its done through SQL. not sure what to search up, any useful resources or a person explanation would be greatly appreciated, thanks. need beginner explanations. does it just automatically happen when i add a foreign key constraint?

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

    Can someone help me understand why the answers are the ones as listed here

    Posted: 18 Apr 2018 11:14 PM PDT

    https://ufile.io/okm41

    In this file lists a pdf...in it lists a couple of classes linked together via inheritance.

    I have a couple of questions I would like answered.

    Please try to be short with your replies.......for example a good reply would be "Its this because of blah blah blah.....any call that is in the blah blah blah is blah blah blah"

    Basically tell me why its the answer relative to the problem but also conceptually tell me why its the answer. Which means tell me why does java do this.

    Anyway here are the ones i have trouble on

    -var2.one() why is it blue 1 red 1 green 1

    -var2.two() why is it error

    -var2.three() Why is it red 2 yellow 2 yellow 3

    -var3.two() Why is it error

    -var3.three() Why is it Yellow 2 yellow 3

    -var4.one() Why is it error

    -((Red) var2).three(); Why is it Red 2 Yellow 2 Yellow 3

    -((Yellow) var2).two(); Why is it Red 2 Yellow 2

    Honestly I just want to understand the answers...I already know what java will spit out if i do this...But i guess I am asking mainly because i want to understand.

    The internet is not always too easy for finding this information. So please. Someone patient, kind, and loving come and help me.

    If all you are going to do is nag and chew me out you should probably not answer because I will not listen.

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

    What should i build with WithReddit.com

    Posted: 18 Apr 2018 11:12 PM PDT

    I saw withgoogle.com and decided getting WithReddit.com was a good Idea. What should I build there though. I was thinking about sentiment analysis of reddit.

    I was thinking to do sentiment analysis of #reddit Tweets.

    What do you guys think?

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

    [Homework] May someone please help me with assessing a specific increment on a variable in JavaScript within the next 8 hours?

    Posted: 18 Apr 2018 11:02 PM PDT

    I have to declare one variable containing the quantity of apple juice bottles bought by person A and one variable containing the price of each apple juice bottle with person A. Then for person B, I must switch both the quantity of bottles bought and the price change per bottle using an increment while using the same variable from person A for both the quantity and cost. Could someone please help me through this?

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

    [C programming]- text to morse code converter help

    Posted: 18 Apr 2018 10:59 PM PDT

    [Homework] -forgot to add to title

    I am trying to finish/edit the program to be able to type out a sentence and convert it into morse code.

    Could someone explain this portion of the code? What I would need to do to change it to make it so it prints multiple words instead of just the first character?

    char * lookup(char *p) { char *ans; int isFound = 0; int i = 0; while (!isFound && i < SIZE) { if (*p == records[i].character) { // we found it isFound = 1; ans = &records[i].character; } i++; } return ans; 

    This is the full code so far:

    #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> char * lookup(char *p); void init(); #define SIZE 36 /* define the struct for the morse conversion table */ typedef struct { char character; // either letter or digit char code[6]; // corresponding morse code } conversion; conversion records[SIZE]; // 26 letters plus 10 digits int main () { // first thing: we need to create and initialize the table init(); // get the sentence from the user char sentence[5000]; gets(sentence); // once we get the sentence, we need to split it char *p; // temp pointer to store the return value from strtok p = strtok(sentence, " "); // fisrt call while (p != NULL) { // print out the corresponding morse code // printf("%s\n", p); printf("code: %s\n", lookup(p)); p = strtok(NULL, " "); // the following call } return 0; } char * lookup(char *p) { char *ans; int isFound = 0; int i = 0; while (!isFound && i < SIZE) { if (*p == records[i].character) { // we found it isFound = 1; ans = &records[i].character; } i++; } return ans; } void init() { records[0].character = '0'; strcpy(records[0].code, "-----"); records[1].character = '1'; strcpy(records[1].code, ".----"); records[2].character = '2'; strcpy(records[2].code, "..---"); records[3].character = '3'; strcpy(records[3].code, "...--"); records[4].character = '4'; strcpy(records[4].code, "....-"); records[5].character = '5'; strcpy(records[5].code, "....."); records[6].character = '6'; strcpy(records[6].code, "-...."); records[7].character = '7'; strcpy(records[7].code, "--..."); records[8].character = '8'; strcpy(records[8].code, "---.."); records[9].character = '9'; strcpy(records[9].code, "----."); records[10].character = 'a'; strcpy(records[10].code, ".-"); records[11].character = 'b'; strcpy(records[11].code, "-..."); records[12].character = 'c'; strcpy(records[12].code, "-.-."); records[13].character = 'd'; strcpy(records[13].code, "-.."); records[14].character = 'e'; strcpy(records[14].code, "."); records[15].character = 'f'; strcpy(records[15].code, "..-."); records[16].character = 'g'; strcpy(records[16].code, "--."); records[17].character = 'h'; strcpy(records[17].code, "...."); records[18].character = 'i'; strcpy(records[18].code, ".."); records[19].character = 'j'; strcpy(records[19].code, ".---"); records[20].character = 'k'; strcpy(records[20].code, "-.-"); records[21].character = 'l'; strcpy(records[21].code, ".-.."); records[22].character = 'm'; strcpy(records[22].code, "--"); records[23].character = 'n'; strcpy(records[23].code, "-."); records[24].character = 'o'; strcpy(records[24].code, "---"); records[25].character = 'p'; strcpy(records[25].code, ".--."); records[26].character = 'q'; strcpy(records[26].code, "--.-"); records[27].character = 'r'; strcpy(records[27].code, ".-."); records[28].character = 's'; strcpy(records[28].code, "..."); records[29].character = 't'; strcpy(records[29].code, "-"); records[30].character = 'u'; strcpy(records[30].code, "..-"); records[31].character = 'v'; strcpy(records[31].code, "...-"); records[32].character = 'w'; strcpy(records[32].code, ".--"); records[33].character = 'x'; strcpy(records[33].code, "-..-"); records[34].character = 'y'; strcpy(records[34].code, "-.--."); records[35].character = 'z'; strcpy(records[35].code, "--.."); } 
    submitted by /u/TRlPPIEREDD
    [link] [comments]

    [Algorithim] undersatnding how a function is running

    Posted: 18 Apr 2018 10:38 PM PDT

    https://i.imgur.com/jmQHr0b.png

    I have the algorithim where A is a 0 indexed array with n even integers to run a runtime analysis. I am having trouble understanding what the function is doing however.

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

    [C++] Help with Merge Sort with a vector of struct objects

    Posted: 18 Apr 2018 10:36 PM PDT

    I'm attempting to perform as many sorting algorithms as possible with this struct:

    template <typename E, typename C> struct uPair { E key; C value; }; 

    with the following sorting class:

    template <typename E, typename C> class sortingAlg { vector<uPair<E,C>> keyvalue; //methods for various sorting algorithms }; 

    And so far I've managed to implement most of the various sorts (insertion, shell, heap, selection, quick), basically, any sorting algorithms that are easily in-place. However I've run into trouble with Merge Sort. I know how to do this with a normal vector:

    void mergeSort(vector<E>& S, const C& less) { typedef vector<E> vect; int n = S.size(); vect v1(S); vect* in = &v1; vect v2(n); vect* out = &v2; for (int m = 1; m < n; m *= 2) { for (int b = 0; b < n; b += 2*m) { merge(*in, *out, less, b, m); } std::swap(in, out); } S = *in; } 

    But am kind of lost as to how to elegantly do this with a vector of structs objects. I've tried passing in the vector of keys and vector of values separately but it turned into such a mess that it wasn't quite it. I then tried passing in copies of vector structs by reference:

    void mergeSort( std::vector< uPair<E,C>> & vect, E uPair::*key, C uPair::*value) 

    But don't quite know what to do after that. If anyone can point me in the right direction I'd greatly appreciate it!

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

    No comments:

    Post a Comment