Issuu on Google+


INDEX Science and Technology 1. 2. 3. 4.

Out of net, Out of Mind ………………………………………………………………………………………………………………….…………… 8 Google Chrome Operating System ………………………………………………………………………………………………….……….… 10 AGOSTA 90-B ………………………………………………………………………………………………………………………………….……….… 12 Experience of Windows 7 ………………………………………………………………………………………………………………….…….… 14

General Articles 5. Ability is Better than Responsibility …………………………………………………………………………………………………….…….. 15 6. Managing Your Work Time ……………………………………………………………………………………………………………….……….. 16 Poetry and Humour 7. Love and Hope ……………………………………………………………………………………………………………………………………….…. 18 8. Baa Baa Black Sheep ……………………………………………………………………………………………………………………….………… 19 9. Smile Please ………………………………………………………………………………………………………………………………….………….. 20 Puzzles – Quizzes – Challenges 10. 11. 12. 13.

Logical Puzzles …………………………………………………………………………………………………………………………………………… 22 Sudoku ………………………………………………………………………………………………………………………………………………….…… 23 Programming Challenges …………………………………………………………………………………………………………………………... 25 Guess the Location ……………………………………………………………………………………………………………………………………. 28

Learning and Information 14. 15. 16. 17. 18. 19. 20. 21.

Polymorphism – In depth …………………………………………………………………………………………………………………………… 30 Learning C++ ……………………………………………………………………………………………………………………………………………… 33 Explore With Me ……………………………………………………………………………………………………………………………………….. 36 Tips and Tricks …………………………………………………………………………………………………………………………………………… 37 Software of the Month ………………………………………………………………………………………………………………………………. 38 Useful Links ……………………………………………………………………………………………………………………………………………….. 39 The Constitution ……………………………………………………………………………………………………………………………………….. 40 MAG News ………………………………………………………………………………………………………………………………………………… 41 One click access – Simply click the topic you want to read!


Translation of

The Holy Quran

Monthly series

[2:17] Their example is like that of one who kindled a fire; and when it lit up all that was around it, Allah took away their light and left them in darkness, unable to see anything. [2:18] Deaf, dumb and blind; and they are not to return. [2:19] Or like a rainstorm from the sky, in which are darkness, thunder and lightning; they thrust their fingers in their ears due to the thunderclaps, fearing death; and Allah has the disbelievers encompassed.


HADITH Narrated Anas: Once Allah's Apostle visited us in this house of ours and asked for something to drink. We milked one of our sheep and mixed it with water from this well of ours and gave it to him. Abu Bakr was sitting on his left side and 'Umar in front of him and a bedouin on his right side. When Allah's Apostle finished, 'Umar said to Allah's Apostle "Here is Abu Bakr." But Allah's Apostle gave the remaining milk to the bedouin and said twice, "The (persons on the) right side! So, start from the right side." Anas added, "It is a Sunna (the Prophet's traditions)" and repeated it thrice. [Sahih Bukhari Volume 3, Book 47, Number 745]

Narrated Aisha: I said, "O Allah's Apostle! I have two neighbours; which of them should I give a gift to?" The Prophet said, "(Give) to the one whose door is nearer to you." [Sahih Bukhari Volume 3, Book 47, Number 767]

Narrated 'Umar bin Al-Khattab: I gave a horse in Allah's Cause. The person to whom it was given, did not look after it. I intended to buy it from him, thinking that he would sell it cheap. When I asked the Prophet he said, "Don't buy it, even if he gives it to you for one Dirham, as the person who takes back what he has given in charity, is like a dog that swallows back its vomit." [Sahih Bukhari Volume 3, Book 47, Number 792]


E-MAG TEAM Editor-in-chief Mian Zeshan Farooqi

Editor Naveed Hamid

Counselling Officer Dilawer Hussain

Advertiser Mobeen Afzal

Reporter Majid Ali

Do not be over whelmed by the enormity of the task. There is many an example in history of young nations building themselves up by sheer determination and force of character. You are made of sterling material and are second to none. Why should you also not succeed like many others, like your own forefathers. You are a nation whose history is replete with people of wonderful grit, character and heroism. Live up to your traditions and add to it another chapter of glory. Muhammad Ali Jinnah

Website: http://www.emagportal.com E-mail: info@emagportal.com

30th October, 1947 Speech at a Mammoth Rally at the University Stadium Lahore


EDITORIAL “In the name of Allah, the most Beneficent, the most Merciful� Our beloved country, Pakistan is suffering from the worst era and different crisis. The electricity crisis is the biggest and the most threatening crisis for us. The recent electricity crisis has disturbed the life of every citizen, villager and common man the most. The long load shedding hours has worsened the situation. Today, is the age of technology and everything runs on electricity but load shedding has spoiled all our industry. This power crisis has a drastic effect on our economic sector. At present total power production capacity in the country is about 19,500 MW, out of which Hydel Power is only 6,500 MW, balance of 13,000 MW is thermal either using Natural Gas or Furnace Oil. Small capacity of 450 MW is Nuclear and only 150 MW is through coal. The short fall of electricity has increased up to 4600 MW. In the second half of December, the situation got so bad that WAPDA & KESC (power generation entities in Pakistan) resorted to draconian levels of load shedding. The power cuts during this time amounted to 20-22 hours a day in most small cities and even cities like Karachi were seeing 18+ hours of load shedding. We are a developing county and we cannot afford to produce electricity from oil. ALLAH has blessed our beloved country with other natural resources such as thermal and tidal power. The non-renewable natural resources such as coal, oil and gas when once used cannot be used again so if continue to produce electricity from these resources then a time will come when these natural resources will be perished. We need to save these resources for the future generation. The ultimate solution to the problem is the hydroelectric renewable energy. We need to build small and large dams to control this crisis. But, unfortunately the narrowmindedness and stubbornness of some people is a hindrance in the construction of dams. They are promoting racial and cultural discrimination only for their personal interest which has stopped the development process. We need to deal these people with iron hands. The whole nation must be united to overcome this crisis. May ALLAH bless our country with all HIS bounties and save us from all internal and external evils. Editor


