Just, like, write some code man.
The Big Programming Thread - Page 479
| Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
|
MichaelEU
Netherlands816 Posts
Just, like, write some code man. | ||
|
Gowerly
United Kingdom916 Posts
I write Python in Notepad++ or a Python IDE. I write C++ and C# in VS (VS 2012 at work, VS Express at home). But it's whatever works for you, really. | ||
|
mcc
Czech Republic4646 Posts
| ||
|
IMlemon
Lithuania296 Posts
| ||
|
MysteryMeat1
United States3292 Posts
Edit: my first time posting in this thread, its not really hw help, just a clarification of a topic. | ||
|
Shield
Bulgaria4824 Posts
Integer.toString(int) // returns String Double.toString(double) // returns String or opposite conversion: Integer.parseInt(String) // returns int Double.parseDouble(String) // returns double To check if a word exists in a String, then: stringInstance.contains(stringInstance2); | ||
|
MysteryMeat1
United States3292 Posts
name gender 0 0 0 0 00 0 0 0 0 0 0 and i want to search for the name and gender and then get the next line and store the zeros as a variable. currently my set up is to ask the user for name and gender that they want. I return that, and in another method take that return and have it set equal while (console.hasNext()) { Line = console.next().toLowerCase(); Scanner lineScanner = new Scanner (Line); if (Line.equals(nameInput)) { Line = console.nextLine(); return Line; as below. The problem with my method so far is that i can't Line to equal both name and Gender, or i can but no space between them. if i do Line += console.next() i get nameGender when i want name Gender the other problem is that line returns only gender and the 0 0 0 0 instead of everything | ||
|
Lorizean
Germany1330 Posts
With youcompleteme and project plugins for vim. I got everything I need for my c++ needs. Learning vim was probably the best decision I ever made ![]() | ||
|
nunez
Norway4003 Posts
some vims, convenient plugins (using youcompleteme too), a fresh gcc, solarized theme and shades. | ||
|
mcc
Czech Republic4646 Posts
On May 13 2014 21:52 Lorizean wrote: How come nobody mentioned emacs or vim as an alternative to the fullblown IDEs? With youcompleteme and project plugins for vim. I got everything I need for my c++ needs. Learning vim was probably the best decision I ever made ![]() They can be if you can get a) autocomplete b) go to definition c) find all references d) as good debugging functionality as good IDE The rest of what IDE offers is just a nice bonus and can be easily replaced/lived without on most projects EDIT: autocomplete has to be really smart and well done ![]() | ||
|
Ben...
Canada3485 Posts
On May 13 2014 19:31 IMlemon wrote: I use IntelliJ for everything. Yup. I seldom use IDEs, but the times I do use them it is always JetBrains stuff. They make actual good IDEs that are fast and highly customizable. Most IDEs are awful in comparison, Visual Studio included. The only IDEs I typically will use are IDEA, PyCharm (not very often though, I usually just use Sublime for Python), and, on rare occasion, MARS, which is a MIPS IDE that isn't complete garbage like SPIM (though that is only for school). Outside of some GUI stuff or special cases, I don't see the point of ever using IDEs. Though I basically never work on Windows anymore because I prefer having the OS not get in the way of me doing work. I'm at the point where I do the extreme majority of my programming in Sublime (modified to behave like Vim) or Vim now with a terminal. I find a text editor and a makefile much faster and easier to use than any IDE for anything other than GUI stuff (heck, even for some GUI stuff, like Swing, I find a text editor faster). For Web stuff, I use a plugin for Sublime and have a separate, extension-free version of Chrome used specifically for testing. On an unrelated note, these new lambda functions in Java 8 seem kinda neat. They're not what I expected when I first read about lambda functions being added to Java, but nonetheless they are pretty neat. Nice and compact. | ||
|
Blitzkrieg0
United States13132 Posts
On May 13 2014 21:35 MysteryMeat1 wrote: an example of the data would be name gender 0 0 0 0 00 0 0 0 0 0 0 and i want to search for the name and gender and then get the next line and store the zeros as a variable. currently my set up is to ask the user for name and gender that they want. I return that, and in another method take that return and have it set equal while (console.hasNext()) { Line = console.next().toLowerCase(); Scanner lineScanner = new Scanner (Line); if (Line.equals(nameInput)) { Line = console.nextLine(); return Line; as below. The problem with my method so far is that i can't Line to equal both name and Gender, or i can but no space between them. if i do Line += console.next() i get nameGender when i want name Gender the other problem is that line returns only gender and the 0 0 0 0 instead of everything Line += " " + console.next() will add a space to the String. Review String concatenation if you want more information about this matter. the other problem is that line returns only gender and the 0 0 0 0 instead of everything Line = console.nextLine(); You are overwriting the Line String when you do this which is why you're losing the name. If you want to add on the gender and numbers then you need to do += instead. If you want it spaced then you'll have to use String concatenation again. | ||
|
spinesheath
Germany8679 Posts
On May 13 2014 22:10 mcc wrote: They can be if you can get a) autocomplete b) go to definition c) find all references d) as good debugging functionality as good IDE The rest of what IDE offers is just a nice bonus and can be easily replaced/lived without on most projects EDIT: autocomplete has to be really smart and well done ![]() Add an extensive set of warnings and code smells. And refactorings, lots of them. Automatically suggested at appropriate places. Good class hierarchy and deep value origin/destination inspection are awesome too. Basically all the stuff Resharper does. | ||
|
mcc
Czech Republic4646 Posts
On May 14 2014 01:00 Ben... wrote: Yup. I seldom use IDEs, but the times I do use them it is always JetBrains stuff. They make actual good IDEs that are fast and highly customizable. Most IDEs are awful in comparison, Visual Studio included. The only IDEs I typically will use are IDEA, PyCharm (not very often though, I usually just use Sublime for Python), and, on rare occasion, MARS, which is a MIPS IDE that isn't complete garbage like SPIM (though that is only for school). Outside of some GUI stuff or special cases, I don't see the point of ever using IDEs. Though I basically never work on Windows anymore because I prefer having the OS not get in the way of me doing work. I'm at the point where I do the extreme majority of my programming in Sublime (modified to behave like Vim) or Vim now with a terminal. I find a text editor and a makefile much faster and easier to use than any IDE for anything other than GUI stuff (heck, even for some GUI stuff, like Swing, I find a text editor faster). For Web stuff, I use a plugin for Sublime and have a separate, extension-free version of Chrome used specifically for testing. On an unrelated note, these new lambda functions in Java 8 seem kinda neat. They're not what I expected when I first read about lambda functions being added to Java, but nonetheless they are pretty neat. Nice and compact. Is there any proper support for things like I mentioned in my previous post that you can get working in non-IDE editor (RT code analysis so you have the go to definition, find all references and similar, and debugging) ? I was looking for some pleasant way to program on Linux, but all IDEs I tested were completely lacking and I am not willing to give up the comfort of all those tools just for my after-work programming. As for lambdas in Java, well they finally copied them from C# (not exactly). I cannot even imagine life without them last few years. | ||
|
Nesserev
Belgium2760 Posts
| ||
|
sluggaslamoo
Australia4494 Posts
On May 14 2014 03:48 mcc wrote: As for lambdas in Java, well they finally copied them from C# (not exactly). I cannot even imagine life without them last few years.Or copied them from like, every other dynamic language that already has them... On May 14 2014 03:48 mcc wrote: Is there any proper support for things like I mentioned in my previous post that you can get working in non-IDE editor (RT code analysis so you have the go to definition, find all references and similar, and debugging) ? I was looking for some pleasant way to program on Linux, but all IDEs I tested were completely lacking and I am not willing to give up the comfort of all those tools just for my after-work programming. Its more the fact that people who don't use those tools don't find those features necessary. Instead you just use the console, as it is much faster and more flexible. If you need auto-complete and search functions and whatnot, you are really stuck with an IDE or heavily customized text editor like vim/emacs. | ||
|
sluggaslamoo
Australia4494 Posts
On May 14 2014 03:56 Nesserev wrote: Wow, you really took that very personal... I don't know if you've noticed, but the internet is a bad way to communicate feelings. I didn't mean it in any offensive way, hor was I talking down upon you, nor was I professing any personal dogmas in any way. It's weird how you judged my whole character on the basis of one sentence... I just found it funny that I never had to use VS, but you said that it was a must... an IDE is just an IDE, another tool that can help you in your journey to writing the code that you want. Also, because I don't use VS, doesn't mean that I've nestled myself into some kind of niche branch. In my opinion, and that's the same opinion of my university's department, students should be able to decide what IDE they personally want to use. Some students use VS, some Eclipse, etc. it's one big happy family. Of course students have to learn how to use IDE's, but that doesn't make VS a must. It's a general rule when it comes to anything in CS: "You should be able to pick up any 'tool' in a very short amount of time." For example: If you always used MySQL, and you then have to switch over to PostgreSQL, then that shouldn't form a problem, just like going from Eclipse to Netbeans, VS or any other IDE. If I ever have to use VS for professional reasons, I don't foresee to have any problems, it's just another IDE (with a couple of different features). I definitely understand the latter part of your 'rant', but that has nothing to do with me. Yeah, using an IDE isn't any kind of special skill, it doesn't take more than a few days, of which most companies are more than willing to allow for you to just settle in. | ||
|
Manit0u
Poland17496 Posts
Problem: create a numeric array (template), get average and median of its members (or something like that, for sure there was something about templates so I guessed they had to use them). Solution:
I know what it lacks for sure: class definition, taking input from console, IOC, interfaces But I'll let my friend figure this all out ![]() | ||
|
nunez
Norway4003 Posts
here i'm using accumulate, is_default_constructible and assert(check only if debug build). disclaimer: had a couple of brews. #include<algorithm> | ||
|
netherh
United Kingdom333 Posts
Use std::accumulate to sum a vector, and std::copy to print a vector. You can also use std::nth_element in the median function. Use more C++11 features (at least use auto, and use range-based for if you don't go with accumulate and copy). Consider making the median logic clearer (at least a comment, or maybe IsEvenSize and GetMean(val1, val2) functions (you could reuse GetAverage({val1, val2}), but that would be less efficient)). I don't think your median function works with even numbers, because you divide two ints by 2 (an int), not 2.0 (a double). Check the problem specifications: Are you sure you want to return doubles, not Ts (be aware of conversions that happen either way...)? What about empty vectors? What about input vectors with 1 item (does the median function still work?) Also see whether the inputs can overflow (i.e. you may be summing lots of large numbers). Pass vectors by const reference. Consider copying the input vector in GetMedian before sorting, so you don't change the input vector itself. | ||
| ||

