online K Map Code

 

<html>

<style type=”text/css”>
TD.HighLighted
{ color: rgb(255,0,255); font-size:150%;
}

.color{
color:#ffffff;
}
</style>

<h1 align=”center”>Karnaugh Map

<h2 align=”center”>Code: Html +Css+ Javascripting

<BODY bgcolor=”black” class=”color”>
<table width=”640″align=”center”>
<tr>

</tr>

 

Copyright : Ahsan Saeed

</td>
</tr>
</table>
</form>
</BODY>
</html>

Advertisements

My grades don’t define my intelligence

15439796_1286235761449306_4773488036194252846_n.jpgThe last paper for the final exams of the semester was almost ending when the instructor came to announce that our marks for a course had already been put up on the notice board and students could see them once they finish with the paper.

I was super-excited and confident too. Achieving good grades and already making it to the top three in the class had made me confident. As soon as the paper ended, everyone rushed towards the notice board while I chose to stay calm and sit on the bench. I was expecting someone to come over and congratulate me for scoring the highest, as it happened most of the time. However, what followed was a situation I’d never experienced before.

A crowd of competitors came up with the news that I had cleared the course, but with C grade. I would have been okay (not happy) with the news if my intelligence would not have been questioned.

Just a few moments ago, I was among the most brilliant students in the class. However, the moment I was declared to have gotten C grade in a course, I became a duffer. Everyone just had the same question for me, “What happened to you? How come your grade fell?”

It was very astonishing for me too. There were several people around me who had even scored worse than me, but still they stood around expressing surprise on my marks, as if to degrade me. I could find no other option but to escape to the girl’s common room to find some space to gulp down this bitter truth.

The bitter reality was not that I got a C grade, but it was that my classmates were so concerned about how a topper’s got such poor marks. I was the hot topic and everyone around somehow had the opinion that if I was really intelligent, I would not have scored poorly in any case.

The teachers also congratulated only the ones who were top scorers. What if once I wasn’t able to prove myself? Was all the previous hard work and reputation of no significance?

That moment, I felt what the other students would have felt in previous semesters. While I would have remained busy celebrating my superiority over others, they must have been made to believe that they were not intelligent or capable enough to meet the required standards.



At that moment I realised how the criteria of talent, intelligence and capabilities were confined to grades. It was hard to accept how I was being defined by whatever I had scored and not the fund of knowledge that was within me. This trend, however, had emerged since I went to my school for the first time. I was overloaded with gifts and appreciation whenever I got a good position and scolded the moment I didn’t make it into the top three. I remember how I studied hard not because I wanted to clear my concepts, but because it was necessary for me to grab a position to avail all those lovely gifts as a child. It didn’t mattered whether or not I had an understanding of what was being taught in the class, if I was able to somehow score high, that straight away meant that I was good at studies.

Unfortunately, in pushing children to adopt the “learn and write” method, the idea of building their intelligence and testing them on the basis of their capabilities has been ignored totally. I wanted to scream to make everyone realise how unethical it was to judge someone on their grades, to discuss and ask the reasons for their failure. But, unfortunately, I had been part of the same practice too. I always enjoyed the appreciation that I got after scoring high, ignoring the fact how my smile and cheers would have made others feel down.

I realised how I and the other students had been forced to chase grades and judge others and ourselves too on the basis of grades only. It is the cruellest reality of our society that the one who fails to produce the desired results in exams is regarded as a symbol of failure in real life too.

Sadly, the complex education system in Pakistan and many countries fails to accept the intelligence in students without having its proof on a piece of paper. It is not necessary that everyone is good at rote learning, some might retain the basic concepts which are enough for success.

Due to what I faced that day, I realised there might be many Steve Jobs in our country, who may be college dropouts or C graders but have the potential to prove it to the world that grades don’t define them. If our society too would have provided open space to those who want to prove themselves by their skills and not by their grades, we would not have been reading the inspirational stories of Steve Jobs or Bill Gates, instead we would have been producing them.

It’s high time that parents and teachers should understand how important it has become to keep grades aside and judge students on their abilities. Giving superiority on the basis of grades is just another form of modern slavery, within which personal and professional growth is totally impossible.

