• Breaking News

    Thursday, March 21, 2019

    Help with an interview question I could not answer. Ask Programming

    Help with an interview question I could not answer. Ask Programming


    Help with an interview question I could not answer.

    Posted: 21 Mar 2019 11:57 AM PDT

    [Java]Reading a specific text inside a txt file.

    Posted: 21 Mar 2019 07:56 PM PDT

    Hello,

    Im using buffered reader in a program, how can I make my program read a specific text inside a txt file?

    like for example there are multiple names inside a txt file and I would input something to make that name appear.

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

    Help with pusing a vector into a vector of vectors (c++)

    Posted: 21 Mar 2019 07:56 PM PDT

    std::vector<std::string> addBorder(std::vector<std::string> picture) {

    int n = picture.size();

    int m = picture[0].size();

    vector<string> row(n+2, "*");

    picture.push_back(row);

    return picture;

    }

    Trying to solve this problem but when I google I get a bunch of different answers that seem to refer to a conflicting data type. I am unable to find the error in the code. It receives a vector of vectors of string type, initializes a string vector and pushes the vector into the vector of vector.

    Error:

    error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char> >::push_back(std::vector<std::__cxx11::basic_string<char> >&)'

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

    How would you program this? (inventory/COGS)

    Posted: 21 Mar 2019 07:08 PM PDT

    1. You have a warehouse. In the warehouse are locations. In the locations are items. Items have SKUs.

    2. You have distributors. You purchase items at the SKU level from your vendors through purchase orders.

    3. You receive the items off of purchase orders, then reconcile/invoice them (cementing the price you paid for the items).

    4. You have orders. You sell the items you bought from your distributors through your purchase orders to your customer. The items leave your warehouse location inventory and makes it way to shipments.

    I think the answer is lot numbers. You don't have 10 of SKU 1234 at location A. You have 5 of SKU 1234 from lot #2018 and 5 of SKU 1234 from lot #2019 at location A. This way, you can always trace back the costs.

    What do you think? Am I overcomplicating it? I can't figure out how to track the cost of the items sold walking out the door because if you don't use lot numbers, the items get all mixed together and you either need to key off of date ordered and FIFO, or use some kind of average cost.

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

    How does the Java Virtual Machine send to standard out and read from standard in?

    Posted: 21 Mar 2019 06:56 AM PDT

    As the JVM sends output streams to standard out, what is the actual JVM bytecode that performs this?

    After looking online, any time System.out.println()
    is called, the equivelent bytecode is simply invokevirtual

    So how does the JVM actually handle input and output and how would I go about it if I were writing a simple vm?

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

    How do I do front-end user authentication using the Rails 'Devise' gem?

    Posted: 21 Mar 2019 02:38 PM PDT

    I've been trying to do front-end user auth with React but to no avail. I've created an AJAX request that SHOULD be creating a user in the back-end, and the promise should be the user's data, but I'm getting some weird HTML element, and the user isn't being created. I know that because I checked in the Rails console. User.all returns an empty array, even after the AJAX request. My theory is that Devise doesn't return JSON formatted data, so I'm probably going to have to create a jbuilder views for that, but I dont even know where to start because everything is so hidden with Devise.

    My purpose here is to retrieve user data (i.e. their id, email, username, and name) inside my Redux state. I've already set up all of my util functions, action creators, thunk action creators, reducers, and store. I've made sure to pass the store to components using Provider, and I have routing set up with HashRouter. I know my Redux state is working because the 'logger' middleware is spitting out a Redux state into the browser console without errors. I'm just having trouble making an AJAX request thay creates the user and inserts the proper data into my Redux state.

    Can anyone provide me with step-by-step instructions on how I could make this feasible?

    submitted by /u/k-hiroshi
    [link] [comments]

    March Madness Scores

    Posted: 21 Mar 2019 04:57 PM PDT

    I am looking to import final scores from March Madness into Excel.

    The idea is to periodically (manually) run the script to update the database of scores.

    Any ideas on how to go about this? It seems like web-scraping with Python/Beautiful Soup is not ideal?

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

    What to learn if I want to know how to process images

    Posted: 21 Mar 2019 04:33 PM PDT

    I always wanted to know how to retrieve information from images. By this i mean image processing like reading text from an image or detecting certain objects from an image. Thank you

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

    SNES games from the 1990s, which language was it written in?

    Posted: 21 Mar 2019 04:15 PM PDT

    Can someone describe the difference between knowing programming and 'being able to program'?

    Posted: 21 Mar 2019 04:01 PM PDT

    Another user mentioned, there are innovative programmers and there are not.

    How does this happen?

    Is this a thing?

    I've considered programming, 'imports' and going until I need to refactor. (although, I do a bit more planning with age)

    I'd like to hear what this "Brick wall" is, in your own words.

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

    What to specialize?

    Posted: 21 Mar 2019 11:12 AM PDT

    Hello guys, long story short, i'm half way through college(Software and Data science), next year i will get to choose between classes, but even if i don't have to i don't know what kind of programmer i want to be.Not because i don't like what i learned so far, but because i was working on a lot of things last couple of years. I'm not saying that i'm expert in all those technologies but if i focus on any of those i could be very good at it. So i was doing:

    Frontend: Angular, React;

    Backend: Node, Java, Django, Flask;

    OOP and console apps: Java, Python, C++, C#;

    Structures and algorithms: Python, Java, JavaScript;

    Databases: MySql, MongoDB;

    Also a little bit of cybersecurity.

    One thing to mention, i will have to choose between a lot of interesting technologies, and that is problem for me because for example i get to choose between AI and cybersecurity which I both like.

    I'd like if someone experienced could give me some advice. Thank you!

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

    Item matching pattern nomenclature question

    Posted: 21 Mar 2019 02:13 PM PDT

    A feature in the software is enabled for domain items on a case by case basis, according to some criteria. Each item is matched against the defined criteria to see if the feature is enabled for it.

    My question is, what would be the nomenclature for an item matching the feature's defined criteria? Instinctively I wanted to write e.g. a boolean method named along the lines of IsFeatureEnabledForItem(), however, our items are persisted including this flag if the feature is enabled for them or not, at the time of persistance. So if I name the method that way (using "enabled"), it would suggest that it returns the persisted flag. However I would like a good name that reflects the dynamic nature of it, i.e. computes the enabling of the feature for the item at runtime, regardless of how it was persisted earlier.

    Is there any established generic name for this technical situation to avoid using "enabled"?

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

    How does the Java Virtual Machine deal with constants?

    Posted: 21 Mar 2019 12:31 PM PDT

    So I compiled this code and decompiled it into bytecode:

    System.out.println("hi");

    compiles to:

    getstatic

    ldc

    invokevirtual

    From what I can see here, the literal value "hi" isn't explicitly stored in any bytecode format, so does a .class file also contain a hidden representaion of a stack for that program. For example when I compiled that program would the .class file contain that bytecode, and a heap data structure containing the literal value "hi". And more generally, does a .class file contain more than just bytecode (e.g. a representation of the heap, stack and registers). thanks!

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

    Java Homework Idea Help

    Posted: 21 Mar 2019 12:00 PM PDT

    Hey everyone that stops by to take time to read this. I have a very vague assignment that is worth 25% of my total grade. My java programming is less than subpar at best. I was hoping you guys could potentially help me think of an idea to use what is required. Here is the assignment:

    For the course project, you are required to come up with a real-life problem (open ended) and solve it by designing and writing a Java program, which implements the following java object oriented features: • Encapsulation (10 Points) • Inheritance (10 Points) • Abstract Class (10 Points) • Interface (10 Points) • Method Overloading and Overriding (10 Points) • Parameterized constructor (10 Points) • Accessors and Mutators (10 Points) • Mutiple java class files (10 Points)

    I do not have any clue on what to do and it is due by April 1st. I need any and all insight so please let me know. Thank you in advance to everyone.

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

    Urgent, need this to bump my grade a letter: How to make an infinite loop to exploit an infinite voting exploit.

    Posted: 21 Mar 2019 11:57 AM PDT

    Long story short, my school entered a competition in which we had to make a video about a company that makes useful stuff. In order to win, you have to have the most votes. One of the coders forgot to make it a one-time voting thingy... so basically, we can infinitely vote. What I need is a code that votes for me in an infinite loop and I want to do this through repl.it (I suck at programming, I'm practically oblivious). What do I need to do, how do I start?

    I'm supposed to be learning this tomorrow, but I want to be ahead of the curve to boost my grade, please help!

    Here is the website, coders of reddit, feel free to mess around and see how it works. Feel free to ask questions. k tnx

    http://www.whatssocool.org/contests/philly/

    edit: If you don't want to just give it to me and want to walk me through it, feel free :)

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

    Getting started on a program relying on Google Map API?

    Posted: 21 Mar 2019 10:19 AM PDT

    Good morning,

    To begin, the goal of my program will be to identify mini food deserts. I work for a company that brokers events for mobile vendors. I was thinking it would be beneficial to find areas within major cities that are low on food options. This way I can generate some leads.

    It seems Google Maps API is the right tool. But alas, I am only comfortable with R and Python. I have only used JavaScript in the form of Processing, and that's just for fun hobby type stuff. From all the tutorials on Google Maps, it seems I need to be intermediate in HTML and JavaScript? My real question is, do you think it's possible to proceed and figure things out as I go if I feel comfortable with other languages already?

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

    How to pass a datatable from c# to js?

    Posted: 21 Mar 2019 09:29 AM PDT

    im using asp.net, the reason why i don't use the datatable in c# is because im trying to use the data on the google maps api for js

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

    What is the best way to package a Python script for distribution to clients?

    Posted: 20 Mar 2019 11:15 PM PDT

    I have a Python script that I want to keep proprietary and prevent reverse engineering, and I intend for it to be ran by clients, so how should I go about packaging it? I know I can use Cython to compile the code as C, and PyInataller, so is there anything else I need to do?

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

    How do you stay motivated to finish a huge project?

    Posted: 20 Mar 2019 11:38 PM PDT

    Hi! I've been working in a project for around 3 months, it's kinda big and it was assigned to me since the beginning. I started with full force and now I feel so empty and don't want to work on it, I'm so done... any advice on how to stop this feeling? :(

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

    Scraping Facebook posts without the Graph API

    Posted: 21 Mar 2019 12:43 AM PDT

    Hey!

    So, I'm working on a project and part of it involves scraping data off a public Facebook page (a university confessions's page to be precise).
    I learnt that using the Graph API is no longer an option to retrieve posts off a page in bulk, so has anyone has a working method to scrape data off Facebook/could point me in the a direction that might help?
    The idea I'm currently playing around with is using some combination of BeautifulSoup and Selenium to scrape the content of each post. Does that sound feasible or are there better tools/methods out there?

    TIA!

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

    No comments:

    Post a Comment