Friday, January 26, 2007

Steps to Learning Programming

This may sound entirely backwards, but open source software has increased my desire to program. So much so, that I am willing to learn my arch nemisis, programming.

My desire to contribute to an open source community, has driven my desire to learn how to program. I have been using Linux for about 4 years. In that time I have re-animated my love for computers. Being a Windows administrator, I would enjoy what I was doing but at the end of the day, I wouldn't touch a computer. With Linux, I am constantly trying something new at home and at the office. However I do all this without having to know a programming language.

I specifically didn't major in Computer Science because I didn't want to 'waste' time learning a language that could be extinct before I graduated. Somewhere around 1985 I learned the chaotic way to program BASIC and found out there were better languages out there.

I have picked up books on how to program Javascript, Java, C++, and most recently Ruby (with an emphasis on Rails) and Python.

I have always wanted to master a programming language but I don't have a long attention span. I have done much better by fitting software pieces together as a system. System administration has fit me very well and I believe that if I could cross over to the programming side I would be even better at it.

I would guess that I'm not alone. The difference between programmers and system admins is probably represented somewhere between learning a programming syntax and wanting the computer to do a specific job.

I once heard or read that programming is getting computers to do what you want. But I think more specifically, programming is the art of getting computers to do what you want. Because it seems to me that sytem administrators is the practicality of getting computers to do what you want.

As a system administrator, I don't care how a job gets done. I'll use multiple tools together to make a complex job easier all without needing to program.

I've gotten to a place in Rails where I feel I could program in it but haven't found any projects to use it. I still don't know the scope of rails but I learned enough to create a web server using apache with cgi and with mongrel and reverse proxies. Recently, learning ruby has been increasing my desire to start using rails.

Because of rails, I want to learn Ruby. I have a project I'd like to do, namely recreate a more versitle version of bashpodder in Ruby. This may not be practical but I'm learning that often, duplication of projects is what programmers do to learn a language. I know what I'm looking for but know enough that I don't know enough methods to do it.

When searching for a "How to program" article I ran across a python site. I can find way more articles on how to program in python than in ruby. Python is also a very heavily used language in Linux distributions like Ubuntu and Debian. If I learn python, a bunch of opportunities open up. Specifically, I can help with bug fixes or patch actual bugs. Even better, I can scratch my own itch.
This is the best guide I've found so far on the Internet, written by Alan Guald. I really like the approach of viewing multiple languages at the same time.  The only problem is that I also want to compare Ruby with his writing.
http://www.freenetpages.co.uk/hp/alan.gauld/

Here is what I will use as a test of my knowledge of a programming language. This is the measuring stick of saying that I'm done and can move onto the next project.

Original forum post written by Prashant N Mhatre. (I quote forum posts on the fear that the dynamic content will disappear)
I've working knowledge of a bunch of programming languages but job demands to learn a new language frequently in a short time. Instead of reading hundreds manual/book pages, I quickly read 10-15 pages of tutorial or primer. (As you know google is the best search engine to look for such stuff). I keep printed copy of the language syntax reference card handy. (There are many reference cards available over internet. Type in 'language to learn' + 'reference card' in google.)

First of all, get familiar with Compiler, compiler option, editor shortcuts or integrated development environment (IDE). Start with a simple 'Hello World' program. Compile it. Use basic functionalities of debugger like setting break points, printing variable values, moving to the next or specific position, stopping debugger etc.

To grasp basics of a new language quickly, here are the exercises I use. Remember some programs may not good for beginners.

1. Display series of numbers (1,2,3,4, 5....etc) in an infinite loop. The program should quit if someone hits a specific key (Say ESCAPE key).

2. Fibonacci series, swapping two variables, finding maximum/minimum among a list of numbers.

3. Accepting series of numbers, strings from keyboard and sorting them ascending, descending order.

4. Reynolds number is calculated using formula (D*v*rho)/mu Where D = Diameter, V= velocity, rho = density mu = viscosity
Write a program that will accept all values in appropriate units (Don't worry about unit conversion)
If number is < 2100, display Laminar flow,
If it’s between 2100 and 4000 display 'Transient flow' and
if more than '4000', display 'Turbulent Flow' (If, else, then...)

5. Modify the above program such that it will ask for 'Do you want to calculate again (y/n),
if you say 'y', it'll again ask the parameters. If 'n', it'll exit. (Do while loop)

While running the program give value mu = 0. See what happens. Does it give 'DIVIDE BY ZERO' error?
Does it give 'Segmentation fault..core dump?'. How to handle this situation. Is there something built
in the language itself? (Exception Handling)

6. Scientific calculator supporting addition, subtraction, multiplication, division, square-root, square, cube,
sin, cos, tan, Factorial, inverse, modulus

7. Printing output in different formats (say rounding up to 5 decimal places, truncating after 4 decimal places,
padding zeros to the right and left, right and left justification)(Input output operations)

8. Open a text file and convert it into HTML file. (File operations/Strings)

9. Time and Date : Get system time and convert it in different formats 'DD-MON-YYYY', 'mm-dd-yyyy', 'dd/mm/yy' etc.

10. Create files with date and time stamp appended to the name

11. Input is HTML table, Remove all tags and put data in a comma/tab separated file.

12. Extract uppercase words from a file, extract unique words

13. Implement word wrapping feature (Observe how word wrap works in windows 'notepad')

14. Adding/removing items in the beginning, middle and end of the array.

15. Are these features supported by your language: Operator overloading, virtual functions, references, pointers etc.

Is there something called 'namespace / package / module' supported by your language? (Name mangling) - Read More on this.

Article written by Prashant N Mhatre.

Dell PCIe Wireless


Abit AirPace Wi-Fi


I ordered a number of Optiplex 745 small form factor pc's and tried to ask for a wireless solution to go with them.  I was told that Dell recommends a USB wireless device that clips on the top of the case.

At any rate, I ordered the PC's and already had a medical PCI video adapter that needed to be installed in the PCI slot.  That left me with a PCIe x16 slot. 

Luckily, I was able to find a progressive company that made a PCI express (PCIe) x1 card that works with the second slot in the machines.  I don't know why there is only 1 manufacturer for the new format.  Apparently you can reuse the same driver code and need only change the hardware (http://en.wikipedia.org/wiki/PCI_Express).  Maybe this is a chicken and the egg problem.

Dell should really offer to sell these Abit AirPace Wi-Fi cards.

Friday, January 12, 2007

ATI Radeon X1300 Works!

My ATI Radeon X1300 video card (Dell Optiplex 745) now works with the newest 8.33.6 driver which came out today.

  1. Download the new ATI Driver Installer

  2. chmod +x *.run

  3. fakeroot ./*.run --buildpkg Ubuntu/edgy

  4. sudo dpkg -i *.deb

  5. sudo module-assistant auto-install fglrx

  6. sudo /etc/init.d/gdm stop

  7. sudo modprobe -r fglrx

  8. sudo depmod -a

  9. sudo /etc/init.d/gdm start

  10. fglrxinfo

  11. fgl_glxgears


I still have a minor issue with the mtrr but it doesn't affect the 3D.