Stuff.
Thanks. I thought that so, but I swear I remember something being inconclusive. Must be remembering things ~.~.
Stuff.
Thanks. I thought that so, but I swear I remember something being inconclusive. Must be remembering things ~.~.
import java.util.Scanner;
public class SpaceReplace {
public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
String userWord = "";
int userNum = 0;
String sentenceWord = "";
String sentenceNum = "";
System.out.print("Enter a Word");
userWord = scnr.next();
System.out.print("Enter a Number");
userNum = scnr.nextInt();
sentenceWord = userWord;
sentenceNum = IntuserNum; //Ithink this is the problem
System.out.print(sentenceWord);
System.out.print("_");
System.out.println(sentenceNum);
return;
}
}
How do I assign a value into a string when the variable is an Int?
int i = 10;
string s = "" + i;
Programming newb here:
A user types a word and a number. Read them into the provided variables. Then print: word_number. End with newline. Example output if user entered: Amy 5
Amy_5
Code:import java.util.Scanner; public class SpaceReplace { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); String userWord = ""; int userNum = 0; String sentenceWord = ""; String sentenceNum = ""; System.out.print("Enter a Word"); userWord = scnr.next(); System.out.print("Enter a Number"); userNum = scnr.nextInt(); sentenceWord = userWord; sentenceNum = IntuserNum; //Ithink this is the problem System.out.print(sentenceWord); System.out.print("_"); System.out.println(sentenceNum); return; } }
How do I assign a value into a string when the variable is an Int?
String twoString = Integer.toString(2);
Here:Guys, I need some help. I can't for the life of me remember some stuff about P, NP and NP- complete and I can't find it on my notes, nor the teachers material nor the internet.
Basically, if I have a problem A which is in NP and a problem B which is in NP-Complete, what can we say about P and NP when:
1. We find a polynomial solution to both A and B
2. We find there's no polynomial solution to A
3. We find there's no polynomial solution to B
4. We find there's no polynomial solution to both A and B
IIRC, from 1 we can deduce P = NP, from 4, P != NP and we can't deduce anything form the other two, but I'm not understanding why.
Thanks.
You may have stated parts 2 & 3 incorrectly.
If you find a polynomial-time solution to B, then P = NP.
If you find a polynomial-time solution to A, it's inconclusive.
What are the differences between linters and syntax checkers in say an IDE like IntelliJ?
I'm keep seeing people talk about how awesome this linter or that linter are, especially in the context of Sublime Text, but whenever I think about them and what they do I keep picturing an IDE. Like they are doing what an IDE would already do for you, just in a less efficient way.
Please set me straight and explain these things if you could!
It's usually setup as part of the build process. It would be silly for an IDE to prevent you from saving code that's not properly linted but you don't want to check it in to version control and not everybody is using the same IDE with the same style rules.
These are nicely done.
1) Syntax checking is just a part of what compilers do. Compilers have to be very fast to be useful in day-to-day development. Separate linters / static analysis tools can take a lot more time to perform deeper analysis that compilers cannot do.What are the differences between linters and syntax checkers in say an IDE like IntelliJ?
I'm keep seeing people talk about how awesome this linter or that linter are, especially in the context of Sublime Text, but whenever I think about them and what they do I keep picturing an IDE. Like they are doing what an IDE would already do for you, just in a less efficient way.
Poster's talking about IDE's though, not compilers. From the sounds of it I'd never use something like atom + linter when a full fledged IDE is available. Unless the functionality is comparable, but it's not though is it?1) Syntax checking is just a part of what compilers do. Compilers have to be very fast to be useful in day-to-day development. Separate linters / static analysis tools can take a lot more time to perform deeper analysis that compilers cannot do.
2) Purpose. Linters may look heuristically for things that might not even be errors, style issues that are only relevant in the context of a particular project's / team's agreed coding style, etc. Integrating all of these features into a giant monolithic compiler as optional features that take no performance when disabled would be a miracle and at least make the compiler unmaintainable.
Poster's talking about IDE's though, not compilers. From the sounds of it I'd never use something like atom + linter when a full fledged IDE is available. Unless the functionality is comparable, but it's not though is it?
And all linters do that? A linter has integrated GIT? What about project package and build management? Debugging?The IDE points out potential problems inline for your benefit but it does nothing to prevent you from checking in bad or inconsistent code to a central repository.
And all linters do that? A linter has integrated GIT? What about project package and build management? Debugging?
A linter is just a code analysis tool that takes in the source code files and spits back a bunch of warnings. So in a normal team scenario you have a build process that gets latest from the repository, compiles the build, pushes it up to a clean environment for testing, and runs automated test, typically on a check in. This is to test if the checked in code broke something and if it did it usually flags the build as bad and the team should stop what they are doing and fix it. This way you don't check in broken code and take off, leaving everyone else with a broken build they can't work with. As part of this many teams opt to include code linters that check for style and form issues.
import java.util.Scanner;
public class SimonSays {
public static void main (String [] args) {
String simonPattern = "";
String userPattern = "";
int userScore = 0;
int i = 0;
userScore = 0;
simonPattern = "RRGBRYYBGY";
userPattern = "RRGBBRYBGY";
char s;
char u;
for(i=0; i < 10; i++) {
s = simonPattern.charAt(i);
u = userPattern.charAt(i);
if(s == u)
userScore = userScore + 1;
continue;
else if(s != u){
break;
}
System.out.println("userScore: " + userScore);
return;
}
}
SimonSays.java:24: 'else' without 'if' else if(s != u){ ^ SimonSays.java:34: reached end of file while parsing } ^ 2 errors
Code:if(s == u) userScore = userScore + 1; continue; else if(s != u){ break; // Missing a } here.
Brackets are your friend. Else statements need to immediately follow the if. For multi line ifs you are going to want bracketsI keep getting this error:Code:SimonSays.java:24: 'else' without 'if' else if(s != u){ ^ SimonSays.java:34: reached end of file while parsing } ^ 2 errors
I am just not sure what I am doing wrong for the else if statement.
I've been learning perl this week and have to say that I'm really, really not a fan. Anyone here have a strong opinion on it?
So question here regarding class generation in C# / VS. I want to be able to write an interface, and have that interface implemented at compile time, or before, automatically.
The implementations of the methods are all according to the same procedure, all information I need per method is the method's name and parameters and then I can write the body. I also need to be able to generate two different implementations per interface (client and server).
What would you suggest, T4 Templates, Reflection.Emit? Are there any other options (built in to VS preferably)?
Looks really cool, simply storing the data beforehand in a way that you can just write/transfer it. But the RPC part isn't available in C#. Doesn't seem like it does what I need it to do either, waiting for the reply part for example seems to be blocking. As for the serialization part, I don't want to use schema's for this project. Streamlining the development process has a higher priority. 2 to 5x the speed of protobuf is insane though, definitely one to watch.I know this doesn't answer your question, but have you considered using something like Cap'n Proto. Because it sounds like you're re-inventing the wheel.
Looks really cool, simply storing the data beforehand in a way that you can just write/transfer it. But the RPC part isn't available in C#. Doesn't seem like it does what I need it to do either, waiting for the reply part for example seems to be blocking. As for the serialization part, I don't want to use schema's for this project. Streamlining the development process has a higher priority. 2 to 5x the speed of protobuf is insane though, definitely one to watch.
The serialization and messaging is already implemented by the way and I'm working on streamlining client-server RPC interfaces. That's why I need to generate classes from an interface, so the developer would only have to edit the interface and then regenerate the classes. Perhaps even at runtime, but then the syntax can't be checked.
'client' : {
'methods' : [
{
'return_type' : 'void'
'name' : 'foo'
'args' : [
{
type : 'int',
name : 'foo_param'
}
]
},
{
'return_type' : 'double'
'name' : 'bar'
'args' : [
{
type : 'float',
name : 'bar_param'
}
]
}
]
}
I've been learning perl this week and have to say that I'm really, really not a fan. Anyone here have a strong opinion on it?
Hm yeah, sort of like an extension as well. Though I don't want to write outside of the IDE/language. But if I write is as VS extension I could use a normal C# interface as well. I guess I'm trying to decide between that (most flexibility, but also most effort), T4 Templates (I think the options here are limited right?) and runtime with Reflection.Emit/Expression trees (less syntax checking, but also least amount of steps for developer to take).To integrate this into VS, first split your project so that the interface is in a separate assembly. Then add all these JSON files to this same project. For each of the JSON files, set the build action to Custom Build Tool and set the command line to run the tool you wrote. Then have the main project add a reference to this project.
Now everything will just be automatic.
Any good resource recs for learning Java? I have very basic knowledge of the language but I want to spend the summer to begin working towards learning to make apps.
public class StudentScores {
public static void main (String [] args) {
final int SCORES_SIZE = 4;
int[] bonusScores = new int[SCORES_SIZE];
int i = 0;
bonusScores[0] = 10;
bonusScores[1] = 20;
bonusScores[2] = 30;
bonusScores[3] = 40;
/* Your solution goes here */
for(i=0; i < 3; ++i){
bonusScores[i] = bonusScores[i] + bonusScores[i+1];
}
for (i = 0; i < SCORES_SIZE; ++i) {
System.out.print(bonusScores[i] + " ");
}
System.out.println();
return;
}
}
Testing for bonusScores = {10, 20, 30, 40}
Your output:30 50 70 40
✖ Runtime error (commonly due to an invalid array/vector access, divide by 0, etc.).
Tests aborted.
Anybody help me with this?
Write a loop that sets each array element to the sum of itself and the next element, except for the last element which stays the same. Be careful not to index beyond the last element. Ex:
Initial scores: 10, 20, 30, 40
Scores after the loop: 30, 50, 70, 40
The first element is 30 or 10 + 20, the second element is 50 or 20 + 30, and the third element is 70 or 30 + 40. The last element remains the same.
Code:public class StudentScores { public static void main (String [] args) { final int SCORES_SIZE = 4; int[] bonusScores = new int[SCORES_SIZE]; int i = 0; bonusScores[0] = 10; bonusScores[1] = 20; bonusScores[2] = 30; bonusScores[3] = 40; /* Your solution goes here */ for(i=0; i < 3; ++i){ bonusScores[i] = bonusScores[i] + bonusScores[i+1]; } for (i = 0; i < SCORES_SIZE; ++i) { System.out.print(bonusScores[i] + " "); } System.out.println(); return; } }
I got the answer correct but I keep getting this error and I am not sure what is wrong exactly
Code:Testing for bonusScores = {10, 20, 30, 40} Your output:30 50 70 40 ✖ Runtime error (commonly due to an invalid array/vector access, divide by 0, etc.). Tests aborted.
Hm yeah, sort of like an extension as well. Though I don't want to write outside of the IDE/language. But if I write is as VS extension I could use a normal C# interface as well. I guess I'm trying to decide between that (most flexibility, but also most effort), T4 Templates (I think the options here are limited right?) and runtime with Reflection.Emit/Expression trees (less syntax checking, but also least amount of steps for developer to take).
Kind of leaning towards Emit/Expression trees now. Seems like it would be neat to just provide an interface to the RPC object and out pops an instance you can use. Everything happening in the background. Eh can't seem to make up my mind
Hello peoples, I had a quick question. I did a programming focused bachelor degree but have been in Networking side of IT last 2 years. I wanted to transition back to soft dev side I studied during college, so I am planning on taking a 3 month course from Epicodus in Portland to brush up on concepts/network as well. My question is they have 2 course offerings and wanted to know which you fellows would think would be more valuable:
Course 1: PHP/Javascript/Drupal
Course 2: Ruby/Javascript/Railsl
^Let me know what you guys think
Hello peoples, I had a quick question. I did a programming focused bachelor degree but have been in Networking side of IT last 2 years. I wanted to transition back to soft dev side I studied during college, so I am planning on taking a 3 month course from Epicodus in Portland to brush up on concepts/network as well. My question is they have 2 course offerings and wanted to know which you fellows would think would be more valuable:
Course 1: PHP/Javascript/Drupal
Course 2: Ruby/Javascript/Railsl
^Let me know what you guys think
Out of those 2, take course 2. More demand and better paid. Only take 1 if you also have a time machine to 2001.
If possible take a course on iOS/Android development, those are scarce and company are even hiring junior dev for those.
The "hotness" right now is node/iOS/new client side js frameworks (react, angular or ember).
Definitely course 2.
Out of those 2, take course 2. More demand and better paid. Only take 1 if you also have a time machine to 2001.
If possible take a course on iOS/Android development, those are scarce and company are even hiring junior dev for those.
The "hotness" right now is node/iOS/new client side js frameworks (react, angular or ember).
I sorta agree, but sorta disagree. PHP (and Perl) can lead to LAMP stack experience, which is, and will be for quite some time, in demand. Maybe is more of a matter of whether he wants to go more towards back end vs front end dev.
With an extension you can generate classes from a context menu, so you don't have to build the project or go outside of VS to gain access to/update the classes.Everything just works, no magic steps for the developer to do. Edit json, hit Build, F5 to run.
If I wanted to work on learning Python, which is the best version to go for? 2.7 still seems to be very common, or would it be better to go for the more recent versions?
I don't really have a huge goal in mind other than learning for the sake of learning.