Page 1


INDEX Science and Technology 1. E-Crime.com ...................................................................................................................................................... 8 2. H.264/MPEG-4 AVC Standard for Video Compression.................................................................................... 10 3. Internet Services Comparison Report ............................................................................................................. 12 4. Easter Eggs and Logic Bomb ............................................................................................................................ 15 General Articles 5. Fasting – In Medical Perspective ..................................................................................................................... 18 6. Independence Day Events ............................................................................................................................... 20 Poetry and Humour 7. The Earth and the Sky ...................................................................................................................................... 21 8. Ding Dong Bell ................................................................................................................................................. 22 9. Smile Please ..................................................................................................................................................... 23 Puzzles – Quizzes – Challenges 10. 11. 12. 13. 14.

BIG CHALLENGES ....................................................................... ............................................................. 25 Logical Puzzles ................................................................................................................................................. 28 Sudoku ............................................................................................................................................................. 29 Programming Challenges ................................................................................................................................. 31 Guess the Location .......................................................................................................................................... 34

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

Polymorphism – In depth ................................................................................................................................ 36 Learning C++ .................................................................................................................................................... 39 Explore With Me .............................................................................................................................................. 43 Tips and Tricks ................................................................................................................................................. 44 Software of the Month ................................................................................................................................... 45 Useful Links ..................................................................................................................................................... 46 The Constitution ............................................................................................................................................. 47 MAG News ...................................................................................................................................................... 49

One click access – Simply click the topic you want to read!


Translation of

The Holy Quran Monthly series

[2:20] It seems the lightning may snatch away their sight from them; whenever it flashes they walk in it, and when it darkens they stand still; if Allah willed, He could take away their hearing and their sight; indeed Allah is Able to do all things. [2:21] O mankind! Worship your Lord, Who has created you and those before you, in the hope of attaining piety. [2:22] The One Who has appointed the earth a base for you, and the sky a canopy - and caused water to pour down from the sky, thereby producing fruits as food for you; and do not knowingly set up rivals to Allah! [2:23] And if you are in any doubt concerning what We have sent down upon Our distinguished bondman (Prophet Mohammed - peace and blessings be upon him), bring forth a single surah (chapter) equal to it; and call upon all your supporters, other than Allah, if you are truthful.


HADITH

Narrated Abu Huraira: Allah's Apostle said, "When the month of Ramadan starts, the gates of the heaven are opened and the gates of Hell are closed and the devils are chained." [Sahih Bukhari Volume 3, Book 31, Number 123]

Narrated Sahl: The Prophet said, "There is a gate in Paradise called Ar-Raiyan, and those who observe fasts will enter through it on the Day of Resurrection and none except them will enter through it. It will be said, 'Where are those who used to observe fasts?' They will get up, and none except them will enter through it. After their entry the gate will be closed and [Sahih Bukhari Volume 3, Book 31, Number 120] nobody will enter through it."

Narrated Abu Huraira: The Prophet or Abu-l-Qasim said, "Start fasting on seeing the crescent (of Ramadan), and give up fasting on seeing the crescent (of Shawwal), and if the sky is overcast (and you cannot see it), complete thirty days of Sha'ban." [Sahih Bukhari Volume 3, Book 31, Number 133]

Narrated Anas bin Malik: We used to travel with the Prophet and neither did the fasting persons criticize those who were not fasting, nor did those who were not fasting criticize the fasting ones. [Sahih Bukhari Volume 3, Book 31, Number 168]


We Wish all of you a very

Happy Independence Day! & HappyToRamadan! All Muslim Community

E-MAG Team Editor-in-cheif Mian Zeshan Farooqi

Editor Naveed Hamid

Co-editor Ayesha Naeem Mirza

Coordinator Dilawer Hussain

Advertiser Mobeen Afzal

Reporter Majid Ali


Editorial “In the name of Allah, the most Beneficent, the most Merciful” There was a time in our country when only few people were aware of a machine named as ‘computer’. With the passage of time more people were aware of this invention and some institutions started the use of this machine. In early times computer was used in major offices such as newspapers, intelligence institutions and other like that. Gradually the computer came into the public use. Some institution started delivering its education. Mostly people were still aware of a technology known as ‘internet’. While rest of the people who knew it had not ever used it in Pakistan. Internet was made available to use in early 1990 in Pakistan. PTCL was the only landline company which provided its lines to the ISPs to provide internet. People of Pakistan enjoyed the experience of Internet through Dial-up connections. In order to purchase an internet connection we had to pass through many formalities. Even ISPs used to require our utility bills, address verification, etc... while selling us their internet connections. The government didn’t gave much attention to the Information Technology and Telecom sector therefore we the technology didn’t improved much faster in Pakistan. We can see that public sector worked more for the advancement of technology in Pakistan. Brain net is one of the pioneers of Internet Service Providers is also a public sector company. Government, in later years, prepared some good policy and gave a good attention the IT and telecom sector. In result, we saw an exciting competition in Internet service providers and other companies of telecommunication. The people of Pakistan started to enjoy the broadband internet speed during and after 2006-07. These were the years which caused a rapid advancement in internet technology. Now we have almost 128 ISPs in Pakistan, which are providing dial-up, DSL, ISDN, broadband and wireless internet services in a very competitive environment. Government should not avoid the IT and telecom sector. This environment of competition should also remain in our country so that we can enjoy latest technologies at affordable tariff.

Editor-in-chief


E-MAG

E-Crime.com Hackers who attack defence or commercial computers in future may be in for a an e-shock: a counterattack, authorised and carried out by the police and defence agencies aiming to disrupt and even knock them off the net. The secret plans, prompted by the explosion in the number of computer-crime incidents from east Asia targeting commercially or politically sensitive information, are known as “strikeback”, and are intended to target hacker’ computers and disrupt them, in some cases involving denial of service attacks. Work on “strikeback” has already begun in Britain, with the Serious Organised Crime Agency (Soca) and the Metropolitan police’s e-crime unit working to deploy teams. The measures are being adopted because of the unprecedented level of attacks being suffered from hacking groups in China, Russia and North Korea, which are suspected of being state sponsored. Among intelligence circles in Washington, DC, the idea of hitting back at foreign hacking groups is being described as the hottest topic in cyberspace. Amid rhetoric reminiscent of the Cold War, it is clear Washington has run out of patience, following blatant cyberattacks such as Titan Rain -- an attempt to breach western defence systems with the aim of stealing defence and commercial secrets. While on the campaign trail last July, Barack Obama identified cybersecurity as one of the biggest challenges facing his country. “As president, I’ll make cybersecurity the top priority that it should be in the 21st century,” he said. He has also equated cyberthreats with nuclear and biological weapons. Last week saw the results of President Obama’s cybersecurity concerns, with the publication by the White House of the “Cyberspace Policy Review” written by Melissa Hathaway, a senior director at the National Security Council who is widely tipped to become Mr. Obama’s cybersecurity chief. In the document -- a review of the American computer security problems, carried out over the past 60 days – Ms Hathaway broadly recommends more cooperation and education, and maintaining the American technological lead. The document also state, “The Communications Act of 1934 authorised the president, if he deems it necessary in the national security or defence and the requisite threshold condition exists, to use, control, or close communications services, systems, and networks under the jurisdiction of the Federal Communications Commission in conditions ranging from ‘state of public peril’ to ‘war’.”

If you are right handed, you will tend to chew your food on your right side.

8


E-MAG