E-MAG

Out of net, Out of mind Frustrated? Furious? Can’t get online? Well, psychiatrists now believe Internet addiction is a serious public health case that should be officially recognized as a clinical disorder. Excessive gaming, viewing online pornography, emailing and text messaging have been identified as causes of a compulsive-impulsive disorder by Dr Jerald Block, author of an editorial for the respected American Journal of Psychiatry. Dr Block argues the disorder is now so common that it merits inclusion in the Diagnostic and Statistical Manual of Mental Disorders, the profession’s primary resource to categories and diagnose mental illnesses. He says Internet addiction has four main components: · Excessive use, often associated with a loss of sense of time or a neglect of basic drives; · Withdrawal, including feelings of anger, tension and/or depression when the computer is inaccessible; · The need for better computers, more software, or more hours of use; · Negative repercussions, including arguments, lying, poor achievement, social isolation and fatigue. A primary case study is South Korea, which has the greatest use of broadband in the world. Dr Block points out that 10 people died from blood clots from remaining seated for long periods in Internet cafes and another was murdered because of an online game. Their country now 'considers internet addiction one of its most serious public health issues'. The government estimates that around 210,000 South Korean children are affected and in need of treatment, of whom 80 per cent might need drugs targeting the brain and nearly a quarter could need to go to hospital. Since the average high school pupil there spends about 23 hours per week gaming, Dr Block notes, another 1.2 million are believed to be at risk of addiction and require basic counseling. There has been alarm over a rising number of addicts dropping out of school or quitting their jobs to spend more time on computers. In China it has been reported that 13.7 percent of adolescent internet users, about 10 million, could be considered addicts. Dr Block, a psychiatrist at the Oregon Health and Science University in Portland, writes the extent of the disorder is more difficult to estimate in America because people tend to surf at home instead of in internet cafes. But he believes there are similar cases, concluding, “Unfortunately internet addiction is resistant to treatment, entails significant risks and has high relapse rates.” He says he hardly believe specific websites are responsible though. “The relationship is with the computer,” he says.”First, it Serving ice cream on cherry pie was once illegal in Kansas.

8


E-MAG

becomes a significant other to them. Second, they exhaust emotions that they could experience in the real world on the computer, through any number of mechanisms: emailing, gaming, porn. Third, computer use occupies a tremendous amount of time in their life. Then if you try to cut the cord in a very abrupt fashion, they’ve lost essentially their best friend. That can take the form of depression or rage.” Internet addiction clinics have sprung up around the world in an attempt to wean people off their need for a fix. Many people have turned, apparently without irony, to web discussion boards with names such as Internet Addicts Anonymous. The Centre for Internet Addiction Recovery in Bradford, Pennsylvania, says Internet addiction has become a growing legal issue in criminal, divorce and employment cases. It offers a consultation service to lawyers that include assessing the role of electronic anonymity in the development of deviant, deceptive and illegal sexual online activities. Robert Freedman, editor of the American Journal of Psychiatry, says expressions of the addiction could be diverse. “In Korea, it seems to be primarily gaming sites. In America, it seems to be Facebook. Its porn, its games, it’s gambling, it’s chatting with friends. All these things existed before, but now they’re a lot easier.” Here is a quiz for net junkies. If you answer “yes” to five or more of these questions, you may have an internet addiction. · Do you feel preoccupied with the internet? (Think about your online activity or anticipate your next online session.) · Do you need increasing amounts of time on the net in order to achieve satisfaction? · Have you repeatedly made unsuccessful efforts to control, cut back or stop internet use? · Do you feel restless, moody, depressed, or irritable when attempting to cut down or stop internet use? · Do you stay online longer than originally intended? · Have you jeopardized or risked the loss of a significant relationship, job, educational or career opportunity because of the internet? · Have you lied to family members, a therapist or others to conceal the extent of your involvement with the internet? · Do you use it to escape from problems (for example, feelings of helplessness, guilt, anxiety, depression)?

Written by: Faiza Raana

Not all polar bears hibernate; only pregnant females polar bears do.

9


E-MAG

Google Chrome Operating System Google is developing an operating system (OS) for personal computers, in a direct challenge to market leader Microsoft and its Windows system. Google Chrome OS will be aimed initially at small, low-cost netbooks, but will eventually be used on PCs as well. Google said netbooks with Chrome OS could be on sale by the middle of 2010. "Speed, simplicity and security are the key aspects of Google Chrome OS," the firm said in its official blog. The operating system, which will run on an open source licence, was a "natural extension" of its Chrome browser, the firm said. The news comes just months before Microsoft launches the latest version of its operating system, called Windows 7. Rebuilding of basis: "We're designing the OS to be fast and lightweight, to start up and get you on to the web in a few seconds," said the blog post written by Sundar Pichai, vice-president of product management, and Google's engineering director Linus Upson. Both men said that "the operating systems that browsers run on were designed in an era where there was no web" and that this OS was "our attempt to rethink what operating systems should be". To that end, the search giant said the new OS would go back to basics. "We are completely redesigning the underlying security architecture of the OS so that users don't have to deal with viruses, malware and security updates. It should just work," said Google. Google already has an operating system for mobile phones called Android which can also be used to run on netbooks. Google Chrome OS will be aimed not just at laptops but also at desktops for those who spend a lot of time on the web. Truly competitive: The announcement could dramatically change the market for operating systems, especially for Microsoft, the biggest player with around 90% share. 2.5 cans of Spam are consumed every second in the United States.

