Thursday, December 16, 2021

Pakistan Indus basin forest - 210522Sa

  Pakistan Indus basin forest  
.1);">.
Version: 210522Sa
.
Other versions
Version Link
170613Tu The Great Green ReCycle - 2017
.
Since some decades I am wondering how we can grow man-made forest in our country, Pakistan. On different occasions different type of ideas came into my mind, some of which I had already discussed in some other post(s) in this blog.
.
Some days ago an idea came to my mind to calculate how many tree saplings will be required if we want to plant them on both sides of river Indus, largest river in our country. Idea was to calculate total number of tree saplings required if we plant one tree sapling after every “R” foot throughout the length of river Indus and plant one tree sapling after every “C” foot sideways on both sides of river.
.
After playing with different numbers for “R” and “C” I settled for 50 rows and 50 columns of tree saplings per square kilometer. This makes 2500 tree saplings per square kilometer. Length of river Indus is around 3000 kilometers. By multiplying length of river with number of tree saplings required per square kilometer we get number of tree saplings required for one side of river Indus and that is 7,500,000 tree saplings. To get number of tree saplings required for both sides I multiplied this number with 2 and got the number 15,000,000.
.
After a few days I started making a software version of that calendar and in a few days completed it's first version. This post is to describe Computer version (I made in 2020) of the Manual version (I made a few decades ago).
.

.
[ Indus basin forest calculation chart ]
Following is the summery chart of Indus basin forest calculation.
.
Indus basin forest calculation chart
River Indus
Length Around 3,000 km
Number of rows "R" per sq km 25
Number of cols "C" per sq km 25
trees per square km "R * C" 2,500
Trees on one side of river 7,500,000
Trees on both sides of river 15,000,000
.

.
[ Map Indus basin forest ]
Following is the map of proposed Indus basin forest. It is looking so beautiful and useful to me.
.
.
.

.
Colors used for Border and Background of this post
Color HSL RGB Hex
 
064, 51%, 21% 077, 081, 026 #4d511a
 
064, 51%, 72% (215, 220, 147 #d7dc93
.

.
If there are any mistakes in this post then I will remove them whenever I will know about them.
.


Thursday, August 5, 2021

Computerized generic calendar - 210805Th

  Computerized generic calendar  
.1);">.
Version - 210805Th
.
Other versions
Version Link
210410Sa Manual Generic Calendar - 210410Sa
.
Many years ago I made a manual calendar for displaying any year's entire calendar in same place. I described that manual calendar in a blog post with title Manual Generic Calendar - 210410Sa.
.
At start I used to use that Manual generic calendar I described in a post here from time to time but as I started having access to other means like computers etc I almost stopped using that calendar. Since then I am keeping that calendar in a drawer of my closet in my room safely.
.
I only take that calendar out to show others or to use myself and/or to go back in time when I made it. Some months ago when I was using that calendar and going back in time I got an idea. That idea was to make it's simulator on computer. That idea looked good to me and I started thinking about it.
.
After a few days I started making a software version of that calendar and in a few days completed it's first version. This post is to describe Computer version (I made in 2020) of the Manual version (I made a few decades ago).
.

.
Above described application "GenericCalendar - 1" is explained, with images where required, in the following.
.

.
[ User interface of Application ]
Application's user interface is explained in the following.
.
User Interface
.
.

.
[ How to Use Application ]
Application's use is explained in the following.
.
How to Use
.
.

.
Following are the screen shots of "GenericCalendar - 1" aplication with explanation.
.

.
[ Application is loaded ]
Application looks like in the following photo when loaded.
.
.
.

