Friday, July 3, 2009

Practical Programming: An Introduction to Computer Science Using Python

Practical Programming: An Introduction to Computer Science Using Python

Authors: Jennifer Campbell, Paul Gries, Jason Montojo, and Greg Wilson
Format: Paperback, 350 pages
Publisher: Pragmatic Bookshelf; 1st edition (May 28, 2009)
ISBN-10: 1934356271
ISBN-13: 978-1934356272

According to wordnetweb.princeton.edu, Computer Science is "the branch of engineering science that studies (with the aid of computers) computable processes and structures". It's the study of computer architectures, languages, and mathematical structures as applied to the process of computing. So what have Campbell, et al produced in this book...a Computer Science textbook that teaches Python? Kind of. Imagine you wanted to learn how the computer is used in the various scientific disciples. Further, you wanted to learn how computer programs and programming is used in this context to construct tools, perform investigations, and to solve problems. You also want to use a single programming language as your example. Welcome to "Practical Programming: An Introduction to Computer Science Using Python". Not a book about learning Python as such, but an introduction to the discipline of Computer Science with Python as your guide.

Yes, it is a text book. Page 5 in the Introduction has a For Instructors section which should be a clue. Code samples and installation instructions for the class are available for download at the book's website. New as this book is, there's already entries in the Errata section, and as with other Pragmatic books, there's a discussion forum available for questions and comments, which will come in handy for teacher and student alike.

This really is a book that starts at the beginning, even to the point of describing a prompt in a python shell on page 9. Sections in Chapter 2 include Expressions and What is a Type, so the reader isn't presumed to know Python or programming at all. Like any other textbook of worth, there are exercises at the end of each chapter. Also like many textbooks, the information is presented in a rather "dry" manner, so don't expect to be entertained. Please keep in mind that this is a textbook and the target audience is a beginning Computer Science class. Class instructors are the most likely subset of the audience to be commenting about the book at this point, since they are using the book to educate their students in the fundamentals of Computer Science (which leaves me out since I'm not an instructor, but I'll do the review anyway).

The book doesn't contain any surprises. Ultimately, it teaches beginning concepts in computer programming and as such, takes the reader along the elements of learning programming. As I mentioned before, Python is the "example" language, but the student is really supposed to be learning programming principles in general, not just Python programming principles. I must admit that Python was a good choice for this task as a language to learn from, plus it has a great deal of power and scalability. Thus the Python skills learned by the student will serve him or her in future classes and in a programming career.

If you want to buy this book as an individual to teach yourself the content, it will still work, but you won't have the support of an instructor or a class. You can use the aforementioned discussion group at the Pragmatic site to ask questions and review any issues or shortcomings you discover (such as packages requiring Python 2.5 be installed on your computer in order to work).

Many of the programming books I review contain at least a little humor to help break the monotony of the topic being taught, but don't expect to get any laughs out of this book. Campbell and company have written this text to be "all business". If used in the classroom, the instructor or the resident "class clown" will need to provide any required distractions or levity. Perhaps this is because this book is for a beginning Computer Science class and needs to take itself very seriously. I suspect that the publisher imposed this style of writing as part of the requirements for this series. In real life, in sure the authors are very funny.

This is a beginner's book, so don't expect to learn everything there is to know about Computer Science or the Python programming language. It's just one class, intended to be taught in semester one of year one of a university student's academic career (though it could also be used in a High School class of similar nature). The later chapters do touch on Object-Oriented Programming, Graphical User Interfaces, and Databases, so by the end of the course, the student should be prepared to move on.

Appendix A is the book's Bibliography, so you can see the sources drawn upon and, if you're using this book independently, determine what other books you might want to add to your library. Many of the sources are other traditional textbooks, but a few are more widely used references such as O'Reilly's Learning SQL.

If you don't anticipate using this textbook in an Introduction to Computer Science class, but are intending to enter into such a program, this book would fit nicely in your summer reading list, giving you a leg up on the course work. Since a large part of what you are supposed to be learning is the process of computing, exposing yourself to the principles early can only help. That, and as a standard classroom textbook, is the best use I can think to make of "Practical Programming: An Introduction to Computer Science Using Python".

New Swiss Airplane to fly 24×7 on sun juice; is Solar finally coming of age?

New Swiss Airplane to fly 24×7 on sun juice; is Solar finally coming of age?



A new Swiss aircraft will be the first to fly night and day without the need for any external source of energy. All its power needs will be met by the nearly 12,000 solar cells mounted on top of its wings. And those are pretty large wings too, mind you. The span is about the same as a Boeing 747, which stands at about 229 feet.

Data collection from mobiles- new possibilities

Data collection from mobiles- new possibilities


