Custom Search

News World

Sep 24, 2014

Trouble >> Stay Out


Now that our scripts are getting a little more complicated, I want to point out some common mistakes that you might run into. To do this, create the following script called trouble.bash. Be sure to enter it exactly as written.
#!/bin/bash

number=1

if [ $number = "1" ]; then
    echo "Number equals 1"
else
    echo "Number does not equal 1"
fi
       
When you run this script, it should output the line "Number equals 1" because, well, number equals 1. If you don't get the expected output, check your typing; you made a mistake.


Missing quotes

Edit line 6 to remove the trailing quote from the end of the line:
   echo "Number equals 1
       
and run the script again. You should get this:
[me@linuxbox me]$ ./trouble.bash
./trouble.bash: line 8: unexpected EOF while looking for matching "
./trouble.bash: line 10 systax error: unexpected end of file

Here we have another case of a mistake in one line causing a problem later in the script. What happens is the shell keeps looking for the closing quotation mark to tell it where the end of the string is, but runs into the end of the file before it finds it.
These errors can be a real pain to find in a long script. This is one reason you should test your scripts frequently when you are writing them so there is less new code to test. I also find that text editors with syntax highlighting (like nedit or kate) make these kinds of bugs easier to find.

Isolating problems

Finding bugs in your programs can sometimes be very difficult and frustrating. Here are a couple of techniques that you will find useful:
Isolate blocks of code by "commenting them out." This trick involves putting comment characters at the beginning of lines of code to stop the shell from reading them. Frequently, you will do this to a block of code to see if a particular problem goes away. By doing this, you can isolate which part of a program is causing (or not causing) a problem.
For example, when we were looking for our missing quotation we could have done this:
#!/bin/bash

number=1

if [ $number = "1" ]; then
    echo "Number equals 1
#else
#   echo "Number does not equal 1"
fi
       
By commenting out the else clause and running the script, we could show that the problem was not in the else clause even though the error message suggested that it was.
Use echo commands to verify your assumptions. As you gain experience tracking down bugs, you will discover that bugs are often not where you first expect to find them. A common problem will be that you will make a false assumption about the performance of your program. You will see a problem develop at a certain point in your program and assume that the problem is there. This is often incorrect, as we have seen. To combat this, you should place echo commands in your code while you are debugging, to produce messages that confirm the program is doing what is expected. There are two kinds of messages that you should insert.
The first type simply announces that you have reached a certain point in the program. We saw this in our earlier discussion on stubbing. It is useful to know that program flow is happening the way we expect.
The second type displays the value of a variable (or variables) used in a calculation or test. You will often find that a portion of your program will fail because something that you assumed was correct earlier in your program is, in fact, incorrect and is causing your program to fail later on.

Empty variables

Edit the script to change line 3 from:
number=1
       
to:
number=
       
