Archive for December, 2007

760Part IVConnectionsIntegration between businesses (Web server logs) particularly benefits the smaller

Monday, December 24th, 2007

760Part IVConnectionsIntegration between businesses particularly benefits the smaller parties involved. Web servicesare easy to implement because corporate firewalls already have holes punched through themfor HTTP and SMTP and because they can be implemented by using inexpensive software suchas PHP. Say that you run a small business that makes widgets. You want your widgets dis- tributed by a large retailer, Humongous Widget Depot. Until recently, for you (and the gazillionsof other manufacturers who supply goods to Humongous Widget Depot) to provide real-timeinventory information to the retailer entailed tremendous expense as you bought a large soft- ware package such as SAP and integrated it on a private network. Now, in theory, each smallmanufacturer can merely expose its inventory information via a Web service, and HumongousWidget Depot s humongous IT department merely points a Web services client at them. That, in a nutshell, is the dream and the promise of Web services. We are quite a way from theactuality, but the outlines of a solution are firming up. REST, XML-RPC, SOAP, .NETFor Web services to work, every application and many servers need to speak a common lan- guage. Everyone agrees that the common language is XML, but there are some philosophicaldifferences about the implementation details. The three main Web services standards areREST, XML-RPC, and SOAP. One of the biggest backers of SOAP is Microsoft, which uses thatstandard heavily in its .NET services architecture. RESTRESTis an acronym for REpresentational State Transfer. The concept is based on a disserta- tion by Roy Fielding, and its main point is that we already have everything we need to imple- ment Web services in HTTP itself. So all REST services must be reachable by normal URIsusing the HTTP GETmethod, and they return XML without any special coded wrapping. Forall intents and purposes, a REST service is just an XML page on the Web, although usually notone that is intended to be read by a human being using a browser. Universal addressability is a big part of the REST style, so Web services that return data inresponse to an HTTP POSTare not technically REST-ful. eBay s developer program has main- tained a service like this for some time now, although by press time they may have switchedto a SOAP service. REST is particularly valuable for content-focused services. You can build an XML documenton the fly, and your users can access it reliably as a URI. In theory, REST should also be easierfor lightly technical users to deal with. On the other hand, REST doesn t have built-in supportfor complex types because there s no shared vocabulary, there s no particular way to desig- nate an array versus a string. You can learn more about REST at the RESTWiki: http://internet.conveyor.com/RESTwiki/moin.cgi/FrontPageand at the Web site of Paul Prescod, REST s most tireless promoter: www.prescod.netCaution46
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

Web site layout - 759Chapter 41Web ServicesThe Web is the biggest, most

Sunday, December 23rd, 2007

