Saturday, February 17, 2018

Pakistan international highway - 180217Sa

Pakistan International Highway - PIH
(Pakistan's proposed international level highway)
.
While watching travel videos, reading travel blogs and thinking and researching on highways in Pakistan and creating multilevel highway system for Pakistan in my mind an idea visited my mind to have an another type of highway called 'Pakistan International Highway' to connect Pakistan's neighboring countries with each-other via Pakistan.
Before I give details of idea first look at the map of Pakistan as shown in "Fig: 1". On one side of Pakistan is sea and on other sides are four countries. Through PIH we will connect all 4 neighboring countries and sea with each other.
.
Now look at the abstract map of Pakistan as shown in "Fig: 2" I made to make things easy to make. On one side of Pakistan is sea and on other sides are four countries.
.
During process of understanding think Pakistan looks like a pentagon. A pentagon with a circle (cyan circle) in it's center and 5 other circles (black circles) one each on middle of it's each sides. All circles on center of pentagon's sides connected to the circle on pentagon's center.
Black circles on the sides of pentagon are international exit/entry check-points on the border. Cyan circle in the middle of pentagon is highway intersection, connecting all PIH sections 'sub-highways' together.
Now transform Pakistan's pentagon like abstract map  to the actual map of Pakistan and PIH will adjust according to this transformation also. Result will be actual highway on actual map. As simple as it is.
People with valid documents eg passport/visa(a kind of transit visa) etc will enter from one check-point and exit from other check-point without getting out of this highway system. There will be enough basic amenities like hotels, camping sites and petrol pumps etc beside this highway system to make sure there will be no need for highway users to get out of highway system. People with normal visa will be able to get out of highway system and re enter at specified/allowed points.
I made different ideas at different times about how this highway will be made:
First idea was to make this highway entirely as an underground highway. This was looking very secure but highly expensive idea.
Second idea was to make this highway as a bridge throughout it's length and cover it in an iron cage on it's left, right and top throughout it's length. This was also secure and expensive idea.
Third idea was to make this highway by utilizing already existing highways and roads. This was less secure and more cheap idea.
Fourth idea was to make this highway based on conveyor belt. This was also expensive and complicated idea with interesting possibilities.
Fifth, and last so far, idea was to make this highway of totally new roads with basic amenity centers beside it through out it's length. Irrespective of it's cost, so far this looks good/best to me.
All vehicles using PIH will need to have GPS system installed and enabled and running on them so that their current location can be known to PIH authority through out journey.
PIH users will need to pay some fees as per their use of PIH. Plus basic amenities beside PIH will not be for free either.
PIH users will also need international standard driving license and travel insurance for using PIH.
.

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

.
.


Friday, February 2, 2018

Happy 6000 PageViews - (2018 Feb 02 Fri)


C O N G R A T U L A T I O N S
Today
On 2018 Feb 02 Fri
my this Blog reached 6000 page views mark.
A lot of THANKS to
Visitors, Viewers, Readers and Wanderers.
Please keep visiting this blog
and
Tell others about it.
Congratulations to me also.


Wednesday, January 31, 2018

Rubik cube game - 3 - C Sharp - 180231We

  Rubik's cube game in C#  
.
(Computer game for solving Rubik's cube puzzle)
(Written by me in c# 2010)
Version: 180231We
.
On last year's (2017) birthday of my niece,  one of my nephew,  gave her 2 gifts. One was a good looking Barbie doll and another was colorful Rubik's cube. While my niece preferred Barbie doll more, I started to analyze Rubik's cube to get some idea how to play with it, to make me able to teach my niece how to play with it. After making some un-successful tries I started searching Internet for tutorials about playing Rubik's cube.
And during searching and researching about Rubik's cube I got an usual idea. Idea was to make softwares for (1) playing Rubik's cube game (2) finding shortest solution for any given pattern of Rubik's cube. So I started making plans for these softwares and then started coding and in some days made them.
During coding of rotations of Rubik's cube I was getting disoriented again and again. So to solve that problem I made a small cube of hard paper. Made 3x3 boxes on it's each side with pencil and numbered them like 2d matrix. Then during coding I used it for reference. Before using this technique I was having difficult time in finding the bug in cube side/face rotation methods.
.
Salient features of Rubik's cube game:
All 6 sides of Rubik's cube are displayed side by side with their side name above them. Side rotating buttons are also above each side on left and right of side name. Game can be played in two modes: manual or auto. In manual human plays and in auto computer plays random moves.
.
Screen shots of game and their description:
Following are screen shots of Rubik's cube solving game at different stages with their description.
.
Game on Load:
Game looks like in the following image when it loads. Menus are on top line and status is at bottom line. Area in between them is divided in 3 columns.  In left column under 'Cube sides' heading are 6 colorful squares of 3x3 sub-squares. They are sides/faces of cube with their respective color. Each side's name is displayed above them. On left and right of each side name are buttons for rotating respective side. Left button for rotating  side clockwise and Right button for rotating side counter-clockwise. In center column Moves log and game controlling controls are displayed. In right column rotation buttons are explained.
.
.

.
Help menu expanded:
Game looks like in the following image when help menu is clicked. Showing it's 5 options: About, Purpose, User interface, How to use and Copyright. Each option of help menu is shown and explained in following.
.
.

.
Help/About:
Game looks like in the following image when 'About' in 'Help' menu is clicked. This menu-item displays basic information about game and it's author.
.
.

.
Help/Purpose:
Game looks like in the following image when 'Purpose' in 'Help' menu is clicked. This menu-item display text explaining purpose of the game.
.
.

.
Help/User interface:
Game looks like in the following image when 'User interface' in 'Help' menu is clicked. This menu option explains game's user interface as visible in following image.
.
.

.
Help/How to use:
Game looks like in the following image when 'How to use' in 'Help' menu is clicked. This menu option explains how to use this game application as visible in following image.
.
.

.
Help/Copyright:
Game looks like in the following image when 'Copyright' in 'Help' menu is clicked. This menu-item displays copyright text for this game application.
.
.

.
'New Game' button clicked
Game looks like in the following image when 'New Game' button in center column under 'Game' section is clicked. This button begins game starting process.
.
.

.
Play mode
Under 'New game' button are two radiobuttons called 'Manual' and 'Auto'. They are enabled only during after 'New game' button is clicked and before 'Start' button is clicked. They allow either human or computer to play the game. Select 'Manual' for human to play or select  'Auto' for computer to play. Computer only makes random moves so chances of computer solving the game is between in minimum moves possible to never.
.

.
'Shuffle colors' buttons
'Shuffle colors' button is also enabled only during after 'New game' button is clicked and before 'Start' button is clicked. Use this button for shuffling Rubik's cube.
.

.
'Start' button clicked (Manual mode):
Game looks like in the following image when 'Start' button in center column under 'Game' section is clicked in manual mode. Only Rubik's cube patterns may be different. I used Rubik's cube patterns in following image in an online Rubik's cube solver to test my game and my game worked correctly.
..
.

.
Some moves are made (Manual mode):
Game looks like in the following image when game is started in manual mode and some moves made.  This image is not sequence of above image. Only Rubik's cube patterns may be different.
.
.

.
'New Game' clicked during running game 'Manual':
Game looks like in the following image when 'New Game' button in center column under 'Game' section is clicked in 'Manual' mode while a game is already running. This option is useful for aborting an running game. This option gives options for actually aborting game or continue with the running game.
.
.

.
'Start' button clicked (Auto mode):
Game looks like in the following image when 'Start' button in center column under 'Game' section is clicked in 'Auto' mode and some moves are made.
.
.

.
'New Game' clicked during running game 'Auto':
Game looks like in the following image when 'New Game' button in center column under 'Game' section is clicked in 'Auto' mode while a game is already running. This option is useful for aborting an running game. This option gives options for actually aborting game or continue with the running game.
.
.

Game completed 'Manual':
Game looks like in the following image when it is completed/solved while game is in 'Manual' mode. Meaning all side/face square's are arranged in the same color as in the respective center square. When this happens game displays an alert message and a message in status bar to congratulate the player. This result was achieved by using generated moves from an online Rubik's cube solver site where I used starting patterns as mentioned above in "'Start' button clicked (Manual mode)"section. And felt happy on finding that my game was working correctly.
.
..

.
After a completed game:
Game looks like in the following image when it is completed/solved and 'Congratulating' alert message is also closed. Now game is ready for player to start New game.
.
.

.
I decided to display all 6 sides/faces of Rubik's cube side by side instead of displaying it as a rotate-able cube because 'side by side' way looks better and easy to understand to me.
.
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.



Monday, January 1, 2018

laptop of my dreams (2018) - 180101Mo

  Laptop of My dreams - 2018  
.
(A laptop I am making in my mind since some years)
Version: 180101Mo
.
Since some years, may be around at least a decade, I am thinking about, making in my mind, a computer which will be able to fit my requirements. And while doing so I am also making a laptop in my mind side by side. For example how it will look, what parts it will have. What it will be able to do. etc.
Although I was thinking and thinking again and again but things were not fitting together as I wanted them to fit. But suddenly a very important part of idea came from word 'Notebook'. Idea was that as there can be many pages in notebook why not have same type of arrangement in laptop. Laptops now a days already have 2 pages. One is it's display and other is it's remaining part. This idea simplified every thing for my dream laptop design.
Specifications of my dream laptop, in simple words, are as follows:
(1)_Overall look: It will have a big screen may be something around 20" so laptop will be large and thick and heavy.
(2)_Multi-paged: It's chassis/body will have more then 2 pages. Each containing a specific part. It's pages are described bellow.
(2a)_Display page: This will be top page and will contain laptop's display. Laptop will support either one or three displays. In case of three displays one called main display will be attached to laptop's chassis and remaining two called left display and right display will be attached to respective sides of main display. Both left and right displays will open and close like door and will have 2 way displays. So opening all displays for doing simple task will not be necessary.
(2b)_Keyboard page: This will be second from top page and will contain desktop like full size Keyboard, track pad etc only. Most chances are that this page will be totally like touch screen. So it will be possible to arrange it's contents in a lot of ways.
(2c)_Motherboard page: As is obvious from name this page will contain laptop's mother board and also main HDD etc.
(2d)_RAM page: This page will contain board with lot of slots for RAMs. Thus this facility will allow laptop to have huge quantity of RAM.
(2e)_Processor page: This page will contain board with a lot of slots for Processors. Suppose there will be N number of slots in this board. Idea is that Processors will be able to work as an individual or as a group of 2 or more processors. Meaning either N processors will work separately OR all as a one processor OR in any combination posibble between these 2 situations. Thus giving very great and versatile computing abilities to laptop.
(2f)_HDD page: This page will contain facility to attach a lot of HDD/SDD etc in it. So giving laptop ability to have huge quantity of external storage.
(2g)_Battery+Adapter page: This will be bottom page and will contain facility for attaching more then one powerful batteries. Plus this page will also contain built in adapter because carrying external adapter with laptop do not look good to me. Idea is that batteries will be so powerful that they will last for a weak while laptop continuously doing all power consuming task in parallel through out this time.
(*) It will be possible to have more then one page for any category  of page except display-page. Meaning this way it will be possible to have more then one motherboard OR more processing power OR more RAM OR more external storage OR more battery power etc in my dream Laptop.
.

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

.


Thursday, October 5, 2017

Prime numbers generator - 6 - 171005Th

  Prime numbers generator - 6 [1/2]  
.
(Finds all prime numbers between 2 and 32000000002 - c#)
Version: 171005Th
.
Once upon a time a few decades ago I was frequent visitor of "Liaquat National Memorial Library - Karachi" for reading books. I do not actually remember now how and when I went there for the first time. But I do remember that I continued going there for a few years. Although books on computer programming were my main interest but I enjoyed reading books on different subjects and reading different news papers as well. Books on "Lisp" and "Prolog" I studied there for the first time, but my main interest was books on "C" programming language and there were a lot of good quality books available there on C.
.
Environment of "Liaquat National Memorial Library" was very good: calm and peaceful. After a few visits I learned that if I do not come early then surely I will not get chair in the huge reading hall of the library. It was great to know that "Liaquat National Memorial Library" was in so huge demand. Therefore, after knowing that, whenever I went there, I went early.
.
Because "Liaquat National Memorial Library" is located beside PTV Karachi therefore during coming and going I also had some glimpses of TV stars of that time e.g. "Subhani ba Yunus" etc. As far as I do remember I also saw famous movie star of Pakistan "Mohammad Ali" one afternoon standing with someone near entrance steps of library building. I think he was minister at that time. Then time was around afternoon and I was mentally very busy and/or occupied in getting photostat of some chapters of computer book on Unix. Otherwise at least I would have requested for his autograph. He was tall with pinkish white in color and had a pleasant smile on his face. I think I missed the opportunity.
.
Let’s come back to the topic. On one visit to "Liaquat National Memorial Library" I requested for the current book of "Guinness book of world records". And in that book, for the first time I came to know about competition for finding prime number with larger number of digits than number of digits in any already known prime number. I knew how to find weather a number is Prime or not so automatically an idea visited my mind to find some prime numbers on computer myself.
.
Since then I am trying different softwares available to me on different times for making applications for finding as many prime numbers as possible. The list of softwares I used so far is as follows:
.
  1. Turbo C version 2 ON Pentium 2 and Pentium 3
  2. Html and JScript ON Pentium 4
  3. GCC ON Pentium 3 and i5
  4. C# 6 ON Pentium 3
  5. C# 2008 ON Pentium 4
  6. C# 2010 ON i5
.
On different times in different softwares I tried different methods for finding prime numbers like “long hand division method” and different variations of “Sieve method”. Also I kept researching on the internet and there I found pages on some sites displaying first few prime numbers for example first million prime numbers etc. I said Ok . . . I am also finding prime numbers, a lot of prime numbers and saving them on my pc's HDD. Why not I put prime numbers found by me, although I am not first to find them, on internet some where some day.
.
Therefore I re-ran current version of the application I made for finding primes to find prime numbers under different upper limits and found that for upper limit of 20000000, number/count of prime numbers is nearly above ONE Million. Some out puts of those Prime number searches I am sharing bellow. So far the maximum I reached for continuous list of prime numbers is:
.
  • Range......................: [2 and 32000000002] inclusive
  • Prime numbers found.: [1382799415]
  • Largest prime number: [31999999987]
.
Following is the list of first "6542" prime numbers, under 2^16, I found using software made by me using C# 2010.  I used this upper limit because it reminds me of "unsigned int" of 16 bit computers.
.

.
List of prime numbers under 2^16
.

.
List of prime numbers under 20000000
.
Following are the links to files containing first 1270607 prime numbers I found under 20000000 using software I made in c# 2010.
  1. Prime numbers between 00000000 and 00999999 inclusive
  2. Prime numbers between 01000000 and 01999999 inclusive
  3. Prime numbers between 02000000 and 02999999 inclusive
  4. Prime numbers between 03000000 and 03999999 inclusive
  5. Prime numbers between 04000000 and 04999999 inclusive
  6. Prime numbers between 05000000 and 05999999 inclusive
  7. Prime numbers between 06000000 and 06999999 inclusive
  8. Prime numbers between 07000000 and 07999999 inclusive
  9. Prime numbers between 08000000 and 08999999 inclusive
  10. Prime numbers between 09000000 and 09999999 inclusive
  11. Prime numbers between 10000000 and 10999999 inclusive
  12. Prime numbers between 11000000 and 11999999 inclusive
  13. Prime numbers between 12000000 and 12999999 inclusive
  14. Prime numbers between 13000000 and 13999999 inclusive
  15. Prime numbers between 14000000 and 14999999 inclusive
  16. Prime numbers between 15000000 and 15999999 inclusive
  17. Prime numbers between 16000000 and 16999999 inclusive
  18. Prime numbers between 17000000 and 17999999 inclusive
  19. Prime numbers between 18000000 and 18999999 inclusive
  20. Prime numbers between 19000000 and 20000000 inclusive
Download all 20 files containing all prime numbrs
under 20000000 (prime number count 1270607)
as a zip file
.

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

I will upload source code of application I made and used for generating above prime numbers in some near-future post some time else.
.