10


E-MAG "This is the first time we have had a truly competitive OS on the market in years. This is potentially disruptive and is the first real attempt by anyone to go after Microsoft. More on Google Chrome: Google Chrome OS will run on both x86 as well as ARM chips and we are working with multiple OEMs to bring a number of netbooks to market next year. The software architecture is simple — Google Chrome running within a new windowing system on top of a Linux kernel. For application developers, the web is the platform. All webbased applications will automatically work and new applications can be written using your favorite web technologies. And of course, these apps will run not only on Google Chrome OS, but on any standards-based browser on Windows, Mac and Linux thereby giving developers the largest user base of any platform. At the popular blog, TechCrunch, MG Siegler said: "Let's be clear on what this really is. This is Google dropping the mother of all bombs on its rival, Microsoft." (Google’s Official Blog) Microsoft releases Windows 7 later this year to replace Windows Vista and Windows XP, which is eight years old. The Redmond-based company claims that 96% of netbooks run Windows to date. In a separate announcement Google also revealed that many of its most popular applications had finally moved out of trial, or beta, phase. Gmail, for example, has worn the beta tag for five years. "We realise this situation puzzles some people, particularly those who subscribe to the traditional definition of beta software as being not yet ready for prime time," wrote Matthew Glotzbach, the director of product management in the official Google blog. The decision to ditch the beta tag was taken because the apps had finally reached the "high bar" mark, he wrote. Two Giants of this era are going to compete with each other, let’s see what happens.

Source: BBC and Google’s Official Blog

The Koala bear is not really a bear, but is really related to the kangaroo and the wombat.

11


E-MAG

AGOSTA 90-B Pakistan is well-known by his armed forces. All around the world accept that reality .We have the ability to face the challenges of terrorism and to serve the motherland. To maintain the Defense Position in the area Pakistan always upgrades military units. Pakistan has many contracts with the Friend countries like China and France to update the units like Fighter jets and Submarines. Pakistan Navy’s submarine force represents the offensive punch and a means to strike the enemy at long ranges. The Submarine Squadron was inaugurated in 1964, with the acquisition of PNS/M GHAZI from the United States. Since its inception the Submarine Squadron has contributed significantly towards the defense of the country. Pakistan and DCN France signed a contract for 3 Agosta 90-B submarines on 21 September 1994. Under the contract, one submarine was to be built in France while the remaining two were to be built in Pakistan. The first unit, "KHALID," was built in Cherbourg and delivered to Pakistan in 1999-2000. The sections of second unit, "SAAD," were constructed in Cherbourg and sent to Karachi for modular assembly in 2000. The third unit of the series, "HAMZA," has been manufactured entirely in Karachi. PNS/M KHALID: Pakistan Navy Submarine KHALID is the first of the Agosta-90B class submarines acquired by the Pakistan Navy from France. It was commissioned on 6 September 1999 and inducted into PN Fleet on 21 December 1999. The Agosta-90B is an improved version of the sea proven Agosta 70. PNS/M KHALID encompasses all qualities to strike terror in the hearts of enemies. The submarine has deep diving capabilities and can undertake patrol of more than 60 days. She also posses state of the art Combat System integrating all available sensors to launch multi-purpose wire guided torpedoes and sub launched missiles. The outfit of submarine systems, weapons and sensors make her unique and unprecedented amongst the existing new generation conventional submarines. PNS/M KHALID is named after Hazrat KHALID BIN WALID, the great Fighter and one of the most reputed military Commanders of Islam. Agosta submarines are currently in service with three navies. PNS/M KHALID incorporate improvements based on the experience gained by the French Navy and new advances in endurance, acoustic discretion, propulsion and diving capability. Its fully integrated COMBAT system enables the command to quickly evaluate the tactical situation and decide on an appropriate response. The submarine is capable to launch multipurpose torpedoes and submarine launched anti-ship missiles

One gallon of pure maple syrup weighs 11 pounds

12


E-MAG PNS/M SAAD: SAAD was the 1st Agosta-90B class submarine built at Pakistan Navy Dockyard under the Transfer of Technology (TOT) agreement with France. She was commissioned in Pakistan Navy on 13 December 2003. Then Ag Captain M Tariq Iqbal Sharafi PN (P.No. 2599) was designated at 1st Commanding Officer of PN Submarine SAAD. The submarine is capable of operating at deeper depths and can under take patrol of more than 60 days. These also posses the state of the art Combat System integrating all available sensors to launch multi purpose wire guided torpedoes and sub launched missiles. The outfit of submarine systems, weapons and sensors make it unique and unprecedented amongst the existing generation conventional submarines. PNS/M HAMZA PNS/M HAMZA, the third Agosta 90B submarine that has been completely built at Pakistan Navy Dockyard was commissioned into Pakistan Navy Fleet on 26 September 2008. . The submarine is named after Hazrat Hamza who is one of the uncles of the last Prophet Hazrat Muhammad (PBUH). HAMZA was known as Lion of God and Lion of Heaven for his bravery. PN Submarine HAMZA is the first submarine that has been fitted with MESMA Air Independent Propulsion (AIP) system. The submarine has been indigenously constructed under transfer of technology program by DCNS of France. Pakistan is the first country to use MESMA AIP system onboard a submarine.

HAMZA ready for diving

Written by: Abdul Salam BSEF07A026, PUCIT Instead of a Birthday Cake, many Russian children are given a Birthday Pie.

20 13


E-MAG