Many involved in the “strikeback” discussions in America think it must be deployed immediately to develop a “defensive offensive capability”. Less bellicose but equally specific definitions are now in force in Britain -- which like many other nations -- has an offensive capability, which is for defence only. There is a growing willingness to strike back against some of the more obvious threats. One of the stated aims of the Met’s e-crime unit is to “disseminate target-specific intervention and prevention advice, and conduct intelligence-led disruption activity. It all sounds very hawkish but it is a policy that is exciting controversy -- how do you hit someone back without causing damage to someone else on the way, or taking out the servers of an ISP that the attack was routed through? “People were talking about this six years ago,” says Rik Ferguson, a senior security adviser for the computer-security company Trend Micro. “This is a very bad idea, due to the issues surrounding collateral damage.” But the hawks say concern is outmoded, as conventional computer-security procedures and the methods used by security companies are proving ineffective at stemming the tide of attacks. And, according to some in the industry, targeting is possible. According to Len Hynds, former head of the National High-Tech Crime Unit, targeting and disruption of hacking groups such as the Russian Business Network has long been a topic of discussion at Soca. “Soca was looking at it as a target, but the stumbling block for them was legal issues.” Which for many means that outsourcing the response is the name of the game? Just as groups such as the RBN and the students operating from Guangdong in China are suspected of working with the collusion of their governments, so many think the hunter-killers of cyberspace will operate on an outsourced basis as paid vigilantes.

Written by: Faiza Raana Freelance Journalist, Editor Monthly Pancham

If you are left handed, you will tend to chew your food on your left side.

9


E-MAG

H.264/MPEG-4 AVC

Part I

Standard for video compression H.264 / MPEG-4 AVC (MPEG-4 Part 10) video compressions standardized by ITU-T H.264 in association with ISO / IEC MPEG-4 AVC standard, they are together called the Joint Video Team (JVT).The H.264/AVC standard was first published in 2003. The process of H.264/AVC standard converting digital video into less capacity when its store and transmitted. The H.264 video provides better compression quality for a given data-rate compared to its predecessors, its builds on the concept of earlier standard such as MPEG-2.

Figure 1 The H.264 video coding and decoding process Encoder processes H.264 video encoder take the video source and prediction, transformation and encoding process provide the compresses H.264 video bits and H.264 video decoder decode the compress video bit stream, inverse transformation and then reconstruction the video for display . The Prediction of the macroblock based on previously coded data, from the current frame intra prediction (Figure 2) or from the other frames before encoded inter prediction (Figure 3). The encoder subtracts the prediction from the current macroblock to from residuals.

Chewing gum while peeling onions will keep you from crying.

10


E-MAG

Figure 2 Inter Prediction

Figure 3 Intra Prediction

The transformed using a 4x4 or 8x8 integer transform in the form of Discrete Cosine Transform (DCT).The output of this transform set of weighted coefficients value that are standard basic pattern, after combine the weighted basic pattern re re-create the block of residual samples. The video encoding process produce the value compressed bitstream. These values include the quantized transform coefficients, information to enable the decoder to re-create the prediction, information about the structure of the compressed data and the compression tools used during encoding, information about the complete video sequence. Decoder Processes A video decoder receives the compressed H.264 bitstream, decodes each of the syntax elements and extracts the information described above (quantized transform coefficients, prediction information, etc). This information is then used to reverse the coding process and recreate a sequence of video images. The quantized transform coefficients are re-scaled. Each coefficient is multiplied by an integer value to restore its original scale2. An inverse transform combines the standard basis patterns, weighted by the re-scaled coefficients, to re-create each block of residual data. These blocks are combined together to form a residual macroblock. For each macroblock, the decoder forms an identical prediction to the one created by the encoder. The decoder adds the prediction to the decoded residual to reconstruct a decoded macroblock which can then be displayed as part of a video frame.

Written by: Muhammad Zeshan Ali Ph.D (Student) Institut für Datentechnik und Kommunikationsnetze TU-Braunschweig, Germany

The Mercedes-Benz motto is “Das Beste oder Nichts” meaning “the best or nothing”.

11


E-MAG

Internet Services Comparison Operator Brand

Supporting Technology

Broadband

Device/ Modem Type

Portability

Activation Cost

Subscription / Month

Download Limit

Coverage Cities

WorldCall Wireless Broadband

EvDO Rev A

Yes

USB

Yes

Rs. 2,999

256 Kbps, 512 Kbps and 1 Mb Packages

None

Khi, Lhr, Other cities to be added soon

Yes

Rs. 2,000 (3 Mbps Package)

None

Khi, Lhr, Isb

Yes

PCMCIA Card USB

PTCL-Evo

EvDO Rev A

Yes

Rs. 4,000 Rs. 6,000

GPRS/EDGE Coverage areas GPRS/EDGE Coverage areas GPRS/EDGE Coverage areas

Zong

GPRS / EDGE

No

USB

Yes

Rs. 9,999

Rs. 400

None

Ufone

GPRS / EDGE

No

USB

Yes

Rs. 6,999

Rs. 605

None

Warid

GPRS / EDGE

No

USB

Yes

Rs. 11,000

Rs. 500

None

Wateen

Wimax

Yes

Indoor & Outdoor CPE

No

Indoor & Outdoor CPE

12 Packages

Yes

22 Cities nationwide

Mobilink Infinity

Wimax

Yes

Indoor CPE

No

6 Packages

Yes

Khi

Wi-Tribe

Wimax

Yes

Yes

Khi, Lhr, Isb

PTCL-DSL

DSL

Yes

None

Major cities of Pakistan

Link Dot Net-DSL

DSL

Yes

None

Major cities of Pakistan

Indoor CPE Indoor CPE Indoor CPE

No

Rs. 3,500 + 2,000 Security Rs. 9,99 + Security

No

Nil

No

Nil

512 Kbps & 1 Mb Packages 1Mb, 2Mb & 4 Mb Packages 1Mb, 2Mb & 4 Mb Packages

CyberNetDSL

DSL

Yes

Indoor CPE

No

Rs. 2500 + 1000

512 Kbps & 1 Mb Packages

20 GB

Brain NetDSL

DSL

Yes

Indoor CPE

No

Rs. 5000

512 Kbps, 1Mb & 2 Mb Packages

None

The Titanic was the first ship to use the SOS signal.

Khi, Lhr, Isb, Hyderabad, Faisalabad, Peshawar, Silakot Lhr, a few cantt exchanges in Punjab & Khi

12


E-MAG

Tariff Overview: Wateen Device cost:

Indoor CPE Outdoor CPE

Download/Upload Limit 5 GB 10 GB 15 GB

Rs. 14, 100 Rs. 18, 900

256 Kbps

512 Kbps

768 Kbps

Rs. 499 Rs. 599 Rs. 699 Rs. 899 Rs. 999 Rs. 1,099 Rs. 1,299 Rs. 1,399 Rs. 1,499 Additional data rates is Rs. 25 / 100 MB for all speeds

1 Mbps Rs. 799 Rs. 1,199 Rs. 1,599

WorldCall Package

256 Kbps

512 Kbps

1 Mbps

Cost

Rs. 1,200

Rs. 1,800

Rs. 2,500

Ufone Free subscription for first 6 months

Warid Free subscription for first month

Mobilink Infinity Download/Upload Limit 5 GB 15 GB

256 Kbps

512 Kbps

Rs. 450 Rs. 700 Rs. 1,000 Rs. 1,200 Additional data rates is Rs. 30 / 100 MB for all speeds

The pupil of the eye expands as much as 45 percent when a person looks at something pleasing.

1 Mbps Rs. 900 Rs. 1,500

13


E-MAG

PTCL DSL Package

1 Mb

2 Mb

4 Mb

Cost

Rs. 1,199

Rs. 1,999

Rs. 4,999

Student Package

Rs.839

