Author Topic: Coding and Scripting  (Read 12519 times)

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Coding and Scripting
« Reply #60 on: November 29, 2009, 03:37:01 PM »
QT Creator isn't too hard to learn. Of the tools available, it is the easiest, IMO.

There's a tutorial for using it here, but I've not reviewed it yet so can't say how good it is. You'll probably want to install devhelp, too; it's in the repos.

Your best tool in developing is a good text editor. We've had some discussion about those in this thread. If you learn to use an editor, those GUI tools will start looking quite easy.


NinerSevenTango

  • Guest
Re: Coding and Scripting
« Reply #61 on: November 29, 2009, 03:40:39 PM »
Thanks, Neal.

I'll read the tutorial.  I'm already familiar with editors.  The hardest part is picking one -- there are so many, and everyone likes the one they know best (same with picking a programming language).

Do you suppose including the examples and the help file in the repo would have been a lot of extra work?  Why would they be left out?  It's crippling not to have the help files.

Thanks again,

--97T--

Edit: The QT Creator manual can be found here: http://doc.trolltech.com/qtcreator-0.9.1-beta/

Edit 2: The help files, tutorials, and examples need to be downloaded separately from the repo.  They are listed under QT4.  Now it works as expected.  So please disregard the above.  Unless you ran into the same problem I did!
« Last Edit: November 29, 2009, 04:15:29 PM by NinerSevenTango »

Offline wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2436
  • Any Bugs in site?
Re: Coding and Scripting
« Reply #62 on: November 29, 2009, 11:30:27 PM »
I am getting slightly interested in making a subtle change to starting up my pclos. This could involve a "simple" script.

Definiton:
When opening/starting plcos, in the last desktop, open 2 konsole user only privilige and 2 konsoles root privilege. Place a script somewhere in the startup sequence or modify and existing.

(old-polack has showed the concept) I have a hazy idea of how many scripts runs at startup but will need to do a fair bit of bashing just to find out where in the file/directory hirarchy  to start.

Any bits of info welcome
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Coding and Scripting
« Reply #63 on: November 30, 2009, 05:34:46 AM »
Thanks, Neal.

I'll read the tutorial.  I'm already familiar with editors.  The hardest part is picking one -- there are so many, and everyone likes the one they know best (same with picking a programming language).


My opinion on editors is that they all have something going for them. There's no shortage of good text editors, so having more than one available is definitely an option. I use kwrite most often but use leafpad when using LXDE. Limiting oneself to only one or two editors is not acceptable, in my opinion. Doing so limits the range of possibilities in your work. Versatility in the use of various tools is a plus, again my opinion.
Likewise in picking a programming language - if you devote yourself to only one, you limit yourself. If however you choose to add knowledge of the use of two or more, you have the possibility of choosing the 'right' language for the job and of creating more than one type application.

Quote
Do you suppose including the examples and the help file in the repo would have been a lot of extra work?  Why would they be left out?  It's crippling not to have the help files.

Thanks again,

--97T--
Edit: The QT Creator manual can be found here: http://doc.trolltech.com/qtcreator-0.9.1-beta/


Good find. :D Thanks.

Quote
Edit 2: The help files, tutorials, and examples need to be downloaded separately from the repo.  They are listed under QT4.  Now it works as expected.  So please disregard the above.  Unless you ran into the same problem I did!


You found them? Good. :D


Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11581
  • ----IOFLU----
Re: Coding and Scripting
« Reply #64 on: November 30, 2009, 08:47:18 AM »
I am getting slightly interested in making a subtle change to starting up my pclos. This could involve a "simple" script.

Definiton:
When opening/starting plcos, in the last desktop, open 2 konsole user only privilige and 2 konsoles root privilege. Place a script somewhere in the startup sequence or modify and existing.

(old-polack has showed the concept) I have a hazy idea of how many scripts runs at startup but will need to do a fair bit of bashing just to find out where in the file/directory hirarchy  to start.

Any bits of info welcome