Mobile phones provide new ways to gather information, both manually and automatically, over wide areas.

If your mobile phone could talk, it could reveal a great deal. Obviously it would know many of your innermost secrets, being privy to your calls and text messages, and possibly your e-mail and diary, too. It also knows where you have been, how you get to work, where you like to go for lunch, what time you got home, and where you like to go at the weekend. Now imagine being able to aggregate this sort of information from large numbers of phones. It would be possible to determine and analyse how people move around cities, how social groups interact, how quickly traffic is moving and even how diseases might spread. The world’s 4 billion mobile phones could be turned into sensors on a global data-collection network.

They could also be used to gather data in more direct ways. Sensors inside phones, or attached to them, could gather information about temperature, humidity, noise level and so on. More straightforwardly, people can send information from their phones, by voice or text message, to a central repository. This can be a useful way to gather data quickly during a disaster-relief operation, for example, or when tracking the outbreak of a disease. Engineers, biologists, sociologists and aid-workers are now building systems that use handsets to sense, monitor and even predict population movements, environmental hazards and public-health threats.

A good example is InSTEDD (Innovative Support to Emergencies, Diseases and Disasters), a non-profit group based in California, which promotes the use of mobile phones to improve developing countries’ ability to respond to disasters. Launched with seed money from Google’s philanthropic arm and the Rockefeller Foundation in late 2007, it has just released a suite of open-source software to share, aggregate and analyse data from mobile phones. Its first test-bed is Cambodia, where health-workers can send text messages, containing observations and diagnoses, to a central number.

The sender’s location is determined for each of the messages, which pop up as conversation threads on an interactive map that can be called up on the web. Clicking on this map allows text messages to be sent back to users in the field from the control centre. InSTEDD says this service, called GeoChat, enables “geospatial ground-truthing, as your mobile team works to confirm, refute, or update data”.

Automating the reporting of titbits from remote clinics has already had a profound impact, says Eric Rasmussen, InSTEDD’s chief executive. Instead of recording information on scraps of paper, which would sometimes take days to reach higher-ups and trigger an alarm, the cycle-time has been reduced to days or even hours. GeoChat has been officially adopted by the six countries which share a border in the Mekong Basin, including Myanmar and Yunnan province in China, establishing a flow of real-time disease data from villages in the region to each country’s health ministry. Authorities can then choose to share this information with international bodies such as America’s Centres for Disease Control and Prevention (CDC) or the World Health Organisation. The aim is to enable a quick response to any outbreak of avian flu, cholera, malaria or dengue fever. InSTEDD is helping aid organisations and government agencies deploy its free tools in other countries, including Bangladesh, Peru and Tanzania.

An alternative approach is to gather information passively from mobile phones, without any user intervention. Alex Pentland, a computer scientist at the Massachusetts Institute of Technology, dreams of “X-raying entire organisations, cities and countries” by collecting data in two ways. First, some handsets can capture information about individuals, such as their activity levels or even their gait, using built-in motion sensors. (Modern handsets use these sensors to work out whether to display information in landscape or portrait format.) Second, information from mobile-network operators, which keep track of handsets in order to pass them smoothly from one network cell to another, can provide a high-level view of how people move around. Dr Pentland’s algorithms can even cluster information from thousands of phones to divide people into “tribes” of like-minded folk. He calls this “reality mining”.

Following the crowd
Sense Networks, a company co-founded by Dr Pentland, wants to use the predictions derived from tracking mobile phones not only for commercial purposes—to produce real-time maps showing the most popular nightlife venues in a particular city, for example—but also for the public good. The company’s charitable foundation is working with Vodafone, a big mobile operator, the CDC and other collaborators to build an early-warning system for modelling and predicting the spread of tuberculosis in South Africa.
As a first step, Sense plans to collect positional information from a control group of infected patients being treated at Helen Joseph Hospital in Johannesburg who would have to volunteer to participate in the scheme. Dr Pentland and his colleagues will then be able to determine which neighbourhoods these patients frequent, and their commuting patterns between them. They hope this will then enable them to work out the characteristics of typical TB patients, so that they can then spot potentially infected people in the wider population. How public-health officials will use this information has yet to be decided: people who are thought to be infected could be contacted by text message and asked to visit a doctor, for example.

Path Intelligence, a British firm, is applying a similar approach to answer more commercial questions. Its FootPath system aggregates and analyses signals picked up from mobile phones as people move through a particular area. The results can be used by planners to optimise the flow of pedestrians through railway stations and airports or to guide the layout of shopping centres. It can determine, for example, whether customers who visit a given shop also visit a rival shop. The same passive method can be used to figure out where best to locate emergency exits, and even to locate clusters of survivors after a disaster.