Rs. 1,399

Rs. 3,499

Package

1 Mb

2 Mb

4 Mb

Cost

Rs. 1,200

Rs. 2,000

Rs. 3,900

Student Package

Rs.885

Rs. 1,485

Rs. 2,900

Link Dot Net DSL

Brain Net DSL Package

512 Kbps

1 Mb

2 Mb

Cost

Rs.999

Rs. 1,111

Rs. 2,222

CyberNet DSL Download/Upload Limit

512 Kbps

1 Mb

20 GB

Rs. 1,150

Rs. 2,100

Additional data volumes provided free on request Bundle packages are available for WorldCall, Wateen & Mobilink Infinity. Tariffs are recorded in July 2009.

Prepared by: Fahad Farrukh Alumni Fall 06 Punjab University College of Information Technology

The average person who stops smoking requires one hour less sleep a night.

14


E-MAG

Easter Eggs and Logic Bomb Easter egg is a hidden feature or a message which a creator puts in his creation. Easter Eggs are found in movies, books, machines, video or computer games and computer programs. This article would cover the computer programs’ Easter eggs. In context of computer programs Easter eggs refers to a hidden feature or a hidden action which in executed in result of some set of commands, key combinations or mouse clicks. Easter egg is such a feature of software which is kept hidden by the programmer. Some feature which should not be logically a part of your program is also considered as an Easter egg. Such features are never documented. Mostly the Easter eggs are entertaining. Easter eggs never harm your PC or data. The hidden features of a program which harm your PC or data are known as Logic Bombs which will be discussed later in this article. Programmers put Easter eggs in their programs for their own recreation during development or there also might be some other reasons. People are never told about Easter eggs officially by the creator because it is an undocumented feature of their program. Easter eggs are found in many operating systems, application softwares and web pages. In Microsoft Excel 95 there was a hidden game named as “The Hall of Tortured Souls”. Same like that MS Office 97 and 2000 also had some hidden games. A very popular Easter eggs of Microsoft Windows (earlier versions then XP) was in screensaver ‘3D Text’. When you write volcano in the Settings of this screensaver, it displays the names of different volcanoes instead of the word volcano. These are the old Easter eggs so I’m not going to discuss them in detail. In MS Word 2007 write =rand(X,Y) or =lorem(X,Y) (replace X and Y with some digit) and press Enter key. It will show you X random sentences in Y random paragraphs. This Easter egg is also found in earlier versions of MS Word. In MS Paint only 5 different line widths are available. While drawing some shape press Ctrl key with + or – key to increase/decrease the width of line as much as you want. Select the pencil tool; by holding Shift key you can draw straight or diagonal lines. Select some portion of an image in MS Paint; hold Ctrl key and drag the selected area. It will create a trail of image. In notepad type bush hid the facts and save the file with any name. Now open the saved file see that the text would be replaced by small squares. If you’ve installed the Chinese fonts and language then you’ll see some funny Chinese characters instead of small squares. In Ubuntu press Alt + F2 and type gegls from outer space. You’ll see some funny cows.

Dalmatians are born without spots.

15


E-MAG Open Run in Windows XP and type telnet towel.blinkenlights.nl to watch an ASCII Movie. This animated film is created in ASCII and it’s a fun to watch it. In Mozilla Firefox web browser go to the address bar and type about:mozilla and press Enter. It will show you a page from “The Book of Mozilla” telling you about the birth of Mozilla. In address bar type about:robots and read the message of Robots for human beings. In address bar type chrome://browser/content/browser.xul and see what happens. Type about:credits to see credits. This Easter egg is also found in Google Chrome. Open Microsoft Visual Basic 6. Right click in empty region in menu bar or standard toolbar and click Customize. Go to Commands tab. In Categories section select Help. In Commands section Click About Microsoft Visual Basic… and drag it to the menu bar or standard toolbar. Now right click the newly inserted item and replace its Name with Show VB Credits and press Enter key. Close the Customize dialog box. Now click the button/item which you renamed as Show VB Credits. It will show you the animated credits of VB Team. Open Microsoft Visual C++ 6. Go to File > New (or press Ctrl + N). Go to Projects tab; select ATL COM AppWizard; give the Project some name and click OK. Now simply click Finish then OK. Click on Insert (menu bar) and select New ATL Object (or simply press Alt + I + A). In objects section (right hand side) click each object one by one from left to right and top to bottom. Now hold Ctrl Key and Double Click the left mouse button in Gray region of this dialog box. You’ll see the pictures and names of ATL Team. In Borland C++ V.3.1 Click Help and then click About. It will open the About Dialog box. Now press Alt + I to see the credits of this compiler. Open WinRAR; click on Help (menu bar) then click on About WinRAR….Click the WinRAR logo to animate the ocean waves. Clicking the books in same dialog box will cause their downward motion. Secrete codes in games which are commonly known as Game Cheats are also considered as Easter eggs. In Windows XP open Pinball game. When the ball appears, type hidden test and enjoy the game. Now you can control the ball with your mouse and make as many scores as you want. In Solitaire (a cards game in Windows) press Alt + Shift + 2. You’ll see the winning animation. It not only shows the animation but you also win the game. Hidden emotions in messengers are also Easter eggs of that messenger. Here are some hidden emotions of Yahoo! Messenger. These emotions were Easter eggs in earlier versions but now they are documented by Yahoo! but still hidden. Try these cute and funny emotions and have fun: 8-X @};- 3:-0 b-( ~o) [-o< >-) @-) $-) :-" :^o [-x \:D/ ~:> %%- :-L o-> (%) (*) :-j :-# :-@ :-> (~~) **== :(|) :@) =:) Bats always turn left when exiting a cave.

16


E-MAG Open Google.com and type Recursion in search box and click search button. It will again prompt you with the same spelling: Did you mean Recursion. There’re some smilies in Facebook chat. Here’re the Easter eggs of Facebook.com chat. Try and enjoy: :) :( :P :D :O ;) 8) 8| >:( :\:’( 3:) O:) :-* <3 ^_^ -_- O.o >:o:v :3 :|] :putnam: In Facebook chat if your write your message between two sterik signs than it will be displayed as bold text. For example *Hello my dear!* would appear as Hello my dear! to the other person. Open Yahoo.com in your web browser. Click on the exclamation sign of Yahoo logo i.e.! You’ll hear a nice voice singing Yahoo! Open GameSpot.com and Press the given key combination: up up down down left right left right b a Enter. You’ll see that the background of the website would be changed. You’ve seen that Easter eggs are usually entertaining. We can say that Easter eggs are the Good eggs. Where there is something good, there would be something bad too. There’re also some Rotten eggs in softwares. We call them ‘Logic Bombs’. A logic bomb is such a hidden feature of a program which harms your system or data. For example a program with a logic bomb works properly on your computer without any disturbance but on meeting some specific condition it deletes all the files and documents on your disk. It is usually very hard to find out a logic bomb in some program. Logic bomb has a brother named as Time Bomb. Time bomb is such a hidden feature of a program or a virus which explodes (executes) itself at some specific time. For example a virus names as ‘INIT 1984’ used to infect the startup files of Mac OS whenever the 13th of any month falls on Friday. Michelangelo virus was a boot sector virus which used to sleep (remain inactive) until March 6. It used to explode on March 6 and performs several actions on the basis of certain conditions of your system. Another virus Nyxem destroys the files of Microsft Office and tries to stop the security and sharing related services on your computer on 3rd of each month. The famous Chernobyl virus which caused damage of millions of computers all around the word was written one year before its execution. It was delivered to the systems by a firmware update of Yamaha Inc. It exploded (executed) itself exactly on April 26, 1999 in the computers of all over the world and caused a historic damage.

Written by: Mian Zeshan Farooqi BS Software Engineering Punjab University College of Information Technology The reason honey is so easy to digest is that it’s already been digested by a bee.

17


E-MAG

FASTING In Medical Perspective Fasting is voluntarily not eating food for varying lengths of time. Fasting is used as a medical therapy for many conditions. It is also a spiritual practice in many religions. Fasting can be used for nearly every chronic condition, including allergies, anxiety, arthritis, asthma, depression, diabetes, headaches, heart disease, high cholesterol, low blood sugar, digestive disorders, mental illness, and obesity. Fasting is an effective and safe weight loss method. Fasting is thought to be beneficial as a preventative measure to increase overall health, vitality, and resistance to disease. Fasting is also used as a method of mental and spiritual rejuvenation. Through evolution, the body became very efficient at storing energy and handling situations when no food was available. For many centuries, fasting was probably a normal occurrence for most people, and the body adapted to it. It is estimated that even very thin people can survive for 40 days or more without food. The body has a special mechanism that is initiated when no food is eaten. Fasting is not starvation, but rather the body's burning of stored energy. Starvation occurs when the body no longer has any stored energy and begins using essential tissues such as organs for an energy source. Many physiological changes occur in the body during fasting. During the first day or so, the body uses its glycogen reserves, the sugars that are the basic energy supply. After these are depleted, the body begins using fat. However, the brain, which has high fuel requirements, still needs glucose (sugars converted from glycogen). To obtain glucose for the brain, the body begins to break down muscle tissue during the second day of the fast. Thus, during fasting some muscle loss will occur. To fuel the brain, the body would need to burn over a pound of muscle a day, but the body has developed another way to create energy that saves important muscle mass. This protein-sparing process is called ketosis, which occurs during the third day of a fast for men and the second day for women. In this highly efficient state, the liver begins converting stored fat and other nonessential tissues into ketones, which can be used by the brain, muscles, and heart as energy. It is at this point in the fast that sensations of hunger generally go away, and many people experience normal or even increased energy levels. Hormone levels and certain functions become more stable in this state as well. The goal of most fasts is to allow the body to reach the ketosis state in order to burn excess fat and unneeded or damaged tissue. Thus, fasts longer than three days are generally recommended as therapy. Weight loss occurs most rapidly during the first few days of a fast, up to 2 pounds per day. In following days, the figure drops to around 0.5 pound per day. An average weight loss of a pound a day for an entire fast can be expected. Fasts can be performed for varying lengths of time, depending on the person and his or her health requirements. For chronic conditions, therapists recommend from two to four weeks to get the most benefits. Roosters cannot crow if they cannot extend their necks.

18


E-MAG Seven-day fasts are also commonly performed. A popular fasting program for prevention and general health is a three-day fast taken four times per year, at the change of each season. These can be easily performed over long weekends. Preventative fasts of one day per week are used by many people as well. Fasts must be entered and exited with care. To enter a fast, the diet should be gradually lightened over a few days. First, heavy foods such as meats and dairy products should be eliminated for a day or two. Grains, nuts, and beans should then be reduced for several days. The day before a fast, only easily digested foods like fruits, light salads, and soups should be eaten. During the fast, only pure water and occasional herbal teas should be drunk. Fasts should be ended as gradually as they are entered, going from lighter to heavier foods progressively. The diet after a fast should emphasize fresh, wholesome foods. Fasters should particularly take care not to overeat when they complete a fast. Fasting isn't appropriate for everyone and, in some cases, could be harmful. Any person undertaking a first fast longer than three days should seek medical supervision. Those with health conditions should always have medical support during fasting. Plenty of water should be taken by fasters since dehydration can occur. Saunas and sweating therapies are sometimes recommended to assist detoxification, but should be used sparingly. Those fasting should significantly slow down their lifestyles. Taking time off of work is helpful, or at least reducing the work load. Fasters should also get plenty of rest. Exercise should be kept light, such as walking and gentle stretching. Those fasting may experience side effects of fatigue, malaise, aches and pains, emotional duress, acne, headaches, allergies, swelling, vomiting, bad breath, and symptoms of colds and flu. These reactions are sometimes called healing crises, which are caused by temporarily increased levels of toxins in the body due to elimination and cleansing. Lower energy levels should be expected during a fast. The physiology of fasting has been widely studied and documented by medical science. Beneficial effects such as lowered cholesterol and improved general functioning have been shown. Fasting as a treatment for illness and disease has been studied less, although some studies around the world have shown beneficial results. A 1984 study showed that workers in Taiwan who had severe chemical poisoning had dramatic improvement after a ten-day fast. In Russia and Japan, studies have demonstrated fasting to be an effective treatment for mental illness. Fasting has been featured on the cover of medical journals, although mainstream medicine has generally ignored fasting and detoxification treatments as valid medical procedures. The majority of research that exists on fasting is testimonial, consisting of individual personal accounts of healing without statistics or controlled scientific experiments. In the alternative medical community, fasting is an essential and widely accepted treatment for many illnesses and chronic conditions. Source: http://medical-dictionary.thefreedictionary.com/fasting

The color blue has a calming effect. It causes the brain to release calming hormones.

19


E-MAG

Independence Day Events Our beloved country, Pakistan, came into being on 14th of August, 1947 in the month of Ramadan after the great sacrifices of our elders. The Independence Day, i.e., 14th of August is celebrated with great zeal and enthusiasm by all Pakistanis. The different events are arranged to celebrate this day. The national anthem is sung at 7:55 am sharp in the whole country and a complete silence lasts for 2-3 minutes and people give standing devotion to show their love for the country. The main celebration takes place in Islamabad. The President and Prime Minister of Islamic Republic of Pakistan raise the flags at presidential and parliament buildings. They deliver speeches, which are telecasted, to enhance the feeling of love and patriotism in the hearts of the people. They urge on unity and define and set goals for the future of Pakistan in the words of the father of the nation, Quaid-e-Azam, bring "Unity, Faith and Discipline" to its people. Another, important event is the change of guards at the Mausoleum of the father of the nation, Mazar-e-Quaid, at Karachi and Wagha Border, Lahore. Both sides, i.e. Pakistan and India exchange prisoners who crossed borders by mistake. Flag Hoisting is also celebrated in every nook and corner of the country. People raise national flag at the top of their roofs. Children also play their role by printing stamps of flags on their shirts and they decorate their houses with the stickers and small flags. They also display badges of Muhammad Ali Jinnah; founder of the nation, Allama Iqbal; our national poet and national flag on their clothes to show their love and patriotism for their county. Different award and prize distribution, educational and cultural ceremonies are also arranged by the schools, colleges, universities, government and non-government organizations. Special programs related to freedom movement and Independence Day are telecasted on various T.V. channels. Different sports events are also arranged in the country for the welfare and betterment of sports. We will celebrate 62nd birthday of independence on coming 14th of August. Pakistan is a great blessing of Allah Almighty. We have got this homeland after the sacrifices and bloodshed of millions of the people of the subcontinent. Though, we should celebrate it with great enthusiasm but we should not forget that purpose of its creation. I pray to Allah Almighty that HE shower HIS blessings and bounties to our country and people living in it. May, GOD protect our country from all evils.

Written by: Naveed Hamid BS Software Engineering Punjab University College of Information Technology

Every time you sneeze some of your brain cells die.

20


E-MAG

The Earth and the Sky When the Wind Blows, And There's Lightening In the Sky, I Wonder I Could Know, Why the Clouds Cry, How the Earth Feels Their Sorrows, And Then Make Itself Dry, Like A Mother Wants Her Baby, To Be A Happy Guy, What’s The Grief They Share? For Such A Long Time, How Hurt the Clouds Are, No One Can Hear, What A Love Is There, Between The Earth and The Sky, That The Earth Never Bears, To Show the People, Their Never Ending Tears, Even If They Try…

Written by: Quratulain SQA Engineer ESP interactive solutions, Inc. Alumni S04, PUCIT

Your left lung is smaller than your right lung to make room for your heart.

21


E-MAG

Ding Dong Bell Ding dong bell Pussy's in the well Who put her in? Little Johnny Flynn Who pulled her out? Little Tommy Stout What a naughty boy was that Try to drown poor Pussycat, Who ne'er did any harm But killed all the mice In the Farmer's barn! "Ding Dong Bell" a poem with a moral theme: The origins of this nursery rhyme date back to the 16th century and the era of Shakespeare who used the phrase "Ding Dong Bell" in several plays. The original lyrics of "Ding Dong Bell" actually ended with the cat being left to drown! These words were modified and the cat was saved by 'Little Tommy Stout' to encourage children to understand that it was unacceptable and cruel to harm any animal 'who ne'er did any harm'. The latter version taught morality at an early age. "Ding Dong Bell" also introduces a child to onomatopoeia ( a word that sounds like its meaning) In this nursery rhyme the lyrics and words "ding dong" when pronounced convey the actual sounds! The Shakespeare Connection! The phrase " Ding Dong Bell" was used by William Shakespeare - but given the original drafts of Shakespeare plays were in Quarto text and the majority were not published until 1623 in the First Folio (7 years after his death) could the phrase actually be the writer's original instructions for sound effects? The Tempest, Act I, Scene II: "Sea nymphs hourly ring his knell: Hark! Now I hear them - Ding, dong, bell." The Merchant of Venice, Act III, Scene II: "Let us all ring fancy's bell; I'll begin it - Ding, dong, bell."

When you blush, the lining of your stomach also turns red.

22


E-MAG

Smile Please A boss asked one of his employees: â&#x20AC;&#x153;Do you believe in life after death?" "Yes, sir," replied the new employee. "I thought you would," said the boss. "Yesterday after you left to go to your grandmother's funeral, she stopped in to see you!"

While visiting a school, the chairman of the Board Of Education became provoked at the noise the unruly students were making in the next room. Angrily, he opened the door and grabbed one of the taller boys who seemed to be doing most of the talking. He dragged the boy to the next room and stood him in the corner. A few minutes later, a small boy stuck his head in the room and pleaded, "Please, sir, may we have our teacher back?"

Try to speak this text loud and fast: A Tudor who Tooted a Flute. How much Wood would a Woodchuck chuck. A Tree Toad loved a She-Toad. Swan swam over the Sea. A Flea and a Fly. Betty Botter. Peter Piper. She sells Sea Shells. Sheila Shorter. The seething sees ceaseth

Teacher: Where is your homework? Student: I lost it fighting this kid who said you weren't the best teacher in the school.

When hippos are upset, their sweat turns red.

23


E-MAG

A MBA and an Engineer go on a camping trip, set up their tent, and fall asleep. Some hours later, the Engineer wakes his MBA friend and asks: "Look up at the sky and tell me what you see?" The MBA replies, "I see millions of stars." The Engineer asks: "What does that tell you?" Don’t forget to brush your teeth twice a day

The MBA ponders for a minute: "Astronomically speaking, it tells me that there are millions of galaxies and potentially billions of planets. Astrologically, it tells me that Saturn is in Leo. Time wise, it appears to be approximately a quarter past three. Theologically, it's evident the Lord is all-powerful and we are small and insignificant. Meteorologically, it seems we will have a beautiful day tomorrow.

A woman will dress up when she goes shopping, empties the garbage, answers the phone, waters the plants, gets the mail and reads a book. A man will dress up for weddings and funerals.

What does it tell you?" The Engineer friend is silent for a moment, and then speaks. "Practically... Someone has stolen our tent".

Alternates are always there: “I couldn't repair your brakes, so I made your horn louder”

The lion that roars in the MGM logo is named Volney.

Old Age Smart Phone

24


E-MAG

N o t h i n g

i s

i m p o s s i b l e . . .

Challenge A:

For C/C++ Programmers

We’ve an array of integers with name numbers and size 100. We take input from user in this array for all 100 elements. You’ve to simply add logical line of code in the following code such that the following code should display the sum of all user given numbers. Isn’t it simple? Here’s the code: #include <iostream.h> void main () { int numbers[ 100 ]; int sum = 0; for( int i = 0; i < 100; i++ ) cin>>numbers[ i ]; // write your line below this comment cout<<sum; }

Note that for( int i = 0; i < 100; i++ ) cin>>numbers[ i ]; is a single physical line of code but these two logical lines of code. You’ve to add one logical line of code below the comments rather than a physical line of code.

Google is actually the common name for a number with a million zeros.

25


E-MAG

Challenge B:

For C/C++ Programmers

You’ve to write a header file magix.h containing a single function named as sum. Your function should receive some integers as parameters; add them and return their sum. A programmer would simply include your header file magix.h and call the function sum with as many (integer) parameters as he wants with the following constrains: a. b. c. d.

All parameters would of int type. All parameters would be non zero except the last one. The last integer would always be a zero (its value would be 0). Programmer may also call the function without any parameter.

In the light of above mentioned constrains, the following function calls would be valid: Function call sum(); sum(0); sum( 1, 0 ); sum( 9, -1, 123, 0 ); sum( -1, 2, 3, 4, 5, 0); sum( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0 );

Return Value 0 0 1 131 13 105

Programmer may also call the function with more parameters. Keep in mind the following Don’ts while writing magix.h: i. ii. iii.

Don’t take integer array as a parameter because user will pass non array variables. Don’t write more than one function in your file magix.h other than sum function. Don’t use any user defined header file.

A sample code given here shows how programmer will use your file. Here’s the output of given code: 0 1 6

#include <iostream.h> #include “magix.h” void main () { cout<<sum()<<endl; cout<<sum( 1, 0 )<<endl; cout<<sum( 1, 2, 3, 0 )<<endl; }

Switching letters is called spoonerism. For example, saying jag of Flapan, instead of flag of Japan.

26


E-MAG

Challenge C:

Logic

See the given image on the right hand side (BCP.C.1). This is not only an image, actually there’s something written here with some logic. You’ve to find out that logic and also guess that what is actually written here with that logic. You’ve to tell us both the logic and the actual text. BCP.C.1

Challenge D:

Logic

Three masters of logic (persons with really strong logic) wanted to find out, who is the wisest one. So they invited the grand master, who took them into a dark room and said: “I will paint each one of you a red or a blue dot on forehead. When you walk out and you will see at least one red point, hands-up. Who says what color is the dot on his own forehead as first, wins.” Then he painted only red dots on every one. When they went out everybody had their hands up and after a while of killing thinking one of them said: “I have a red dot on my head.” He is correct but how could he be so sure? Submit the Solutions: Dear Readers! There is a broader time span to submit the solutions of BIG CHALLENGES! You can submit your solutions till October 31, 2009. The solutions will be published in November’s edition of E-MAG with the name of those people who submitted the correct solutions. Don’t give up. Try to solve these challenges! You can do it! You can send your solutions till October 31, 2009 at the following email address:

editor@emagportal.com

It cost 7 million dollars to build the Titanic and 200 million to make a film about it.

27


E-MAG

LOGICAL PUZZLES

Solutions

By Saad Ahmed

Christmas Tree There are 2 possible solutions: 1. If angels B and C had aureole of the same color, then angel A must have immediately said his own color (other than theirs), 2. If angels B and C had different colors, then angel A must have been silent and that would have been a signal for angel B, who could know (looking at angel C) what his own color is (the other one then C had).

Trains Of course, when the trains encounter, they will be approximately the same distance away from New York. The New York train will be closer to New York by approximately one train length because they're coming from different directions. That is, unless you take "meet" to mean "perfectly overlapped".

Belt The original length of belt was 96 cm.

Apples 4 kids get an apple (one apple for each one of them) and the fifth kid gets an apple with the basket still containing the apple.

Well Done!

Correct Solutions Submitted by: Quratulain - BCSS04A055 - PUCIT Naseem Rafiq - BCSF06A028 - PUCIT

The attachment of the human skin to muscles is what causes dimples.

28


E-MAG

SUDOKU

Solutions

2

4

7

8

3

5

1

6

9

5

1

3

6

9

2

8

4

7

6

9

8

4

7

1

2

3

5

8

7

1

3

6

9

5

2

4

9

5

4

1

2

8

3

7

6

3

6

2

7

5

4

9

8

1

1

8

9

2

4

6

7

5

3

4

3

5

9

8

7

6

1

2

7

2

6

5

1

3

4

9

8

Correct Solutions Submitted by:

Well Done!

 Asma Kaleem - BITS06M023 - PUCIT  M Shuaib Imran - BITF06M004 - PUCIT  Muhammad Luqman Zafar - BSEF07A017 - PUCIT  Muhammad Rizwan Asghar - BCSS02A023 - PUCIT  Saima Irfan - MCSF01M034 - PUCIT

There are 1,792 steps to the top of the Eiffel Tower.

29


E-MAG

SUDOKU

5

8 3

4

5 9

2

5 7

9

4

9 1

1

7

4

8 3

6 5

4

6

2

8 1

7

3

3 5

5 8

9 6

2

4

8

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 August 31, 2009 at editor@emagportal.com Your name would be published in next edition of E-MAG if you submit correct solution.

The sound you hear when you crack your knuckles is actually the sound of nitrogen gas bubbles bursting.

30


E-MAG Solutions

Programming Challenges By Mian Zeshan Farooqi

Make the following code of C++ correct without changing any single character. However youâ&#x20AC;&#x2122;re allowed to add some code in the following code to make it work properly. #include <iostream.h> #include <conio.h> typedef void VOID; typedef int Integer; VOID main () { Integer a, b, ans; cout<<"Enter two numbers:\t"; cin>>a>>b; ans = a + b; cout<<ans; }

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. #include<iostream.h> void main() { cout<<"Capacity of int :\t"<<sizeof(int)*8<<"bits"<<endl; cout<<"Capacity of long:\t "<<sizeof(long)*8<<"bits"<<endl; }

Note: Order of problems is changed to adjust the solutions on page. Human hair and fingernails continue to grow after death.

31


E-MAG 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). #include <iostream.h> void main() { unsigned int number, even = 0, odd = 0, temp; cout<<“Enter a positive number:\t”; cin>>number; if( number == 0 ) even++; while( number > 0 ) { temp = number % 10; if ( temp % 2 == 0 ) even++; else odd++; number = number / 10; } cout<<"This number has:"<<endl <<even<<" even digits and "<<endl <<odd<<" odd digits."; }

Well Done! Correct Solutions Submitted by:  M Shuaib Imran - BITF06M004 - PUCIT  Muhammad Luqman Zafar - BSEF07A017 – PUCIT  Samia Amjad – BITF08M036 - PUCIT

It takes about 20 seconds for a red blood cell to circle the whole body.

32


E-MAG

Programming Challenges By Mian Zeshan Farooqi 1. Prompt the user to enter an even number. If user enters an even number then display “Very Good!” otherwise display “Don’t you the difference between Evens and Odds?” There is a restriction in this problem. You’re not allowed to use if-else statements or a trinary operator. The rest of the problem is quite simple and clear. For more clearity see the following sample output screens:

Enter an even number: 8 Very Good!

Enter an even number: 3 Don’t you the difference between Evens and Odds?”

2. You might be aware of the function getch(). getch() and getche() gets a character as an input. Usually we use these functions to pause the execution of our program. For example we usually use getch() as the last statement in our program so that user can read the text on output screen and presses some key to terminate the program. See the following code: #include <iostream.h> #include <conio.h> void main () { cout<< “This text will remain on screen until you don’t press some key”; getch(); }

Understand the behavior of above program and write a program which should behave same like as the above program. But you’re not allowed to use getch() or getche() function. Your program should terminate after a single key stroke. Note: Solution will be published in next edition. Submit your solutions at editor@emagportal.com before August 31, 2009. Your name would be published in next edition of E-MAG if you submit correct solution. The plastic things on the end of shoelaces are called aglets.

33


E-MAG Answer

Guess the Location

Punjab Assembly Hall Guessed Correctly By:          

Abbas Ali Butt - BCSF04A020 - PUCIT Abdul Salam - BSEF07A026 - PUCIT Adnan Ramzan - BITF07A005 - PUCIT Asma Kaleem - BITS06M023 - PUCIT Asma Wakeel - BCSF06M051 - PUCIT Farooq Ahmad - Lab Supervisor - GCU Khadija Arshad - BITF06M052 - PUCIT Khaldoon Masud - Alumni BCSF04 - PUCIT Maher Usman Altaf - MS(TS) - UCP Moneeb Ahmed - BITS06A013 - PUCIT

        

Muhammad Awais Dilber - BCSF06A046 - PUCIT Muhammad Bilal Asghar - BSEF08A023 - PUCIT Muhammad Luqman Zafar - BSEF07A017 - PUCIT Muhammad Rizwan Asghar - BCSS02A023 - PUCIT Nimra Humayun - MECF06E021 - PUCIT Quratulain - BCSS04A055 - PUCIT Sami Haroon - GCU Syed Khalid Hayat - Alumni S04 - PUCIT Usman Aslam - Alumni - PUCIT

Well Done! Most soccer players run 7 miles in a game.

34


E-MAG

Guess the Location

Note: Answer will be published in next edition. Submit your answer at editor@emagportal.com before June 30, 2009. Your name would be published in next edition of E-MAG if you submit correct answer.

Intelligent people have more zinc and copper in their hair.

35


E-MAG

Polymorphism â&#x20AC;&#x201C; In depth

Episode # 4

A different perspective on polymorphism

Run Time Polymorphism Some points to ponder (continued): 6. The virtual function mechanism works only with public derivation. 7. The virtual function mechanism doesnâ&#x20AC;&#x2122;t work with private derivation. class base { public: virtual void fun() {} }; class derive: private base { public: void fun() {} }; void main() { base *pb = new derive;

// illegal: conversion from 'class derive *' to 'class //base *' does not exists base *pb=(base*) new derive; //Legal: now pb->fun() resolves to pb->fun(); //derive::fun()

} 8. But what about this? class base The average person laughs 13 times a day.

36


E-MAG

{ public: virtual void fun() {} }; class derive: private base { public: void fun() { base *pb = new derive; pb->fun(); } };

//Legal

REASON: The main function is just like a client which is using base and derive class. So, a client can’t access private part of a class that is why client can’t manipulate derive class object using its base class pointer (privately inherited). 9. The virtual function mechanism doesn’t work with protected derivation. class base { public: virtual void fun() {} }; class derive: protected base { public: void fun() {} }; Women blink nearly twice as much as men.

37


E-MAG

void main() { base *pb = new derive; // illegal: conversion from 'class derive *' to 'class //base *' exists, but is inaccessible base *pb=(base*) new derive; //Legal: now pb->fun() resolves to pb->fun(); // derive::fun() } 10. But what about this? class base { public: virtual void fun() };

{}

class derive: protected base { public: void fun() { base *pb = new derive; //Legal pb->fun(); } }; REASON: The same reason as in point 8, the difference is that the ‘class base’ can be further inherited in a class derived from ‘class derive’.

Written by: Fareed ul Hassan Baig Lecturer Punjab University College of Information Technology University of the Punjab, Lahore

German Shepherds bite humans more than any other breed of dog.

38


E-MAG

Learning C++ By Mian Zeshan Farooqi In this episode we’ll start learning the iteration structures which are commonly known as loops. We can execute a single statement or a block of statements for several times using loop structures. There’re three types of loops in C++: for, while and do-while. This episode will cover the contents of for loop. The general syntax of repeating a single statement using for loop is: for(initialization; expression; increment) statement; The general syntax of repeating a single statement using for loop is: for(initialization; expression; increment) { statements…. } for is keyword of C++. You can see that there’re three parts of a for loop i.e. initialization, expression and increment. Each part is separated by a semicolon. Initialization: In this part we initialize a variable (usually known as loop control variable) with some value. Expression: This is a conditional expression. The loop will keep on iterating until the given expression is true. Increment: It determines that how much increment should be made in the loop control variable after each iteration. See the following example: #include <iostream.h> void main () { int i; for( i = 1; i <= 10; i++ ) cout<<i<<endl; }

The above code prints counting from 1 to 10. You can see that we’ve initialized variable i with value 1; expression is i <= 10 and the increment is i++ (i.e. i = i + 1). Whip makes a cracking sound because its tip moves faster than the speed of sound.

39


E-MAG Note that we’ve declare the loop control variable outside the loop. We can also declare this variable in the for loop like this: for( int i = 1; i <= 10; i++ ) According to the rules of language, the scope of i in the above example should be limited to the loop’s body i.e. loop’s statement or block of statements. But practically, in most compilers, the scope of this variable is extended to the whole function. In the above example you can see that the loop’s expression is consisted of the loop control variable. It is not necessary to do so. You can write any expression in loop according to your scenario. See the following example which prints counting (starting from 0) until user enters a negative number. #include <iostream.h> void main () { int num = 1; for( int i = 1; num > 0; i++ ) { cout<<i<<endl; cin>>num; } } You can also write compound expressions in a loop. Let’s modify the above example and limit the counting to 100 and user’s input. #include <iostream.h> void main () { int num = 1; for( int i = 1; i <= 100 && num > 0; i++ ) { cout<<i<<endl; cin>>num; } } The above loop will terminate if i becomes greater than 100 or user enters a negative number.

The human heart creates enough pressure while pumping to squirt blood 30 feet!!

40


E-MAG Now let’s write a program which prints the counting until the square root of user given input is less than 9. #include <iostream.h> #include <math.h> void main () { int num = 1; for( int i = 1; sqrt(num) < 9; i++ ) { cout<<i<<endl; cin>>num; } } The above example demonstrates that you can make a function call to evaluate a loop’s expression. sqrt() is a standard function defined in math.h header file. You can use multiple variables in a loop. Let’s see the following example: for( int i = 0, j = 10; i != j; i++, j-- ) cout<<i<<‘ ’<<j<<endl; You can see that we’ve declared and initialized two variables in initialization part. The expression part is consisted of a single expression. The increment part performs increment in one variable (i.e. positive increment) and decrement in other variable (i.e. negative increment). The loop with positive increment (or simply increment) is known as forward loop while the loop with negative increment (decrement) is also known as backward loop. Now let’s see some more variations of for loop. We can keep one or more parts of a for loop empty. Let’s see how. All of the following loops are valid in C++. for(; i < 10; i++ ) statement;

for( i = 0; i < 10; ) statement;

for(; i < 10 ;) statement;

for( i = 0; ; i++ ) statement;

for(i = 0; ;) statement;

for( ; ; i++ ) statement;

The ant can lift bodies 10 times its own weight.

41


E-MAG Episode # 6

Even the following form of a for loop is also valid: for(;;) statements ;

There are many scenarios in which we do not need to write the body of for loop. We simply put a semicolon at the end of such loops to make them a single but iterative statement. Let’s take an example from the real world. If you say a child to write counting from 1 to 10 then he’ll start from 1 and keep on adding and writing the numbers. Its code would be like this: for( int i = 1; i <= 10; i++ ) cout<<i; Now consider the Hide ‘n Seek game. The person who has to find others simply counts from (say) 1 to 20. After that he starts finding his fellows. During this counting he does nothing. So if we code this scenario then it would be like this: for( int i = 1; i <= 20; i++ );

The above loop declares and initializes the variable i with 1 and keep on adding 1 into it until it becomes 20. During this process the loop is not executing any other statement. Now let’s see an example which demonstrates the same work with two different methods: int y = 2; for( int i = 1; i <= 10; i++ ) { y = y * i; cout<<‚Iteration No.:‛<<i; }

for( int i=1, y=2 ; i <= 10; i++, y=y*2 ) cout<<‚Iteration No.:‛<<i;

Both of the above loops are doing the same work but we’ve reduced the lines of code in the second one. You’ve seen that for loop is a very flexible structure. You can mold it in your own way and use it with ease to fulfill your requirements.

Author’s Note: If you need any kind of help regarding C++ then feel free to contact me at zeshan.farooqi@yahoo.com Every minute 300 million body cells die and are replaced by new healthy cells.

42


E-MAG

Explore With Me By Mian Zeshan Farooqi

Break Statement What: break is a keyword of C/C++ Where: break statement is used inside the blocks of statements of for, while, do-while and switch. Why: break statement is used to bring the control out of the block of for, while, do-while and switch controls. How: break statement skips the execution of all successive statements of its block (the block in which break is written) and moves the control outside that block. Examples: int i = 8; while( i < 10 ) { cout<<”Hello”; break; cout<<”World”; getch(); } cout<<”End”;

In this example the control will first declare a variable i and initialize it value 8. As the loop’s expression is true so the control will enter the block of while loop. It will print Hello on screen. Next the control will encounter with the break statement, therefore the break statement will immediately move the control outside this block of while loop. Hence control will never reach cout<<”World”; and getch(); statement. So the output of the above code would be simply HelloEnd. An elephant trunk has no bones but it has 40,000 muscles.

43


E-MAG

Tips and Tricks How to Boot Windows速 XP Fast?

Submitted by: Muhammad Junaid Butt

Follow the following steps 1. Open notepad.exe, type "del c:\windows\prefetch\ntosboot-*.* /q" (without the quotes) & save as "ntosboot.bat" in c:\ 2. From the Start menu, select "Run..." & type "gpedit.msc". 3. Double click "Windows Settings" under "Computer Configuration" and double click again on "Shutdown" in the right window. 4. In the new window, click "add", "Browse", locate your "ntosboot.bat" file & click "Open". 5. Click "OK", "Apply" & "OK" once again to exit. 6. From the Start menu, select "Run..." & type "devmgmt.msc". 7. Double click on "IDE ATA/ATAPI controllers" 8. Right click on "Primary IDE Channel" and select "Properties". 9. Select the "Advanced Settings" tab then on the device or 1 that doesn't have 'device type' greyed out select 'none' instead of 'autodetect' & click "OK". 10. Right click on "Secondary IDE channel", select "Properties" and repeat step 9. 11. Reboot your computer.

Google Tips

By: Mian Zeshan Farooqi

While using Google web pages if you need to perform some calculations, unit conversions, currency conversions, etc...Then Google search bar is enough for this. See the following examples. You just need to type in your query in the search bar of Google and see the results without opening any external website. Calculator: 5+4+1+2 or perform some advance calculations like this 5 + 2*(sqrt 9) ^ 3 Unit Conversion: 1 cm in inches or 12.5 feet in km or 91 liters in gallons Currency conversion: 1 USD in PKR or 12 PKR in EURO Turtle can live for more than 200 year.

44


E-MAG

Software of the Month ADOBE Photoshop CS4 Extended Adobe® Photoshop® CS4 Extended software delivers all the features in Photoshop CS4, plus new features for working with 3D imagery, motionbased content, and advanced image analysis. With its latest version, Photoshop CS4 Extended, Adobe has completely re-created Photoshop’s user interface and thoroughly modernized the program for users and the Web world. For its AEC users Photoshop Extended has added a completely redesigned, more powerful 3D modeling engine. Veteran set of powerful imaging tools; streamlined user interface; more extensible and customizable; completely overhauled 3D engine in Extended version. More of a memory hog than Photoshop CS3; print features and type engine still in dire need of an update. If you work with 3D, Photoshop Extended is a must-have upgrade; ditto if you think you'd use more of Standard's tools if the interface were less opaque, if you need to upgrade other suite applications, or if you qualify for an academic discount. All things considered, while Adobe Photoshop CS4 makes some improvements over CS3, it might be worth skipping this generation and waiting for the next.

System Requirements:      

1.8 GHz or faster processor Microsoft Windows XP with Service Pack 2 or higher 512MB of RAM (1GB recommended) 1GB of free space on hard disk 1,024x768 display (1,280x800 recommended) with 16-bit video card Some GPU-accelerated features require graphics support for Shader Model 3.0 and OpenGL 2.0

Direct link: http://www.adobe.com/products/photoshop/photoshopextended

Source: Adobe.com

The strongest muscle in the body is the tongue.

45


E-MAG

Useful Links By Dilawer Hussain

Monster.com Monster.com is an employment website owned by Monster Worldwide. Monster is one of the 20 most visited websites out of 100 million worldwide, according to comScore Media Metrics (November 2006). It was created in 1999 by the merger of The Monster Board (TMB) and Online Career Center (OCC), which were two of the first and most popular career web sites on the Internet. Monster is primarily used to help those seeking work to find job openings that match their skills and location.

Nationalgeographic.com National Geographic provides free maps, photos, videos and daily news stories, as well as articles and features about animals, the environment, cultures. The National Geographic website (nationalgeographic.com) provides a wealth of content in multimedia formats, including a recently launched site highlighting world music.

Bitpipe.com Bitpipe.com is the enterprise IT professional's guide to information technology resources. Browse this free online library for the latest technical white papers, webcasts and product information to help you make intelligent IT product purchasing decisions.

It is physically impossible for pigs to look up into the sky.

46


E-MAG

The Constitution of

Episode # 5

The Islamic Republic of Pakistan

Article 9:

Security of person

9. Security of person: No person shall be deprived of life or liberty save in accordance with law.

Article 10:

Safeguards as to arrest and detention

10. Safeguards as to arrest and detention: (1) No person who is arrested shall be detained in custody without being informed, as soon as may be, of the grounds for such arrest, nor shall he be denied the right to consult and be defended by a legal practitioner of his choice. (2) Every person who is arrested and detained in custody shall be produced before a Magistrate within a period of twenty-four hours of such arrest, excluding the time necessary for the journey from the place of arrest to the Court of the nearest Magistrate, and no such person shall be detained in custody beyond the said period without the authority of a Magistrate. (3) Nothing in clauses (1) and (2) shall apply to any person who is arrested or detained under any law providing for preventive detention. (4) No law providing for preventive detention shall be made except to deal with persons acting in a manner prejudicial to the integrity, security or defence of Pakistan or any part thereof, or external affairs of Pakistan, or public order, or the maintenance of supplies or services, and no such law shall authorise the detention of a person for a period exceeding 1[three months] unless the appropriate Review Board has, after affording him an opportunity of being heard in person, reviewed his case and reported, before the expiration of the said period, that there is, in its opinion, sufficient cause for such detention, and, if the detention is continued after the said period of 1[three months], unless the appropriate Review Board has reviewed his case and reported, before the expiration of each period of three months, that there is, in its opinion, sufficient cause for such detention. Explanation I: In this Article, "the appropriate Review Board" means, (i).

in the case of a person detained under a Federal Law, a Board appointed by the Chief Justice of Pakistan and consisting of a Chairman and two other persons, each of whom is or has been a Judge of the Supreme Court or a High Court: and

A snail can sleep for three years.

47


E-MAG (ii).

in the case of a person detained under a Provincial Law, a Board appointed by the Chief Justice of the High Court concerned and consisting of a Chairman and two other persons, each of whom is or has been a Judge of a High Court.

Explanation II: The opinion of a Review Board shall be expressed in terms of the views of the majority of its members. (5) When any person is detained in pursuance of an order made under any law providing for preventive detention, the authority making the order shall, 2[within fifteen days] from such detention, communicate to such person the grounds on which the order has been made, and shall afford him the earliest opportunity of making a representation against the order: provided that the authority making any such order may refuse to disclose facts which such authority considers it to be against the public interest to disclose. (6) The authority making the order shall furnish to the appropriate Review Board all documents relevant to the case unless a certificate, signed by a Secretary to the Government concerned, to the effect that it is not in the public interest to furnish any documents, is produced. (7) Within a period of twenty-four months commencing on the day of his first detention in pursuance of an order made under a law providing for preventive detention, no person shall be detained in pursuance of any such order for more than a total period of eight months in the case of a person detained for acting in a manner prejudicial to public order and twelve months in any other case:

Provided that this clause shall not apply to any person who is employed by, or works for, or acts on instructions received from, the enemy 3[or who is acting or attempting to act in a manner prejudicial to the integrity, security or defence of Pakistan or any part thereof or who commits or attempts to commit any act which amounts to an anti-national activity as defined in a Federal law or is a member of any association which has for its objects, or which indulges in, any such anti-national activity]. (8) The appropriate Review Board shall determine the place of detention of the person detained and fix a reasonable subsistence allowance for his family. (9) Nothing in this Article shall apply to any person who for the time being is an enemy alien.

Butterflies taste with their feet.

48


E-MAG

MAG NEWS

P S

UCIT (Punjab University College of Information Technology) will announce the result of Spring 2009 semester, in the second week of August 2009. This is not an official statement and collected from our own resources.

upport for Windows XP Service Pack 2 (SP2) will end on July 13, 2010. This date was established when Windows XP Service Pack 3 (SP3) was released on April 21, 2008. This announcement is in line with the Microsoft Support Lifecycle policy for Windows service packs. This policy states that when a new service pack is released, Microsoft will provide 24 months of support for the previous service pack for products that belong to the Windows product family. (Microsoft Official Website)

G

oogle Code Jam 2009 is coming up. This year's contest will consist of a qualification round followed by 3 full online rounds, culminating in a 25-person final in our Mountain View, California headquarters. We're still choosing the exact times for everything, but here's our tentative schedule:

Early-Mid August: Registration will open. +4 Weeks: Qualification round +1 Week: Rounds 1A, 1B, 1C +1 Week: Round 2 +1 Week: Round 3 November: World Finals in Mountain View Online rounds begin soon, so start practicing! (Google Code Jam Official Website)

An Ostrichâ&#x20AC;&#x2122;s eye is bigger than its brain.

49


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

E-MAG (6th edition)  

E-MAG (6th edition)

Read more
Read more
Similar to
Popular now
Just for you