• What do you need help with? Version 1
    5,001 replies, posted
[QUOTE=ZeekyHBomb;24567963]Huh? I sure don't have problems reading XML data with just a simple text editor.[/QUOTE] Whether it's text or not has very little to do with what I'm talking about. Compare this: [url]http://pastebin.com/1pWeLr41[/url] To this: [url]http://en.wikipedia.org/wiki/Yaml#Sample_document[/url] I don't know about you, but to a [B]human[/B], I find YAML a lot easier to read and edit than XML.
[QUOTE=gparent;24567901]I disagree so heavily with this. XML is the worst for human readability. It's way better for inter operating with different systems using one universal format. YAML, on the other hand, is well suited for a format a human can actually read and comprehend.[/QUOTE] XML is much easier to comprehend for humans. Computers are really good at identifying where nested elements start and stop. Humans are really bad at it. Hence, a closing tag that tells you what tag it is is really useful, especially in complex cases.
[QUOTE=arienh4;24568178]XML is much easier to comprehend for humans. Computers are really good at identifying where nested elements start and stop. Humans are really bad at it. Hence, a closing tag that tells you what tag it is is really useful, especially in complex cases.[/QUOTE] Maybe I'm just some sort of superhuman or something because I have no difficulty at all comprehending the YAML sample on Wikipedia, yet I spent quite a bit of time looking through the abomination that is app/web/machine.config.
YAML looks more plain that XML, thus making it easier to read as a whole, but this still doesn't make XML not easily readable and editable. The XML sample you have also seems a bit more complex than the structure shown in the Wikipedia sample. I can't say which is better, nor is it my intention to do that, but both look easy enough for humans to understand.
[QUOTE=ZeekyHBomb;24568479]YAML looks more plain that XML, thus making it easier to read as a whole, but this still doesn't make XML not easily readable and editable. [/QUOTE] XML is obviously readable and editable, I'm just saying the difficulty is going to be higher than a format. The article I linked even mentions that humans have difficulty balancing opening and closing tags, whether it be braces, quotation marks or anything else. Basically, if your main aim is to go for a user friendly format, I'd avoid XML. If you just want a format to inter operate and maybe once in a while edit with a text editor, there's nothing wrong with it.
[QUOTE=gparent;24568273]Maybe I'm just some sort of superhuman or something because I have no difficulty at all comprehending the YAML sample on Wikipedia, yet I spent quite a bit of time looking through the abomination that is app/web/machine.config.[/QUOTE] Since Facepunch in Internet Explorer 6 looks better than the version from 5 years ago does in Firefox 3, IE6 must be superior. Convert the abomination that is app/web/machine.config to YAML and see if you still feel the same way. You're comparing apples to oranges now.
Not necessarily a web programming question because I'm using a local database and C# (It was homework, and it was this or Access), but with SqlCe how would I only create a table if it doesn't exist? In MySQL it was just CREATE TABLE IF NOT EXISTS ...
[QUOTE=Robert64;24572344]Not necessarily a web programming question because I'm using a local database and C# (It was homework, and it was this or Access), but with SqlCe how would I only create a table if it doesn't exist? In MySQL it was just CREATE TABLE IF NOT EXISTS ...[/QUOTE] SQL CE uses T-SQL, so just CREATE TABLE IF NOT EXISTS ...
[QUOTE=arienh4;24572546]SQL CE uses T-SQL, so just CREATE TABLE IF NOT EXISTS ...[/QUOTE] [code]There was an error parsing the query. [ Token line number = 1,Token line offset = 14,Token in error = IF ][/code] :frown: [editline]08:10PM[/editline] I can't use IF at all, anywhere
[QUOTE=Robert64;24595262][code]There was an error parsing the query. [ Token line number = 1,Token line offset = 14,Token in error = IF ][/code] :frown: [editline]08:10PM[/editline] I can't use IF at all, anywhere[/QUOTE] You might read up on T-SQL though. Wikipedia: Keywords for flow control in Transact-SQL include BEGIN and END, BREAK, CONTINUE, GOTO, IF and ELSE, RETURN, WAITFOR, and WHILE. IF and ELSE allow conditional execution. This batch statement will print "It is the weekend" if the current date is a weekend day, or "It is a weekday" if the current date is a weekday. [code]IF DATEPART(dw, GETDATE()) = 7 OR DATEPART(dw, GETDATE()) = 1 PRINT 'It is the weekend.' ELSE PRINT 'It is a weekday.'[/code]
[QUOTE=arienh4;24595424]You might read up on T-SQL though. Wikipedia: Keywords for flow control in Transact-SQL include BEGIN and END, BREAK, CONTINUE, GOTO, IF and ELSE, RETURN, WAITFOR, and WHILE. IF and ELSE allow conditional execution. This batch statement will print "It is the weekend" if the current date is a weekend day, or "It is a weekday" if the current date is a weekday. [code]IF DATEPART(dw, GETDATE()) = 7 OR DATEPART(dw, GETDATE()) = 1 PRINT 'It is the weekend.' ELSE PRINT 'It is a weekday.'[/code][/QUOTE] Again, with your example, same error from the IF (token 1). Maybe I misunderstood? [editline]08:28PM[/editline] It turns out SQL CE doesn't support IF statements :sigh:
Sorry then. Was just trying to help, the Wikipedia article for SQL CE said it did.
[url]http://social.msdn.microsoft.com/forums/en-US/sqlce/thread/d1da3652-8cd1-4f5e-a3fa-34af78a95fe7[/url]
couple of questions: first is, with 3d models (obj files i think) are they like pictures or like vector files? as in do they loose quality when there resized or do they always look the same? second How much knowledge of say C# can you introduce into C++? how much of one of the languages would someone know that is fluent in the other? My guess is if you know C++ pretty well then you should be fine with C# But if you know C# then you still have to learn about memory management and that stuff.. im asking this due to the fact that m messing around with both C# and C++ but i want to dedicate myself to just one of them to be able to learn it quicker but i dont know which one is better to learn first. I will hopefully be learning both in the future but for now just one is enough :P Also worth mentioning that i currently only know Java and VB
[QUOTE=Richy19;24613283]couple of questions: first is, with 3d models (obj files i think) are they like pictures or like vector files? as in do they loose quality when there resized or do they always look the same? [/QUOTE] If they're made of voxels, they will lose quality. OBJ files, like most 3d file formats, are not. They use vector positions for vertices and are therefore fully scalable. [QUOTE=Richy19;24613283] second How much knowledge of say C# can you introduce into C++? how much of one of the languages would someone know that is fluent in the other? My guess is if you know C++ pretty well then you should be fine with C# But if you know C# then you still have to learn about memory management and that stuff.. [/QUOTE] Well, another thing is that you don't get fancy pre-done stuff in the standard libraries with C++. Obviously memory management is one thing, but you can get fairly far without touching pointers, so even that's not so important at the beginning. [QUOTE=Richy19;24613283] im asking this due to the fact that m messing around with both C# and C++ but i want to dedicate myself to just one of them to be able to learn it quicker but i dont know which one is better to learn first. I will hopefully be learning both in the future but for now just one is enough :P Also worth mentioning that i currently only know Java and VB[/QUOTE] Learn C# if you like doing stuff easier and in a more platform-independent way.
[QUOTE=esalaka;24613969]Learn C# if you like doing stuff easier and in a more platform-independent way.[/QUOTE] Wait surely C++ is more platform independent
[QUOTE=Richy19;24615500]Wait surely C++ is more platform independent[/QUOTE] Well, no. C# code can usually run without any modification and recompilation on other platforms. For C++ you need to recompile code and usually port it.
[QUOTE=arienh4;24615595]Well, no. C# code can usually run without any modification and recompilation on other platforms. For C++ you need to recompile code and usually port it.[/QUOTE] This. Mono can literally run the windows executables on any supported platform, given that the executable doesn't use any platform-dependent (eg. native) code.
Ahh i see btw how is Mono with windows form applications? i read it doesnt work too well on MACs also, does anyone have the book [URL="http://www.amazon.co.uk/TCP-IP-Sockets-Practical-Programmers/dp/0124660517/ref=sr_1_1?ie=UTF8&s=books&qid=1283706417&sr=8-1"]TCP/IP Sockets in C#: Practical Guide for Programmers[/URL]? Having been published in 2004 is it worth getting it? Or would it be out of date?
[QUOTE=Richy19;24617577]Ahh i see btw how is Mono with windows form applications? i read it doesnt work too well on MACs[/QUOTE] It works quite well, albeit retaining a Windows look. Gtk# is a lot better for interoperability. WinForms does work though.
Okay, this is going to be a bit of a newbie question but I'm just trying to re-remember the syntax: In C++, how do I make a string get more than one word from a cin? For example, let's call the string answer, and the question is what is blue and big and a whale? When I cin "Blue Whale" it only accepts "Blue" How do I fix this?
Lookup std::getline.
I'm using that but it just goes to the next cout and flashes back to main. Here's the code if you need it: [code]#include <iostream> #include <string> using namespace std; int main(); int nameconfirm(); int q1(); int q2(); int q3(); int wrong(); char name[256], answer[256]; int main() { system("cls"); cout << "Hello and welcome to the Magical Turnip Text-Based Quiz Show! I am your host, \nTexty! \nWhat is your name? \n Please enter your name below: \n"; cin >> name; nameconfirm(); return 0; } int nameconfirm() { cout << "Is your name " << name << "?\n Y/N?\n"; cin.getline (answer,256); if(answer == "Y" || answer == "y") { q1(); } else { main(); } return 0; } int q1() { cout << "Great! Okay, " << name << ", here's your first question!\n"; system("pause"); system("cls"); cout << "Here's your first question: \nWhat is the world's largest animal?\n"; cin.getline (answer,256); if( answer == "blue whale" || answer == "Blue whale" || answer == "Blue Whale" || answer == "blue Whale") { system("cls"); cout << "Great job! The Blue Whale (Balaenoptera musculus) is the largest animal known to exist at 108 feet (33 metres) long!"; q2(); } else { wrong(); } return 0; } int q2() { return 0; } int wrong() { system("cls"); cout << "Oh! I'm sorry, but " << answer << " is not the right answer! Please try again!\n"; system("pause"); main(); return 0; } [/code]
You've still got a cin>> on line 20
[QUOTE=shill le 2nd;24622258]You've still got a cin>> on line 20[/QUOTE] And now it won't accept y or Y in nameconfirm. I apollogize in advance, I really don't like bugging people for help but this is something I've been killing myself over.
[QUOTE=Dacheet;24622352]And now it won't accept y or Y in nameconfirm. I apollogize in advance, I really don't like bugging people for help but this is something I've been killing myself over.[/QUOTE] You can't compare a string (char array) using ==. Either read only a single char (and compare using == and single-quotes), or use strcmp.
[QUOTE=Dacheet;24621877]I'm using that but it just goes to the next cout and flashes back to main. Here's the code if you need it: [code]#include <iostream> #include <string> using namespace std; int main(); int nameconfirm(); int q1(); int q2(); int q3(); int wrong(); char name[256], answer[256]; int main() { system("cls"); cout << "Hello and welcome to the Magical Turnip Text-Based Quiz Show! I am your host, \nTexty! \nWhat is your name? \n Please enter your name below: \n"; cin >> name; nameconfirm(); return 0; } int nameconfirm() { cout << "Is your name " << name << "?\n Y/N?\n"; cin.getline (answer,256); if(answer == "Y" || answer == "y") { q1(); } else { main(); } return 0; } int q1() { cout << "Great! Okay, " << name << ", here's your first question!\n"; system("pause"); system("cls"); cout << "Here's your first question: \nWhat is the world's largest animal?\n"; cin.getline (answer,256); if( answer == "blue whale" || answer == "Blue whale" || answer == "Blue Whale" || answer == "blue Whale") { system("cls"); cout << "Great job! The Blue Whale (Balaenoptera musculus) is the largest animal known to exist at 108 feet (33 metres) long!"; q2(); } else { wrong(); } return 0; } int q2() { return 0; } int wrong() { system("cls"); cout << "Oh! I'm sorry, but " << answer << " is not the right answer! Please try again!\n"; system("pause"); main(); return 0; } [/code][/QUOTE] Sorry, but that code is giving me the creeps. You are probably still learning C++ and that's great, but you should probably look further on that than writing this questionnaire. For example, you are using char-arrays instead of std::strings for no apparent reason. std::strings will have a few advantages over char arrays here, for example easy comparison via ==. Another is that you're looping around using function calls. That will really just clog up the stack and instead you should be using loops. Yet another is using a non-void return type on every function for no reason. And yet another is the usage of std::system for something it was not really meant for I believe. It's pretty inefficient to call an external program just to clear the console or let the user press a key. It's also just inelegant, among other stuff. True, clearing the console the proper way does require a bit of code, but there's nothing wrong with leaving the crap that was there before just stay. As for pressing a key, you could either just use platform-independent cin.get() and live with the user having to press enter or include the Microsoft Windows (?) conio.h header and use _getch(). And a tip for those functions you are making (q1, q2, ...), you should look into using an array, saving the questions there and simply iterating over them instead of having a function for each question.
[QUOTE=arienh4;24569170]Convert the abomination that is app/web/machine.config to YAML and see if you still feel the same way. You're comparing apples to oranges now.[/QUOTE] I'd feel the same, actually. But nice try.
[QUOTE=arienh4;24615595]Well, no. C# code can usually run without any modification and recompilation on other platforms. For C++ you need to recompile code and usually port it.[/QUOTE] Oh come on, stop spreading this one-sided bullshit. It's not that simple. The only part that is different is the recompilation part, and at a cost - platforms with .NET support are sparse compared to platforms with a C++ compiler.
[QUOTE=jA_cOp;24635279]Oh come on, stop spreading this one-sided bullshit. It's not that simple. The only part that is different is the recompilation part, and at a cost - platforms with .NET support are sparse compared to platforms with a C++ compiler.[/QUOTE] The amount of platforms isn't what is really important, the amount of supported computers is and mono supports the huge majority of them.
Sorry, you need to Log In to post a reply to this thread.