Experience of Windows 7 Written by: Mian Zeshan Farooqi Microsoft Windows XP was retailed in October 2001. It passes the longest time in market as compared to the other versions of Windows i.e. almost six years. Six year is a very long time which made the people tired this operating system. Even I got tired of it and wished to try something new. Announcement for the launch of Windows Vista brought a hope among people. But the release of Windows Vista disappointed many people including the professionals, experts and ordinary users. The compatibility issues of Windows Vista began a great criticism on Microsoft. It was a big shock for Microsoft that people switched to other operating systems. As an effort for the revival of Microsoft, Microsoft decided to launch a new operating system named as Windows 7. I’m consciously waiting for the launch of Windows 7 because it seems to me that Microsoft’s down fall would be stopped after the launch of this new operating system. According to Microsoft, many compatibilities issues have been resolved in Windows 7. Evaluation copy of Windows 7 is available on Microsoft’s official website. Windows 7 will be released in October 2009. I’ve tried the Evaluation Version of Windows 7 and found it much better as compared to Microsoft Windows Vista. It gives a very light experience and consumes less system resources. Its system requirements are 1GHz processor and 1GB RAM with 16 GB hard disk.

Microsoft Paint

The most interesting thing to see in Windows 7 is the innovation of Microsoft. Microsoft has done something new after a very long time. The traditional Word Pad, MS Paint, Calculator and many other programs are upgraded. Microsoft Office 2007 like ribbons is introduced in these programs. Calculator has been really made well. Now also contains a Programmer’s Mode, Conversions and many other good features. Another improved accessibility utility which has been added to Windows 7 is Speech Recognition. It’s a great fun to use this feature. I just command it with voice and it performs that action for me. For example I say ‘Open WordPad’ then it opens WordPad for me. Then I said ‘I am going to the super market’. It wrote the sentence in WordPad. It has many other interesting things which would force someone to try this operating system.

Chinese Crested dogs can get acne.

14


E-MAG

Ability is better than Responsibility By Naveed Hamid

A responsibility is a particular burden of obligation upon one who is responsible. On the other hand ability is what you are cable of doing. Ability is ageless. Research has also proved that a person can perform better if he is mentally relaxed. William said, “Responsibility is like a string, we can only see the middle, of both ends are out of sight.” Similarly, Stanly Milgram said, “It is easy to ignore responsibility when one is only an intermediate link in a chain of action.” These quotes illustrate that responsibility is just a burden on a person and it does not polish his skills while an able person is creative and crucial in thinking. Donald Kitcher said, “A man of ability and the desire to accomplish something can do anything.” Zig Ziglar quotes, “Success is the maximum utilization of the ability that you have.” Responsibility is not enough to accomplish a task unless you are also capable of doing it. Ability is something which will take you to the way of success. I elaborate this point with the help of an example from our daily life. Let us consider an example of a teacher; it is his responsibility to provide his students with quality education but what will happen if he fails to give a satisfactory answer of the students. The students might think that the teacher does not have sufficient knowledge of the subject but it could not be the case. The reason could be that the teacher does not have the ability to handle the questions. Let us consider another example of a political leader. A political leader must have the ability to handle press conferences and press releases. If, he is unable to overcome the crisis and give the satisfactory answers to the public then there might be a case that he even has to end up his political career. History has also proved that all the great religious leaders, political leaders, warriors, journalists, reporters, judges and sportsmen are renowned only because of their some prominent ability which made them distinguished from the others. It is rightly said, “Ability is cooler than responsibility.”

It costs about 3 cents to make a $1 bill in the United States.

15


E-MAG

Managing Your Work Time Having too much to do and not enough time available is a common complaint that all of us will make at some point during our working lives. It seems the problem is getting worse with productivity levels in Britain among the lowest across the whole of Europe. Despite working some of the longest hours in the developed world Britons seem unable to manage their working time productivity. Although everyone has their own individual way of getting things done there are some techniques and rules that can help maximize the working day, making the most productive use of the time available. Getting Started It may seem obvious to say that it’s important to know exactly what all your tasks are but this is vital in forming a cohesive and successful plan to make the most of the available time. It’s a common mistake to simply tackle each task as it comes in and can often lead to a situation where workers are just ‘fire fighting’ each individual problem instead of working through all of the tasks in a methodical way. You should draw up a list of daily, monthly or any regular tasks and then look at other things that may come up as part of your duties. This will help you plan effectively for the usual peaks and troughs of your workload and deal with tasks or projects that come your way. Evaluating the Workload It’s very important to make sure you don’t become overwhelmed with excessive work or try to take on too much as this will usually result in even less productivity. Becoming swamped with more than you can handle is totally counterproductive and will soon lead to even less being accomplished. Demands on your time will always rise and fall but you should place sensible limits on what you hope to achieve in any set period of time. Too much work or being put under excessive pressure can lead to workplace stress which can in turn lead to a host of other problems for workers and employers. If you feel too much is being expected of you don’t be afraid to speak with your manager or supervisor to discuss the workload. You should always ensure that: Any targets associated with your work are achievable.

It is estimated that by the end of 2000, there has been 142,600 tons of gold mined in the world.It

16


E-MAG The agreed deadlines are realistic. Work isn’t forced on you or your colleagues. You don’t agree to take on tasks that you cannot realistically complete. Managing Your Time Effectively Time management is one of the most important skills to have in the workplace, although it can be something of an art because most people have different ways of working. Some find it better to work flat out until a job is complete but others are more productive when they break work up into lots of smaller, more manageable chunks. Identifying your own strengths or weaknesses and finding the style that works best for you is really what effective time management is all about.

Prioritize: You must look at the most important tasks to complete and make some difficult decisions about the urgency of things facing you. Deciding on the most important jobs will help you tackle the working day more effectively and put your plans into action.

