« Archives in February, 2006

failed to open stream: HTTP request failed!

[17-Feb-2006 13:05:28] PHP Warning: readfile(http://xxxxxxx): failed to open stream: HTTP request failed! À
in Command line code on line 1

=> a weird error code return

Problem w/ .htaccess and mod_rewrite

Purpose: maintain the same .htaccess file between localhost and production servers. Making changes to one file is better than editing two or more.

Problem: directory for the project at local & production server are different. Therefore, RewriteBase of mod_rewrite needs to be set differently. Eg:

  • Local: http://localhost/working/abc.html
  • Production: http://example.com/abc.html

Solution/Hack: have this in httpd.conf for the localhost

Problem of CSS float & IE

IE seems to really have a problem with breaking CSS. First is the 3-pixel bug for 2-column layout float. Solution: instead of just having the left panel float, have both panels (left & main) float left & right.

Then there is an issue with italic and float. If the text in the left panel is italized, right aligned and with certain font-size (11px in my example), it extends the width and pushes the main panel down below instead of next to the left panel. The main panel contains an image that has the exact width of the panel. Turning off italic immediately eliminates the problem.

The source code of IE must contain lots of hacks. For IE7, don’t know if it improves. Otherwise, I would suggest Microsoft rewrites IE from scratch to have a better end-user product.

Geographic Information Systems in e-businesses

Title: Uses of Geographic Information Systems in e-businesses to improve user experience with online services

Date: Feb 28, 2003


Surfing across a website, you see an advertisement of a local store for this week’s sale. This event immediately catches your attention and you click the banner. Businesses are putting great effort to understand website visitors in order to expand their customer base and provide the appropriate goods and services. One of the tools to gain knowledge about the users is Geographic Information Systems (GIS). This report demonstrates some of GIS applications to improve user experience with online services. One of the definitions of a Geographic Information System is an information technology which stores, analyses, and displays both spatial and non-spatial data [1]. Components of a GIS include: Software, Hardware, Data, and People.

Software and hardware are supportive items while people and data are the main factors that decide how information should be extracted and used wisely. The subsequent sections describe steps taken by an online user in a typical transaction and GIS applications in each step.

Finding the goods or services in need

Sample Application: Target Advertising. GIS is being used extensively in advertisement management systems to deliver target promotional content. Google AdWords targets sponsored search results to country level. If the advertiser decides to target Canada, only Canadian visitors will see the ads. By building user geographic profiles with available information, online marketers can choose to deliver certain ads to target groups of users. For instance, a dating system that is locally in nature needs to show relevant ads to local users. Another example is an advertisement for Amazon.ca will be displayed instead of one for Amazon.com when the system determines the user is from Canada. The more relevant the ads, the more likely the user will response and make actions by clicking and visiting the website.

The technology behind target marketing strategies is based on the mapping of Internet Protocol (IP) addresses to geographic locations. These systems could map to country, state or city level depends on the available information and the technique. Popular methods to perform mapping include exhausted search of massive database, informed guess of location using hints from the resolved hostname. Hostname-based method refers to the use of Domain Name Service (DNS) as the basis to make an educated guess of the whereabouts of the host machine.

For example, the IP resolves to HSE-Kitchener-ppp120151.sympatico.ca. Because the resolved hostname ends with .ca, we say that this user is from Canada. With additional geography information about Canadian cities and provinces, we further conclude that the user is from Kitchener, Ontario. Other techniques combine IP-to-location mapping, delay in signal transmission across the network and technical understandings of network routing policies for different Internet providers [2].

Visiting the website

Sample Application: Customized Content. Once the user decides to visit the website, GIS uses the knowledge about the visitor to create a personalised website. Some examples are local news, events, weather, products or services. The narrow characteristics are particularly interested to a local user. Google.com automatically redirects Canadian visitors to Google.ca knowing that their searches would potentially more beneficial and relevant if its search engine focuses in Canadian sites.

Another sensitive issue is response and load time of a web page. With the visitor profile stored in the database and Internet Service Provider (ISP) policies in naming the resolved hostname, it is possible for a GIS to determine the connection speed. In our previous example, HSE-Kitchener-ppp120151.sympatico.ca implies a Digital Subscriber Line (DSL) connection. More specifically, the service is High Speed Edition Internet service by Sympatico. Knowing the connection speed, a site makes use of different layouts or content, rich media content to take advantage of high-speed connections or text for slow users.


  • 29.mucc.chcg.chcgil24.dsl.att.net is possibly on a DSL connection.
  • CPE00055d210763-CM.cpe.net.cable.rogers.com is possibly on a cable connection.
  • v90-232-88.dialup.umass.edu is possibly on a dial-up connection.

Buying from the website

Sample Application: Online Fraud Detection. Now the user is convinced and about to make the purchase. Many users are afraid of using their credit card online because of frauds. Making the users feel secured is an enhancement of their experience with the business. During payment processing process, GIS is used to prevent credit card frauds by spotting unusual patterns and alerting the staff.

For example, 2CheckOut.com, among many credit card processing agents, checks the IP address and compares with billing address provided by buyers. If these records match, the sale is authorised for actual charge into the credit card. Otherwise, an alert message is sent to both the vendor and the billing agent for further investigations.

For a business that offers download services or products, GIS can create an efficient strategy to give clients the fastest download time by connecting to the closest server and avoid net congestion. These issues are critical for real-time services like virtual meetings and webcasts.

For other businesses, brick-and-mortal stores or pick-up locations might be needed to finish the purchase. In such cases, a store-locator finds the most appropriate physical store. Some criteria include distance, convenient routes and availability of products.

Post-sale issues

Sample Application: Customer Support Enhancement. On a regular basis, a business needs to conduct a market analysis, which “means using customer information to estimate the size and character of a market” [4]. GIS is a powerful tool to analyse the spatial relationships between suppliers, customers and competitors. Knowing where online clients locate together with information about their system configurations, support staff diagnoses and solves problems faster and more efficiently.

By examining site usage, webmasters tailor the site to different groups of users to improve site usability. By analysing sale statistics to obtain future trends, management team develops better strategies to reach potential customers and improve experience of current clients. Suggestions include local promotions, new pickup locations for online orders and development of localised websites. Following is an example that shows currently online visitors and their information. This information is useful to improve the website usability.

Tracking information of on-site visitors. Courtesy of AdSpeed.com


Ad hoc process

Determining the geographic location of end-users is not a simple and exact process. Each connected user is associated with a unique IP number. The mapping from IP addresses to geographic locations requires sophisticated systems and algorithms due to the massive amount of possible IP addresses. In theory, there are over four billions addresses that need to keep track and update on a regular basis. Additionally, there is no standard in assigning hostnames and no guarantee that every hostname is recognisable. A hostname is recognisable if it contains documented patterns in identifying its location. For some ISPs, each IP record is associated with longitude and latitude data which makes it easy to identify the exact location of the machine. However, very few ISPs enable this feature and there is no guarantee of the correctness of input information. Proxy servers, which act as gateways between the end-users and the website, make it harder to identify real IP addresses. The proxy server broadcasts its IP address instead of the user address. America Online has many proxy servers located at Virginia, U.S., to serve the majority of its clients across the country.

Example: cache-ra06.proxy.aol.com, cache-rl05.proxy.aol.com are among thousands of AOL gateways.


Privacy advocacy groups are concerning about how much data of online users should be available and publicly accessible. Malicious systems can use this information to cause harms or take advantage of Internet users. One fictional scenario is a terrorist attack into a nuclear power plant. The attackers use the IP mapping mechanism to identify the location and information of critical machines.


With all the automatic detection mechanisms, users still want controls over their preferences. If a user connects from Vietnam is more comfortable with English than Vietnamese, the system should be flexible and present the information in English.


Another difficulty is the knowledge and experience requirements to implement a GIS. According to a recent study [5], the acceptance of a generic GIS among business users to support decision-making is rather low. In many cases, a GIS is not in the top priorities of IS managers.


This report discusses some of the more popular applications of GIS. Because of the chaotic characteristics of Internet hosts, there is a suggestion for international standards to identify the location of each connected machine. Along with the standards, businesses and research communities can benefit from databases with consolidated information about Internet addresses. Early researches in GIS applications have been mainly into capturing spatial data to generate maps [3]. Today GIS business applications are expanding continuously to support decision-makers. An information system with spatial data is very useful in hands of knowledgeable users. Formal training courses for employees or hiring specialists are among the methods to gain knowledge about GIS for the business. IT managers should take the initiative and learn how a GIS could supports business operations and improves experience of clients.


[1] Parker, H.D. The Unique Qualities of a Geographic Information System: A Commentary. Photogrammetric Engineering and Remote Sensing, 54:11, p. 1547-1549, 1988.

[2] Padmanabhan, V.N. and Subramanian, L. An investigation of Geographic Mapping Techniques for Internet Hosts. ACM SIGCOMM, August 2001.

[3] Coppock, J.T. and Rhind, D.W. The History of GIS. In: Geographic Information Systems: Principles and Applications, Vol. 1, editied by D.J. Maguire, M.F. Goodchild, and D.W. Rhind, pp. 21-43. London: Longman Scientific and Technical, 1991.

[4] Francese, P., and Piirto, R. Capturing Customers: How to Target the Hottest Markets of the ’90s. Ithaca, NY: American Demographics Books, 1990.

[5] Hernandez, T., H. J. Scholten, D. Bennison, M. Biasiotto, B. Cornelius and M. Van Der Beek. Explaining Retail GIS: The Adoption, Use and Development of GIS by Retail Organisations in the Netherlands, the UK and Canada. Netherlands Geographical Studies No. 258, 1999.

Blog Conversion – pLog to WordPress

To convert database from pLog to WordPress, you basically need to run 2 SQL queries, assuming you have them on the same server.

Google Sitemap – PHP Classes – XML Generator

If you need some PHP classes to generate Google Sitemap XML, you come to the right page.

CGoogleSiteMapURL is the support class for CGoogleSiteMapBase

Sample Usage: init the class and add URLs to the base class and call display to generate the XML.