and run the script again. This time you should get the following:
[me@linuxbox me]$ ./trouble.bash
/trouble.bash: [: =: unary operator expected.
Number does not equal 1

As you can see, bash displayed an error message when we ran the script. You probably think that by removing the "1" on line 3 it created a syntax error on line 3, but it didn't. Let's look at the error message again:
./trouble.bash: [: =: unary operator expected
We can see that ./trouble.bash is reporting the error and the error has to do with "[". Remember that "[" is an abbreviation for the test shell builtin. From this we can determine that the error is occurring on line 5 not line 3.
First, let me say there is nothing wrong with line 3. number= is perfectly good syntax. You will sometimes want to set a variable's value to nothing. You can confirm the validity of this by trying it on the command line:
[me@linuxbox me]$ number=
[me@linuxbox me]$
See, no error message. So what's wrong with line 5? It worked before.
To understand this error, we have to see what the shell sees. Remember that the shell spends a lot of its life substituting text. In line 5, the shell substitutes the value of number where it sees $number. In our first try (when number=1), the shell substituted 1 for $number like so:
if [ 1 = "1" ]; then
       
However, when we set number to nothing (number=), the shell saw this after the substitution:
if [ = "1" ]; then
       
which is an error. It also explains the rest of the error message we received. The "=" is a binary operator; that is, it expects two items to operate upon - one on each side. What the shell was trying to tell us was that there was only one item and there should have been a unary operator (like "!") that only operates on a single item.
To fix this problem, change line 5 to read:
if [ "$number" = "1" ]; then
       
Now when the shell performs the substitution it will see:
if [ "" = "1" ]; then
       
which correctly expresses our intent.
This brings up an important thing to remember when you are writing your scripts. Consider what happens if a variable is set to equal nothing.

Watching your script run

It is possible to have bash show you what it is doing when you run your script. To do this, add a "-x" to the first line of your script, like this:
#!/bin/bash -x
       
Now, when you run your script, bash will display each line (with substitutions performed) as it executes it. This technique is called tracing. Here is what it looks like:
[me@linuxbox me]$ ./trouble.bash
+ number=1
+ '[' 1 = 1 ']'
+ echo 'Number equals 1'
Number equals 1

Alternately, you can use the set command within your script to turn tracing on and off. Use set -x to turn tracing on and set +x to turn tracing off. For example.:
#!/bin/bash

number=1

set -x
if [ $number = "1" ]; then
    echo "Number equals 1"
else
    echo "Number does not equal 1"
fi
set +x
 
by William Shotts, Jr. 

Jun 29, 2013

News :: European R&D leader in travel and tourism calls hoteliers to embrace innovation with them

Amadeus has yet again ranked as the European Research & Development (R&D) leader in the travel and tourism industry, according to the 2012 EU Industrial R&D Investment Scoreboard – an annual European Commission report that ranks the largest 1,000 European companies by total investment in R&D. 

This award recognises Amadeus’ commitment to R&D and emphasis on innovation, which is one of the drivers behind Amadeus’ progress and growth. With a team of over 4,500 people split across sixteen centres around the world (Nice, London, Sydney, Antwerp, Aachen, Frankfurt, Munich, Boston, Miami, Toronto, Strasbourg, Tucson, Bangalore, Bogota, Warsaw and Bangkok), the desire for innovation spreads throughout all sectors in Amadeus.
Amadeus invested €347.5 million during 2011, an increase of 6.7% on 2010, to research and develop technologies for use in the travel sector. This investment represented 12.7% of revenues and helped the company maintain it number one position in Europe by total R&D investment in the area of travel and tourism.
HervĂ© Couturier, Executive Vice President, R&D, Amadeus IT Group, said: “Naturally we are very pleased to see that our investment in R&D has been highlighted again by this important European Commission study. Equally we are very proud to be ranked again as a leader in the travel and tourism area. This further emphasises our reputation for innovation”.

Innovation in hotels

In recent years, Amadeus’ R&D efforts have particularly focused on the hospitality industry.
In 2010, Amadeus launched the Amadeus Hotel Platform, an integrated and centralised hotel IT solution for hotel chains that is set to transform the way hotels do business. Available as a Software-as-a-Service (SaaS) model, it combines central reservation system, above-property management solution, call centre, distribution to any channel, e-commerce, m-commerce and business intelligence into one fully integrated platform.

This platform is designed to support hotels in the current era of globalisation and expansion, enabling them to respond to changing traveller demands. Amadeus Hotel Platform is not only a unique solution in the industry but is also an excellent example of a platform conceived from an Open Systems approach and developed with the proliferation of cloud computing in mind.

Innovation in the cloud

In January this year, Amadeus Hotels published Clearing the Cloud; Best of Open Systems and Cloud for hotel business optimisation, a report that makes the case for hoteliers to embrace the Open Source Software revolution in order to benefit from greater innovation.
Whether the hotelier is battling with unwieldy legacy systems, trying to reduce costs across IT systems or looking for that something extra to gain competitive advantage, the report examines the suitability of Open Source Software. The report also outlines the specific benefits to be gained from switching to Open Source software which include: innovation, cost-efficiency, security, scalability and responsiveness.

The future

Amadeus has not only pioneered the use of open systems within Amadeus Hotel Platform but also within Amadeus’ own business making them a clear example of the benefits from innovation. 

HervĂ© Couturier said, “Nonetheless, our desire for innovation has not yet been satisfied and R&D will continue to inspire our evolution as a large-scale technology pioneer in 2013 and beyond”.


Jun 28, 2013

News :: What are the five essentials global hoteliers should demand from IT providers?

Technology is changing – particularly in the hospitality sector. Guests demand greater online interaction and more tailored offers. Shareholders want greater cost savings to drive profitability following the sluggish performance of the hotel sector in the last two years. Hotel groups need to relentlessly search for new revenue opportunities, and need to act quickly to secure them. In this era of change, hoteliers face a crucial question: what to demand of IT providers?
With IT becoming an essential component of effective corporate strategy, it is important to get fundamentals right. Through discussions with industry analysts, commentators and hotel groups, analysing surveys, and considering recent research, five key themes have emerged on what global hoteliers should demand from IT providers:

The ability to cope with global expansion and business consolidation as the market demands – even when these shifts happen rapidly

Over the past decade, the technological demands of hotels have grown significantly. Such demands occur on two levels: the growing extent of information surrounding each guest; and the need for operational agility. Relating to the first, hoteliers have increasingly focused on developing specific customer relationship management programs to foster cradle-to-grave brand loyalty, requiring capturing and storing information on guest activities and preferences. Simultaneously, guests themselves have increasingly demanded more sophisticated technological facilities, mostly before and during their stay. Relating to the second, unpredictable markets and shifting economies require hotels to adjust accordingly. IT providers must be able to meet these adjustments in an agile, responsive manner. For instance, advertising sites and search engines are increasingly able to propose leads to hoteliers in real time, requiring hoteliers to accept or reject these leads in real time too. This requires not so much a large amount of data as it does the ability to process quickly the qualifications of a lead against an extensive amount of data – which in turn requires IT providers suited to the task. Such operational agility is particularly important for growing hotel chains.

A vision towards the future and a focus on innovation

While Hoteliers focus on their own business, they may not have the possibility to focus so much on technology. Hoteliers may struggle to transform and develop IT technologies themselves. Indeed, in the past, hoteliers tended to be almost reluctant to invest in IT, arriving late to technological change. Yet now the consumer is pressing for technological development, and the e-commerce/mobile trend in the market is becoming an increasing reality.

Given this, hoteliers must look for IT providers that both integrate new technology, and that possess a future-oriented vision to determine what technological actions should be taken. Integrating new technology refers to the ability of IT providers to work with new applications, keeping up with and driving change. Studies have shown that hoteliers should expect the next decade to demand enhanced websites, upgraded Central Reservation Systems and internet booking engines, new means of promotion, and an increased interaction with technology. Customisable website booking options is thought to be the number one emerging technology trend. Artificial Intelligence-based technologies used to forecast food and beverage demand more accurately will become more common. Mobile technology is increasingly being used by consumers to interact with hotels, leading to pressure for specialised websites and interfaces.

Can the IT provider handle these approaching demands? Indeed, can they not just meet these changes, but actually drive change forward, operating as a proactive rather than reactive force for the hoteliers? Understanding such trends and future developments require constant immersion in the IT world, combined with a serious focus on the omnipresent question of ‘what is next’. Hoteliers deserve IT providers that can both respond to, and lead, innovation.

Present a track record of success

IT providers should have demonstrated in the past that they have the delivery capabilities and know-how to take on major industry challenges. They need to be able to handle global, complex implementations and on-going support for clients. How many dedicated client-facing and research and development staff do they have? How many years of experience do they possess managing portfolios? What is their track record in dealing with heavy transaction processing? The absence of such a background could be dangerous for hoteliers. For instance, the web often has a high ‘look to book’ ratio. If IT providers have been unable to handle heavy transaction processing in the past, this suggests they will continue to do so in the future – meaning this ‘look to book’ ratio will struggle against bad technology, and the hotelier would lose business. Again, hoteliers require IT providers that are future-proof – and in this case with the background to prove it.

Possess robust, stable and secure systems

A hotelier needs to be able to rely on their IT provider. They must be able to trust that the IT provider’s system is at once stable, secure and robust. A recent study indicated that more than 55% of credit card fraud comes from the hospitality industry. Unpatched systems, storing prohibited data, using low-strength passwords, and operating via unsecured web applications have all been cited as leading to credit card fraud. Security is crucial to protecting the reputation of the hotel brand. What can the IT provider offer to ensure guests are protected? Likewise, what happens when complications arise that challenge the stability of an IT provider, such as a natural disaster or a power outing? Infrastructure, system strength and security must be at the top of any priority list, providing not simply stability but high level stability within a heavy transactional environment.

Thus IT providers should offer innovative, forward-looking solutions. Data monitoring and data surveillance are obvious steps. Increasingly important to security is the use of hybrid-cloud technology. The managed nature of certain cloud structures helps ensure that important data is stored within a secure, stable location outside the hotels. Should a natural disaster or power outage occur, stressing the infrastructure of the hotel or the IT provider, cloud computing helps ensure data is housed within a stable cloud environment. IT providers should also offer systems secure not only in the present, but in the future, considering projected security developments like ambient intelligence, knowledge mining, biometrics and predictive analytics.

Offer development that is conscious of expenditure

For hoteliers, budgets inevitably factor into cohesive business plans. IT providers should be conscious of this, operating in such a way that a hotelier’s investment is maximised. A recent study determined that not having the budget to make necessary improvements was the biggest challenge for IT departments, even as such developments and improvements were considered to be crucial. Likewise, projects supporting both cost-savings and revenue generating were ranked first (97%) as the main driver for technology initiatives. Thus hoteliers should ask: what is the IT provider doing to accommodate financial realities? How are they addressing expenditures without hindering development? For instance, some IT providers invest their own extensive funds into a centralised system, enabling hoteliers to access the benefits of these systems without having to likewise expend such capital upfront. Hoteliers should consider the capex versus the opex commitments required to modernise their systems.
Inevitably, this is only the start. There will be other things hoteliers should demand from IT providers – such as sector experience and an ability to quickly meet needs, to name only two. But the five demands listed above are crucial as hoteliers consider their IT needs. They allow hoteliers to work with IT providers towards future-proof, secure, client-focused, business-aware development. They encourage advancement with stability and affordability with innovation. In short, they are demands worth making.

Technology :: Genetic survey sheds light on Oceans' lean, mean microbial machines

Planktonic bacteria inhabiting the world's oceans have streamlined their genetic makeup to become lean, mean survival machines, according to new research by an international team of researchers, including microbiologists at the University of British Columbia.

The findings, published this week in the Proceedings of the National Academy of Sciences, is the first direct evidence of widespread genome reduction—organisms evolving to cast off superfluous genes and traits in favor of simpler, specialized genetic make-ups optimized for rapid growth.

"Microbes are the dominant form of life on the planet and comprise a huge proportion of the oceans' biomass, but we know next to nothing about how populations exist, evolve and interact outside of the lab," says UBC microbiologist Steven Hallam, Canada Research Chair in Environmental Genomics and author on the paper.

"This widespread, signal cell genome sequencing of marine bacteria in the surface ocean has uncovered a surprising amount of metabolic specialization. This tendency toward genome reduction has profound implications for how microbial communities develop metabolic interactions that couple nutrient and energy flow patterns in the ocean. It could be a matter of survival of the most connected."

Says Ramunas Stepanauskas, director of the Bigelow Single Cell Genomics Centre and the paper's lead author: "We found that natural bacterioplankton are devoid of 'genomic pork' such as gene duplications and noncoding nucleotides, and utilize more diverse energy sources than previously thought."

Samples of planktonic bacteria were targeted from the Gulf of Maine, the Mediterranean, the South Atlantic and other sites. Data from northeast subarctic Pacific samples—taken over a six year period from the waters between Saanich Inlet and Ocean Station Papa along the Department of Fisheries and Oceans Line P transect was provided by Hallam's team.

IT Conversations

Moneycontrol Latest News

Latest new pages on Computer Hope

Latest from Infoworld

Door Lock

Door Lock Import Top Door Lock from China Contact Quality Manufacturers Now