But some people find the idea of having their movements tracked in this way unsettling, even when the data are anonymised and aggregated. And knowing someone’s position is not enough on its own to determine whether they carry a disease or would be interested in going to a particular nightclub. So the best approach may be to combine voluntary (but potentially unreliable) contributions that are submitted manually with automated data capture that does not require user intervention, but may not capture the whole picture. A good example is the study of well-water contamination in Bangladesh conducted by Andrew Gelman, a statistician at Columbia University. His project combined readings from remote water-sensors with queries and data which villagers keyed into their mobile phones.

On a grander scale, InSTEDD’s Dr Rasmussen is trying to stitch together a global network, tentatively dubbed Archangel, to combine all manner of data sources, from satellite imagery and seismic sensors to field-workers texting from refugee camps. A first glimpse of what such a network would look like is pachube.com, an experimental web-service launched in 2007 by Usman Haque, an architect based in London. He aims to patch together sensors and people into a “conversant ecosystem” of devices, buildings and environments.

Path Intelligence

Watching while you shop
Some computer scientists look forward to the day when mobile phones and sensors can provide a central nervous system for the entire planet. An abundance of sensors, they believe, will lead to two things. First, the amount of data will increase, allowing scientists to build more realistic models. Alessandro Vespignani of Indiana University compares the current state of affairs to weather forecasting a century ago, before satellites had provided meteorologists with the data to build and optimise mathematical models. When it comes to problems such as tracking and predicting the spread of diseases and other environmental hazards, he argues, scientists can never get enough data.

The human touch
Second, once people are able to contribute data to research projects from their mobile phones, it could provide an ideal way to broaden public involvement in scientific activities. This would be the next logical step after the popularity of web-based participation in scientific research, from folding proteins to categorising photographs of galaxies. Eric Paulos, a computer scientist at Carnegie Mellon University in Pittsburgh, predicts the rise of “citizen scientists” able to measure and sample their surroundings wherever they go. When people can report mundane variables such as the level of traffic noise in their street or the degree of air pollution at the bus stop, he argues, their outlook on science changes. “People develop a relationship with and a sense of ownership over the data,” he says. He foresees amateur experts being driven by a new sense of volunteerism, the 21st-century equivalent of cleaning up the neighbourhood park. Nokia has even designed a prototype handset with environmental sensors (see article).

Dr Paulos has already equipped street sweepers in San Francisco and taxis in Accra, the capital of Ghana, with sensors to measure pollution levels, which he then used to create a map of each city’s environmental landscape. He plans to do the same with cyclists in Pittsburgh. Graduate students in his newly created Living Environments Lab have loaded households with sensors to sample tap water and indoor-air quality. Results are uploaded to a website where participants can compare them with other people’s contributions.

The technology is probably the easy part, however. For global networks of mobile sensors to provide useful insights, technology firms, governments, aid organisations and individuals will have to find ways to address concerns over privacy, accuracy, ownership and sovereignty. Only if they do so will it be possible to tap the gold mine of information inside the world’s billions of mobile phones.

Wi-Tribe Pakistan wireless broadband packages details

Wi-Tribe Pakistan wireless broadband packages details

Our cutomized packages are designed to suit your needs and lifestyle.

wireless broadband pakistan

wireless broadband pakistan

wireless broadband pakistan

wireless broadband pakistan
wireless broadband pakistan



Telematics In Pakistan

Telematics In Pakistan


This is an introductory post on the topic of Telematics and how it could be used in Pakistan. Telematics refers to the convergence of telecommunications and information processing in the context of automobiles. Services which are enabled by telematics include safety and security (get help after a crash, ask for help with a dead battery, stolen car alert), convenience (traffic alerts, find an address, remotely unlock a door) and other (download content to car, book a hotel room). Telematics used to be offered by expensive car makers but it is now becoming mainstream rapidly.

Lets take a look at what components and technologies are involved in building a telematics solution.

  • Hardware - TCU (Telematics Control Unit) - a box which is placed in the car and has GPS
  • Connectivity for voice (call center) and data (GSM or CDMA for sms and TCP/IP data)
  • Software (server-side platform which manages the entire solution)
  • Services and applications (e.g. speech recognition, POI data, call center)

Overall building a telematics solution is very much like a systems integration work. From connecting the hardware to data centers, managing the wireless data and voice, providing the information to a specialized call center and coordinating the response with different types of providers (emergency, police, roadside assistance, insurance etc). Protocols are defined to communicate between different components and to handle messages in SMS format or to handle packet data.

