Page 2 of 2 FirstFirst 1 2
Results 21 to 36 of 36

Thread: C++ Question     submit to reddit submit to twitter

  1. #21
    Renegade Philosopher
    Join Date
    Jul 2004
    Posts
    4,439
    BG Level
    7

    I also hate these new rash of programmers who want to use database servers for everything!
    Databases are your friends. :wink:

  2. #22
    netz
    Guest

    Quote Originally Posted by Quicklet
    I also hate these new rash of programmers who want to use database servers for everything!
    Databases are your friends. :wink:
    I like working with databases and database servers, but I don't think every application needs one, as much as the PHP/MySQL-trained crowd would like to think.

  3. #23
    Ridill
    Join Date
    May 2005
    Posts
    13,568
    BG Level
    9

    Why *wouldn't* you use a database to store persistent data? That's like, what they're made for. It's even in their name: database. It's like a BASE for DATA.

  4. #24
    Chram
    Join Date
    Jun 2006
    Posts
    2,539
    BG Level
    7

    I'm in too much of a hurry to quote everyone but..

    The win32 api is a lot easier to learn than MFC and your applications will be 10x smaller and 10x faster as a result, though your source code may be 10x larger

    I just find MFC frustrating and a pain in the ass and if I need a more advanced library I just use QT. With QT you can easilly recompile your app to run on OS X, Linux, FreeBSD, Windows, etc. http://www.trolltech.com/developer/downloads

    --------------------------------------------------------------------

    Self teaching is fine I suppose, but there is a lot to be said for a traditional computer science education. When you really understand the fundamentals you have a lot more options and can do stuff like become proficient in java in a week, python in a day, php in an hour, etc. Besides, you don't wanna look stupid if someone asks you the difference between a r-tree and a b-tree or a qsort and a bubblesort or a local variable and a static variable, etc.

    Whatever you do don't just learn one language because you never want to be locked into one frame of though or one platform. Play on other platforms too with different GUIs or no GUI at all. Everything you learn in one language will help you in others and when a simple task comes up the time you invested in diversity will pay off when you can use the right tool for the job.

    ----------------------------------------------------------------

    On databases eh.. You only need a database SERVER if multiple clients are accessing the data and you need ACID (Atomicity, Consistency, Isolation, Durability). Basically if there is not a "BEGIN" and a "COMMIT" anywhere in your sql code, you did yourself a disfavor by using a database server.

    For example lets say in your business and you write a check to pay for the phone bill. You have to insert a new row for the actual check, and you have to do debits and credits on your cash account and expense account. What happens if something goes wrong and the program crashes halfway? You general ledger may not balance and it could halt your entire business for days while someone puts their nose in their manually to figure out what didn't balance up.

    Transactional databases guarantee that a series of sql statements made in the context of BEGIN and COMMIT will either all go through or none at all.

    Usually when you need one you are doing something kind of important.. I could go on for days about why mysql is a bad choice for something important but I will just give you one example and you can google for 99999999999 more if you like.

    Mysql violates Consistency. Example: Lets say a column in your scheme is just a 16 bit integer. If you insert the value 100,000 into it, what will happen?

    If you use postgresql, oracle, or any other real database you will get an error and it won't work.

    In mysql.. it depends on the version of mysql It will insert something but it won't be 100,000. This causes the worst bugs in the world because it may take awhile to figure out what caused your entire database to become dirty with data that makes no sense.

    Sure it is your fault for trying to put a number too big in the field, but it is the databases's job to store data for you. Sometimes the person who makes the scheme is different than the person who wrote the code which is different than the person who uses it. If I ask it to store the number 100,000 and it says "OK, I did!" it shouldn't fucking store 0, or 1, or 65535, or 32767. This is the type of shit that can cause you to loose your job, taint your reputation, and cost the company you work for millions.

    One of the common arguments mysql users have used in the past is that it is "so fast!" when doing simple selects. First of all, simple selects are retarded. Most of these people don't know the difference between an outer join or a left join or don't know what a join is at all. Tables in SQL are supposed to have M:N relationships and to properly query them you gotta have some joins going on for input to make sense. Databases that are designed for that type of real workload are faster than mysql

    If you are just doing key->value lookups check out http://www.php.net/manual/en/ref.dba.php and you can blow mysql's simple selects out of the water.

    If you still plan on using mysql.. learn sql at least. I can't tell you how many times i've seen this. Website will query a list of people who meet a certain criteria from another table like the people who made a purchase in the last month. Of course just printing out their customer IDs won't do any good you need to print the name out in the table too right? Lol.. mysql users will go ahead and start printing the table, than when it reaches each invidual customer ID it will do another separate query to get their name/address/etc. If 200 customers are displayed in the table, thats 201 separate queries to the database! Thats "so fast!"

    Quote Originally Posted by aurik
    Why *wouldn't* you use a database to store persistent data? That's like, what they're made for. It's even in their name: database. It's like a BASE for DATA.
    There is a difference between a DATABASE and a DATABASE SERVER

  5. #25
    netz
    Guest

    Quote Originally Posted by Devek
    I just find MFC frustrating and a pain in the ass and if I need a more advanced library I just use QT. With QT you can easilly recompile your app to run on OS X, Linux, FreeBSD, Windows, etc. http://www.trolltech.com/developer/downloads
    Qt is GPL. Anything linking to a GPL product needs to be GPL itself. If you don't mind distributing your source code to whomever uses your product, then you're in the clear. If you do mind, you need to buy a license. This makes it inappropriate for some people to use; use of the MFC doesn't enforce any similar license/distribution restrictions.

    Quote Originally Posted by aurik
    Why *wouldn't* you use a database to store persistent data? That's like, what they're made for. It's even in their name: database. It's like a BASE for DATA.
    Poor wording and a lack of thought on my part. I meant only database servers. Most people's first thought for small data storage shouldn't be, "I need a SQL driven DB server" when designing their new weblog.

  6. #26
    Chram
    Join Date
    Jun 2006
    Posts
    2,539
    BG Level
    7

    Quote Originally Posted by netz
    Quote Originally Posted by Devek
    I just find MFC frustrating and a pain in the ass and if I need a more advanced library I just use QT. With QT you can easilly recompile your app to run on OS X, Linux, FreeBSD, Windows, etc. http://www.trolltech.com/developer/downloads
    Qt is GPL. Anything linking to a GPL product needs to be GPL itself. If you don't mind distributing your source code to whomever uses your product, then you're in the clear.
    It doesn't matter if you are not selling your application..

    Quote Originally Posted by netz
    If you do mind, you need to buy a license. This makes it inappropriate for some people to use;
    If you're selling commercial software and you can't afford QT.. lol. It pays for itself in how well it works. If your program is even halfway popular it will pay for itself even more by being able to sell it to people who don't use windows..

    Quote Originally Posted by netz
    use of the MFC doesn't enforce any similar license/distribution restrictions.
    While Windows onry isn't a similar restriction, it is kind of a significant one

  7. #27
    Puppetmaster
    Join Date
    Sep 2006
    Posts
    55
    BG Level
    2

    Re: C++ Question

    Quote Originally Posted by Chreman
    Hey, I've been messing around with some c++ programs I wrote back in highschool to try and reteach myself everything i've forgotten since then.

    One thing we never covered and I'd like to learn how to do is saving certain variables in such a way that upon opening the program I can call them and basically 'load' from where I left off last time.

    I can clarify what I mean if you need, but does anyone know how to do something like this or where to find a tutorial on it?
    Like making the variable global? Which you can access them anywhere during your coding.

  8. #28
    E. Body
    Join Date
    Jun 2006
    Posts
    2,181
    BG Level
    7
    FFXIV Character
    Bro Teampill
    FFXIV Server
    Gilgamesh
    FFXI Server
    Ifrit

    Re: C++ Question

    Quote Originally Posted by Wtfiku
    Quote Originally Posted by Chreman
    Hey, I've been messing around with some c++ programs I wrote back in highschool to try and reteach myself everything i've forgotten since then.

    One thing we never covered and I'd like to learn how to do is saving certain variables in such a way that upon opening the program I can call them and basically 'load' from where I left off last time.

    I can clarify what I mean if you need, but does anyone know how to do something like this or where to find a tutorial on it?
    Like making the variable global? Which you can access them anywhere during your coding.

  9. #29
    Ridill
    Join Date
    May 2005
    Posts
    13,568
    BG Level
    9

    Re: C++ Question

    Quote Originally Posted by Fhqwghads
    Quote Originally Posted by Wtfiku
    Quote Originally Posted by Chreman
    Hey, I've been messing around with some c++ programs I wrote back in highschool to try and reteach myself everything i've forgotten since then.

    One thing we never covered and I'd like to learn how to do is saving certain variables in such a way that upon opening the program I can call them and basically 'load' from where I left off last time.

    I can clarify what I mean if you need, but does anyone know how to do something like this or where to find a tutorial on it?
    Like making the variable global? Which you can access them anywhere during your coding.
    Fixed.

  10. #30
    netz
    Guest

    Quote Originally Posted by Devek
    Quote Originally Posted by netz
    Quote Originally Posted by Devek
    I just find MFC frustrating and a pain in the ass and if I need a more advanced library I just use QT. With QT you can easilly recompile your app to run on OS X, Linux, FreeBSD, Windows, etc. http://www.trolltech.com/developer/downloads
    Qt is GPL. Anything linking to a GPL product needs to be GPL itself. If you don't mind distributing your source code to whomever uses your product, then you're in the clear.
    It doesn't matter if you are not selling your application..
    No... if you distribute binaries of a GPL application, the source must go along with it, or must be made available on request. Cost has nothing to do with it.

    The other major competing toolkit, GTK, is LGPL, and can be linked against by closed source applications without the viral clauses of the GPL taking effect.

  11. #31
    Chram
    Join Date
    Jun 2006
    Posts
    2,539
    BG Level
    7

    Quote Originally Posted by netz
    Quote Originally Posted by Devek
    Quote Originally Posted by netz
    Quote Originally Posted by Devek
    I just find MFC frustrating and a pain in the ass and if I need a more advanced library I just use QT. With QT you can easilly recompile your app to run on OS X, Linux, FreeBSD, Windows, etc. http://www.trolltech.com/developer/downloads
    Qt is GPL. Anything linking to a GPL product needs to be GPL itself. If you don't mind distributing your source code to whomever uses your product, then you're in the clear.
    It doesn't matter if you are not selling your application..
    No... if you distribute binaries of a GPL application, the source must go along with it, or must be made available on request. Cost has nothing to do with it.

    The other major competing toolkit, GTK, is LGPL, and can be linked against by closed source applications without the viral clauses of the GPL taking effect.
    If you're not selling the application why would distributing the source matter? If you can't afford QT what the fuck do you have thats valuable and worth protecting?

    It isn't a problem. I distribute source with just about everything I do, simply because people paranoid about spyware and viri can simply recompile it themselves. In fact I would say anyone afraid to show their source are gigantic faggots for the most part

    GTK on the other hand sucks balls, especially on Windows

  12. #32
    netz
    Guest

    Quote Originally Posted by Devek
    Quote Originally Posted by netz
    Quote Originally Posted by Devek
    Quote Originally Posted by netz
    Quote Originally Posted by Devek
    I just find MFC frustrating and a pain in the ass and if I need a more advanced library I just use QT. With QT you can easilly recompile your app to run on OS X, Linux, FreeBSD, Windows, etc. http://www.trolltech.com/developer/downloads
    Qt is GPL. Anything linking to a GPL product needs to be GPL itself. If you don't mind distributing your source code to whomever uses your product, then you're in the clear.
    It doesn't matter if you are not selling your application..
    No... if you distribute binaries of a GPL application, the source must go along with it, or must be made available on request. Cost has nothing to do with it.

    The other major competing toolkit, GTK, is LGPL, and can be linked against by closed source applications without the viral clauses of the GPL taking effect.
    If you're not selling the application why would distributing the source matter? If you can't afford QT what the fuck do you have thats valuable and worth protecting?

    It isn't a problem. I distribute source with just about everything I do, simply because people paranoid about spyware and viri can simply recompile it themselves. In fact I would say anyone afraid to show their source are gigantic faggots for the most part

    GTK on the other hand sucks balls, especially on Windows
    I'm pretty much completely in agreement with you, right up until the gigantic faggot part... but the way Qt is licensed does present a difficulty for anyone who wishes to distribute (free or sold) binaries and withhold the source code. It mostly concerns people still tied to Windows; how many freely available Windows-only applications came with the source code? I understand this is a non-issue for you, but I don't think it's unreasonable to say that not every developer holds the same views you do, and wish to keep their source code proprietary.

    I don't even really know why I decided to nitpick on this technicality >.>

  13. #33
    E. Body
    Join Date
    Jun 2006
    Posts
    2,181
    BG Level
    7
    FFXIV Character
    Bro Teampill
    FFXIV Server
    Gilgamesh
    FFXI Server
    Ifrit

    Quote Originally Posted by Devek
    In fact I would say anyone afraid to show their source are gigantic faggots for the most part
    I don't like revealing my source because of my naming conventions. Like:

    BOOL bFuckOff
    int nCountVarBitch
    float fFuckDecimals
    DWORD dwWORDTOYOMOMMA
    char szItsATempVarWhoTheFuckCaresGoddamnit[256]

    And my comments aren't the best either:

    Code:
    // Class
    class SuperComplexClass : cSomeOtherBullshit
    {
       private:
       int nSuperImportantInt;
    
       // Constructor.
       SuperComplexClass(int nGuessWhatThisIsFor)
       {
           // Do all kindsa funky wonky weird shit that nobody knows wtf it's there for.
           // Make sure at least 1 constructor is private just to keep people wondering.
       }
    
       public:
       // Constructor
       SuperComplexClass(){nSuperImportantInt = 0x3357; // Magic numbers are fun!}
    
      /* Add insane number of methods whose names have nothing to do with what the methods accomplish. Example follows. /*
       void SitAndSpin(int a, int b, int* ret){*ret = a+b;}
    
    }
    Job security ftw. If they don't know wtf your code is doing, they can't get rid of you.

  14. #34
    Relic Weapons
    Join Date
    Apr 2006
    Posts
    357
    BG Level
    4
    FFXI Server
    Lakshmi

    Hungarian code ftl!

  15. #35
    New Merits
    Join Date
    Nov 2005
    Posts
    233
    BG Level
    4

    Code:
    // Class
    class SuperComplexClass : cSomeOtherBullshit
    {
       private:
       int nSuperImportantInt;
    
       // Constructor.
       SuperComplexClass(int nGuessWhatThisIsFor)
       {
           // Do all kindsa funky wonky weird shit that nobody knows wtf it's there for.
           // Make sure at least 1 constructor is private just to keep people wondering.
       }
    
       public:
       // Constructor
       SuperComplexClass(){nSuperImportantInt = 0x3357; // Magic numbers are fun!}
    
      /* Add insane number of methods whose names have nothing to do with what the methods accomplish. Example follows.    Error oh no lawl /*   
       void SitAndSpin(int a, int b, int* ret){*ret = a+b;}
    
    }
    Error. Correction */ 8)

  16. #36
    E. Body
    Join Date
    Jun 2006
    Posts
    2,181
    BG Level
    7
    FFXIV Character
    Bro Teampill
    FFXIV Server
    Gilgamesh
    FFXI Server
    Ifrit

    Good catch! :D Your compiling skill increases 0.3 points.

Page 2 of 2 FirstFirst 1 2

Similar Threads

  1. A question to Yummy and Clistophy!!
    By Hirronimus in forum General Discussion
    Replies: 2
    Last Post: 2004-08-11, 00:14
  2. Just got a question for you guys
    By Blackwar in forum General Discussion
    Replies: 3
    Last Post: 2004-08-06, 20:14