DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 23rd December 2008
Solaris_Delta Solaris_Delta is offline
New User
 
Join Date: Dec 2008
Location: North Carolina
Posts: 2
Thanked 0 Times in 0 Posts
Arrow Learning how to program

I see alot of threads in this forum dedicated to learning how to program this or that and so on, but this thread is a wee bit different. I know nothing about programming. Time and time again, I've tried learning but continue running into a brick wall as far as putting everything together. I seem to only get one or two chapters into any book before running into this wall (I.E; I know and understand what an if,then statement does, but how do I integrate this into a larger project and what are some examples of projects I could work on). I took ONE programming course back in high school around four years ago, and was lost after the hello world program. This is somewhat embarassing, because as far as administering a machine, I can pick that up pretty easily (I may not know alot, but so long as there is documentation, I can pull myself along pretty much where I need to go).

Anyway, I just want some suggestions/advice on what would be the easiest programming language to start with, and some books/documentation to help me along the way. I'm determined to master at least ONE language, I don't care if it takes me until I'm 50!
Reply With Quote
  #2   (View Single Post)  
Old 23rd December 2008
ephemera's Avatar
ephemera ephemera is offline
Knuth's homeboy
 
Join Date: Apr 2008
Posts: 537
Thanked 49 Times in 43 Posts
Default

Why do you wish to learn programming? <blunt but well meaning question>
Reply With Quote
  #3   (View Single Post)  
Old 23rd December 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,135
Thanked 182 Times in 149 Posts
Default

If you have no problem in administering machines, you could start with shell programming. That way you have small tasks which you can automate with a shell script.

My experience is that many people who, don't have any problem to solve, quit learning programming rather fast.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #4   (View Single Post)  
Old 23rd December 2008
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,873
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by ephemera View Post
Why do you wish to learn programming?
ephemera's point is that without a problem to solve, there may not be enough motivation to move up the learning curve. Having a tangible goal helps.
Quote:
Originally Posted by Solaris_Delta
...I just want some suggestions/advice on what would be the easiest programming language to start with, and some books/documentation to help me along the way.
My suggestion would be to start with Python given that its syntax is perhaps the least obtrusive, & dynamic languages tend to hide many implementation details that C/C++ programmers have to overcome. As for what books, etc., consider:
Reply With Quote
  #5   (View Single Post)  
Old 23rd December 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Thanked 112 Times in 104 Posts
Default

If you're used to using a unix shell, learning shell scripting is a very good idea; especially when you find yourself entering mini shell scripts into your shell prompt, rather then abusing history / line editing features lol.


In my personal opinion there is a great difference between learning programming, and learning a programming language. One is an art form, the other is just a canvas. I would also recommend reading this article sometime.


Interpreted languages make a lot of things easier -> /bin/sh, Ruby, and Python are all good choices. In my experience, Pythons docs are boring as horse-crap if you're not used to the lingo, but is very handy when solving problems. Ruby is on par with Python and is a very easy language to learn (~couple hours), but the overall documentation lacks in some spots when placed along side other languages (Python, Perl, Java, C, C++). The bourne shell (sh) and related ones (bash/ksh), are about as simple as it gets;but one needs to b/p to think outside the box often, in order to manipulate data at times.


If you use an editor like Vim or Emacs, that has their own internal scripting language; you might try utilizing it (vimscript/elisp) to do odds an ends.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
  #6   (View Single Post)  
Old 23rd December 2008
Solaris_Delta Solaris_Delta is offline
New User
 
Join Date: Dec 2008
Location: North Carolina
Posts: 2
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by ephemera View Post
Why do you wish to learn programming? <blunt but well meaning question>
My ultimate goal is to become a database administrator. I know how to set up machines and get certain services configured, but I know I will have to have knowledge about PHP, MySQL, etc but the difficult part is finding problems which would allow me to learn the skills and then put them to use. So, I guess the problem has been finding real, attainable goals.

Quote:
If you have no problem in administering machines, you could start with shell programming. That way you have small tasks which you can automate with a shell script.

My experience is that many people who, don't have any problem to solve, quit learning programming rather fast.
Another problem. Once I get things set up on my FBSD system, they are pretty much set in stone. This may change over time, as I learn more and more (tonight, I'm going to experiment with making jails), but right now I can't think of anything that needs to be automated which as I understand it is the biggest use behind shell scripting. Such scripting knowledge would be useful on the Windows side, where I could automate things such as virus scans, defrags, and disk cleanups.

@ocicat: Thanks for the references. I take a look at them, and hopefully the book will be available at my local library to at least skim over.
Reply With Quote
  #7   (View Single Post)  
Old 24th December 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,135
Thanked 182 Times in 149 Posts
Default

Each sequence of commands that you repeat a couple of times can be scripted. Not only configuring can be automated. Actually reporting is a more thankful target for automating.

For instance:
Code:
#!/bin/sh

HOMES=" \
/home/j65nko
/home/john
/home/robert
/home/packages
"
CMD="du -ks"
# -k    : blocks of 1024 bytes
# -s    : grand total only (no individial files)

echo "Home directory usage on $(uname -n)"
date
echo "==============================================="

${CMD} ${HOMES} | awk '{ total += $1 ;
                         printf "%-30s : %10u\n", $2, $1 ;
                        } END { printf "%+30s : %10u\n", "TOTAL", total }'