Most common scenario of telematics is when a car is in accident. Modern TCUs can sense the crash and send the data automatically to the system, alerting a call center about the crash severity and the location. Emergency help can thus be sent. Other scenario is when a person gets stranded on a road and needs help, then the SOS button in the car is pushed and a call is initiated to the call center from the car. Of course a wireless signal is needed for the TCU to dial out. Similarly a call center can call back the car.

Fleet tracking (commercial vehicles - taxis, buses, company vans, trucks etc) is another big area where the cost of telematics is justified because of business advantages.

In developing countries, services such as stolen vehicle alert and location could be useful. Since a vast majority of the cars do not come with the hardware, retrofitting of cars with TCU/GPS units will be most common. Once there is connectivity and a way to send data over the air, many different solutions can be built. You can have a geo-fence application which can alert you if your car moves out of a certain radius. Parents can track the movement of the car when their kids are driving. Of course the modern cars have many sensor built into the car so one can imagine all kinds of automobile data being sent over the air. Vehicle data can be used for troubleshooting, diagnostics and maintenance alerts.

In Pakistan there are a few companies and groups working on telematics (perhaps as distributors of foreign hardware makers) but the market is not ready for massive adoption - most probably due to hardware cost, complexity of building solutions and the limited number of people who are willing to pay for such service. It usually takes the car makers a few years to plan out a complete telematics solution so we might see something in the next 2-3 years in limited models. At least a good and affrodable telecom and wirless infrastructure is in place in Pakistan to support the telematics services. There is plenty of activity in this area in India.


Telematics In Pakistan

Telematics In Pakistan


This is an introductory post on the topic of Telematics and how it could be used in Pakistan. Telematics refers to the convergence of telecommunications and information processing in the context of automobiles. Services which are enabled by telematics include safety and security (get help after a crash, ask for help with a dead battery, stolen car alert), convenience (traffic alerts, find an address, remotely unlock a door) and other (download content to car, book a hotel room). Telematics used to be offered by expensive car makers but it is now becoming mainstream rapidly.

Lets take a look at what components and technologies are involved in building a telematics solution.

  • Hardware - TCU (Telematics Control Unit) - a box which is placed in the car and has GPS
  • Connectivity for voice (call center) and data (GSM or CDMA for sms and TCP/IP data)
  • Software (server-side platform which manages the entire solution)
  • Services and applications (e.g. speech recognition, POI data, call center)

Overall building a telematics solution is very much like a systems integration work. From connecting the hardware to data centers, managing the wireless data and voice, providing the information to a specialized call center and coordinating the response with different types of providers (emergency, police, roadside assistance, insurance etc). Protocols are defined to communicate between different components and to handle messages in SMS format or to handle packet data.

Most common scenario of telematics is when a car is in accident. Modern TCUs can sense the crash and send the data automatically to the system, alerting a call center about the crash severity and the location. Emergency help can thus be sent. Other scenario is when a person gets stranded on a road and needs help, then the SOS button in the car is pushed and a call is initiated to the call center from the car. Of course a wireless signal is needed for the TCU to dial out. Similarly a call center can call back the car.

Fleet tracking (commercial vehicles - taxis, buses, company vans, trucks etc) is another big area where the cost of telematics is justified because of business advantages.

In developing countries, services such as stolen vehicle alert and location could be useful. Since a vast majority of the cars do not come with the hardware, retrofitting of cars with TCU/GPS units will be most common. Once there is connectivity and a way to send data over the air, many different solutions can be built. You can have a geo-fence application which can alert you if your car moves out of a certain radius. Parents can track the movement of the car when their kids are driving. Of course the modern cars have many sensor built into the car so one can imagine all kinds of automobile data being sent over the air. Vehicle data can be used for troubleshooting, diagnostics and maintenance alerts.

In Pakistan there are a few companies and groups working on telematics (perhaps as distributors of foreign hardware makers) but the market is not ready for massive adoption - most probably due to hardware cost, complexity of building solutions and the limited number of people who are willing to pay for such service. It usually takes the car makers a few years to plan out a complete telematics solution so we might see something in the next 2-3 years in limited models. At least a good and affrodable telecom and wirless infrastructure is in place in Pakistan to support the telematics services. There is plenty of activity in this area in India.


Younis demands pay hike from IPL for his champions


Younis demands pay hike from IPL for his champions



Karachi: Pakistan captain Younis Khan has advised his fellow players to revise their contracts with the Indian Premier League following the team's Twenty20 World Cup victory.

"After all, these players are now World champions and highly marketable. There is more value on their performances. Why should they keep on having contracts with the IPL franchises on same old contracts," Younis said.

He pointed out that top players like Kamran Akmal, Sohail Tanvir, Umar Gul and Misbah-ul Haq had signed contracts for USD 100,000 or less with the IPL when it was launched in 2008.