If I'm in Ruby, I will put braces in differently. If I'm doing something like
myArr.each { |item|
item.DoThing()
}
then my braces are like that. I don't know if Ruby even works without it as I'm still rather new.
| 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. | ||
|
Gowerly
United Kingdom916 Posts
November 05 2014 14:40 GMT
#10841
If I'm in Ruby, I will put braces in differently. If I'm doing something like
then my braces are like that. I don't know if Ruby even works without it as I'm still rather new. | ||
|
Manit0u
Poland17496 Posts
November 05 2014 14:59 GMT
#10842
1. Compiling this code to .war produces file that's 5x smaller than previously, probably missing some dependencies... 2. Errors be thrown: java.lang.NoClassDefFoundError, definitely dependencies are missing... 3. 'mvn depdendency:resolve' downloads all the required stuff, 1 and 2 remain unchanged. Help? I've recompiled the code like 15 times now, updated everything, all looks cool and dandy, maven is able to install, clean package and all that jazz, but it doesn't work ![]() And yes, all deps are properly included in pom.xml and class that's throwing the error does import the right thing. | ||
|
bangsholt
Denmark138 Posts
November 05 2014 16:14 GMT
#10843
My personal preferences are to follow the style guide of the language you're working in - with the exception of C, where I strongly prefer the Linux Kernel Style. If it's not consistent, abuse CTRL + K, CTRL + D in VS, CTRL + SHIFT + F in Eclipse or ALT + CTRL + L in IntelliJ. Now it is. | ||
|
spinesheath
Germany8679 Posts
November 05 2014 17:05 GMT
#10844
On November 06 2014 01:14 bangsholt wrote: As long as the code is formatted in a consistent way, I don't mind how it's written. My personal preferences are to follow the style guide of the language you're working in - with the exception of C, where I strongly prefer the Linux Kernel Style. If it's not consistent, abuse CTRL + K, CTRL + D in VS, CTRL + SHIFT + F in Eclipse or ALT + CTRL + L in IntelliJ. Now it is. And then you pray that you're not the guy who has to merge that with another branch that has code changes in the files you just touched. | ||
|
nunez
Norway4003 Posts
November 05 2014 18:25 GMT
#10845
On November 06 2014 01:14 bangsholt wrote: As long as the code is formatted in a consistent way, I don't mind how it's written. i am with you brother. i associate a narrow mind with syntax tears. | ||
|
Saumure
France404 Posts
November 05 2014 20:56 GMT
#10846
I am pretty desperate ![]() I wrote some c++ code in Qt and when I try to run the executable from the terminal, the program stops right after launching saying: Illegal instruction In Qt, when I try to debug, i get: Debugging starts &"warning: GDB: Failed to set controlling terminal: Inappropriate ioctl for device\n" Can someone help me please? EDIT: solved it ![]() | ||
|
Manit0u
Poland17496 Posts
November 06 2014 08:48 GMT
#10847
On November 06 2014 03:25 nunez wrote: Show nested quote + On November 06 2014 01:14 bangsholt wrote: As long as the code is formatted in a consistent way, I don't mind how it's written. i am with you brother. i associate a narrow mind with syntax tears. I only want to cry if people don't put return statements on their own line and don't separate control statements from the rest of the code. I couldn't care less about where you put your bracers since I'm simultaneously working on several projects that have totally different brace-placement policy. | ||
|
Manit0u
Poland17496 Posts
November 06 2014 13:19 GMT
#10848
On November 05 2014 23:12 spinesheath wrote: I retract the question. You're defining a method inside a class inside a method inside a class. This just can't be a good idea. Ever. Is that 3rd method catching the exceptions it throws? There are plenty of methods that: a) throw 3 different exceptions in 7 different places b) catch some of the exceptions they throw themselves and exceptions thrown by other events c) call other methods that do the same, inside a loop, inside a loop (and those other methods also do such things) d) there are methods inside classes inside methods inside classes inside methods inside classes and some of those methods are anonymous overrides to methods in classes higher in the order of hierarchy e) in some classes there are methods that override basic stuff, like count() - my favorite part of it: if (total == 0) { total = 1; }, equals(), etc. With every passing hour spent trying to understand this code I feel like I'm just diving into madness and going way too far down the rabbit hole... | ||
|
djookz
1 Post
November 06 2014 13:55 GMT
#10849
I've been an avid reader since this page came out but never felt the urge to make an account, but upon seeing this thread for the first time now (Usually not looking at General), I wanted to ask if some people here use R? | ||
|
Chocolate
United States2350 Posts
November 06 2014 18:04 GMT
#10850
| ||
|
MichaelEU
Netherlands816 Posts
November 06 2014 18:15 GMT
#10851
On November 07 2014 03:04 Chocolate wrote: Taking a database class centered around SQL (our professor is lazy and is making the course parallel to a course offered at Stanford, so if you have taken their course, it's like that). Should I expect this to be very hard? I hear it's very useful in the working world, but I'm currently at 13 hours (my next semester I'll be busy with non-school things) and I want to know if I should drop this class if I get into a more important CS class that I'm trying to get. SQL (or rather: database design, which likely involves SQL) is one of the most useful things to learn. It's not that difficult. | ||
|
Chocolate
United States2350 Posts
November 06 2014 18:22 GMT
#10852
Also, can any of you tell me why in the world Visual Studio won't let me compile the code on this line? I stared at this shit for half an hour last night and couldn't figure out why VS was being a bitch about it. It's a default constructor for a generic queue class that I have to write for a project template <typename type> The error says "expected semicolon" and that the "<" and ">" don't make sense. I checked a billion times for missing curly brackets and semicolons above this code but couldn't find any. | ||
|
Khalum
Austria831 Posts
November 06 2014 19:07 GMT
#10853
| ||
|
Chocolate
United States2350 Posts
November 06 2014 19:42 GMT
#10854
| ||
|
Khalum
Austria831 Posts
November 06 2014 19:53 GMT
#10855
[edit] That was not well formulated. You can't declare/define template classes/functions in .cpp files. | ||
|
Chocolate
United States2350 Posts
November 06 2014 20:23 GMT
#10856
template <typename type> | ||
|
Khalum
Austria831 Posts
November 06 2014 20:40 GMT
#10857
| ||
|
Nesserev
Belgium2760 Posts
November 06 2014 20:44 GMT
#10858
| ||
|
Shield
Bulgaria4824 Posts
November 06 2014 22:50 GMT
#10859
On November 07 2014 05:44 Nesserev wrote: Show nested quote + On November 07 2014 05:23 Chocolate wrote: I'm 99% sure you can though, I have a working Stack class where the default constructor is template <typename type> You can put a rusty spoon in your ass... doesn't mean that you should do it. The baseline is... you're not supposed to do stuff like including source files in your header files. Wtf, where do you even get this idea? Conventions, please. You're supposed to put all template definitions in the same file (.tpp or .hpp). It makes sense that a compiler cannot compile a generic template directly like a normal class; templates are just a 'blueprint'. When you use the template, you basically create a new class, and for the compiler to generate that class, it needs all the information that is given by the class definition and class method definitions, so you put it in one file altogether. The reason why it works if you include your source file from your header, is that #includes basically 'copy' the contents of that file to your translation unit... .h and .cpp are just extensions for the sake of conventions and clarity, so they're treated the same way. But just don't do this stuff... you probably forgot your guards and sh!t in your .cpp file. Dangerous slippery slope to hell and stuff.. Actually, some articles suggest including a source file from header so this is no surprise. Here is an example I'm reading at the moment: http://stackoverflow.com/a/495056/1091781 | ||
|
Nesserev
Belgium2760 Posts
November 06 2014 23:08 GMT
#10860
| ||
| ||
StarCraft 2 StarCraft: Brood War Britney Dota 2GuemChi Horang2 actioN Jaedong BeSt Mini Dewaltoss Sharp EffOrt [ Show more ] League of Legends Counter-Strike Super Smash Bros Other Games Organizations Other Games StarCraft: Brood War StarCraft 2 StarCraft: Brood War
StarCraft 2 • LUISG StarCraft: Brood War• Light_VIP • AfreecaTV YouTube • intothetv • Kozan • IndyKCrew • LaughNgamezSOOP • Migwel • sooper7s Dota 2 League of Legends |
|
OSC
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
Korean StarCraft League
CranKy Ducklings
WardiTV 2025
SC Evo League
BSL 21
Sziky vs OyAji
Gypsy vs eOnzErG
OSC
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
WardiTV 2025
[ Show More ] OSC
BSL 21
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
Wardi Open
StarCraft2.fi
Monday Night Weeklies
Replay Cast
WardiTV 2025
StarCraft2.fi
PiGosaur Monday
StarCraft2.fi
Tenacious Turtle Tussle
The PondCast
|
|
|