759Chapter 41Web ServicesThe Web is the biggest, most open, most loosely coupled and most successful distributedarchitecture of all time. With few exceptions, no Web server cares which Web browser is ask- ing it for a page, or what operating system that browser is running on, or what chip is runningthe hardware on which that operating system lives. The application asking for the page doesn t even need to be a browser it may be a spider from a search engine, it may be anfopen()call from a PHP command-line script, or it may be a cellular phone. The HTML itsends may not render nicely on every device, but that has nothing to do with whether Apacheor IIS is serving up the page. There are a lot of reasons why the World Wide Web has taken off as it has, but one of them iscertainly a factor that computer scientists semi-affectionately refer to as worse is better. This philosophy, which exists in contrast to the lofty perfectionism of the right thing, means that in many circumstances it is the very junkiness of a thing that leads to its success. Certainly if all HTML had been forced to meet the standards of well-formedness that someWeb pundits now want to impose, the Web would still be the province of a few physicists try- ing to distribute their academic papers via plain gray home pages. On a more fundamentallevel, HTTP and other Internet protocols grew on the back of TCP/IP which itself is a notori- ously worse is better design. TCP/IP never guarantees you an entire message in a timelymanner. It tries really hard to make that happen, via methods such as replication but we rejust going to say that one of us once got an e-mail two and a half years after it was sent. Applying the lessons of the Web to applications, you come up with something quite a lot likeWeb services. The beauty of Web services is its brutal simplicity, which squashes everythingdown to a lowest common denominator. A Web-services architecture doesn t care about thebenefits of any particular platform, and it doesn t care about the pitfalls. Those are your prob- lems. All that matters to the outside world is that a program can send and receive text mes- sages across HTTP or SMTP and that these text messages can trigger computational actions. An archetypal Web service would be something like a Japanese-to-English translation service. It lives somewhere on the Internet, on some unknown platform, and is written in someunknown programming language. You don t need to know or care about that stuff. All youcare about is that your browser or your mail client knows that you only read English soevery time you get a Web page or an e-mail in Japanese, these applications automaticallysend their contents to this translation service and then display the translated results to you. You don t ever see or care that part of the processing is happening at some remotelocation to you, the end user, it just looks as though your application is handling it seam- lessly. Instead of your Web browser using Babelfish to translate Japanese to English, and yourmail client having a little built-in dictionary, and your local department store s inventory man- agement system using a third-party program that runs only on Solaris all of them can justcall this translation Web service. Web services should also enable much easier integration. Say that you work for a universityalumni office that is still using an alumni database written in COBOL on a VAX. (You maylaugh, but Y2K wouldn t have been such a big deal if there weren t so many legacy systemslying around.) It works perfectly well, and you don t have budget to replace it but thoseVAX terminals are getting old. It would sure be great if you could query your alumni databasevia an ordinary Web browser but there s no way you re ever going to be able to squeeze afull Web server onto that old VAX, even if someone wrote one. With Web services, if you canget the VAX to understand just a little bit of XML and spit out its data as XML, you re all set. You can exchange instructions and data via XML by using some other machine that does havea Web server, and that other machine can communicate with the rest of the world. Somedaywhen you are ready to replace that VAX with a newer machine and a different programminglanguage, no one need ever know. As long as the service is reachable at the same address byusing the same method invocations, it doesn t matter whether it s a VAX or a PC, whether theapplication was written in COBOL or whether it s just a thin shell of PHP on top of a database.
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.

758Part IVConnectionsthe Associate so much so that (Cedant web hosting) it s a

Saturday, December 22nd, 2007

758Part IVConnectionsthe Associate so much so that it s a good way to get banned from Amazon altogether. Slamming the door on requests from a particular IP block is almost the only way to controlaccess to a public Web server. Even if an organization wants to give you large amounts of information in a data feed, themechanics right now are not very elegant. We are aware of many large and well-respecteddata-related businesses that move data around in text files (or spreadsheets) that are down- loaded via some mechanism such as FTP (or e-mail) and parsed on both ends by custom Perlcode (or by hand). Often, there is no way to send only data that has changed the feeds aredumped out and processed in a dumb way every so often, rather than updating only if andwhen changes occur. Obviously, these are all batch processes, which have no possibility ofworking in real-time. XML-based Web services promise to offer a common language, a com- mon transport mechanism, a common authentication and authorization method, and poten- tially common code for organizations to access each other s data. If Web services were just about moving data around, the idea would be extremely useful butnot at all sexy. What excites everyone about Web services is the promise that it can helpsolve the hardest problems of distributed computing once and for all. Brutal simplicityThink back, if you can, to the bad old days before the Web. If you can go back far enough, think back to the days when the Internet itself was a rarity and networking something limitedto high-end universities (it may help to remember that for a long time one of Apple s sellingpoints in college computer labs was AppleTalk). Back in those dark days, my children, things such as operating systems and programming lan- guages were major barriers to integration they were little islands in the sea of incompatibil- ity. If you were going to write an application, you were specifically writing it for a particularplatform and language sometimes even for a particular version of a compiler. It was very, very hard to make one program talk to another program. If you wrote a COBOL program onaVAX, that was where it was going to stay. With a great deal of effort you could get one pro- gram to send something simple, such as ASCII data, to another but any little thing couldmess up your interapp communication. If you changed anything on one side, it might meanthat you had to change a bunch of stuff on the other side, too. These programs were said tobe tightly coupled. This meant a lot of duplication of effort. Porting was technically difficult, and the marketwasfragmented. So a team that wrote an application say, an accounting program forMinicomputer X was not necessarily going to have the resources to do the same forMicrocomputer Y. Lots of teams wrote lots of accounting programs, and all the formats wereproprietary. None of them could exchange data with each other, much less share tasks easily. Slowly, mankind groped toward a way to make programs talk to each other. The blanket termfor this activity was distributed computing. It took until the mid-1990s for these methods toreach the common programmer, in the form of standards such as DCOM, CORBA, and JavaRMI. These standards enabled all programs that shared a common architecture to call eachother s methods and send data back and forth. When you are able to embed a spreadsheetinside a word processor document, it s via the magic of DCOM. These common object models, however, had three major problems. They were still more orless tied to particular platforms or programming languages; they were considered difficult tolearn, and they reached general usability at the same moment that the Web arrived to tanta- lize us with the possibility of Internet-scale loosely coupled, distributed computing based onopen standards.
Please visit our professional web hosting services to find out about cheap and reliable webhost service that will surely answer all your demands.

