Announcement

Collapse
No announcement yet.

Starting some real Linux coding

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Starting some real Linux coding

    Hello,

    I'd like to hear advice, how to best jump into some real Linux programming. I have basically no experience in doing any cpp programming for linux, so there will be much ropes learning, I guess. But I have deep and long-time experience in other programming languages, starting with MSX Basic and Z-80 assembler, down to QBasic, Pascal, Visual Basic, PHP, Perl, JavaScript, and C# (yes, I come from MSFT camp). So, I think I will manage to find online references for tools and programming languages, etc.

    But it's hard when you don't have any idea from where to start.

    I'd like to pick up some trivial project that involves some basic graphics (for example most basic classic snake or pong), where all the parts are easy to grasp. Then I'd see how the keyboard events is handled, how graphics are done, etc. So I could jump right in and alter the code, compile it and see what happens.

    Where I need your advice, is this:
    - I believe, most used programming language for Linux is C++. If that's so, I'd be happy to see some good tutorial that gives firm base understanding of the main paradigms and structures there.
    - Some reference on commands that do compiling stuff etc.
    - What could be that "trivial starter project" that is not too complex, but is not also a variation of "Hello World".

    Thanks for your help!

    Passiday

    #2
    Re: Starting some real Linux coding

    Well since you are a MSdev ( so am I, .Net C#) I would check out QT http://qt.nokia.com/
    The IDE is nice an qt supports cross-platform, it's installed on my linux box.

    As far as a project check out kde.org - Plasma widget tutorial would be a good start. Even the apps you have installed on your box might have source code available.

    Good luck.
    * Sager NP8120&nbsp; w/ Kubuntu 10.10 vm-ware (VMPlanet)<br />*&nbsp; Sager NP5790&nbsp; Kubuntu 10.10 <br />* Gateway Solo&nbsp; 1100 (rip) KDE 1.1.2

    Comment


      #3
      Re: Starting some real Linux coding

      Hey Passiday, are you in for a world of FUN!

      I, too, came from a Windows programming background, retiring two years ago after 40 years of coding in a wide variety of languages using as many console and gui IDEs.

      "Linux" programming is an EXTREMELY LARGE topic coving as many languages as you'd care to learn. I am assuming you want to expand your horizons beyond .NET & C# and get into tools that are under the GPL and don't have a Microsoft "license fee" looming ahead if you want to get serious.

      So, IF you want to learn how to write kernel code then you are headed for C. www.kernel.org is the place to go to learn about the tools for that area. Git is their version control system.

      IF you want to write apps for GNOME then C & GTK+ is what your want. The GNOME website has all the particulars.

      IF you want to learn to write apps to run on KDE4 then C++ & Qt4 are the tools and QtCreator (or QtQuick) is the GUI IDE. AWESOME tool, but I am biased. Install QtCreator from the repository and it will bring down all the Qt4 API basics. Also, be sure you install gcc-4.4 as well. In Synaptic I searched on Qt4 and installed about every package that QtCreator did not install that had qt4 as a prefix, suffix of part of the name.

      As a back end I installed the latest PostgreSQL & pgAdmin3. It is between 90 - 95% Oracle 10g compatible. Here is how to setup PostgreSQL. It refers to the 8.3 version, which you'll have to change to 8,4 (or what ever is currently in the repository):
      Right for the basic installation, at the command-line, enter the following commands (or search for the listed packages in synaptic if you prefer that way of working):

      $ sudo apt-get install postgresql postgresql-client postgresql-contrib
      $ sudo apt-get install pgadmin3

      This installs the database server/client, some extra utility scripts and the pgAdmin GUI application for working with the database.

      Now we need to reset the password for the ‘postgres’ admin account for the server, so we can use this for all of the system administration tasks. Type the following at the command-line (substitute in the password you want to use for your administrator account):

      $ sudo su postgres -c psql template1
      template1=# ALTER USER postgres WITH PASSWORD 'password';
      template1=# \q

      That alters the password for within the database, now we need to do the same for the unix user ‘postgres’:

      $ sudo passwd -d postgres
      $ sudo su postgres -c passwd

      Now enter the same password that you used previously.

      Then, from here on in we can use both pgAdmin and command-line access (as the postgres user) to run the database server.
      Qt4 used to be only the Qt-Designer (GUI tool), Qt-Assistant (documentation * API) and Qt-linguist (i18n facility). Any editor could (can) be used for the *.c or *.h files. QtCreator combined them all into a tool equal or better than MSVC++, but specifically for Qt4.

      QtCreator comes with a ton of example applications, including source and full, line by line descriptions. Before I retired I was using Microsoft's Visual C++ 6.0 and Qt4 to write in-house client-server applications for my employer. MSVC was so slow that I copied the source to my Linux side, used Qt-Designer to develop gui's, Kate to edit the code, and gcc to compile. What took MSVC 20-25 minutes took gcc 3 to 5 minutes. I tested against PostgreSQL. When I was satisfied I'd copy the source back over to XP and compile against the Oracle db without changing a line of code, thanks to compiler defines. But, since you'll be on Kubuntu you can forget about the Win32 platform!

      Here is a host of demo and how to videos at the QtStudio on Youtube: http://www.youtube.com/qtstudios

      For more basic Qt videos search Youtube: using this.

      Here is an example of writing a Qt4 app WITHOUT writing a line of code: http://www.youtube.com/watch?v=2AV9nRHJNK4 That search will also bring up a lot of excellent tutorials in the sidebar.



      A good C++ tutorial is Bruce Eckler's "Thinking in C++"
      Vol 1
      Vol 2


      "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
      – John F. Kennedy, February 26, 1962.

      Comment


        #4
        Re: Starting some real Linux coding

        Wow, GrayGeek,

        What an elaborate post! Reply from a retired long-time coder is perhaps the best thing I could have.

        So I set off to install the Qt4 and start the journey in the world of OSS. In long term, I hope to contribute both to the development and also to the promotion of the open-source paradigm in the circles of influence I have.

        In Synaptic I searched on Qt4 and installed about every package that QtCreator did not install that had qt4 as a prefix, suffix of part of the name.
        Is't this a bit overkill? I did the Synaptic search, and there are loads and loads of packages... I kind of wouldn't like to mess my system up with unused stuff. I mean, what kind of risks do I have? If I will stumble upon some problem, perhaps I will get warned that some package is required, etc.

        Comment


          #5
          Re: Starting some real Linux coding

          Originally posted by Passiday
          ...
          In Synaptic I searched on Qt4 and installed about every package that QtCreator did not install that had qt4 as a prefix, suffix of part of the name.
          Is't this a bit overkill? I did the Synaptic search, and there are loads and loads of packages... I kind of wouldn't like to mess my system up with unused stuff. I mean, what kind of risks do I have? If I will stumble upon some problem, perhaps I will get warned that some package is required, etc.
          Overkill? Not at all! Remember, it's "qt4" inclusions you'll want, not qt3. Any qt3 files that get installed are because they were called by qt4 stuff during installation. That's OK. Besides, not everyone who installs qtcreator may choose to use PostgreSQL, so libqt4-sql-psql may not be necessary for them. They may choose libqt4-sql-mysql or libqt4-sql-odbc. Or they may be happy with the default install of libqt4-sql-sqlite. I chose them all because I want my tool box to contain any tool I think I may have even a remote possibility of using. It's like insurance, when you need it you can't get it.

          As far as "risks", you have none. The apps are vetted in the repository, dependencies are automatically handled, and so is installation and configuration. IF you select a package that requires unusual dependencies a popup dialog will list them and ask for your approval. I usually affirm installation. The only time I don't is when I am told that MONO (libmono, libcli or other .NET software will be installed. I cancel that stuff and the app that requires it. IF I wanted to run .NET I'd switch to Windows. (Take a look at my sig!)

          I've attached to jpg files which show what I've installed relating to Qt4 and PostgreSQL 8.4.


          Attached Files
          "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
          – John F. Kennedy, February 26, 1962.

          Comment

          Working...
          X