Make to-do-lists: Preparing daily or weekly to-do-lists will set out all your tasks and act as a permanent reminder of what needs to be done. Many people find that these sort of lists help them avoid procrastination and keep them organised. However, you should set a maximum number of tasks per day or the list will become unmanageable.

Delegate tasks or get help: You will become stressed and overworked unless you can calculate your maximum workload, and develop delegation skills.

Source: Safe Workers Official Website

One-third pound stalk of broccoli contains more vitamin C than 204 apples.

17


E-MAG

Love and Hope

Love your country, love your place,

It will give yourself a grace, Learn to serve, always praise,

Never give up, let your hopes raise,

Always run, never leave the race, You will finally get, the thing you chase,

It’s your zeal, that helps you trace,

All your dreams and aims you phrase....!

Written by: Qurat-ul-Ain Akram

The Flintstones cartoon was the first thirty-minute cartoon to be aired during prime time.

18


E-MAG

Baa Baa Black Sheep

Baa baa black sheep, have you any wool? Yes sir, yes sir, three bags full! One for the master, one for the dame, And one for the little boy who lives down the lane.

History: The earliest publication date for the "Baa, baa black sheep" rhyme or poem is dated 1744. Music was first published for "Baa, baa black sheep" was in the early nineteenth century making it into a song for children The wool industry was critical to the UK's economy from the Middle Ages until the nineteenth century so it is therefore not surprising that it is celebrated in the Baa Baa Black Sheep Nursery Rhyme. An historical connection for this rhyme has been suggested - a political satire said to refer to the Plantagenet King Edward I (the Master) and the the export tax imposed in Britain in 1275 in which the English Customs Statute authorised the king to collect a tax on all exports of wool in every port in the country. But our further research indicates another possible connection of this Nursery rhyme to English history relating to King Edward II (1307-1327). The best wool in Europe was produced in England but the cloth workers from Flanders, Bruges and Lille were better skilled in the complex finishing trades such as dying and fulling (cleansing, shrinking, and thickening the cloth). King Edward II encouraged Flemmish weavers and cloth dyers to improve the quality of the final English products.

Dipsomania refers to an insatiable craving for alcoholic beverages.

19


E-MAG

Smile Please A new teacher was trying to make use of her psychology courses. She started her class by saying, "Everyone who thinks you're stupid, stand up!" After a few seconds, Little Johnny stood up. The teacher said, "Do you think you're stupid, Little Johnny?" "No, ma'am, but I hate to see you standing there all by yourself!"

A man was driving when a traffic camera flashed. He thought his picture was taken for exceeding the speed limit, even though he knew he was not speeding. Just to be sure, he went around the block and passed the same spot, driving even more slowly, but again the camera flashed. He thought this was quite funny, so he slowed down even further as he drove past the area, but the traffic camera flashed yet again. He tried a fourth time with the same result. The fifth time he was laughing when the camera flashed as he rolled past at a snail's pace. Two weeks later, he got five traffic fine letters in the mail for driving without a seat belt.

Teacher: Billy, name two pronouns. Billy (anxiously): Who, me? Teacher: Very good!

China has more English speakers than the United States.

20


E-MAG

There was once a young man who, in his youth, professed his desire to become a great writer. When asked to define "great" he said, "I want to write stuff that the whole world will read, stuff that people will react to on a truly emotional level, stuff that will make them scream, cry, howl in pain and anger!"

"UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity."

He now works for Microsoft, writing error messages.

ERROR: Keyboard not found.

"As far as the laws of mathematics

Press < F1 > to RESUME.

refer to reality, they are not

.......

certain; and as far as they are certain,

they

do not

refer

to

reality."

Definition of an upgrade: Take old bugs out, put new ones in.

Pitcher Darold Knowles once pitched all seven games of one World Series.

21


E-MAG

Logical Puzzles By: Saad Ahmed CHRISTMAS TREE There were 4 angels on a Christmas tree (besides other frou-frou). Two had a blue aureole and two yellow, however none of them can see behind his head. Angel A is on the highest place and he can see angels B and C, which hang below him. Below hangs angel B, that can see only angel C under him. Angel C can't see anybody, because angel D hangs under a twig (nobody can see him and he cannot see anyone either). Which one of them will be the first to guess, what his own aureole is?

TRAINS A train leaves New York for Boston. Five minutes later another train leaves Boston for New York, having a double speed. Which train will be closer to New York, when they encounter?

BELT A magic rectangular belt always shrinks its length to 1/2 and width to 1/3 whenever its owner wishes something. After three such wishes, its surface was 4 cm2. What was the original length, if the original width was 9 cm?

APPLES A basket contains 5 apples. Do you know how to divide them to 5 kids so that each one has an apple and one apple stays in the basket? Note: Solution will be published in next edition. Submit your solutions at editor@emagportal.com before July 31, 2009. Your name would be published in next edition of E-MAG if you submit correct solution.

Before 1928, yo-yos used to be called bandalores in the United States.

22


E-MAG

SUDOKU

Solution

Well Done!

4

1

8

7

5

9

2

3

6

6

5

2

1

3

8

9

7

4

7

3

9

4

6

2

1

5

8

8

4

7

9

1

6

3

2

5

5

6

1

3

2

7

4

8

9

2

9

3

8

4

5

7

6

1

1

2

4

6

8

3

5

9

7

9

8

5

2

7

4

6

1

3

3

7

6

5

9

1

8

4

2

Correct Solutions Submitted By:  Rabia Binte Mehmood - BCSF04M008 - PUCIT  Samia Irfan - MCSF01M034 - PUCIT

Irish Wolfhound dogs have a short lifespan and live about 7-8 years.

23


E-MAG

SUDOKU 4 1 6

8

5

6 8

3 8

4

1

2

1

3

9

5

5

1 3 2

4 5

7 2

7

4

9