Web ServicesWeb services is an emerging field of (Web site management)

Saturday, December 22nd, 2007

Web ServicesWeb services is an emerging field of programming that seeks toapply the benefits of the Web to bigger problems than merelydisplaying data in a browser. PHP, which has already proven itself asa core gluecomponent of the Web, has the opportunity to grab evenmore market share in the Web services arena. As is true of other hottechnologies such as XML, however, a world of hype surrounds Webservices. Here we try to cut through the buzzwords and analyst pre- dictions to look at what Web services means to the average PHPdeveloper. The End of Programming as We Know ItThe title of this section is a bit of a joke one of us works in the Webservices field and often hears presentations that assert things suchas: In 10 years, we will have no more need for programmers, becauseWeb services will eliminate duplication of effort. Many people havethought that programming was about to die out, and all of them havebeen wrong so far but hope springs eternal in the pundit s breast. Notching down the hyperbole to manageable levels, we can say thatWeb services could make some common but hard tasks in commer- cial computer programming a lot easier. The ugly truth about data mungingJoking aside, Web services do solve some problems at the momentlargely in the realm of moving data around. Later in this chapter, forexample, we offer code for a client to the Amazon REST service. Thiscode enables you to grab the latest data about a given product orgroup of products photos, current prices, availability, and so on up to once per second via an automatic process. If you re a first-time author who has a small informational site withone link to Amazon, this isn t really going to help you much. But thereare Amazon Associates who link to thousands or even millions ofproducts. They did so until recently by horrible hacks involvingdownloading all those Web pages and using some kind of string orXPATH parsing to pick out the three or four pieces of data theywanted from each page. Furthermore, each client organization did allthis work for itself because, among other things, this is a totallyunauthorized use of Amazon s copyrighted material, so they canhardly expect Amazon to help them. Harvesting data from full HTMLpages is tremendously wasteful and expensive for both Amazon and4141CHAPTER …In This ChapterThe promise of WebservicesREST, XML-RPC, SOAPIssues with WebservicesProject: a REST clientProject: a SOAP clientand server …
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.

Http web server - 756Part IVConnectionsSummaryXML is an application-independent data-exchange format that

Friday, December 21st, 2007