Playwright Bano Qudsia passes away aged 88

Bano-Qudsia.jpg

Famous playwright and spiritual writer Bano Qudsia died on Saturday at an age of 88, Express News reported.

She was wife to well-known literary figure Ashfaq Ahmed. Bano earned international recognition for her masterpiece Raja Gidh – an Urdu novel.

Besides, Bano wrote extensively for Pakistani dramas and also contributed to Punjabi literature.

Noted short-story writer Bano was given the Kamal-e-Fun Award for 2010 by the Pakistan Image result for bano qudsia poetryAcademy of Letters (PAL).

Related image

20e8f41e2665f98a268a73f14ba2508b.jpg

Famous writer Bano Qudsia speaks at a session on Day II. PHOTO: ABID NAWAZ/EXPRESS

 

 

Visual Basic The Quiz Program – File Handling

 Introduction

This page contains instructions to make a simple quiz in Visual Basic. It introduces the Structure statement for creating user-defined data types and how to read from a text file containing the question data for the quiz.

The Structure Statement

The data types we have used so far only store one type of information. The structure statement allows you to create variables which store more than one type of information.

For each question in our quiz there are several data items to be stored,

  • Question Text
  • 4 Possible Answers
  • The Correct Answer

This translates to Visual Basic as the following code,

Private Structure myQuestion
Public strQuestionText As String
Public strSuggestion() As String
Public strAnswer As String
End Structure

