| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.
|
Monday, July 3, 2017
ConsoleColor demo -2- C Sharp - 170703Mo
Thursday, June 29, 2017
Turbo C assignment - No 1 - C Sharp - 170629Thu
Turbo C assignment # 1 | |
. | |
(Re-Written in visual C# 2010 for producing here) | |
Version: 170629Thu | |
. | |
A few decades ago when I was learning computer programming 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 programming language a lot. And that created special kind of curiosity in me for 'C' programming language. And a line he spoke about benefits of learning 'C' computer programming language is still very valid in 2017. | |
. | |
And when in 2nd semester we started learning 'C' programming language, I was going ahead of class work; at least I was thinking so. I was reading my 'C' book faster than class lecture was going. I was going to library and reading different books on 'C' programming 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' programming 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 especially 'C' lab, library etc. Everything 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 cannot 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 becomes alive again. I felt relieved and relaxed. My teacher then looked at the code for a while and then ran/executed the program by pressing 'Ctrl+F9'. Turbo C IDE compiled the program and displayed it’s output. Teacher looked at program’s output and smiled. Then teacher again looked at the code and ran the code a few more times. Then my teacher 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, who was then a 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 cannot 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 post. | |
. | |
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 - 170613Tu
The Great Green ReCycle - 2017 |
. |
(Simplified method for making world greener) |
Version: 170613Tu |
. |
I have a great fondness for two types of plants. Firstly, those that produce vibrant flowers with captivating colors, fragrances, and shapes. Secondly, those with striking leaves in a kaleidoscope of colors, shapes, and designs. I'm thrilled to see the vast array of colors and patterns in nature, both in flowers and leaves. While collecting and planting these plants in our home lawn a few years ago, I realized that there wasn't enough space to accommodate all the varieties I wanted. It dawned on me that a single lawn couldn't possibly showcase the vast diversity of plants that nature has to offer. |
. |
After running out of space in our home lawn, I reluctantly moved outside and started planting different type of plants in a park near our home. There, I met a retired military havaldar, who shared my passion for gardening. Every morning, he was diligently watering plants in the same park. His dedication inspired me, and I found the motivation to continue my mission of planting a diverse range of species in the park, transforming it into a beautiful oasis for the community. |
. |
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. |
. |
Wednesday, May 24, 2017
Randomnes Tester - Ver 3 - C Sharp - 170524We
Randomnes Tester ver 3 |
. |
(Written by me in c#) |
Version: 170524We |
. |
Some years ago while working in the beautiful Borland Turbo C IDE and using Random numbers, for doing something, I thought why not test how many times any number comes in a list of Random numbers. So I then made a C program for testing that. At watching the result of that program I was a little surprised. |
. |
In first version that program generated 100 random numbers and displayed them on screen/CRT. I was surprised to see that some numbers were generated more than once and some never. So I made another version of that program and I changed it's working a little from the first version. Now although it was still generating random numbers between 0 and 99 but a lot of times and was storing how many times a number was getting generated in an array of 100 elements. In fact it was generating random numbers multiple of 100 times between 0 and 99. Now again I was surprised to see it's result. This time almost all numbers were generated 1 percent of times. All of this looked very interesting to me. |
. |
Few months ago I planned/decided to put that program on my this blog but because that program was in Pentium 3 and because that Pentium 3 was no longer working so after thinking and thinking I re-made that program and this time in c# in visual-studio 2010 for putting/sharing on my this blog. I named this new application 'RandomnesTester'. |
. |
Randomnes-tester’s user interface is simple and easy to use. At top right it shows a button with text 'Help'. Click this button for viewing Help information about this application. Next to 'Random number count' enter how many random numbers are required. It is a UInt32 field. Next to it is 'Max value' button. Click it to get max number entered in 'Random number count' field automatically. Helpful alert messages will display on invalid inputs. Click 'Start' button for starting process. Click 'Stop' button for stopping/cancelling process any time while it is running. On success result will display Under 'Randomnes Test Result'. Column 'Number' will show all numbers it generates from 0 to 99. Column 'Count' will show how many times each number is generated. Column 'Percentage' will show how many percent of times a number is generated. Under these is footer. Footer will show total numbers in 'Number' column under 'Number' column, total of 'Count' column under 'Count' column and total of 'Percentage' column under 'Percentage' column. Different text messages will show in bottom left telling what application is doing. Process status will show in text in bottom left and in Progressbar in bottom right. |
. |
. |
Following are the screen shots of 'RandomnessTester' version 3 application with explanation. |
. |
![]() |
Application looks like this when it is loaded. |
. |
. |
![]() |
This is application's Help screen. It displays basic information about application under 'About' section, purpose under 'Purpose' section and how to use under 'How to Use' section. |
. |
. |
![]() |
If input number is not valid then application displays this alert message giving user 2 options as discribed in it. |
. |
. |
![]() |
This alert message is displayed when input number is not multiple of 100 telling it will be made so. |
. |
. |
![]() |
Application looks like this when (1st) Valid number in entered , (2nd) 'Start' button is clicked and (3rd) It begin processing. During processing helpful information is displayed in status line at bottom |
. |
. |
![]() |
Application looks like this when during processing 'Stop' button is pressed, Cancelling process. helpful information is displayed in status line at bottom |
. |
. |
![]() |
Application looks like this when processing ends successfully, helpful information is displayed in status line at bottom |
. |
. |
In above image result of process is displayed under 'Randomnes Test Result'. And from this it can be observed that all numbers betwen 0 and 99 are generated near 1 percent of times. |
. |
. |
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. |
. |
Saturday, May 6, 2017
Menu for TV - Ver 1 - C Sharp - 170506Sa
Menu for TV - Ver 1 |
. |
(Proposed Menu for TV) |
(Demo application is written by me in c# 2010) |
Version: 170506Sa |
. |
Few years ago our Cable provider changed sequence of tv channels again and again in a few months and it made me very upset. Every time they were changing channel sequence I was re-arranging them back to, as much as possible, already memorised sequence numbers. But after that doing it again and again atleast once every year made me to think something else for solving this problem. |
. |
My idea was and still is to some how 'make' tv-menu or 'extend' already availabe tv-menu in tv sets. And in this new and/or extended tv-menu some-where (1) have options for searching tv-channels by typing their name, brand or type etc and (2) have lists of tv-channels orderd in different useful ways eg by-name, by-brand, by-type etc. |
. |
To test and view how menu arrangement look like i made an appllication in c# 2010. I implemented my idea through menu-item 'Channel', which is under menu-item 'TV Menu', with sub menu-items "Search", 'As is', 'Ordered' and 'User Preference' etc. Application and it's menu system is explained bellow with images where required or available. |
. |
Application at Start: |
Application looks like this on start. On top-left is the menu, 'TV Menu', I was discussing above. Under it under 'Help' in four rectangles 'About', 'Copyright', 'Purpose' and 'How to Use' information is displayed. How it all looks like is shown in following image. |
. |
![]() |
. |
. |
Application Menu - 'TV Menu': |
'TV Menu' is the menu I made to see and perfect look of my proposed menu for tv sets. This is available on top-left of application. |
. |
. |
'TV Menu/Channel/Search' menu-item: |
This menu-item will provide options for searching tv-channels by entering full or part of their 'name', 'brand' or 'type' etc. How it may look like is shown in following image. |
. |
![]() |
. |
. |
'TV Menu/Channel/As is' menu-item: |
This menu-item will show selectable list of channels in order set by Cable provider. How it may look like is shown in following image. |
. |
![]() |
. |
. |
'TV Menu/Channel/Ordered' menu-item:+ |
This menu-item will have sub menu-items like 'By Frequency', 'By Alphabet', 'By Brand' and 'By Type' etc for displaying tv-channel list by some order. These sub menu-items are explained bellow. |
. |
'TV Menu/Channel/Ordered/By Frequency' menu-item: |
This menu-item will display selectable list of tv-channels ordered by their transmision frequency. How it may look like is shown in following image. |
. |
![]() |
. |
. |
'TV Menu/Channel/Ordered/By Alphabet' menu-item: |
This menu-item will display tv-channels ordered by their names. This menu-item will have sub menu-items with names made of first character of tv-chanels. Eg 'A', 'Z', '0' and '5' etc. Each of these one character menu-items will display selectable list of ordered tv-chanels with names starting with this character. How it may look like is shown in following image. |
. |
![]() |
. |
. |
'TV Menu/Channel/Ordered/By Brand' menu-item: |
This menu-item will display tv-channel list ordered by their Brand (Brand=Company of channel). This menu-item will have sub menu-items with names made of brand-names of chanells. Each of these brand-name menu-items will display selectable ordered list of tv-chanels from these brands. How it may look like is shown in following image. |
. |
![]() |
. |
. |
+ 'TV Menu/Channel/Ordered/By Type' menu-item: |
This menu-item will display tv-channel list ordered by their type eg 'Sports', 'News' and 'Drama' etc. This menu-item will have sub menu-items with names made of channel type eg 'Drama', 'Sports' and 'News' etc. Each of these type-name menu-items will display selectable ordered list of tv-chanels of this type from different brands. How it may look llike is shown in following image. |
. |
![]() |
. |
. |
'TV Menu/Channel/User Preference' menu-item: |
This menu-item will allow user to store and then display selectable list of tv-channels according to their preferences. How it may look like is shown in following image. |
. |
![]() |
. |
. |
'TV Menu/Setting' menu-item: |
This menu-item will have all setting options for tv. How it may look like is shown in following image. |
. |
![]() |
. |
. |
'TV Menu/Entertainment' menu-item: |
This menu-item will have all entertaining options for tv. For example in our current tv set 'Game' option is very entertaining. How it may look like is shown in following image. |
. |
![]() |
. |
. |
I am shareing source code of that application here also. |
. |
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. |
Subscribe to:
Posts (Atom)