756Part IVConnectionsSummaryXML is an application-independent data-exchange format that promises to make Web devel- opment faster and easier in the future. XML and HTML are both descended from SGML, accounting for their close resemblance at first glance. Both have tags (more correctly calledelements) and attributes, although XML s are self-defined and structured whereas HTML s aredefined by the HTML standard and contain no information about document structure. XML has only a few minimal requirements for well-formedness. These include closed ele- ments, no overlapping elements, escaped special characters, and the presence of a singleroot element for each document. XML can also be valid, however, in the sense of conformingto a formal declaration of its structure in a document type definition or DTD. DTDs can beinternal or external to the XML document and even located on another server. They containdeclarations of the types, attributes, and names of the various elements within the XML file. For the present, few prefabricated tools are available to help you write, edit, and display XML. You can use one of the three PHP XML APIs SAX, DOM, and SimpleXML to write your owntools. The APIs have different tradeoffs and uses. SAX is an event-based parser, whereas DOMXML creates an object tree in memory. SimpleXML is easy to use and requires little code, butis relatively limited in its capability. It s mainly useful for quick reads of simple XML files. At the moment, PHP with the SAX extension can be used to write out well-formed XML fromvalues entered into a Web form, and to edit XML documents. DOM XML can be used to createcomplete XML documents programmatically. The SAX parser is also commonly employed totransform XML into HTML for less problematic display in current Web browsers. Anotherpossible task for PHP s XML extensions is to pull data from a data store and write it out asXML for exchange with another organization. …
You want to have a cheap webhost for your apache application, then check apache web hosting services.

755Chapter 40PHP and XML// Display form with old (Cedant web hosting)

Thursday, December 20th, 2007

755Chapter 40PHP and XML// Display form with old values$php_self = $_SERVER[ PHP_SELF ]; $form = <<< EOFORM

Start Date:
End date:
Poll question:
$resp_str
EOFORM; echo $form; unset($resp_str); unset($response_array); } ?> Gotchas and TroubleshootingThe DOM and SAX parsers will only parse a well-formed XML document. If the parser rejectsyour XML, make sure it is well formed. If it looks good to your eye, run it through a differentvalidating parser or an online XML checker, such as the one at http://www.xml.com/ xml/pub/tools/ruwf/check.html. If you cannot read and write XML documents to disk, check that the Web server process haspermission to do so. If the DOM API returns a fatal function not found error, the DOM XML module may not beinstalled. Use the phpinfo()function to check for a domxmlentry. If it isn t there, you willhave to recompile PHP with the DOM XML module (on Unix) or uncomment the php_ domxml.dllline in php.ini(on Windows). The DOM API underwent a major revision in PHP5 (and was altogether new in PHP4), so all the kinks may not be worked out yet. Keep this in mind and check the bugs database(http://bugs.php.net/) if you encounter problems. Remember that you re supposed to make a strenuous effort to search the mailing-list archivesbefore you search the bugs database. Please make sure that your problem is really a bug andhas not been resolved before filing it as a bug. If any doubt is in your mind, read the How toReport a Bug document attached to the bugs database.
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

754Part IVConnectionsListing 40-12(continued) // Write out the file$doc->save($pollfile); (Best web hosting site)

Thursday, December 20th, 2007

754Part IVConnectionsListing 40-12(continued) // Write out the file$doc->save($pollfile); } // This stuff happens every time, whether a submission// has occurred or not. // Reading in the XML file as a DOM object// Must read fresh every timeif (!$doc->load($pollfile)) { echo Cannot read XML file. ; exit; } // Get a list of the polls in this XML document// and then pull out the start date, end date, // poll question, and possible responses. $poll_list = $doc->getElementsByTagname( Poll ); foreach ($poll_list as $poll_obj) { $id = $poll_obj->getAttribute( id ); $children = $poll_obj->childNodes; foreach ($children as $key=>$child_obj) { $node_name = $child_obj->nodeName; if ($node_name != #text && $node_name != responseSet ) { $content_str = $child_obj->nodeValue; $poll_array[ $node_name ] = $content_str; } elseif ($node_name == responseSet ) { // Get the responses$responselist = $child_obj->childNodes; foreach ($responselist as $responses) { $response_name = $responses->nodeName; if ($response_name != #text ) { $response_array[] = $responses->nodeValue; } } } } // Arrange all the data nicely$poll_startdate = $poll_array[ StartDate ]; $poll_enddate = $poll_array[ EndDate ]; $poll_name = $poll_array[ name ]; $poll_question = $poll_array[ question ]; $poll_question = stripslashes($poll_question); foreach ($response_array as $key=>$val) { $resp_str .= Option:
n ; }
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