9

2

6

7

5

6 5

3

3 1 9

Sudoku is a number placement puzzle. The objective is to place digits in 9 x 9 grids such that digits from 1 to 9 occur once in each row, each column and each 3 x 3 boxes (blocks). Some numbers are already given at random places. Player has to fill the remaining boxes according to above constrain.

Download the preformatted solution file for this Sudoku by clicking here (optional). Submit your solutions before July 31st, 2009 at editor@emagportal.com Your name would be published in next edition of E-MAG if you submit correct solution,

When Queen Elizabeth I of England died she owned over 3,000 gowns.

24


E-MAG

Programming Challenges

Solutions

By: Mian Zeshan Farooqi 1. Suppose I’ve written the following code in a file named as “source.c”. Identify the error in the following code without testing it on compiler. (Assume that required header files are included). void main () { int i = 0; clrscr(); for( int j = 0; j < 10; j++ ) i = i + 2; getch(); }

Error is in for loop because C language allows the declaration of variables only at the beginning of a function.

2. Take a positive number from user and print counting from 1 to that number in the following format. You’re not allowed to use an array. See the following sample cases, where N is the user’s input:

1 2 3 4 5 6 7 8 9

01 02 03 . . . 10 11 12 . . . 18 19 20

001 002 003 . . . . 098 099 100 101 102 103 104 105

N=7

N = 20

N = 105

Female alligators lay about 40 eggs that hatch in 60 - 70 days.

0001 0002 0003 . . . 0098 0099 0100 . . . 0997 0998 0999 1000. . . 1024 N = 1024 25


E-MAG

void main () { unsigned int number; cin>>number; int digits = countDigits( number ); for( int i = 1; i <= number; i++ ) { cout.width( digits ); cout.fill('0'); cout<<i<<endl; } }

int countDigits( unsigned int number ) { if( number == 0 ) return 1; int count = 0; while( number > 0 ) { number = number / 10; count++; } return count; }

3. In the following code we’re taking character by character input from user. We’ve assumed that user will never give any white space or newline character. For more simplicity, assume that user will not give an input of more than 500 characters. Simple fill in the blank with some code, such that it will display the total number of characters which user has entered. You’re not allowed to modify this code, simply write your code in the given space (gray bar).

#include <iostream.h> #include <conio.h> void main () { clrscr(); char ch = ‘A’; while( ch != ‘Z’ ) //we’ve to take input until user enters ‘Z’ ch = getche(); cout<<endl<<‚You’ve entered ‛ <<(((wherey()-1)*80)+wherex()-1) <<‚ characters‛; }

Emus cannot walk backwards.

26


E-MAG

Programming Challenges By: Mian Zeshan Farooqi 1. Make the following code of C++ correct without changing any single character. However you’re allowed to add some code in the following code to make it work properly.

#include <iostream.h> #include <conio.h> VOID main () { Integer a, b, ans; cout<<‚Enter two numbers:\t‛; cin>>a>>b; ans = a + b; cout<<ans; }

2. Take a positive integer from user and show the number of even digits and number of odd digits in that number (Say 0 is an even number). Sample Input 12598 Sample Output Even: 2 Odd: 3 3. Every data type can store a specific amount of data which is known as its range. The capacity of a variable of same type varies from environment to environment. For example int may consume 4 bytes in 16-bit environment (e.g. Borland C++) and 8 bytes in 32-bit environment (like Microsoft Visual C++). Write a program which should tell the capacity of int and long in terms of bits, at run time.

Note: Solution will be published in next edition. Submit your solutions at editor@emagportal.com before July 31st, 2009. Your name would be published in next edition of E-MAG if you submit correct solution. The most popular Twizzler candy flavour is strawberry.

27


E-MAG Answer

Guess the Location

Govt. College University, Lahore

Guessed Correctly By:                

Abbas Ali Butt - Uraan Software Solution Afnan Ahmad - BITF08A042 - PUCIT Ali Younas - BSEF07A010 - PUCIT Ammar Aslam - BSEF07A037 - PUCIT Asma Kaleem - BITS06M023 - PUCIT Bushra Naz - BSEF07A032 - PUCIT Iqra Mehmood M Shafiq Azam - MCSS07A015 - PUCIT Muhammad Luqman Zafar - BSEF07A017 - PUCIT Nimra Humayun - MECF06E021 - PUCIT Rehan Farooq - BCSF02A042 - PUCIT Sami Haroon - GCU Saqib Mushtaq - (BCSF02A096) - Coventry University, UK Shamaila - MITF07M023 - PUCIT Waqas Akram - PUCIT Zaka Ullah - BITF05M018 - PUCIT

Thirty percent of all bingo players are under the age of 35.

Well Done!

28


E-MAG

Guess the Location

Note: Solution will be published in next edition. Submit your solutions at editor@emagportal.com before July 31st, 2009. Your name would be published in next edition of E-MAG if you submit correct solution.

Infants spend more time dreaming than adults do.

29


E-MAG

Polymorphism â&#x20AC;&#x201C; In depth A different perspective on polymorphism

Episode # 3

Runtime Polymorphism: Some points to ponder:

1. If the return type is a pointer or reference to the base class, then it may be a pointer or reference to the derived class in the derived class signature. Otherwise, the return type must match in any derived class. class base { public: virtual base * f(); virtual ~base(); }; class derive : public base { public: virtual derive * f(); virtual ~derive(); }; 2. Virtual global friend is illegal, but virtual functions in one class may be designated as friend in another class. 3. Virtual function may be inline and have default arguments. 4. Changing the access level of a virtual function in a derived class is a poor idea. For example: class base { public: The famous Casanova (Giacomo Casanova) was a librarian for many years before he died.

30


E-MAG

virtual void fun() {} }; class derive : public base { private: virtual void fun() {} }; void main() { base *pb=new derive; pb->fun(); } Note: The statement above “pb->fun()” is valid, because access specifiers are compile time check, so at compile time, compiler checks the type of pointer “pb” which is “base“, so “pb” can access “base::fun()”, But at runtime because of dynamic binding “pb->fun()” resolves to derive::fun(). 5. using declaration help derived class to avoid hiding of base class functions Example 1: class base { public: void print(int , int) {} }; class derive { public: using base::print;

//bring into local scope

The only species of turtle that lives in the open ocean is the sea turtle.

31


E-MAG

void print(char) {} //overloads with derive::print(char) }; Example 2: class base { public: virtual void fun(int , int) {} virtual int fun(float) {} virtual void fun(char *) {} virtual void fun() {} }; class derive : public base { public: using base::fun; //bring rest of three functions into local scope void fun(int , int) {} }; NOTE: Without making use of â&#x20AC;&#x153;using declarationâ&#x20AC;?, derive::fun(int,int) hides the other versions of fun().

By: Fareed Ul Hassan Baig Lecturer, Punjab University College of Information Technology University of the Punjab, Lahore

Toronto was the first city in the world with a computerized traffic signal system.

32


E-MAG

Learning C++

Episode # 5

By: Mian Zeshan Farooqi In the previous episode we learnt about the if-else control structure which was a conditional structure. Now weâ&#x20AC;&#x2122;ll move towards another conditional structure switch. You would remember that we check a condition in ifelse structure by writing an expression as a condition. If that expression results (evaluates) to 0 then it means that the condition is false otherwise for every non-zero value we say that the condition is true. The working of switch is not totally similar to the if-else structure. We can only check the equality with this structure. This structure starts from the switch keyword and an expression (i.e. usually a variable) known as controlling expression. The body of switch consists of several case labels and optionally a default label:

switch( expression ) { case <value1>: Statements case <value2>: Statements . . . case <value-n>: Statements default: Statements } switch, case and default are reserved keywords of language. Value1, Value2 â&#x20AC;Ś value-N are the possible values of above expression. System will check each case and where it would match the value of expression, it will execute the statements below that case and will carry on executing until the body of switch ends. In case no value

Venus is the only planet that rotates clockwise.

33


E-MAG matches with the expression, then the statements below the default would be executed. But default label is optional. As I told that once it matched some value then it would keep on execute the following instructions until the block of switch ends. Therefore it is necessary to separate the statements of each case. For this purpose we use break statement. break is a keyword which causes the compiler to go out of the current block. Let’s see both examples. See the following code first.

int number = 2; switch( number ) { case 1: cout<<“One”<<endl; case 2: cout<< “Two”<<endl; case 3: cout<< “Three”<<endl; default: cout<< “Greater than three”; }

You might think that the above code will display Two. But it is not like that. It will display the following output:

Two Three Greater than three

Incas used to create pots in the shape of peanuts that were highly prized.

34


E-MAG In order to get the desired behavior of the above code, we should introduce break statements. break statement will keep the statements of cases separate and will not allow the executing of instruction one case after the other. See the modified code and its resulted output:

int number = 2; switch( number ) { case 1: cout<<“One”<<endl; break; case 2: cout<< “Two”<<endl; break; case 3: cout<< “Three”<<endl; break; default: cout<< “Greater than three”; break; // its not necessary here }

Now it will show our desired output i.e. Two. The break statement after the default label is not necessary because the execution of this block will be ended in both cases, whether we put break after default or not.

Author’s Note: If you need any kind of help regarding C++ then feel free to contact me at zeshan.farooqi@yahoo.com

The letter J does not appear anywhere on the periodic table of the elements.

35


E-MAG

Explore With Me By: Mian Zeshan Farooqi

How to get and set the position of cursor in C? Get the cursor position: We’ve two functions wherex() and wherey() defined in conio.h. The prototype of these functions is as follow: int wherex( void ); int wherey( void ); wherex() returns the current horizontal position of cursor while wherey() returns the vertical position of cursor.

Set the cursor position: Another function gotoxy() is defined in conio.h which takes two parameters x and y and moves the cursor to the given x and y position on the screen. The prototype of this function is as follow: void gotoxy( int x, int y );

Usage: See the following code and its output

void main ()

ABC

{ cout<<‛A‛; gotoxy( 3, 6 ); cout<<wherex()<<‛ ‚<<wherey(); gotoxy( 2, 1 );

3 6

cout<<‚BC‛; }

Over 200 varieties of watermelons are grown in the U.S.

36


E-MAG

Tips and Tricks Remove Shared Documents folder From My Computer Click on Start Button and then click on â&#x20AC;&#x2DC;Runâ&#x20AC;&#x2122; in start menu. Type regedit.exe and navigate to the following path in registry editor HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer \ My Computer \ NameSpace \ DelegateFolders You must see a sub-key named {59031a47-3f72-44a7-89c5-5595fe6b30ee}. If you delete this key, you have effectively removed the shared documents folder.

Remove Multiple Boot Screens: If you are getting unwanted multiple boot screen then Follow these Steps. 1. Right Click on My Computer 2. Select Properties 3. Select Advanced Tab 4. Select Settings In the Startup & Recovery Section(3rd grp) 5. Select the operating system which u want and Click OK. 6. Again press the setting and click on Edit. It will open boot.ini File. 7. Now u can delete those o/s which you don't want to be displayed.

Note: For deleting operating systems from boot.ini file, keep it mind that you can't delete that o/s which is selected by default there. Before making any changes make a copy of boot.ini file.

Japan uses the most energy per year than any other country.

37


E-MAG

Software of the Month Review by: Dilawer Hussain

AUTO CAD AutoCAD is a CAD (Computer Aided Design or Computer Aided Drafting) software application for 2D and 3D design and drafting, developed and sold by Autodesk, Inc. Initially released in late 1982, AutoCAD was one of the first CAD programs to run on personal computers, and notably the IBM PC. Most CAD software at the time ran on graphics terminals connected to mainframe computers or mini-computers.

AutoCAD supports a number of application programming interfaces (APIs) for customization and automation. These include Auto LISP, Visual LISP, VBA, .NET and ObjectARX. ObjectARX is a C++ class library, which was also the base for products extending AutoCAD functionality to specific fields, to create products such as AutoCAD Architecture, AutoCAD Electrical, AutoCAD Civil 3D, or third-party AutoCAD-based applications. Design and shape the world around you with the powerful, flexible features found in AutoCADÂŽ software, one of the worldâ&#x20AC;&#x2122;s leading 2D and 3D design software. With robust 3D tools that can create almost any shape imaginable, AutoCAD helps you intuitively explore design ideas. It offers innovations that increase design and documentation efficiency, and enables you to more securely, accurately, and seamlessly share those designs with colleagues. And with thousands of available add-ons, AutoCAD provides the ultimate in flexibility because it can be easily customized for your specific needs. With these capabilities and more, AutoCAD delivers the power and flexibility needed to take documentation and design further. Download Link: http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=2704278

The longest chapter in the Bible is Psalm 119, which is 176 verses.

38


E-MAG

Useful Links

Jobz.pk Search jobs in Pakistan online, Jobz.pk is Pakistans No. 1 Job portal for opportunities in engineering, computer jobs, banking jobs, data entry jobs. Search jobs in Pakistan online, Job opportunities in engineering, computer, banking, data entry, medical, finance, Government.

NASA NASA - National Aeronautics and Space Administration ... View more than 700 NASA.gov Image of the Day features posted from 2003 to 2006. News and features about NASA research, aimed at the general public. It Includes sections of astronomy, space science, beyond rocketry, living in space, News, links, mission schedules, and NASA for kids. Since its inception in 1958, NASA has achieved many great scientific and technological feats.

Weather.com The Weather Channel and weather.com provide a national and local weather forecast for cities, as well as weather radar, report and hurricane. This website can show you local weather for thousands of cities around the world.

During the First World War, cigarettes were handed out to soldiers along with their rations.

39


E-MAG

The Constitution of

Episode # 4

The Islamic Republic of Pakistan Part II - Chapter I Fundamental Rights

Article 8: Laws inconsistent with or in derogation of Fundamental Rights to be void 8. Laws inconsistent with or in derogation of Fundamental Rights to be void (1) Any law, or any custom or usage having the force of law, in so far as it is inconsistent with the rights conferred by this Chapter, shall, to the extent of such inconsistency, be void. (2) The State shall not make any law which takes away or abridges the rights so conferred and any law made in contravention of this clause shall, to the extent of such contravention, be void. (3) The provisions of this Article shall not apply to(a) any law relating to members of the Armed Forces, or of the police or of such other forces as are charged with the maintenance of public order, for the purpose of ensuring the proper discharge of their duties or the maintenance of discipline among them; or; (b) any of the(i) laws specified in the First Schedule as in force immediately before the commencing day or as amended by any of the laws specified in that Schedule; (ii) other laws specified in Part I of the First Schedule; and no such law nor any provision thereof shall be void on the ground that such law or provision is inconsistent with, or repugnant to, any provision of this Chapter. (4) Notwithstanding anything contained in paragraph (b) of clause (3), within a period of two years from the commencing day, the appropriate Legislature shall bring the laws specified in 2[Part II of the First Schedule] into conformity with the rights conferred by this Chapter: Provided that the appropriate Legislature may by resolution extend the said period of two years by a period not exceeding six months.

The longest freshwater shoreline in the world is located in the state of Michigan

40


E-MAG

MAG NEWS S06 (Morning) won the Punjab University Flood Lit Tournament and Badminton Tournaments held at Khalid Bin Waleed Hall, Old Campus, Lahore. S06 morning team WAHSHEE TOLAA remain unbeaten through-out the whole tournament. The winning team was comprises of Haider Ali Awan (Captain), Zahid Bashir Mughal, Ali Hussain, Hafiz Zeshaan Abid, Sanam Iqbal Baig, Adnan Sohail, Usman Hafeez, Zeeshan Akram Sahi, Rai Mudassar, Shahid Latif and Nabeel Akram.

May 29, 2009 â&#x20AC;&#x201C; A Farewell party was organized for MCS. Dr Masoor Sarwar (The Prinipal, PUCIT) and other faculty members of PUCIT were invited.

Students of MCS with the principal and faculty members of PUCIT

There are bananas called "Red banana" that are maroon to dark purple when ripe.

41


Notices If you are a good writer or a good poet and want to write for E-MAG then you can send us your stuff at editor@emagportal.com If you like to share some article or other stuff from your collection then you must mention the name of original writer or poet. Send us your feed backs at editor@emagportal.com or fill the online feedback form at http://www.emagportal.com If you want to communicate with any of the writers then send us your message at same address and weâ&#x20AC;&#x2122;ll forward your message to the respective person. You can download E-MAG from http://www.emagportal.com or you can also subscribe to our mailing list to receive a copy of E-MAG every month. Some supporting files like WinRAR, Adobe Acrobat Reader, and other supporting files which are discussed in articles are available at http://www.emagportal.com

Website: http://www.emagportal.com Email: editor@emagportal.com


This is the last page of E-MAG and has been left blank intentionally. E-MAG is designed by: Mian Zeshan Farooqi zeshan.farooqi@yahoo.com


EMAG (5th edition)