A sample run
Code:
$ sudo home-usage                            
Home directory usage on hercules.utp.xnet
Wed Dec 24 02:30:50 CET 2008
===============================================
/home/j65nko                   :    5829316
/home/john                     :       2686
/home/robert                   :         20
/home/packages                 :     262100
                         TOTAL :    6094122
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #8   (View Single Post)  
Old 24th December 2008
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,873
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by Solaris_Delta View Post
My ultimate goal is to become a database administrator.
There are three levels in which tasks can be automated:
  • Tasks from simple to moderate complexity can be scripted through shell scripts. Given that shells capable of executing Bourne shell scripts are ubiquitous throughout all the Unixes, writing to this lowest common denominator is a skill worth learning. It is the first tool you should take off the shelf.
  • However at some point (& you will learn this through experience...), shell scripting will not be able to handle all tasks, or to do so will become quite cumbersome, so reaching for a dynamic language such as Python or Perl will be better choice. As stated before, Python is perhaps easier to learn & read, but the add-on modules to Perl was more mature, & a number of books exist explaining how to use Perl to make database administration easier:

    http://www.amazon.com/Perl-Oracle-DB...0138350&sr=1-1
  • If database applications are either that useful, complicated, or require professional polish, they can or may be required to be written in C/C++, complete with GUI interfaces. However note that GUI libraries are also available for Python & Perl, so the divining point is blurred.
The advise you have received in this thread is grounded. Without a specific problem to solve, you will tire of programming & move to other tasks. If your ultimate goal is to be a DBA, learning shell scripting followed by some of the dynamic languages are skills you will use time & again.
Reply With Quote
  #9   (View Single Post)  
Old 24th December 2008
drhowarddrfine drhowarddrfine is offline
VPN Cryptographer
 
Join Date: May 2008
Posts: 358
Thanked 9 Times in 8 Posts
Default

Quote:
Originally Posted by J65nko View Post
My experience is that many people who, don't have any problem to solve, quit learning programming rather fast.
Excellent observation that is true of most things.
Reply With Quote
Old 24th December 2008
ephemera's Avatar
ephemera ephemera is offline
Knuth's homeboy
 
Join Date: Apr 2008
Posts: 537
Thanked 49 Times in 43 Posts
Default

For Perl I would recommend this book:

http://www.amazon.com/Beginning-Perl.../dp/1861003145

It's also available free online: http://books.simon-cozens.org/index.php/Beginning_Perl

Perl is a good choice for administration - its powerful, has a huge library of software available via CPAN and its available on all *nix and also windows (activestate.com). oh, and it also has good support for databases.

Python is interesting too. Its has a clean language implementation, is under active development (perl6 is not releasing anytime soon) and appears to be gaining some momentum.
Though I wonder if its just as easy to create the one-liner tools of Perl in Python also I believe CPAN is still unmatched.

Quote:
Originally Posted by Solaris_Delta
I know nothing about programming. Time and time again, I've tried learning but continue running into a brick wall as far as putting everything together. I seem to only get one or two chapters into any book before running into this wall (I.E; I know and understand what an if,then statement does, but how do I integrate this into a larger project and what are some examples of projects I could work on).
Get a good book, find a quiet place where you won't be disturbed and keep your laptop beside you and try out the examples on the computer (<- and this is very important). Also try solving the exercise problems at the end of the chapter (if any). And don't be in a rush to finish the book, take your time and I am sure you will find the experience quite enjoyable.

Last edited by ephemera; 24th December 2008 at 08:13 PM.
Reply With Quote
Reply

Tags
novice, programming

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Undertaking computer science degree, which BSD for learning professional assembly? lionsong Programming 15 18th October 2009 11:26 PM
Learning Content Management System Oko General software and network 0 31st October 2008 04:02 AM
Learning Programming Crypt Programming 35 27th October 2008 04:54 PM
Learning Perl mtx Book reviews 7 22nd October 2008 05:55 PM
Executing a c program Libran Programming 13 12th August 2008 11:42 PM


All times are GMT. The time now is 10:41 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick