An introduction to Support Vector Machines via /r/learnprogramming


An introduction to Support Vector Machines

Support Vector Machines is a fast and dependable classification algorithm that performs very well with a limited amount of data.

This guide goes through the basics of Support Vector Machines and how it works with a simple example. It also walk through how to apply this algorithm for text classification.

Check it out: http://ift.tt/2rZuBjl

Submitted June 22, 2017 at 01:33PM by wildcodegowrong
via reddit http://ift.tt/2t08UUP

tips to make my java program less messy?? via /r/learnprogramming


tips to make my java program less messy??

Hi, I recently jumped on to Java, and after taking 2 classes of Java, I attempted to write a code that functions as a vending machine. It is extremely messy and might contain errors! but I really want to learn how to organize my code. tbh idk if anybody will bother to read all of the code below, but I would definitely like to get some constructive feedback 🙂 Since Im a noob coder, please dont take some mistakes too seriously:D

p.s. everything that I applied here are only: variables, operators, and conditions.. i think.

import java.util.Scanner; public class andrew { public static void main(String[] args) { Scanner val = new Scanner(System.in); // variable Double fanta = 3.25; Double coke = 4.75; Double sprite = 5.50; System.out.println("This is a vending machine."); System.out.print("Insert money: "); // only works with the factor of 0.25 USD. Double money = val.nextDouble(); if (money >= 10.00) { System.out.println("The machine only takes below 10.00 USD."); } else if (money <= fanta) { System.out.println("You are poor."); } else if (fanta <= money && money < coke) { System.out.println("Option(s): Fanta"); Scanner hm = new Scanner(System.in); System.out.print("Choose a drink: "); String ha = hm.nextLine(); if (ha.equals("Fanta")) { System.out.println("Price of Fanta: 3.25 USD"); double x = ((money - fanta) % 1) / 0.25; double x1 = (money - fanta) - ((money - fanta) % 1); System.out.println("Number of quarters for change: " + x); System.out.println("Number of dollar coins for change: " + x1); } } else if (fanta <= money && money < sprite) { System.out.println("Option(s) : Fanta or Coke"); Scanner type = new Scanner(System.in); System.out.print("Choose a drink: "); String drink = type.nextLine(); if (drink.equals("Fanta")) { System.out.println("Price of Fanta: 3.25 USD"); double x = ((money - fanta) % 1) / 0.25; double x1 = (money - fanta) - ((money - fanta) % 1); System.out.println("Number of quarters for change: " + x); System.out.println("Number of dollar coins for change: " + x1); } if (drink.equals("Coke")) { System.out.println("Price of Coke: 4.75 USD"); double y = ((money - coke) % 1) / 0.25; double y1 = (money - coke) - ((money - coke) % 1); System.out.println("Number of quarters for change: " + y); System.out.println("Number of dollar coins for change: " + y1); } } else if (fanta <= money && money < 10.00) { System.out.println("Option(s) : Fanta, Coke, or Sprite"); Scanner lel = new Scanner(System.in); System.out.print("Choose a drink: "); String lmao = lel.nextLine(); if (lmao.equals("Fanta")) { System.out.println("Price of Fanta: 3.25 USD"); double x = ((money - fanta) % 1) / 0.25; double x1 = (money - fanta) - ((money - fanta) % 1); System.out.println("Number of quarters for change: " + x); System.out.println("Number of dollar coins for change: " + x1); } if (lmao.equals("Coke")) { System.out.println("Price of Coke: 4.75 USD"); double y = ((money - coke) % 1) / 0.25; double y1 = (money - coke) - ((money - coke) % 1); System.out.println("Number of quarters for change: " + y); System.out.println("Number of dollar coins for change: " + y1); } if (lmao.equals("Sprite")) { System.out.println("Price of Sprite: 5.50 USD"); double z = ((money - sprite) % 1) / 0.25; double z1 = (money - sprite) - ((money - sprite) % 1); System.out.println("Number of quarters for change: " + z); System.out.println("Number of dollar coins for change: " + z1); } //if } // else if System.out.println("Thank you for using my vending machine."); } // public thingy } // class 

Submitted June 22, 2017 at 12:04PM by alwaysacsnoob
via reddit http://ift.tt/2t09SAx

The software archeology phenomenon via /r/learnprogramming


The software archeology phenomenon

A.K.A. – Noone knows how this product works.

Story: I'm pretty new to software development, I've just started my first internship 3 months ago, after changing career from bartender to software dev. Hurray! I started working at a pretty big company where I've got involved with unimaginably complex telecommunication software. And here comes the surprise, and I know this must be pretty obvious to some of you. I just want to share this and ask if you experienced this the same way: It pretty much looks like no one really understands the all the processes behind the product. I mean yeah sure, it's huge, and different people understand different aspects. Hell, just the testing has got something like 10 layers! But still, it seems like some guys figured out this system somewhat 10-15 years ago, and developed it, and here we are now. And I am sitting there and they say: "If this happens you just say >restart", and I'm like: "Why?", and they are like "Well dunno. This usually works.". I have talked to several people and they told me that it is usual that if a company is working on a big code for long years, the subtleties tend to become foggy, as people come, put in work and leave during the years. Still: I'm just really surprised that a lot of programs and software that underlay our modern technology are a mystery even to those who develop it!

Submitted June 22, 2017 at 12:05PM by pencillr
via reddit http://ift.tt/2rGElQa

[C] ‘for’ loop appears to terminate even though cond_expression not zero via /r/learnprogramming


[C] ‘for’ loop appears to terminate even though cond_expression not zero

I'm trying to understand why this program only prints up to 2.

 #include <stdio.h> int main() { int i = 0; for (i = 1; i <= 2; ++i) { printf("|%2d|\n", i); } } 

This is my understanding of what this code does:

1. Set the value of i to 1.

2. Don't increment just yet. Move to the body of the loop and execute the printf statement with the initial value of i.

|1|

3. Check that the current value of i is less than or equal to 2.

TRUE

Since it is, increment the current value of i by 1.

i = 2

5. Execute the printf statement with the current value of i.

|2|

6. Is the current value of i (2) less than or equal to 2?

Yes, it is.

Since the condition in (6) is met, why doesn't C increment the value of i to 3 and print it to the screen?

This C reference page says that if the result of the cond_expression in a for loop is "zero, the loop statement is exited immediately." In the above code, the loop, by not printing '|3|', appears to terminate even though the value of i was within the acceptable range (1, 2) for the cond_expression.

According to the Microsoft reference page on the topic, a 'for' statement is executed as follows (after the init-expression):

If cond-expression is true (nonzero), statement is executed; then loop-expression, if any, is evaluated. The loop-expression is evaluated after each iteration. There is no restriction on its type. Side effects will execute in order. The process then begins again with the evaluation of cond-expression.

For the code above, this would be:

  1. cond-expression (i <= 2)
  2. statement (printf("|%2d|\n", i);)
  3. loop-expression (++i)

So, if I'm understanding this correctly, it is not that C first increments 'i' and then checks to see whether it's less than or equal to 2.

What am I missing? Thank you.

Submitted June 22, 2017 at 12:08PM by cartographyquestion
via reddit http://ift.tt/2rGSLj2

How to make a custom scannable code like Messenger, Snapchat and Kik? via /r/learnprogramming


How to make a custom scannable code like Messenger, Snapchat and Kik?

I was wondering if anyone has any experience making custom scannable codes (much like QR codes), similar to the ones Messenger, Snapchat and Kik uses.

I have googled a lot the last few days, but could not find any resources or answers. Thanks in advance.

Submitted June 22, 2017 at 12:15PM by evjand
via reddit http://ift.tt/2sZHyhq

Github Organization Logs Question via /r/learnprogramming


Github Organization Logs Question

I have recently noticed that I am still in a private github organization for a job (kind of) I had a while ago. One of the repositories is written in a language I am in the process of learning, and I am somewhat interested in looking over the files for purely educational purposes. However, some of the content may be proprietary, even if I would have no use for it without certain resources (which I do not have).

Not sure if this is the correct place to ask, but what are the risks involved with viewing or cloning the content? Can the organization owner see individual pageviews or downloads by a given user?

Submitted June 22, 2017 at 12:22PM by ghtway
via reddit http://ift.tt/2sVdseL

App idea (help). via /r/learnprogramming


App idea (help).

Ok essentially, right now all I have done is program a few websites. Im looking to program an App as my next project. I was wondering the best way to approach this? This is a very foreign concept to me. I wouldn't know the best place to start. Any help would be massively appreciated.

Submitted June 22, 2017 at 09:12AM by ItsHardToBeHumble
via reddit http://ift.tt/2sumnDd