• Breaking News

    Monday, March 26, 2018

    If programming weren't an option, what profession do you think you'd do well in or enjoy instead? Ask Programming

    If programming weren't an option, what profession do you think you'd do well in or enjoy instead? Ask Programming


    If programming weren't an option, what profession do you think you'd do well in or enjoy instead?

    Posted: 26 Mar 2018 11:08 AM PDT

    How would I go about programming pagers for a fast-food restaurant?

    Posted: 26 Mar 2018 04:58 PM PDT

    Hello AskProgramming, I will start this off by saying that I am rather new when it comes to software engineering, but I can say that I understand the concept of writing rules for the computer to follow and solve problems for us. I work at a fast-food restaurant and we have a problem of getting our on-times logged correctly. We need every order to be completed in less than 15 minutes, which is nearly impossible with our lack luster staff. In an attempt to impress the higher-ups we memorize the order and "bump" (log) our orders early. Unfortunately this doesn't always happen and I thought that with a little software programming I could have a couple pagers for our employee's to hold so that whenever an order has a life of 14 minutes it would buzz until someone "bumps" the order. How would I go about doing this? Any help/feedback would be much appreciated, thank you!

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

    Novice here

    Posted: 26 Mar 2018 06:44 PM PDT

    Hey guys! I'm fairly new to programming and I apologize if this is a silly question, but at what point would a server be necessary? For example, I am writing a program that will recommend restaurants based off of user input. At what point would it make sense to store the restaurant options on a server rather than the front-end? Thanks in advance.

    submitted by /u/positivity-123
    [link] [comments]

    [C++] I need help tying one of my assignments together!

    Posted: 26 Mar 2018 09:28 PM PDT

    So my assignment goes as follows,

    The program will open a file called Times.txt which contains an unknown number of times. The file will be formatted as follows: 11 15 AM 2 37 PM 4 59 PM where the hour is always entered first, followed by a space, followed by the minutes, then a space, and then either the word AM or PM in all caps. Note: For programming ease, there will be NO times in the document that have a 12 as the hour number.

    All of the times should be read into a vector of clock structures1 , each having three objects; an integer hour, an integer minute, and a string AMPM. The program should then look through the vector for the latest time in the file and output this time to the console.

     Here are the specifics about what your program should do: 1. Implement code to determine whether or not the file has opened properly. If not, the program should display an error message to the user and exit after a system pause. 2. Your program must make use of vectors and structs as specified above. 3. Follow the formatting conventions of our in-class programs. 4. Your program should be free of compiler warnings; that is, all data types should match when performing comparisons and when looping. 5. Your program should include documentation, including specifying sections for input, process, and output, but also including comments on the other things you may be doing. 6. If your program crashes, you will automatically lose 2.5 points. 7. Display an informative output message before outputting the latest time in the day. 

    For example, The latest time in the file Time.txt is 10 47 PM

    Now, the base code that I know works goes as follows,

    #include <iostream> #include <iomanip> #include <string> #include <fstream> #include <vector> #include <algorithm> using namespace std; //Defining the struct for the hours, intergers, and the AMPM for further use within in the code struct tickytock //I tried this with "struct clock" it did not like that, so I used tickytock instead { int hour; int minute; string AMPM; }; int main() { //Must dictate which file you want this program to open //In this case, it would be Times.txt ifstream fin("Times.txt"); //The exit message if that file does not open if(fin.fail()) { cout << "The computer can not open that file." << endl; cout << " " << endl; cout << "Please retry with a valid file type." << endl; //The error message that will appear cout << " " << endl; system("pause"); exit(0); } //Now that the exit code is out of the way, we can get to the actual body of the code //defining my variable for the while to read in from the file, much like Student s in the example vector<tickytock> chad; //Calling this vector chad, dont ask me, I dont know tickytock z; //Some abritrary varible. I chose z. while (fin >> z.hour >> z.minute >> z.AMPM); { chad.push_back(z); //The pushback statement to store the variable(z) within the vector(chad) } fin.close();//Closes input from the file cout << "The latest time is " << endl; system ("pause"); return 0; } 

    This is the code that I know works, but the things that I have tried to get it to output the "latest time" have all failed. It has been recommended to me that I should establish another vector to hold the "latest time" and compare that to vector above. And then after that I, I need some if loops to distinguish AMPM, which has to come after that vector has been established. Sorry, I know this is a lot, but I am not sure at all how to format this, and all ways that I can think of doing this have failed.

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

    Help with coding a truth table in java

    Posted: 26 Mar 2018 09:15 PM PDT

    Sorry if this is a stupid question but I need to code a truth table. I am having trouble developing a loop to set the values like this. I am doing this in java and I need to use booleans and print them out as 1s and 0s. Thanks for your help!

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

    Is it possible to use a bot to get new posts in a facebook group?

    Posted: 26 Mar 2018 09:00 PM PDT

    I want to be able to pull posts in a group whenever someone posts. They will then be piped to a discord server where the posts will be posted as a message

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

    How would I go about learning sql?

    Posted: 26 Mar 2018 08:59 PM PDT

    Basically the title

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

    Is there a good interactive learning resource for Jython/Python?

    Posted: 26 Mar 2018 08:38 PM PDT

    I'm VERY new to programming. I just started. Does anybody know of a good place on the web to learn Jython? It's a good language to start out on to learn the basics. All I can find really is the manual, but I learn more interactively (think codeacademy, lynda, etc). Is there anything like that out there for this programming language?

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

    I need to understand how programming works in a very simple way.

    Posted: 26 Mar 2018 08:23 PM PDT

    Basically, I am taking a jython class in college. There is a lot of for and if statements, and nesting, etc......WHAT DOES IT ALL MEAN?? I can write the programs because I am memorizing them, but I want to know how it works. Does anyone have a simple diagram or foundation they use to understand how programming works?

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

    Any good Amazon RDS tutorials?

    Posted: 26 Mar 2018 07:59 PM PDT

    I'm a web developer, but how do you go about developing desktop applications?

    Posted: 26 Mar 2018 11:00 AM PDT

    I am a freelance Django dev, and academically I've also used PHP, RoR and Spring for web development. Also plain C++ and Java as general purpose languages. And C# for Unity.

    Many businesses want desktop applications rather than web apps. I wonder what are the most popular languages and framework to develop desktop applications. I think learning some of these would be a good decision.

    For Python, the language I'm currently most "proficient" at, I've previously played with tkinter, but if I recall correctly was pretty limited and the GUI was very basic.

    I am pretty sure you can use C++ and C# under the whole .NET framework for Windows desktop apps. But I haven't actually ever gotten my hands on it so I have no idea how it actually works. Oh and also VB but I don't even want to look at it (perhaps I'm just having prejudices).

    Also pretty sure Linux development is done in C++ but I don't know anything about it. I'd leave this aside for the moment as most business use Windows, not Linux.

    For Java, I've played with Swing and JavaFX, but both seemed pretty limited as well, especially swing. JavaFX was ok actually.

    So yeah, my questions:

    • What are the most popular languages and frameworks for Windows desktop development? Which one would you recommend?

    • Which ones of those would be most useful when it comes to meeting the client's requirements?

    • Which ones of those are more requested in software development companies? I'm a freelancer but I don't discard working in a company in the future, so having the skillset would be welcome.

    Thanks in advance!

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

    Help getting information from a .txt file. I have 10 different address within my file however my program is only getting 9 of them and the last isnt showing up. why is this?

    Posted: 26 Mar 2018 07:06 PM PDT

    import java.io.*; import java.util.Scanner; public class project2Donnegan { public static void main(String[] args) throws IOException { File file = new File("utility.txt"); Scanner inputFile = new Scanner(file); String companyName, companyCity, companyState, companyAddress; String title ="Energy Consumption for a 300 Watt Refrigerator Running 24 Hours a Day"; double khwRate; double averageCost=0; int zipCode; double monthlyCost=0; final double monthKilowatts=216; System.out.println(title); System.out.println(); System.out.println(); while(inputFile.hasNext()) { companyName = inputFile.nextLine(); companyAddress = inputFile.nextLine(); companyCity = inputFile.nextLine(); companyState = inputFile.nextLine(); zipCode = inputFile.nextInt(); khwRate = inputFile.nextInt(); inputFile.nextLine(); if(inputFile.hasNext()) { inputFile.nextLine(); } monthlyCost=((monthKilowatts*khwRate)/100); averageCost += monthlyCost; System.out.println("Utility Company: " + companyName); System.out.println(companyAddress); System.out.println(companyCity +"," + companyState +","+ zipCode); System.out.printf("kWh Rate: %.0f cents \n" ,khwRate); System.out.println("Monthly Cost: $" + monthlyCost); System.out.println(); } inputFile.close(); System.out.println("Average Cost: " + (averageCost/10)); } } 
    submitted by /u/beansandbeams
    [link] [comments]

    What is this piece of code found on my IOs contact list and how is it making autocorrect changes?

    Posted: 26 Mar 2018 05:28 PM PDT

    Code: <sn>id:5xxxxxxxx/friendof:5xxxxxxxx</sn>

    Ok so not sure if this is the correct place to post but wanted to see if any programmers could help me out and explain this weird code thing that happened with my phone: (Iphone OS) and Facebooks odd apparent influence on my phone.

    First: I started noticing my phone autocorrecting a name of my current boyfriend to my past boyfriend automatically in text messages to anyone, (I would type my current boyfriend's name in and it would autocorrect to my past boyfriend's name and their names aren't even close) after updating to the latest OS (we have been broken up for six years and I've been with my current BF for five). I couldn't figure out what was going on. I know you can manually set things to autocorrect into something else as a prank (I have done that to others in the past), but no shortcuts were added to the autocorrect section.

    Second: Today, I went into my past boyfriend's contact on my phone and found this piece of code in the notes section:

    <sn>id:XXXXXXXXX/friendof:XXXXXXXXX</sn>

    I changed the actual numbers into X's to obscure the identities, but when those numbers were typed in after facebook's URL, the first ID number pulled up my account and second pulled up my past boyfriend's. No where in the this code did it have my current boyfriend's facebook URL number.

    This kind of freaked me out because I have no idea how this apparent code got into my phone and how it was causing this name autocorrect. As soon as I deleted it the autocorrects stopped.

    Also another odd aspect of the story is that my current boyfriends name in my phone is completely different. Lets call my current boyfrined Robert and I call him Rob but hes only in my contacts as Robert. My past boyfriend lets call him Sam.

    So here is what would happen. Every time I typed in Rob it would autocorrect to Sam. No where in my contacts is Rob associated with Robert (shorter version). This is the oddest part because this means there is some kind of association between the two people that is happening on my phone. Makes me wonder if its some kind of experiment to see what would happen if you constantly associated and replaced one name with another.

    Sorry for the long post just kinda freaked out.

    Any idea of what is going on here?

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

    Was were your biggest problems when doing C++? What is not intuitive when coming from a different language? I'm collecting problems and common mistakes for a tutorial

    Posted: 26 Mar 2018 03:56 AM PDT

    Pretty much as in the title. I'm searching for stuff that people find hard to understand, or stuff that has missing step-by-step guides. While almost all problems are on Stack Overflow, they are scattered across the web and do not have the form that would allow incremental learning. There is also a great site cppreference.com with complete language and standard library documentation, but's more of techical info than a guide. Learning from reference site is like trying to learn English by reading a dictionary.

    So, what you have found hard to understand? What is unintuitive when coming from other programming language?

    The list so far I found people have problems with:

    • header vs source files - how does it work and why
    • pointers - necessity in C, usually bad code in C++
    • references vs pointers - differences and their purpose
    • iterators - what are they? what is their purpose
    • const - where and when, what can be const-qualified and what does it mean
    • lvalue, rvalue, glvalue, xvalue, prvalue and their (const) references
    • templates - this will be a separate tutorial on itself
    • lambda expressions - the magic of [&]
    • operator overloading - dos and dont's
    • how to read compiler errors
    • string-to-int and int-to-string convertions
    • memory management - why you should never write new in C++ - false-friend trap for people coming from many garbage-collected languages (smart pointers and other RAII stuff)
    • reinventing the wheel - mostly writing C code due to lack of knowledge that something is already in C++ standard library

    Edit: added:

    • tools - debugging, profiling, sanitizers, enabling warnings etc
    • cheatsheets - not tied to any particular tutorial, but very good thing for an easily memorable piece of information
      • operator overloading (unary, binary, dos/dont's)
      • what argument type to choose: T, T&, const T& or T&&
      • static_cast vs dynamic_cast vs const_cast vs reinterpret_cast
      • template language schema - (which feature relies on which) - this might be interesting
    submitted by /u/Xeverous
    [link] [comments]

    Starting to learn how to code in android.

    Posted: 26 Mar 2018 01:01 PM PDT

    I recently bought a book so i can learn how to code in android (XML and Java) and the first step is to make a contact list where it leads to another page if i press on the contact. How do i code it so I can make the contact clickable to lead to another page? Sorry if it the wording is wrong. I'm coming into this with little prior knowledge. Thank you for your help.

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

    Help me with my code

    Posted: 26 Mar 2018 11:24 AM PDT

    Side note. I am new to coding.

    I want to implement a background aswell as have a button display a message saying "Good luck!" - everything via a JPanel.

    When I do not display the background the button works fine but with the background activated the button does not respond.

    // all the imports - yada yada

    public class Game {

    public static void main(String[] args) { JFrame Gamescreen = new JFrame(); JButton StartButton = new JButton(); StartButton.setText("Start"); StartButton.setVisible(true); ImageIcon icon = new ImageIcon("image dir"); Gamescreen.setIconImage(icon.getImage()); try { Gamescreen.setContentPane(new JLabel(new ImageIcon(ImageIO.read( new File("image dir"))))); } catch (IOException e) { e.printStackTrace(); } Gamescreen.setLayout(new GridBagLayout()); Gamescreen.setVisible(true); Gamescreen.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Gamescreen.pack(); Gamescreen.getContentPane().add(StartButton, BorderLayout.CENTER); StartButton.addActionListener(new ActionListener() { public void actionPerformed (ActionEvent e) { JOptionPane.showMessageDialog(null, "Good luck!"); } } ); } 

    }

    Hope you can read it .. posting from mobile. Image dir is replaced by the right directionary.

    Thanks for any help in advance.

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

    Generating list of lowest rated businesses on google

    Posted: 26 Mar 2018 08:52 AM PDT

    I'm working on a project and am currently taking a lot of time searching and logging the lowest rated businesses on google/facebook/yelp.

    Would it be feasible for a programmer/student to write a simple script to generate businesses/info from google and facebook, for example under a 4.5 rating? In the past I've had a tech student design a python script to feed public housing data to excel..I'm wondering if this would be similar?

    TLDR: Can a programmer easily create a script to feed google/facebook businesses to excel format? Specifically low rated businesses.

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

    Immutable Classes - Java

    Posted: 26 Mar 2018 10:43 AM PDT

    Currently trying to create an immutable matrix class with different methods that add/subtract/multiply matrices. Having trouble with the immutable part though. I figured the way to do it was to create a new matrix with the values of the immutable matrix then perform an operation to the new matrix in order to change the values, but I seem to be changing the original matrix each time I perform an operation. Is my thought process on what I should be doing right?

    submitted by /u/newtoprogramming-
    [link] [comments]

    Algorithm question -- find repeated suffix in a string

    Posted: 26 Mar 2018 09:59 AM PDT

    Suppose I have a string that has the form prefix (suffix)* (in RE-ish syntax) for some strings prefix and suffix. I want to find the longest suffix for which this is true.

    For example, if my string is abcDefdgDefdgDefdg, I want to find Defdg. (The capital letter is for you; you can't rely on it being there all friendly, of course. :-))

    It seems like it should be possible to adapt KMP or something to this task, but maybe someone has written up a description I can just crib? My Google attempts have also turned up using suffix trees to find the longest repeated substring -- I'm trying now to understand if I can adapt that to find the longest that occurs at the end, but I have to read up on suffix trees first. [Edit: I'm a lot more lukewarm on the suffix tree thing being a good solution.]

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

    How long does it take to adapt a simple medical diagnostics program from C++ to Android?

    Posted: 26 Mar 2018 12:56 PM PDT

    I need a general time estimate that it would take 2 programmers to adapt a C++ program to Android. I realize its a vague question, just need a time range. 1 week? 2 weeks? Less, more, whatever your expert judgment suggests. Thanks!

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

    What are the best ways/design patterns for matching transaction data between two sources?

    Posted: 26 Mar 2018 08:34 AM PDT

    I need to find transaction records that match between two data sources, matching on vendor names, dollar amounts, and dates. There will definitely be some "fuzzy" matching involved, and there are also cases where multiple transactions on one side roll up into a single transaction in the other. I would like a way to assess match quality in order to programmatically be able to decide my tolerance for questionable matches.

    The current process that I am looking to improve is entirely in HiveQL (SQL), but I am comfortable with Python and Ruby if there is a better scripting solution or a way to tackle it with machine learning.

    I tried to keep the description in the general case, but if anyone has specific questions please comment. If anyone can point me to some recommended reading or outline a solution it would be much appreciated!

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

    Does anyone use PDDL or any such planners in production?

    Posted: 26 Mar 2018 06:49 AM PDT

    We're are thinking of rewriting our entire scheduling algorithm in PDDL, so that for different customer requirements, we can just change the problem in PDDL and pass it to our own solver, instead of adding edge cases and changing scheduling code every time a new constraint is added.

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

    how to get network request/data urls using java ?

    Posted: 26 Mar 2018 03:57 AM PDT

    I want to get the netwrok traffic urls that include images and xhr urls ..I have tried selenium but i want to acheive this without automation libraries..I am making an android app a small part of its function is to obtain the network urls select specific links and send http request to those links for futher working...

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

    Question about representations

    Posted: 26 Mar 2018 03:39 AM PDT

    Given a set of data such as this, how would one propose a representation for the information?

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

    No comments:

    Post a Comment