If you open a Konsole, and click the small icon in the lower left corner, it opens a second konsole as a tab in the first window. Tabs are seen at the bottom.





If you set up your sessions to restore the previous session, the konsoles you left open on the desktop of choice will still be there when you log in, no need for a script to start them at each log in.

« Last Edit: November 30, 2009, 04:43:56 PM by old-polack »
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline The Chief

  • Hero Member
  • *****
  • Posts: 2248
Re: Coding and Scripting
« Reply #65 on: November 30, 2009, 09:13:55 AM »
We still need to decide on what language we're going to be using for teaching.

I think we should have two separate lines of instruction going. 

One for interpreted languages, starting with, most likely, bash.  This is always a useful skill, in any environment.

Two for compiled languages, starting (I suggest) with C, although we can use the C++ compiler (it does make comments much easier - so much so that many C compilers have adopted that part of the C++ standard).  The C++ compiler should handle about any C construct we can come up with.

But, I'm not hard over on any of this...  ::)

Retired Senior Chief, Retired Software Engineer, Active GrandPa

Offline gseaman

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3793
Re: Coding and Scripting
« Reply #66 on: November 30, 2009, 09:50:04 AM »
I've started the C++ tutorial mentioned in this thread.
http://www.cplusplus.com/doc/tutorial/

I'm almost done with the "Control Structures" section and ready for my first assignment.

Galen

Offline wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2436
  • Any Bugs in site?
Re: Coding and Scripting
« Reply #67 on: November 30, 2009, 03:37:08 PM »
old-polacl
thank you for the konsole 'anchoring', so that was where that function was hiding, looked very familiar when I saw it. This will do for now.   ;D
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Coding and Scripting
« Reply #68 on: November 30, 2009, 05:53:38 PM »
Bash is fine by me, TheChief, though if we discussed python, I'd not complain. Re C or C++, I'd like to know more of both, but I'll go with the consensus on which we're doing first. Some of us have already started on C++, but C can be started on, too, I think.


Offline The Chief

  • Hero Member
  • *****
  • Posts: 2248
Re: Coding and Scripting
« Reply #69 on: December 01, 2009, 10:02:30 AM »
old-polacl
thank you for the konsole 'anchoring', so that was where that function was hiding, looked very familiar when I saw it. This will do for now.   ;D

Yeah, it did the job, but you didn't learn any programming!   >:(

Retired Senior Chief, Retired Software Engineer, Active GrandPa

Offline The Chief

  • Hero Member
  • *****
  • Posts: 2248
Re: Coding and Scripting
« Reply #70 on: December 01, 2009, 10:17:08 AM »
Bash is fine by me, TheChief, though if we discussed python, I'd not complain. Re C or C++, I'd like to know more of both, but I'll go with the consensus on which we're doing first. Some of us have already started on C++, but C can be started on, too, I think.



I said bash only because it is always present by default on any PCLOS installation.  Python (or perl) would have to be installed - not a biggie, I know, since both are in the repos. 

IMHO we should start out with plain old C, until most are up to speed on basic programming concepts - then we can introduce objects and all their ramifications...  C++ is just grown up C...  And any C++ compiler can handle plain old C (AFAIK)...

Plain old C is actually a pretty simple language - only a dozen or so keywords, and maybe a half dozen data types (which might need some tutorials on their own).  Anything really complicated is handled by the libraries.  Learning to use them and the operators is the hardest part.

