• Breaking News

    Saturday, December 9, 2017

    What is a coding project that can be worked on continuously from a beginner level to "mastery"? Ask Programming

    What is a coding project that can be worked on continuously from a beginner level to "mastery"? Ask Programming


    What is a coding project that can be worked on continuously from a beginner level to "mastery"?

    Posted: 09 Dec 2017 05:32 PM PST

    In terms of a single person, what is the best coding project that can be developed by a beginner, encapsulates the core of programming, and be continuously developed as programming skill increases?

    For instance, I am working on a basic calculator and it runs well, but when I tried to write my own square root function, everything fell apart. I spent hours just contemplating about it, brute forcing it, and failing over and over, until I gave up, Googled it, and now understand why roots are never discussed in detail in high school.

    Writing a calculator (without using libraries) appears to be quite difficult; the learning curve went from almost level to quite steep in an instant.

    I'd like to work on a project as I continue programming so that as my skills evolve I can literally see my progress via git on a single project. It would be amazing to look back on in a year or so.

    What project would you recommend?

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

    Distributed system to send unique auto-incremented IDs to clients. Questions about whether using Redis makes sense and whether we can avoid sending duplicates or skipping IDs when machines go down.

    Posted: 09 Dec 2017 09:34 PM PST

    For practicing system design interview questions, I want to design a distributed system that outputs unique auto-incremented IDs. The numbers should start from 1.

    There should be no duplicate IDs. (We should not send the number 5 twice.) No numbers should be skipped. (We should skip 3 when send 1, 2, 4, 5.)

    A toy example could be I want to design an airline website that gives people boarding numbers based solely on when they checked in. Check-in is open 24 hours before the flight's takeoff time. Flights generally have fewer than 1,000 seats. To make this a nontrivial scalability problem, let's say the a flight can hold a million people.

    A large number of people will be checking in 24 hours before the flight takes off. Peak check-ins for a particular flight will be 100,000 requests per second. How do I build a scalable, fault-tolerant distributed system to handle this traffic?

    My thought is want to use an in-memory key-value store like Redis to help me auto-increment IDs. According to https://redis.io/topics/benchmarks, "INCR: 143061.52 requests per second."

    Each flight would have a unique ID. I would create key-value pairs in Redis for each flight like this (unique flight ID, counter starting from 1). I would have a replication factor of 3. That is, data would be stored on three different machines. I would use consistent hashing to make sure that if machines go down or we add more machines, we would on average need to move only 1/n of the total data (where n is the number of machines in the Redis cluster).

    I'm new to Redis and distributed systems. Does this solution make sense?

    Also, I'm not that familiar with how Redis handles machines going down. What happens if the Redis machine with your unique ID goes down? That means you might send duplicate IDs. Is there a way to avoid that in Redis? Or is another kind of architecture better than Redis at avoiding duplicates?

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

    How to validate boolean through user input?

    Posted: 09 Dec 2017 01:59 PM PST

    I am wanting to let the user input true/false for the boolean which works but if say the user enters in any other value it just crashes but I want it to throw up an error message and rerun to tell the user to enter true or false again. How can I fix my code? Thanks Code Below System.out.println("Is the product discontinued? True/False"); boolean proDiscontinued = mySc.nextBoolean();

     if(proDiscontinued == true) { System.out.println("Producted Registered As Discontinued"); } else if (proDiscontinued == false) { System.out.println("Product Registered As Not Discontinued"); } else System.out.println("Invalid input"); 
    submitted by /u/Life59
    [link] [comments]

    How much can a freelance content developer make/charge

    Posted: 09 Dec 2017 07:54 PM PST

    How best to have a lot of data accessible to the user for a website?

    Posted: 09 Dec 2017 03:10 PM PST

    I've been working on a website that needs a large amount of data. Well, the database tables aren't too large, but there are about 50 tables. Anyway, I was originally planning on using an API using AWS, but that can be sort of expensive. I also want everything to be quick for the user. If I'm using an API, would it be best to transfer more info that may not all be needed, but have fewer API calls, or less information and fewer calls? Thanks!

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

    how do you make a reddit bot?

    Posted: 09 Dec 2017 12:05 PM PST

    or bots for any website, for that matter. for example, one that posts a reply to comments that have the words "star wars"

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

    Better way to write many if statements in Java?

    Posted: 09 Dec 2017 10:25 AM PST

    So I have this homework where I need to build a vending machine, and I assigned a coordinate to every product (A1, A2, A3..) and when the user enters the coin value I have to calculate if he can buy the product that he chose and if yes calculate the change, since i'm still new to programming I now have ended up with many statements like this

     if("a1".equals(choice) ){ System.out.println("You chose SNICKERS!"); if(money<50){ System.out.println("This is not enough money to buy this product");} else if (money >= 50){ System.out.println(" Price = 50 Your change = " + (money-50));} } 

    where the only things changing are the coordinates (a1, a2, a3, a4, b1, b2 and so on) and the prices. What would be a better way to do this?

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

    Having issues trying to get my menu to display what I want (Java)

    Posted: 09 Dec 2017 05:39 PM PST

    Hello,

    In case anyone is curious, this program is just the result of my own attempts to get acquainted with object-oriented programming and trying to see how far I can take it.

    So in my program, you make a person with certain characteristics. Once you've made the person, you come to a menu whose code is here: public static String getUserCommand(Human user, Scanner input) {

     System.out.println("Welcome to the Make U menu!"); System.out.println("Here is the current information about your person:"); System.out.println(" Name: " + user.getName()); System.out.println(" Age: " + user.getAge()); System.out.println(" Height(in Inches): " + user.getHeightInInches()); System.out.println(" Height(in Centimeters): " + user.getHeightInCentimeters()); System.out.println(" Hobbies: " + user.getHobbies()); System.out.println(" Languages: " + user.getLanguages()); System.out.println("What would you like to do?"); System.out.println(" Type \"done\" to leave the program."); return (input.next()).toLowerCase(); 

    }

    Everything seems to be working fine, except that when I run the program and go to the menu, I get this:

    Welcome to the Make U menu! Here is the current information about your person: Name: Isaiah Pellerin Age: 17 Height(in Inches): 72 Height(in Centimeters): 182.88 Hobbies: and french Languages: English and French What would you like to do? Type "done" to leave the program.

    The problem is the hobbies text which states "and french". What I originally (as the user) inputted to the program was "video games, programming and french."

    Here is my code for the getHobbies method in my Human object (note that hobbies is a global variable for the class): public String getHobbies() {

     Scanner hobbyFormat = new Scanner(hobbies); String formattedHobbies = ""; int hobbyCount = 0; while(hobbyFormat.hasNext()) { hobbyFormat.next(); hobbyCount++; } Scanner hobbyFormat2 = new Scanner(hobbies); for(int i = 1; i < hobbyCount; i++) { formattedHobbies = formattedHobbies + hobbyFormat2.next() + ", "; } return formattedHobbies + "and " + hobbyFormat2.next(); 

    }

    What I don't understand is why I end up with "and french" and not the text that I want.

    P.S. when my human object is constructed, it is given the format "hobby1, hobby2 and hobby3", but I format it into a "hobbit1 hobbit2 hobbit3" for other methods that I may want to write later on. I don't think the method for getting that format is messing it up, but if the programming that I've shown is perfectly fine, then I will reply and share that other method as well.

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

    Default constructors standard?

    Posted: 09 Dec 2017 08:14 AM PST

    I'm currently learning Java as part of a college course. In Java, default, no-arg constructors are always made automatically using the same name as the class. Is this common in other programming languages, or more of a Java-specific quirk?

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

    How to add up values in an ArrayList according to user input?

    Posted: 09 Dec 2017 03:42 PM PST

    My array list is stored as Product p1 = new Product(101, "Apple", "Mac Book Air", 900, 5, false);

    The problem is I want the user to enter say the Product code at the start of the array "101" but it then to add up the price 900 to say the final bill so if the user wants to buy the product code 101 and 102 which is 1600 it would total it to 2500.

    Below is my code. The problem am having with it is if I key in more than one product it won't generate the total figure. Any help would be appreciated thanks. public static void addProductsUp() {

     for (Supplier eS : suppliers) { ArrayList <Product>supProduct = eS.getSupproduct(); for(Product eP : supProduct) { System.out.print("Please enter in Product Code You Wish To Produce Quote for) : "); int priceAdd = mySc.nextInt(); System.out.println("Would you like to add another product to add to the quote Y/N"); String runAgain = mySc.next(); if(runAgain.equals("y") && priceAdd == eP.getProCode()) addProductsUp(); 

    if(runAgain.equalsIgnoreCase("n") && eP.getProCode() == priceAdd) { double Total = + eP.getProPrice(); System.out.println("Total Price is" + Total);

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

    receiver re programming?

    Posted: 09 Dec 2017 03:26 PM PST

    probably a really dumb question but would there be a way to reprogram this logitech receiver so instead of having a mouse connecting to it i could connect a wireless controller to it?

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

    I need someone to program this. I don't know how much afford this is or time will take. Couldn't find something similiar.

    Posted: 09 Dec 2017 03:20 PM PST

    Googled for hours today, but didn't find something that gave me the possibility. Whatever...

    AIMING FOR: I wanna play Terraria or any other game on 2 Screens. One Game should get controlled by mouse and keyboard and the other by a controller.

    PROBLEM: The controller only works in the active window in windows. That means I can control one game at once, bc windows only supports one active window at the same time.

    IDEA: Let the controller send signals even when the window is inactive and limit the signals, that get send, to one process/window, so it doesn't effect the active window.

    Thats ofc just an idea by me, but honestly I don't have an idea how to program. If there are other ideas how to do it, then sure go ahead. I'm not the programmer.

    THANKS for everyone trying to help!

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

    Dev Environment - Simulate Client Router Connection

    Posted: 09 Dec 2017 11:53 AM PST

    Background: We are developing devices which are controlled by an ESP8266. These devices connect to a Raspberry Pi Server which acts as a Router (DHCP, DNS) and Webserver (Apache). The Client connects to the Raspberry Pi and can control all other devices.

    I want to create a Development environment inside a VM to emulate the whole system. I would also like to emulate the ESP8266 connecting to the raspberry router part. I am having trouble thinking of an easy way of doing this except to create a VM for each ESP8266 device and to connect to the "Server" VM. Could this be done with jails?

    The ESP8266 devices will be emulated by node.js instances probably.

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

    python doubt: how does this work/mean ??

    Posted: 09 Dec 2017 11:49 AM PST

    for i in 'Prashant': print (i,end=" ") print ("\r")

    print (' ' is ' ')

    print ({} is {})

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

    What are the disadvantages of using OpenGL for GUI software?

    Posted: 09 Dec 2017 11:17 AM PST

    Came across NanoGUI and it looks very cool. Here's a screenshot of a GUI you could create using it.

    Makes me think there's a lot of creative possibilities with software using OpenGL.

    Besides having to code widgets from scratch (If you're not using a library like NanoGUI), are there any big disadvantages with an OpenGL GUI?

    submitted by /u/dougie-io
    [link] [comments]

    Canonical Correlation Question (Matlab)

    Posted: 09 Dec 2017 09:51 AM PST

    My code so far: https://pastebin.com/q1gaRe84 And the math I've been given: https://imgur.com/a/45mfn So, for this I have to implement my own canonical correlation algorithm without using Matlab's built in function. I've wrote out the math I've been given, but I'm not sure how to interpret r once I have it. Also, my r doesn't have the off-diagonal elements as non-zero. So, I think there must be an error in my code. Any help would be massively appreciated! Thanks in advance.

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

    Where can I look for tutorials on how to write a code similar to Anki? (Gonna write an Applied Spaced Repetition System)

    Posted: 09 Dec 2017 09:17 AM PST

    Preferably C# or Java, as those are the only 2 languages I kind of know. This is essentially my idea for my capstone project (hopefully it gets accepted this time). I have no idea how to start the project from scratch.

    A little something about myself: It's been several years since the last time I attended school (I'm a returning student), and I've spent my time working (unrelated to programming) to be able to study again, and this time I wanted to finish my degree.

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

    I've been handed an entire messy repository to manage on my own, how can I make it more workable?

    Posted: 09 Dec 2017 08:42 AM PST

    So 2 months ago, our main programmer and owner of the e-commerce company I work for stepped down. He has left me, quite underprepared, with 1000s of files of code for the site and back-end system. Code which has absolutely no notes and I'm expected to just takeover everything he's been doing with minimal help. I'm now the only programmer at the company with a to do list longer than me. Before this, I was mainly working on the site layouts and front-end dev.

    Now this guy hated the tab and return keys apparently, most of it is all in one long php/mysql/html string. I've got functions named as ridiculous things like 'makethingbigger' and 'getnumberandmakepretty'. Anytime I need to change something or introduce a new feature I have to go in, deconstruct everything, figure out how he's done it and build it back up. It wasn't too bad when he was here because I could just ask him but now I'm on my own. His methods were quite outdated, he's also been very lazy in the way he's done things, using the same framework for things that don't need to be related, making it very hard to change simple things without screwing up something else entirely. The entire site is also set up with HTML tables, tables within tables within tables. I've slowly been converting it but there's so many tables, so so many tables man. Most of it is using inline styling as well, it's a nightmare.

    Basically, I just wanted some advice, what you would do in my shoes? Is there something I can do that I'm just missing? Is there anything I can do to make the code more readable? Is it even worth trying to make it workable?

    Half of me just wants to leave this code behind and set up an entirely new site. Half of me wants to just quit. I understand it's hard to give advice without seeing what I'm working with but any help will be greatly appreciated!

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

    What are the best network bonding modes (Linux)?

    Posted: 09 Dec 2017 03:40 AM PST

    I'm deploying a server and I'm wondering which mode, without having to configure the switch to evenly balance packets to either or, would be better for fault tolerance and balance of packets i.e. in the case one NIC fails, the other takes over but, if they're both operational, they balance packets to increase the upload and download speeds.

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

    Looking for an online insult generator I can scrape in my IOT device.

    Posted: 09 Dec 2017 03:33 AM PST

    The problem is that I can't use HTTPS as my processor is not powerful enough to do https processing.

    I'm looking to basically scrape text from a HTML response.

    Any alternative thoughts would also be welcome.

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

    What book do you propose to become a master in databases?

    Posted: 08 Dec 2017 11:25 PM PST

    I mean database implementations, database architecture.

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

    How to create a disk file of size n blocks? Java

    Posted: 09 Dec 2017 02:28 AM PST

    This is what i currently have, i just dont know how to add the size blocks.

    public static int tfs_dio_create(byte[] name, int nlength, int size) { //create a disk file of size blocks. the disk file is a real file in your system which TFS is implemented //return 0 if there is no error try { File disk_file = new File("disk_file"); if(disk_file.createNewFile()) return 0; } catch (IOException e){ e.printStackTrace(); } return -1; } 
    submitted by /u/computergal101
    [link] [comments]

    No comments:

    Post a Comment