C# Very basic knowledge question as to why this is not returning the right result.

Learn Programming - Tue, 06/19/2018 - 10:42
using System; public class Lesson4 { public static void Main() { string strFirst, strSecond; double first, second, result; Console.Out.Write("Enter a number: "); strFirst = Console.ReadLine(); first = Convert.ToDouble(strFirst); Console.Out.Write("Enter a second number: "); strSecond = Console.ReadLine(); second = Convert.ToDouble(strFirst); result = Sum(first, second); Console.Out.WriteLine("The sum is: " + result); Console.ReadKey(); } public static double Sum(double number1, double number2) { double answer = number1 + number2; return answer; } }

I am just starting out in this class so I am sorry if this is a stupid question, but I have been looking this over for the last 45 minutes and cannot understand why it is not returning the value it is supposed to. I am running with just basic Command Prompt lines for the beginning of this class.

The code itself should ask for two inputs, then add them together and display it on the screen. I have ran the code about twenty times to try and understand what I am doing wrong before I ask for help, but frankly I'm at a loss. I understand the basic theory behind what is going on and how it should flow, but it just isn't working. The results for inputs and results are below.










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

Route Gateway Issue

Learn Programming - Tue, 06/19/2018 - 10:09


Don't know if there is a better place to post this but had a gateway issue I need help with. I am working on an external processor that is running Linux, and want to be able to ssh in from my work network. In my net-intf file (my routing file basically), I have the default gateway listed in there, however when I run the "route" command, it doesn't show up and I cannot connect. If I then input "route add default gateway #", I can connect, but when the system reboots, it doesn't work (even though it is listed in the config file.

Anyone have any idea on why this might be happening? Or, if you can explain in depth exactly what files the command "route add" changes or affects, that would be great too.


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

It's Triumphant Tuesday! Post your recent Drupal wins and launches

Drupal - Open Source Content Platform - Tue, 06/19/2018 - 10:07

Here's your chance to brag about cool stuff you've done recently and awesome sites you've shipped. Anything happy and Drupal-related goes.

(Check out the weekly post schedule in the sidebar)

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

Is it possible to have a single sign on with Windows AD and O365?

Learn Programming - Tue, 06/19/2018 - 09:57

So what I want is that if the user is authenticated on their PC, so they log in on their PC and their account is in our Windows AD domain, that when that user goes to an o365 website, they won't have to login anymore. Right now I have to login into o365 using that same (company) account and it works.

Is there a single sign on way to do this? I have no experience with anything single sign on-wise though.

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

TASM debugger hangs when I press F7 to trace

Learn Programming - Tue, 06/19/2018 - 09:52

Hey guys

so after making a object file of the program by "TD" command I open the debugger and then open my program it opens perfectly but when I press F7 to trace it moves to next line and permanently hangs what should I do ?

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

Java Help (MySQL) - Parameter Index out of range (6 > number of parameters, which is 0)

Learn Programming - Tue, 06/19/2018 - 09:10

I have textfields and a update button to update the database and when I use =? everything works fine except they update all the fields with that number. So if I click on 1 field in the database with the number 5 and update it to 6, and if there are 2 fields that have 5, then both fields update to 6. So I need to get all the current fields so I update 1 and not multiples on accident.

Works but updates all with same:

// String sql = "UPDATE `Loads` SET `date_shipped`=?,`month`=?,`load`=?,`status`=?,`number`=? WHERE date_arrived=?";

What I want but gets Parameter Index out of range (6 > number of parameters, which is 0) :

String sql = "UPDATE `Loads` SET `date_shipped`="+((JTextField)date_shipped.getDateEditor().getUiComponent()).getText()+",`month`="+month.getSelectedItem().toString ()+", `load`="+load.getText()+",`status`="+status.getSelectedItem().toString()+", `number`="+number.getText()+" WHEREdate_arrived="+((JTextField)date_arrived.getDateEditor().getUiComponent()).getText(); con = DriverManager.getConnection("jdbc:mysqls?SomethingCool=convertToNull","SomethingCool","SomethingCool"); pst = con.prepareStatement(sql); pst.setString(6, ((JTextField)date_arrived.getDateEditor().getUiComponent()).getText()); pst.setString(3, load.getText()); pst.setString(1, ((JTextField)date_shipped.getDateEditor().getUiComponent()).getText()); String monthvalue=month.getSelectedItem().toString(); pst.setString(2, monthvalue); String statusvalue=status.getSelectedItem().toString(); pst.setString(4, statusvalue); pst.setString(5, number.getText()); pst.execute(); JOptionPane.showMessageDialog(null, "Successfully Updated"); submitted by /u/CEOTRAMMELL
[link] [comments]

C++ Find word in a very long line/string

Learn Programming - Tue, 06/19/2018 - 09:09

How should I go about finding a word(between 0 and 128 chars) in a long line? Assuming the line is long enough that it would make "getline()" throw an exception or error (if that's possible, which I assume it is)

I know I could just read chunks of it (1000 chars per iteration for example) but how would I know my word hasn't been cut of at the beginning or end of these 1000 characters?



N-th iteration ______ N+1th iteration

. . . . . . . w o _____ r d . . . . . . . . . .



I can't wrap my head around this, and using STRING container with the find() function would still require me to keep that line / chunk of that line in a variable, so the problem would still be there.

And verifying chunks of 1000 characters , where after each iteration I'd simply move the start and end by 1 character would be very inefficient

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

Hack Reactor & Fullstack Academy Grads: How to best prep (after being admitted) - 0 CS training

Learn Programming - Tue, 06/19/2018 - 09:08

Goal: soloprenuer, augment myself, web-literacy and ability to manipulate the web to further my goal of remote independence and prosperity. Learn how to learn, allow myself to follow my interests in software and automation in the future.


I recently was admitted to FSA. I decided to defer joining the bootcamp until my contract with my current employer is up in about 6 months. I have often read that "you get out what you put in" and that the best grads from both of these programs had a solid foundation going in. Many of these top grads had CS degrees or were in Q&A or something softwareish.

I currently do not have that foundation. I had just enough to get in and that is it. Javascript only.


How would you prep on a part time basis (outside 9-5) for 6 months?

I am considering taking the CS50x course from Harvard, but also thinking of doing FreeCodeCamp from the ground up. CS50x offers a true cs intro, while FCC would pretty much be doing some form of what these bootcamps actually are ahead of time.

I think pre-learning the course would be helpful for me and would allow me to build off that foundation and fill in the gaps the second time with the support of the school/instructors etc. I honestly think FCC is the way to go. I'd be down to take other JS fullstack courses if you have suggestions. I also could just focus 100% on algorithms. I am suffering from choice overload and I have embarked on a new course every day for the past week or two lol. No bueno.

Pease identify if you went to HR or FSA in your answer. I am totally open to non-JS bootcamp grad's answers but I really am looking for their input specifically.




Please do not offer your opinions on if I should be spending a slightly used economy car on a bootcamp or not. I've already decided this is the best route for my goals. I am too ADHD and impulsive to completely learn webdev/software engineering on my own and I want the pressure, timeline, framework and guidance that these programs offer. I also can afford to take one. I also think these two schools are the best in the space and John Sonmez did give his endorsement of bootcamps in general. Not sure if you guys respect his opinion or not...

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