If any one wants a reference book/manual, K&R is hard to beat (they created the language, after all) and while not free, isn't very expensive, either.  Uhh - wait a minute!  I just checked and it's running a list price of $60 now on Amazon!  >:(

http://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628

 I got mine for $15!  Buy used!  Under $20!

Retired Senior Chief, Retired Software Engineer, Active GrandPa

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Coding and Scripting
« Reply #71 on: December 01, 2009, 10:50:58 AM »
I said bash only because it is always present by default on any PCLOS installation.  Python (or perl) would have to be installed - not a biggie, I know, since both are in the repos. 

Actually, both python and perl are installed on every release of PCLinuxOS, AFAIK. Too many apps require them to leave them off. This of course does not in any way negate the importance of studying bash.

Quote
IMHO we should start out with plain old C, until most are up to speed on basic programming concepts - then we can introduce objects and all their ramifications...  C++ is just grown up C...  And any C++ compiler can handle plain old C (AFAIK)...

While I have no objection to your suggestion, and indeed it does sound reasonable to me, I'd prefer the direction of study be chosen by consensus. That way everyone gets to have some input.

As a way to speed that process, I've posted a poll.

Quote
Plain old C is actually a pretty simple language - only a dozen or so keywords, and maybe a half dozen data types (which might need some tutorials on their own).  Anything really complicated is handled by the libraries.  Learning to use them and the operators is the hardest part.

You make it seem relatively simple to learn the basics of C. How difficult is it to learn the libraries and operators?

Quote
If any one wants a reference book/manual, K&R is hard to beat (they created the language, after all) and while not free, isn't very expensive, either.  Uhh - wait a minute!  I just checked and it's running a list price of $60 now on Amazon!  >:(

http://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628

 I got mine for $15!  Buy used!  Under $20!

$60 is way outside my current budget. :o While under $20 may seem cheap, especially in comparison, for anyone on a limited income it may be hard to come by.

Are there any good books / references / how-tos available on the web gratis?


Offline Padma

  • Hero Member
  • *****
  • Posts: 1099
  • The Outbond
    • Civilization Fanatics Center
Re: Coding and Scripting
« Reply #72 on: December 01, 2009, 12:10:01 PM »
I think I'll keep an ear on this thread. ;)  I've been a professional programmer since the 80s, doing everything from COBOL/FORTRAN/Assembler to C and Java.  I've worked on mainframes, Windows boxes, and Unix/Linux.  Currently using Perl, PHP, and occasionally Java on Linux servers.

C++ has never really interested me, so I probably won't input much on that subject.

And I'll stick to my vim editor, thanks. ;)
1st Lieutenant, USAFR (Retired)
Co-Administrator: Civilization Fanatics Center

Ramblings of a Professional Computer Geek


Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Coding and Scripting
« Reply #73 on: December 01, 2009, 01:05:47 PM »
Please everyone, vote in the poll on which language we're studying.


Offline maik3531

  • Full Member
  • ***
  • Posts: 129
Colorfun
« Reply #74 on: December 01, 2009, 01:20:20 PM »
Also had little time trying...

following C++ code under e.g. "colors.cpp" save

Code: [Select]
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
if((argv[1][0])=='s')cout<<"\e[30m";
else if((argv[1][0])=='r')cout<<"\e[31m";
else if((argv[1][0])=='g')cout<<"\e[32m";
else if((argv[1][0])=='y')cout<<"\e[33m";
else if((argv[1][0])=='b')cout<<"\e[34m";
else if((argv[1][0])=='p')cout<<"\e[35m";
else if((argv[1][0])=='h')cout<<"\e[36m";
else if((argv[1][0])=='w')cout<<"\e[37m";

if(argc>2)
{
if((argv[2][0])=='s')cout<<"\e[40m";
else if((argv[2][0])=='r')cout<<"\e[41m";
else if((argv[2][0])=='g')cout<<"\e[42m";
else if((argv[2][0])=='y')cout<<"\e[43m";
else if((argv[2][0])=='b')cout<<"\e[44m";
else if((argv[2][0])=='p')cout<<"\e[45m";
else if((argv[2][0])=='h')cout<<"\e[46m";
else if((argv[2][0])=='w')cout<<"\e[47m";

}
return 0;
}

then compile with "g++ colors.cpp -o colors" create an executable file
Now you can with a simple ./color <color> change the color of the input. The whole can of course also be under "/ usr / bin /" or stored as it is easier to incorporate into scripts. :-)

Example:

./colors r
./colors b
./colors h



regards
maik3531

Please excuse my English