Ruby:
http://ruby-doc.org/
Ruby on Rails:
http://railscasts.com/
http://railslab.newrelic.com/scaling-rails
Thought about learning C or C++ but decided not to after seeing some tutorials :p
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. | ||
Kentor
![]()
United States5784 Posts
Ruby: http://ruby-doc.org/ Ruby on Rails: http://railscasts.com/ http://railslab.newrelic.com/scaling-rails Thought about learning C or C++ but decided not to after seeing some tutorials :p | ||
spinesheath
Germany8679 Posts
On July 11 2010 19:55 haduken wrote: \n is a character literal, for the sake of platform sanity. use cout << YourString << endl; format fixed.. pg 633: I say "Manipulators taking istream and ostream are presented in and < ostream> respectively, and also in < iostream>. The rest of the standard manipulators are presented in < iomanip>." However, the standard disagrees and provides no manipulators in < iostream>, thus making this usage non-conforming: #include < iostream> Personally, I prefer the simpler (and valid) #include < iostream> but I expect that there are enough programs depending on endl for the committee to seriously consider changing the standard to match the implementations. from Stroustrup: Open issues for The C++ Programming Language (3rd Edition) I personally go with Stroustrup. The inventor of the language most likely isn't horribly wrong. \n also doesn't flush the stream when you might not want to. For halting the program, I usually use: char c ; It requires you to enter a character and then hit enter (at least on Windows), so it's not exactly perfect. But for hackish small applications it's fine. I would recommend you not to use anything that begins with an underscore (like _getch()), it's most likely not defined by the standard or implementation dependent. The standard also reseves most names with a leading underscore for the implementation. I haven't heard of this conio.h before, it's a C header that is not part of the C++ standard headers. For the sake of learning proper C++ I'd use C++ headers where possible. | ||
LuckyLuke43
Norway169 Posts
+ Show Spoiler + #include <iostream> using namespace std; int main() { cout << "Tell me a number, and I will tell you if it is positive or negative!" << endl; int choice; cin >> choice; if (choice > 0) { cout << "The number you have chosen is positive." << endl; } else if (choice < 0) { cout << "The number you have chosen is negative." << endl; } else { cout << "The number you have chosen is zero." << endl; } system("PAUSE"); return 0; } Okay so atleast I completed my 2nd assignment, but I'm not satisfied with this whole system("PAUSE") ordeal, if system is bad practice.. This worked: char c; cin >> c; However, it does not give any visual warning. (?) (Just for me, personally): I would like it to actually be optional, if the user wants to exit or do it over again. I did a small app earlier where I asked "play again? (y/n)", and if y it would CLS and start over. If n it would quit. Anyone got this small piece of code in their head? I can't remember -_- sry ![]() EDIT: WOOP WOOP 100th post ;D | ||
![]()
tofucake
Hyrule18967 Posts
char c; To be even more accurate, endl is \r\n and a buffer flush. \n is new line, and \r is carriage return. Most programs today automatically assume \n implies \r as well (compilers :|). Specifically: \n is a vertical shift \r is a horizontal reset So, it should be possible to do cout << "some text\rblah\n"; to get blah text As for coding style, I prefer the following: if(condition) Splitting up sections of if's can cause headaches in more confusing programs, and I've always hated the { being on the same line as whatever it's opening (conditional, loop, etc). @Whoever said get Qt setup: that's all fine and dandy, but don't forget about GTK+ and GTK2. @spinesheath: C casting is taught over C++ casting because C++ casting is slower, uses more memory, and is far uglier. The plus side is that casting objects is simpler. | ||
spinesheath
Germany8679 Posts
cout << "hit any key to exit\n" ; or whatever you want. If you want to ask something, then just do it like above and add this at the end: if(c == 'y') { /*do smth*/ } @tofucake: static_cast is resolved at compile time, so it is in no way slower than C style casting. Internally there is no difference to a C style cast. const_cast is exactly the same. reinterpret_cast should be compile time too, but I would have to check that... dynamic_cast is slower, but C-style casting with class pointers/references is highly unportable and implementation dependent. It might fail at any time. C++ casts are indeed uglier and that speaks FOR them. Safe casts are performed implicitly anyways. Unsafe casts should avoided and if necessary be treated very carefully and because of that an ugly syntax is much better for this. | ||
tdsamardzhiev
Bulgaria9 Posts
javalessons.com Splitting up sections of if's can cause headaches in more confusing programs, and I've always hated the { being on the same line as whatever it's opening (conditional, loop, etc). Putting the opening bracket after else on a new line can be confusing, and if you put it in the same line and then if's opening bracket on a new line, that's kinda strange to me. Still, I don't think it matters that much with modern code editors - you can set, say, Eclipse, to format the code in whatever style you like by only selecting the text and clicking ctrl+shift+f. | ||
LuckyLuke43
Norway169 Posts
Apparently something is horribly wrong here, becuase I get like 3 syntax errors, which I commented into the code. Those 3 lines, get those 3 syntax errors. I've tried googling it now for 30 minutes, but it only comes up in like - in comparison to my skills - super highlvl code ;PPP Anyone? Thanks<3 EDIT: I removed the parenthesis around if (choice 1); and that removed the missing ')', but I got a new one now -> identifier 'choice' heh. EDIT2: Solved! thank you haduken. | ||
haduken
Australia8267 Posts
You are missing the comparison operator. | ||
LuckyLuke43
Norway169 Posts
On July 11 2010 23:30 haduken wrote: if(choice == 1) You are missing the comparison operator. Lol yeah, that was all it was. Hmm. I need to read up on comparison operators I guess. sry ;/ and thank you sir! Edit: Mohaha, assignment No.3 done! *proud* + Show Spoiler +
| ||
![]()
tofucake
Hyrule18967 Posts
| ||
Craton
United States17232 Posts
On July 11 2010 20:22 Kentor wrote: Thought about learning C or C++ but decided not to after seeing some tutorials :p C# would be easier for you to learn some of the basics with, rotnek. Start easy, since this is all hobbyish for you. | ||
fabiano
Brazil4644 Posts
On July 11 2010 18:56 Adeny wrote: Show nested quote + On July 11 2010 09:19 tofucake wrote: I've done plenty with sockets in just about every language I've worked with. Anyway, what's your aim? Writing a website that does fancy loading without reloading is totally different from writing, say, a Battle.net bot. Well, let's say I want to be able to pull data from websites, to find the temperature for today, or something to that effect. Or mayhaps build a bot, that would probably be fun. I'm talking about interacting with the websites, not building fancy websites in php/java/etc. Not sure if someone answered you yet, but what you are looking for are webservices. Afaik there are 2 types of them SOAP and REST. I've not take a look at REST so far because I've been working on SOAP services, so all I know about SOAP is that you will need to know: - how to parse XML. There are libs that support it (libxml for C and the class NSXMLParser for Objective-C - but the latter isnt available for the iPhone only god knows why) - how namespaces work Here is a silly example: TL is now offering a service which allows you to pull data from the Power Rank section. So, there will be a specification somewhere that tells you what are the parameters needed to pull such information. Think of it like a method in Java: String getPowerRank(String player_name). You have to send to the server teh player name so it can process and reply which rank does that player have in the Power Rank. You do it through SOAP messages. The request message (highly simplified): <envelope> <header> ... </header> <body> <getPowerRank> <player_name>Jaedong</player_name> </getPowerRank> </body> <envelope> The reply message from the server (highly simplified): <envelope> <header> ... <header> <body> <getPowerRankResponse> <Rank>2</Rank> </getPowerRankResponse> </body> </envelope> Now you will need to parse the reply from the server to get the Jaedong's position in the power rank. PS: I'm also very new to the subject, so if there is wrong stuff here, please correct me because I want to learn too :D | ||
dimfish
United States663 Posts
On July 11 2010 20:22 Kentor wrote: Thought about learning C or C++ but decided not to after seeing some tutorials :p Hold, man, hold! The best reason for learning C/C++ is that it is the most powerful balance between a high-level language (forms of abstraction) and having a direct correlation with what the underlying hardware will actually do. Compilers are really good these days and C is about as far from the machine language as you can get but still be writing code that is almost exactly what will end up in the executable binary. It's good for even small projects that need performance. | ||
Craton
United States17232 Posts
On July 12 2010 00:46 fabiano wrote: Not sure if someone answered you yet, but what you are looking for are webservices. Afaik there are 2 types of them SOAP and REST. I meant to, but I forgot. For the stuff he's talking about, web services could definitely accomplish the task. I'm not really familiar with socket programming. Your XML SOAP looked pretty accurate to me. Looking back at some of my code for a final project last semester, there wasn't much involved with consuming a simple one like temperature. You pretty much just added the service or web reference and then instantiated it in your program. Every web service should have documentation on what kind of output it sends, which lets you know what how to handle what's coming in. For data where you're getting multiple fields and multiple rows (e.g. movie showtimes), you'll find structs are convenient to help simplify things. + Show Spoiler [Web Services] + Theaters and movie showtimes (last I used it they had removed the showtime part, rendering it fairly useless): http://www.ignyte.com/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx?op=GetTheatersAndMovies More web services: http://www.xmethods.net/ve2/index.po | ||
Catch]22
Sweden2683 Posts
On July 12 2010 01:11 dimfish wrote: Show nested quote + On July 11 2010 20:22 Kentor wrote: Thought about learning C or C++ but decided not to after seeing some tutorials :p Hold, man, hold! The best reason for learning C/C++ is that it is the most powerful balance between a high-level language (forms of abstraction) and having a direct correlation with what the underlying hardware will actually do. Compilers are really good these days and C is about as far from the machine language as you can get but still be writing code that is almost exactly what will end up in the executable binary. It's good for even small projects that need performance. Except if you want to add GUIs, GUIs are a pain in both of them, in that case, go Java. | ||
uNiGNoRe
Germany1115 Posts
On July 12 2010 02:01 Catch]22 wrote: Show nested quote + On July 12 2010 01:11 dimfish wrote: On July 11 2010 20:22 Kentor wrote: Thought about learning C or C++ but decided not to after seeing some tutorials :p Hold, man, hold! The best reason for learning C/C++ is that it is the most powerful balance between a high-level language (forms of abstraction) and having a direct correlation with what the underlying hardware will actually do. Compilers are really good these days and C is about as far from the machine language as you can get but still be writing code that is almost exactly what will end up in the executable binary. It's good for even small projects that need performance. Except if you want to add GUIs, GUIs are a pain in both of them, in that case, go Java. Not necessarily. I used wxWidgets once for a C++ GUI and it's basically like Swing in Java. Very easy, platform independent and the documentation is good. | ||
xLethargicax
United States469 Posts
The prospect of programming excites me, but I feel like there is no way for me to learn except for a class. Do you programmers just crave the thought of learning a language? or is it more enjoying the product? Will I ever be a programmer =[[[[[[[[[? | ||
catamorphist
United States297 Posts
There are lots of good programmers in the first group. If you subscribe to that philosophy, it's fine. You just need to think of cool shit to make, and then dedicate yourself to figuring out how to make it. If you're of average intelligence and you know how to post on a message board, there's no hurdle along the way that you will find impassable, I promise. If you can't motivate yourself either to make cool shit or to learn about interesting ideas, and the only way you can imagine yourself bothering to do any of it is if you have a class in it, then you might someday be a barely competent programmer, but I doubt you will ever be a very good one. You need a pretty sweepingly broad amount of knowledge and experience to be a good programmer, and very few CS or software engineering programs will give you enough of either on their own. However, you will still be ahead of the large amount of people who take the classes and don't even learn anything then. | ||
spinesheath
Germany8679 Posts
On July 12 2010 06:02 xLethargicax wrote: I've always wanted to learn a programming language. Whenever I seem to try from an internet source or a book, I just get so bored. The prospect of programming excites me, but I feel like there is no way for me to learn except for a class. Do you programmers just crave the thought of learning a language? or is it more enjoying the product? Will I ever be a programmer =[[[[[[[[[? It's perfectly fine to just decide to code some_application and then read up on what you need. It's probably not the most efficient way to learn a programming language, but it works. In the beginning the major source of information will be tutorials just to get the code to compile etc., then slowly the sources will shift towards google and structured reference sites. All you need to know is the topic you need information on. If you choose that path you should try to complete your target application in small steps; get this part to run, then add another part and so on. If you can see results it will help you go on. You can't expect to do it all at once. Also expect to throw away most of your code because you found a much better design. Several times. That's standard practice (though if you do proper OOP you try to create code that you can keep even if you discard or reshuffle the overall design). If it the application turns out to be too complex for your current level, find something else. You definitely learned something and the next try will be easier. Programming always involves a lot of failing, so don't be discouraged. You will learn from your failures. | ||
Epsilon8
Canada173 Posts
On July 11 2010 21:20 spinesheath wrote: Show nested quote + On July 11 2010 19:55 haduken wrote: \n is a character literal, for the sake of platform sanity. use cout << YourString << endl; format fixed.. Show nested quote + pg 633: I say "Manipulators taking istream and ostream are presented in and < ostream> respectively, and also in < iostream>. The rest of the standard manipulators are presented in < iomanip>." However, the standard disagrees and provides no manipulators in < iostream>, thus making this usage non-conforming: #include < iostream> Personally, I prefer the simpler (and valid) #include < iostream> but I expect that there are enough programs depending on endl for the committee to seriously consider changing the standard to match the implementations. from Stroustrup: Open issues for The C++ Programming Language (3rd Edition) I personally go with Stroustrup. The inventor of the language most likely isn't horribly wrong. \n also doesn't flush the stream when you might not want to. For halting the program, I usually use: char c ; It requires you to enter a character and then hit enter (at least on Windows), so it's not exactly perfect. But for hackish small applications it's fine. I would recommend you not to use anything that begins with an underscore (like _getch()), it's most likely not defined by the standard or implementation dependent. The standard also reseves most names with a leading underscore for the implementation. I haven't heard of this conio.h before, it's a C header that is not part of the C++ standard headers. For the sake of learning proper C++ I'd use C++ headers where possible. conio.h is a legacy library used on Windows.net and Borland. Its the counter part to linux's curses.h for GNU. The new and 'improved' version of conio.h is windows.h. | ||
| ||
![]() StarCraft 2 StarCraft: Brood War Rain Dota 2![]() Horang2 ![]() Shuttle ![]() Flash ![]() Hyuk ![]() Jaedong ![]() ggaemo ![]() Last ![]() Soulkey ![]() Mong ![]() [ Show more ] Counter-Strike Super Smash Bros Other Games tarik_tv35823 singsing2989 olofmeister1276 DeMusliM553 B2W.Neo427 sgares415 crisheroes304 Livibee277 Lowko262 RotterdaM79 Trikslyr32 QueenE32 Organizations StarCraft 2 StarCraft: Brood War StarCraft 2 StarCraft: Brood War
StarCraft 2 • AfreecaTV YouTube StarCraft: Brood War• intothetv ![]() • Kozan • IndyKCrew ![]() • LaughNgamezSOOP • Laughngamez YouTube • Migwel ![]() • sooper7s Dota 2 League of Legends |
Replay Cast
OSC
Replay Cast
OSC
Replay Cast
CranKy Ducklings
WardiTV Invitational
[BSL 2025] Weekly
Replay Cast
Sparkling Tuna Cup
[ Show More ] WardiTV Invitational
Replay Cast
Clem vs Zoun
Tenacious Turtle Tussle
The PondCast
|
|