753Chapter 40PHP and XML// Figure out which poll (Affordable web hosting)

Wednesday, December 19th, 2007

753Chapter 40PHP and XML// Figure out which poll we re editing, then work on its children$pollname_value = $poll_obj->getAttribute( id ); if ($pollname_value == $pollname) { $children = $poll_obj->childNodes; foreach ($children as $child_obj) { $node_name = $child_obj->nodeName; $value = $child_obj->nodeValue; if ($node_name == StartDate ) { if ($value == $startdate) { // Do nothing} else { $sd_textnode = $child_obj->firstChild; $new_startdate = $doc->createTextNode($startdate); $child_obj->replaceChild($new_startdate, $sd_textnode); } } if ($node_name == EndDate ) { if ($value == $enddate) { // Do nothing} else { $ed_textnode = $child_obj->firstChild; $new_enddate = $doc->createTextNode($enddate); $child_obj->replaceChild($new_enddate, $ed_textnode); } } if ($node_name == question ) { if ($value == $enddate) { // Do nothing} else { $q_textnode = $child_obj->firstChild; $new_question = $doc->createTextNode($question); $child_obj->replaceChild($new_question, $q_textnode); } } if ($node_name == responseSet ) { $old_responses = $child_obj->childNodes; $i=0; foreach ($old_responses as $delete_responses) { if ($delete_responses->nodeName == response ) { $r_textnode = $delete_responses->firstChild; $new_response = $doc- >createTextNode($_POST[ response ][$i]); $delete_responses->replaceChild($new_response, $r_textnode); $i++; } } } } } } Continued45
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

752Part IVConnectionsListing 40-11(continued) (Web and email hosting) Mouse Trackball Touchpad TrackPoint Pen

Tuesday, December 18th, 2007

752Part IVConnectionsListing 40-11(continued) Mouse Trackball Touchpad TrackPoint Pen Stylus Listing 40-12 shows a script that will allow you to edit the XML file in Listing 40-10 using DOM XML. Listing 40-12:XML editor (dom_polledit.php) load($pollfile)) { echo Cannot read XML file. ; exit; } // Once a poll is created, the user will only be able to // change the StartDate, EndDate, Question, and response values. // Format the data$pollname = $_POST[ poll_name ]; $startdate = $_POST[ Poll_Startdate ]; $enddate = $_POST[ Poll_Enddate ]; $question = $_POST[ Poll_Question ]; // Replace the values as text nodes$poll_list = $doc->getElementsByTagname( Poll ); foreach ($poll_list as $poll_obj) {
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

751Chapter 40PHP (Shared web hosting) and XML $RespSet ; $newxml =

Monday, December 17th, 2007

751Chapter 40PHP and XML $RespSet ; $newxml = implode($glue, $divide); //Write to file$fd = fopen($pollfile, w ) or die( Can t open file for writing; checkfile permissions ); $writestr = fwrite($fd, $newxml); //Messageecho Wrote $writestr chars to $pollfile. ; ?> Listing 40-11 shows the XML file where our polls are stored, with one poll already defined foryou. If you add a new poll, it will be appended near the top of this file, and its name will beadded to the PollList. Listing 40-11:An XML file (poll.xml) 01/01/200333 01/31/2004 Which is the best programmer s editor? emacs vim notepad kate BBEdit 02/01/2004 02/29/2004 Which is the best pointer device? Continued45
You want to have a cheap webhost for your apache application, then check apache web hosting services.