Study this code carefully and then copy it to the code window (at the top where global variable declarations go.

Just below the structure statement, we will declare the variables that we need for the program. The first line declares an array of variables using our structure.

Dim strTheQuestions(9) As myQuestion
Dim intCurrentQuestion As Integer
Dim intCorrect As Integer

Adding The Text File To The Project

To add the text file to the project, click on Add Existing Item on the Project menu. Choose the questions file. In the properties for the new object change the value of the Copy To Output Folder to Always.

Reading The Text File

We need to read values from the text file to store in our data structure.

The first job is to make sure that our program references the correct code libraries for File IO operations. Above the Public Class Quiz line at the top of your program, write the following lines,

Imports system
Imports System.IO

The following code reads from the text file and stores the results in our structure. This code should be placed in the load event handler for the form.

‘open up a stream to the file we need
Using sr As StreamReader = File.OpenText(“questions.txt”)
‘counter variables for loops to read in question data
Dim intQuestionCounter As Integer, intAnswerCounter As Integer
‘Loops through each question
For intQuestionCounter = 0 To 9
‘reads the question text of thenext item
strTheQuestions(intQuestionCounter).strQuestionText = sr.ReadLine()
‘initialises the array of answers
ReDim strTheQuestions(intQuestionCounter).strSuggestion(3)
‘reads in the set of suggestions for this question
For intAnswerCounter = 0 To 3
strTheQuestions(intQuestionCounter).strSuggestion(intAnswerCounter) = sr.ReadLine()
Next
‘reads the answer for the question
strTheQuestions(intQuestionCounter).strAnswer = sr.ReadLine()
Next
End Using

Initialising Global Variables

The variables we declared at the top of the form need to have their initial values set, we do this beneath the code we have already written inside the load event handler for the form.

intCurrentQuestion = 0
intCorrect = 0

Designing The Form

The form is set up to be able to display a question at a time. There is a label called lblQuestionText, a list box called lstAnswers and a button called btnNextQuestion. Your form should look something like the image below,

Writing A Procedure To Display A Question

Questions will be displayed on the form on 10 occasions. It makes sense to create reusable code to do this. The following procedure can be used to display the correct information in our controls.

Private Sub showQuestion()
lblQuestionText.Text = (intCurrentQuestion + 1) & “. ” & strTheQuestions(intCurrentQuestion).strQuestionText
Dim intcounter As Integer
lstAnswers.Items.Clear()
For intcounter = 0 To 3
lstAnswers.Items.Add(strTheQuestions(intCurrentQuestion).strSuggestion(intcounter))
Next
End Sub

The last line of code within the form’s load event handler should be a call to this procedure,

showQuestion()

Programming The Button

When the button is pressed, we need to check that the user has chosen an answer. If they have, we compare their answer with the actual answer. If they are correct, we add 1 to their score and increase the question counter by 1. If all of the questions have been answered, we tell the user their score.

If lstAnswers.SelectedIndex = -1 Then Exit Sub
Dim strUserAnswer As String
strUserAnswer = lstAnswers.SelectedItem
If strUserAnswer = strTheQuestions(intCurrentQuestion).strAnswer Then
intCorrect = intCorrect + 1
End If
intCurrentQuestion = intCurrentQuestion + 1
If intCurrentQuestion = 10 Then
MsgBox(“The quiz is over, you scored ” & intCorrect & ” out of 10.”)
Else
showQuestion()
End If

Extensions To The Program

Better Feedback / Alternative Input Methods

The program functions in a very basic way. There is little feedback to the user and there are many ways to allow the user to select an answer. You could change the theme of the quiz – and make the questions a tad more challenging. You could also build on the code that you have copied from this page to make a Who Wants To Be A Millionaire? game. You could also tell the user which questions they got wrong and end the quiz in a less abrupt manner.

More File Handling

You will need to use the MSDN help file that comes with Visual Basic. Search the help to find out how to write information to a text file. There are several examples showing how to do this. You could then make an editor to allow you to design quizzes to use with the program.

You might also want to use the OpenFileDialog and the SaveFileDialog to allow you to choose the files that you want to edit.

A final enhancement would allow the user to choose their quiz by selecting the appropriate quiz file.

Programming Might Not Be That Hard

programming-languages

If you think that coding has been overwhelmingly hard to understand, then you might have a minimum chance to discover the essence of programming. On the other hand, no matter how you felt coding as difficult task to accomplish, but end up finishing it, programming might not be as hard as you think. In fact, coding is a part of a long process taken in a single programming project.

Besides coding, programming involves requirement analysis, specification, software architecture, coding, debugging, integration, maintenance, and software testing. Those steps are what you basically need to proceed one by one as you are creating a computer software. So, in very simple words, programming urges you design, build, and evaluate a computer software, as if you are constructing a house which is able to occupy the inhabitants’ various activities.

However, many people do not find those general points as programming’s challenges. The implementation is obviously what they bother, particularly about writing programming languages.

You should have understood that computers do not ‘speak’ the same language as what we use. What is written on a particularly computer software’s interface is our language, human’s languages, since the software is made for us to understand its instructions. Yet, the software itself does not receive the terms as its language, but rather as a constructed command which has been ‘translated’ into human languages.

2014%2f04%2f30%2fae%2fcomputerpro-a015f

Fortunately, today, more people use the kind of programming language which is easier to be used. The language is named ‘high-level language’. Its characteristics, compared to ‘low-level language’ are depended on natural language or mathematical notation which are basically more easily to be understood by people in general.

Because of that language, programmers today, find it easier to design computer software. In addition, because of that language too, we do not actually need to worry about different alphabet, grammar or syntax that we find in high-level language. By using certain programming language, programmers would majorly need to use alphabets, grammar or syntax that they use in English. So, if you think it is hard, you might just have not get used to it.

Consequently, it does not take years to master programming skill. If you can get those mentioned basic points about programming alongside its language use, then it would not take you so long to complete the learning by implementing your lesson. Therefore, it is somewhat logical for one to build her/his own computer software after taking the course not more than a couple of months.

Data Structure

Insertion Sort

Algorithm: Insertion Sort

It works the way you might sort a hand of playing cards:

  1. We start with an empty left hand [sorted array] and the cards face down on the table [unsorted array].

  2. Then remove one card [key] at a time from the table [unsorted array], and insert it into the correct position in the left hand [sorted array].

  3. To find the correct position for the card, we compare it with each of the cards already in the hand, from right to left.

Note that at all times, the cards held in the left hand are sorted, and these cards were originally the top cards of the pile on the table.

Pseudocode


INSERTION_SORT (A)

1.     FOR j ← 2 TO length[A]
2.             DO  key ← A[j]
3.                   {Put A[j] into the sorted sequence A[1 . . j − 1]}
4.                    ij − 1
5.                    WHILE i > 0 and A[i] > key
6.                                 DO A[i +1] ← A[i]
7.                                         ii − 1
8.                     A[i + 1] ← key


Example: Following figure (from CLRS) shows the operation of INSERTION-SORT on the array A= (5, 2, 4, 6, 1, 3). Each part shows what happens for a particular iteration with the value of j indicated. j indexes the “current card” being inserted into the hand.

The operation of INSERTION-SORT on the array A = <5, 2, 4, 6, 1, 3>

Read the figure row by row. Elements to the left of A[j] that are greater than A[j] move one position to the right, and A[j] moves into the evacuated position.

Analysis

Since the running time of an algorithm on a particular input is the number of steps executed, we must define “step” independent of machine. We say that a statement that takes ci steps to execute and executed n times contributescin to the total running time of the algorithm. To compute the running time, T(n), we sum the products of the cost and times column [see CLRS page 26]. That is, the running time of the algorithm is the sum of running times for each statement executed. So, we have

T(n) = c1n + c2 (n 1) + 0 (n 1) + c4 (n 1) + c5 ∑2 ≤ j n ( tj )+ c62 ≤ j n (tj 1) + c72 ≤ j n (tj 1) + c8 (n 1)

In the above equation we supposed that tj  be the number of times the while-loop (in line 5) is executed for that value of j. Note that the value of j runs from 2 to (n 1). We have

T(n) = c1n + c2 (n 1) + c4 (n 1) + c5 ∑2 ≤ j n ( tj )+ c62 ≤ j n (tj  1) + c72 ≤ j n (tj  1) + c8 (n 1)  Equation (1)

Best-Case

The best case occurs if the array is already sorted. For each j = 2, 3, …, n, we find that A[i] less than or equal to the key when i has its initial value of (j 1). In other words, when i = j 1, always find the key A[i] upon the first time the WHILE loop is run.

Therefore, tj = 1 for j = 2, 3, …, n and the best-case running time can be computed using equation (1) as follows:

T(n) = c1n + c2 (n 1) + c4 (n 1) + c5 ∑2 ≤ j n (1) + c62 ≤ j n (1 − 1) + c72 ≤ j n (1 − 1) + c8 (n 1)

T(n) = c1n + c2 (n 1) + c4 (n 1) + c5 (n 1) + c8 (n 1)

T(n) = (c1 + c2 + c4  + c5  + c8 ) n + (c2  + c4  + c5  + c8)

This running time can be expressed as an + b for constants a and b that depend on the statement costs ci. Therefore, T(n) it is a linear function of n.

The punch line here is that the while-loop in line 5 executed only once for each j. This happens if given array A is already sorted.

T(n) = an + b = O(n)

It is a linear function of n.

Worst-Case

The worst-case occurs if the array is sorted in reverse order i.e., in decreasing order. In the reverse order, we always find that A[i] is greater than the key in the while-loop test. So, we must compare each element A[j] with each element in the entire sorted subarray A[1 .. j 1] and so tj = j for j = 2, 3, …, n. Equivalently, we can say that since the while-loop exits because i reaches to 0, there is one additional test after (j 1) tests. Therefore, tj = j for j = 2, 3, …, n and the worst-case running time can be computed using equation (1) as follows:

T(n) = c1n + c2 (n 1) + c4  (n 1) + c5 ∑2 ≤ j n ( j ) + c62 ≤ j n(j 1) + c72 ≤ j n(j 1) + c8 (n 1)

And using the summations in CLRS on page 27, we have

T(n) = c1n + c2 (n 1) + c4  (n 1) + c5 ∑2 ≤ j n [n(n +1)/2 + 1] + c62 ≤ j n [n(n 1)/2] + c72 ≤ j n [n(n 1)/2] + c8 (n 1)

T(n) = (c5/2 + c6/2 + c7/2) n2 + (c1 + c2 + c4 + c5/2 c6/2 c7/2 + c8) n (c2 + c4 + c5 + c8)

This running time can be expressed as (an2 + bn + c) for constants a, b, and c that again depend on the statement costs ci. Therefore, T(n) is a quadratic function of n.

Here the punch line is that the worst-case occurs, when line 5 executed j times for each j. This can happens if array A starts out in reverse order

T(n) = an2 + bn + c = O(n2)

It is a quadratic function of n.

The graph shows the n2 complexity of the insertion sort.

Worst-case and average-case Analysis

We usually concentrate on finding the worst-case running time: the longest running time for any input size n. The reasons for this choice are as follows:

  • The worst-case running time gives a guaranteed upper bound on the running time for any input. That is, upper bound gives us a guarantee that the algorithm will never take any longer.
  • For some algorithms, the worst case occurs often. For example, when searching, the worst case often occurs when the item being searched for is not present, and searches for absent items may be frequent.
  • Why not analyze the average case? Because it’s often about as bad as the worst case.

Example: Suppose that we randomly choose n numbers as the input to insertion sort.

On average, the key in A[j] is less than half the elements in A[1 .. j 1] and it is greater than the other half. It implies that on average, the while loop has to look halfway through the sorted subarray A[1 .. j1] to decide where to drop key. This means that tj  = j/2.

Although the average-case running time is approximately half of the worst-case running time, it is still a quadratic function of n.

Stability

Since multiple keys with the same value are placed in the sorted array in the same order that they appear in the input array, Insertion sort is stable.

Extra Memory

This algorithm does not require extra memory.

  • For Insertion sort we say the worst-case running time is θ(n2), and the best-case running time is θ(n).
  • Insertion sort use no extra memory it sort in place.
  • The time of  Insertion sort is depends on the original order of a input. It takes a time in Ω(n2) in the worst-case, despite the fact that a time in order of n is sufficient to solve large instances in which the items are already sorted.

Implementation

void insertionSort(int numbers[], int array_size)
{
int i, j, index;

for (i = 1; i < array_size; i++)
{
index = numbers[i];
j = i;
while ((j > 0) && (numbers[j1] > index))
{
numbers[j] = numbers[j 1];
j = j 1;
}
numbers[j] = index;
}
}

Legendary Abdul Sattar Edhi – میرے ملک کے گریبو کا کیال دکنا

0

Edhi’s war was against prejudice, cruelty .No politics, no fatwas, no greed. Just humanity for the sake of humanity.

Prominent Pakistani philanthropist Abdul Sattar Edhi has died from renal failure, his family has said. He was 88.

Earlier on Friday, Faisal Edhi told a news conference that his father was in critical condition at the intensive care unit of a Karachi hospital.

The 88-year-old died Friday night in Karachi, Pakistan’s largest city. He had been ill for weeks, and had needed a new kidney since 2013, but was too frail for a transplant. His family’s announcing of his death led to an outpouring of grief.

Md1Xfgx7

 

 

 

 

 

 

 

 

 

 

 

He was a hero to Pakistan’s poor and needy

Edhi final words
میرے ملک کے گریبو کا کیال دکنا  | Take care of the poor people of my country.

“He wished to be buried in the same clothes he used to wear. He also wanted to donate his body parts, but only his cornea can be donated as rest of the organs were not in healthy condition,” said Faisal Edhi.

Edhi’s funeral prayers will be offered on Saturday after Zuhr prayers at the National Stadium, after which he will be laid to rest at Edhi village.

akistani volunteers from the Edhi Foundation transport the bodies of those killed in an attack on a bus in Quetta, Pakistan, on May 30, 2015. (Banaras Khan/AFP/Getty Images)

akistani volunteers from the Edhi Foundation transport the bodies of those killed in an attack on a bus in Quetta, Pakistan, on May 30, 2015. (Banaras Khan/AFP/Getty Images)

 Edhi arranges relief supplies for flood survivors in Karachi. (Zahid Hussein/Reuters)


Edhi arranges relief supplies for flood survivors in Karachi. (Zahid Hussein/Reuters)

 

Born: January 1, 1928, Bantva, India    |    Died: July 8, 2016, Karachi, Pakistan
Spouse: Bilquis Edhi (m. 1965–2016)   |    Organization founded: Edhi Foundation
Children: Kubra Edhi, Faisal Edhi,           |     Siblings: Abdul Aziz Edhi
                       Kutub Edhi, Ilmas Edhi