.
[ Application's Action/Weekly-holidays menu expanded ]
Application's Action/Weeklly-holidays menu looks like this. It has options for each day of week.
.
.
.

.
[ Application's Help menlu is displayed ]
Application's Help menu is displayed. It has 5 options About, Purpose, User interface, How to use, Copyright.
.
.
.

.
[ Application's Help/About form is displayed ]
Application's Help/About form is displayed. It displays  basic information about application.
.
.
.

.
[ Application's Help/Purpose form is displayed ]
Application's Help/Purpose form is displayed. It displays purpose of this application.
.
.
.

.
[ Application's Help/Copyright form is displayed ]
Application's Help/Copyright form is displayed. It displays copyright notice of this application.
.
.
.

.
[ Leep year displalyed ]
Application looks like this when leep year is selected/entered and calendar is displayed..
.
.
.

.
[ Year value selected/entered ]
Application looks like this when new year value is selected/entered by user and calendar for that year is displayed..
.
.
.

.
[ Day of week changed ]
Application looks like this when day of week is changed and calendar is displayed
.
.
.

.
Colors used for Border and Background of this post
Color HSL RGB Hex
 
213, 51%, 40% 050, 097, 154 #32619a
 
213, 51%, 64% 116, 159, 210 #749fd2
.

.
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.
.

.
If there are any mistakes in this post then I will remove them whenever I will know about them.
.


Wednesday, June 16, 2021

N-Queen Puzzle Solver - 2 - 131124Su

  NQueen Puzzle Solver - 2  
.1);">.
.
Version - 131124Sun
.
Other versions
Version Link
None No other versions are available so far
.
I learned playing Chess from my father, in my childhood, on chessboard which my father won in some competition in AJK. All my siblings learned playing chess from our father and we often used to play chess with each other. As we grew playing chess with each other on that chessboard, chessboard and it’s chess-pieces started showing signs of decay because of it’s age and use.
.
So I put that chessboard in safe place to make sure chessboard did not get damaged any further and remain with us for next generations. For playing chess I bought a new chessboard and chess-pieces set. After doing so some decades ago I started trying to make computer game for Chess also.
.
During online research for making computer chess game I came across many chess puzzles like "N Queen Puzzle" and "Knight tour" etc. A few years earlier than that online research I had also read about these types of puzzles in books on AI programming (prolog, lisp) in "Liaquat Memorial Library - Karachi".
.
These chess puzzles inspired me to make my own application for solving them on computer. I kept making them using different softwares. First time I made “N Queen” and “Knight tour” puzzle solving software in HTML/JavaScript and last time in C# (In between attempts I no longer remember).
.
This post is about an application "N Queen - 2". I made this application in year 2013 in c# for solving N-Queen Puzzle using computer. This application can solve N-Queen puzzles from 4*4 to 30*30 size chessboards. Optionally it can save results in file also.
.
[ N Queen puzzle (definition) ]
The N queens puzzle is the Puzzle of placing N chess queens on an NxN chessboard so that no two queens threaten/attack each other; thus, a solution requires that no two queens share the same row, column, or diagonal.
.
[ Application's UI and Working: ]
Application's user interface and how to use it is explained in the following.
  1. user have to select chessboard side size on which depends how many Queens to place on chessboard. Count of Queens is equal to size of chessboard side.
  2. User also have to select whether to find first solution only or to find all solutions.
  3. User also have to select whether to save result to file or not.
    1. If save to file selected than use also have to select folder where results will be saved.
  4. Calculation is started by clicking Start button.
  5. Calculation is canceled by clicking Cancel button.
  6. Running results are displayed in Output form.
  7. Current status is displayed in status line.
  8. Application log is displayed in Combo-box.
Following are the screen shots of 'N Queen - 2' application with explanation.
.

.
[ Application is loaded ]
Application looks like in the following photo when loaded.
.
.
.

.
[ Application's Menu/Help menu expanded ]
Application's Menu/Help menu looks like this. It has options for displaying differentc infomations about application.
.
.
.

.
[ Application's Menu/Help/About form is displayed ]
Application's Help/About form is displayed. It displays basic information about application.
.
.
.

.
[ Application's Menu/Help/How-to-Use form is displayed ]
Application's Menu/Help/How-to-Use form is displayed. It displays  information about application's UI nnd how to use it.
.
.
.

.
[ Application's Menu/Help/Copyright form is displayed ]
Application's Menu/Help/Copyright form is displayed. It displays basic Copyright notice about application.
.
.
.

.
[ Chessboard size option expanded ]
Application looks like this when Chessboard size option is expanded.
.
.
.

.
[ Chessboard size selected ]
Application looks like this after Chessboard size option is selected.
.
.
.

.
[ Browseing for output folder ]
Application looks like this when it's "Save solution to file" option  is checked and "Choose folder for saving solutions" clicked.
.
.
.

.
[ Output folder selected/Created ]
Application looks like this when output folder is either selected or created.
.
.
.

.
[ Start button clicked ]
[ Process started ]
Application looks like this when 'Start' button is clicked and application starts finding solutions.form.
.
.
.

.
.
.
.

.
[ Saving solutions to file ]
Application looks like this during saving found solutions to file in selected/created folder.
.
.
.

.
[ Process Completed ]
Application looks like this when Job is completed. All solutions are found and optionally all solutions are saved to file.
.
.
.

.
[ Process Completed (ready) ]
Application looks like this when Job is completed and application is ready for new Job.
.
.
.

.
[ Cancel button clicked ]
Application looks like this when 'Cancel' button is clicked. On doing so application stops doing it's job and displays related messages.
.
.
.

.
[ Log combo-box expanded ]
Application looks like this when application completes it's job successfully/un-successfully and log combo-box is expanded.
.
.
.

.
[ N-Queen puzzle solutions for 8x8 board ]
This application solves N Queen puzzle for selected chessboard size and optionaly saves solutions to file in selected/created folder. Following is the content of a N Queen puzzle solution file when chessboard size was 8x8 and all solutions were required.
.
.
.

.
Colors used for Border and Background of this post
Color HSL RGB Hex
 
93, 51%, 40% 97, 154, 50 #619a32
 
93, 53%, 81% 204, 232, 181 #cce8b5
.

.
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.
.

.
If there are any mistakes in this post then I will remove them whenever I will know about them.
.


Thursday, June 10, 2021

FG Progressbar 03.01 - 170410Mo

  FG Progressbar - 3.1  
.1);">.
Version: 170410Mo
.
Other versions
Version Link
2 Fancy Progressbar - Ver 2 - C Sharp
.
Few month ago while going through posts on my this blog I reached on a post with title “Fancy Progressbar - Ver 2 - C Sharp”. After reading that post I searched on HDD of pc for the project discussed and shared in that post. In search result I found many more Progressbars made by me as UserControl in c# (c sharp) with different look and abilities.
.
Out of that search result list I found a progressbar project which was next version (version 3) of above mentioned progressbar project (version 2). I ran that version 3 few times and then made another project based on it for sharing here and named it “FG ProgressBar – 3.1”. I made some modification, improvements to UI and logic of the new project. When I found workings and looks of the new application Ok then I took it’s ScreenShots at it’s different stages. After that I added watermarks to all ScreenShots.
.
This progressbar version 3.1 application is a demo project. First it demonstrates a good and simple looking progressbar. Second it demonstrates how to find prime numbers between 2 randomly selected numbers with a gap of 100000000. Third it demonstrates how to create a form programmatically and use it to show Help information.
.
A simple looking progressbar:
This simple looking progressbar is actually made of 3 controls one TableLayoutPanel with one row and two columns and two Labels. First Label for showing completed progress and second Label for showing remaining progress. Resultant Progressbar is made to look simple and user friendly. Progressbar displays status of process end with 3 colors. Green is for SUCCESS, Orange is for CANCEL and Red is for ERROR. This progressbar’s use is demonstrated during finding of prime numbers.
.
Finding Prime numbers:
Application runs a long process for finding prime numbers between 2 randomly generated numbers with a gap of 100000000 and updates fancy progressbar based on calculated percentage of work done by that process for each number it processes. Method for finding prime number is not optimized for speed or space. It is used here for having a long process for Fancy progressbar demo.
.
Creating Form programmatically:
Help information is displayed through a form created dynamically / programmatically on the fly. First Form is created second a control is added, RichTextBox in this case, third some properties of Form and RichTextBox are set according to needs (like Help info to Text property of RichTextBox) and fourth form with Help information is displayed.
.
Application's UI and Working:
Application's user interface and how to use it is explained row wise in the following.
  1. This row displays title of application.
  2. This row displays minimum number for processing when "Start" button is clicked.
  3. This row displays maximum number for processing when "Start" button is clicked.
  4. This rows displays primes found count during processing.
  5. This rows displays primes found percent during processing.
  6. Thirs row is for telling long process to generate error or not.
  7. This row contains 2 buttons:
    1. Start: For starting lengthy process.
    2. Stop: For stoping/canceling lengthy process.
  8. This row contain 2 buttons:
    1. Show Help: This button displays help form for this application.
    2. Exit: This button is for exiting from this application.
  9. This row contains 3 controls:
    1. Lable for displaying application status.
    2. Progressbar_3.1: This is the progressbar for which thlis application is made.
    3. Label for displaying progress percentage.
Following are the screen shots of 'FG Progressbar - Ver 03.01' application with explanation.
.

.
[ Application is loaded ]
Application looks like in the following photo when loaded.
.
.
.

.
[ Application's Help form is displayed ]
Application's Help form looks like this and it is displayed when 'Show Help' button is clicked. It displays some basic information about application. Working of main Form is not blocked by display of Help form. Help window uses different color on each load which it randomly selects from "Black, Blue, Green, Purple, DarkOrange, Red and DarkCyan". I used creation date of the original project version 3 in Help info.
.
.
.

.
[ Start button clicked ]
[ Process started (Busy...) ]
Application looks like this when 'Start' button is clicked and application starts finding prime numbers between 2 randomly generated numbers. 'Start' button becomes disabled and 'Stop' button becomes enabled. In status line application shows that it is 'Busy...' and percentage of job done by progressbar and percentage number. It also shows number of Primes found and Primes found percentage in form.
.
.
.

.
[ Process Completed (Done) ]
Application looks like this when Job is completed. 'Start' button becomes enabled again and 'Stop' button becomes disabled. In status line it shows 'Done' and Progressbar and percentage label shows that 100% job is completed. Total Primes found and Primes found percentage are shown in different fields of form.
.
.
.

.
[ Process Completed (Ready) ]
Application looks like this when Job is completed. 'Start' button becomes enabled again and 'Stop' button becomes disabled. In status line it shows 'Ready' and Progressbar and percentage label shows that 100% job is completed. Total Primes found and Primes found percentage are shown in different fields of form.
.
.
.

.
[ Stop button clicked (Stoped) ]
Application looks like this when 'Stop' button is clicked. On doing so application stops doing it's job and shows 'Stoped' in status line. 'Start' button gets enabled and 'Stop' button gets disabled.
.
.
.

.
[ Stoped button clicked (Ready) ]
Application looks like this when 'Stop' button is clicked. On doing so application stops doing it's job and shows 'Ready' in status line. 'Start' button gets enabled and 'Stop' button gets disabled.
.
.
.

.
[ Generate Error Yes option checked ]
[ Application aborts on error (Error) ]
Application looks like this when 'Yes' opption is checked for Generate Error. On doing so application's long process generates devide by zero error and so stops doing it's job and shows 'Error' in status line. 'Start' and ' Stop' button gets disabled.
.
.
.

.
[ Application aborted on error (Ready) ]
Application looks like this when 'Yes' opption is checked for Generate Error. On doing so application's long process generates devide by zero error and so stops doing it's job and shows 'Ready' in status line. 'Start' button get enabled and 'Stop' button gets disabled.
.
.
.

.
[ Application's alert message on closing ]
On application closing application checks if background worker is working and if it finds background worker working then it displays message with options to close application anyway or leave background worker working.
.
.
.

.
Colors used for Border and Background of this post
Color HSL RGB Hex
 
51, 51%, 40% 071, 050, 154 #47329a
 
51, 53%, 81% 185, 174, 229 #b9aee5
.

.
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.
.

.
If there are any mistakes in this post then I will remove them whenever I will know about them.
.