Thursday, June 29, 2017

Turbo C assignment - No 1 - C Sharp


Turbo C assignment # 1
(Re-Written in visual C# 2010 for producing here)
.
A few decades ago when I was learning computer programing in some institute in Karachi, Sindh, Pakistan, during orientation class a teacher, who after-wards taught us 'dBASE III plus' and was very good teacher, praised 'C' computer programing language a lot. And that created special kind of curiosity in me for 'C' programing language. And a line he spoke about benefits of learning 'C' computer programing language is still very valid in 2017.
And when in 2nd semester we started learning 'C' programing language, I was going ahead of class work, at least I was thinking so. I was reading my 'C' book faster then class lecture was going. I was going to library and reading different books on 'C' programing language. I was going to computer lab and writing sample and example programs from books looking interesting to me and experimenting with those programs and was also solving exercises from different books.
In that class I/we learned 'C' programing language through 'Turbo C Ver 2'.  'Turbo C's IDE was very excellent and advance. During that time before and beside 'Turbo C' I liked 'GW-Basic' for its own good IDE and 'dBASE III plus' for it's very good IDE.
As I am writing this text, time then spent in that institute  is coming to my mind. Friends of that time/institute, teachers and specially that of 'C' subject, class room, computer labs and specially 'C' lab, library etc. Every thing is revisiting my mind in pieces in random sequence. And a gentle wish of some-how going back in time to that time and place is also coming in my mind. But because it can not happen so I am getting a strange feeling of loosing something.
From that time a program written in 'Turbo C' is still available with me in hard copy. Special thing about that program is that it was first assignment of 'Turbo C', my favorite subject/class of 2nd semester, and so still is very memorable for me. One more thing special about it is that, on assignment submitting day in 'C Lab' after loading 'C' assignment in 'Turbo C' IDE, I was waiting for 'C' teacher to come up to me to inspect/check my assignment. I was sitting in front of PC with my back towards PC. On my turn teacher came to me and while looking on monitor of PC I was using said to me with his ever smiling face and eyes "Oh, you did nothing". I got shocked and looked back at computer screen ... Computer monitor was blank ... "What happened? where is everything? ..." I said to myself. Meanwhile teacher touched some key on keyboard and everything came back, monitor become alive again. I felt relieved/relaxed. Teacher looked at code. Then ran it by pressing 'Ctrl+F9'. Then looked at it's out-put. Again looked at code. Ran code few more times. Praised me for my assignment, but not before disturbing my heart beat, and went to next student sitting in front of next PC beside me, Amir Hanif, who was very good friend of mine. Meanwhile my heart beat started to come back to normal.
.
Turbo C assignment requirement
Requirement for 'Turbo C' assignment #1 was to display all tables from '2' to '10' together on computer monitor with proper formatting.
.
Assignment Code migration from Turbo C to C# 2010
'Turbo C' is available on my Pentium 3 and that Pentium 3 is not booting, in fact it is not getting ON, and I am neither fixing it myself nor taking it to shop for fixing it. So I can not write that assignment in 'Turbo C'. So I wrote it in visual c# 2010 as a console application for producing here on my this Blog.
Following is the C# code for achieving above discussed 'Turbo C' assignment requirements in 'C# 2010' Console application. I made a few +/- to original code for adjusting to C# console application. Code is well documented and easy to understand.
.

.
Visual C# 2010 Code
.

.
Application Output
(Console screen/window after program execution)
.
If there are any mistakes then I will surely remove them whenever found.
I used 'Snipping Tool' for getting Screen-shot of application discussed above. And I did this for the first time for this post. Doing this helped me keeping background color of post.

Enjoy Complete Source code of application written and compiled in visual studio 2010 Ultimate by me. Download it. Extract it. Read 'ReadMeFirst.txt' file and do as is explained in it.


Tuesday, June 13, 2017

The Great Green ReCycle - 2017

The Great Green ReCycle - 2017
(Simplified method for making world greener)
.
I really like two types of plants very much. First those which gives flowers of any good color, smell and shape. Second those who have colorful leaves of any color, shape and design. I am happy that there are so many colors and designs of both flowers and leaves in nature. Some years ago while collecting and planting plants with different color flowers and leaves in lawn of our home, I felt shortage of space in lawn. And thought one lawn cannot accommodate all of them (plants) available in nature.
.
After feeling shortage of space in lawn of our home I reluctantly moved outside and started planting different type of plants in a park near our home. There I also found/met a senior rtd. military havaldar doing almost same thing, he was daily morning watering in the same park as time pass. This gave me some encouragement and I continued with my plan of planting different type of plants in park as welfare.
.
Almost during those same days in evening after walking for some time I used to sit in a park, near our home and beside main road, to enjoy gentle and cool breeze of evening. There were and still are a lot of “Azadirachta indica” neem trees on both sides of that main road. But where I used to sit there was sadly an old but dead tree on other side of the main road. Daily watching that tree not matching with it's surroundings something came in my mind. So one day I went to place of that old tree with right tools and around 4 liters of water and a few tree seedlings of “neem tree” and planted them right beside that old and now dead tree. After that I started daily watering those young seedlings.
.
Slowly and steadily they started growing. At beginning their growth was very slow but with time they picked speed. There growth took speed specialty when dept. responsible for up-keep of trees etc in our area started giving re-cycled water to all trees and plants in the area. It made me very happy and I stopped watering plants planted by me. Within few years those seedlings planted by me were, young trees, taller than me and it made me excited and very satisfied.
.
I started showing those young “neem” trees to my friends and relatives and slowly, slowly also started to feel like those people who earlier, in fact very earlier, had planted those now fully grown beautiful neem trees. For some years time passed like that very happily. BUT ... suddenly one day when I went to see “neem” trees planted by me I was shocked and surprised to see that those trees were completely cut by someone and there branches were lying on ground nearby. I watched here and there but no one was there to give answer to my questions. A few days after that sad day I again went to same place and was again surprised to see that almost all trees on one side of main road were cut to ground completely. On inquiry I got reply that govt. is making these roads wider and thus they are cutting trees. :). I felt relieved and relaxed.
.
After that I stopped planting plants any where other then lawn of our home. But at the same time started thinking how in some other way this can be done. After thinking and thinking I made some ideas and one of them looked very interesting and simple also.
.

.
      That idea was and still is something like this:
.
First: Collect seeds of long living and hardy building, fruit giving, flower giving and/or shadow giving trees etc from common public, private companies, government organizations and/or farmers etc.
Second: Categorize collected seeds according to their quality. Discard low quality seeds.
Third: Categorize collected seeds according to their type. For example Building, Fruit-giving, Flower-giving and Shadow-giving etc.
Fourth: Select suitable areas for each type of tree.
Fifth: Plant/sow quality seeds selected in second step, just before rainy season, in areas which normally have good rains every year.
Sixth: Do not do any thing else like giving water etc in planted area.
Seventh: Let trees grow naturally and wildly. Do not trim them.
Eighth: Do not remove any plants etc which grow beside/under planted trees.
Ninth: Repeat from First step every year. There is no End time for this plan.
.
Note: There is no END time for this plan and START time for this plan is as early as possible.
.

.
I think this scheme is simple and cheap to implement and maintain. Very easily any individual or group or private company or government organization can do it.
.
By keep planting trees in rainy areas and beside rivers, lakes etc every year we will one day have in Pakistan our own made rainforest like Amazon rainforest of Brazil etc.
.
HINT: We can also plant seeds of fruits (dates etc) we eat in every ramzan and any time else. Just think how much/many seeds we waist every year. We must surely re-cycle seeds.
.

If there are any mistakes then I will surely remove them whenever found.

.