CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Thu, 07 Aug 2025 14:31:21 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20101002045830
location: https://web.archive.org/web/20101002045830/https://forums.oreilly.com/user/10803/Michael-Morrison/
server-timing: captures_list;dur=0.684023, exclusion.robots;dur=0.026889, exclusion.robots.policy;dur=0.014445, esindex;dur=0.015410, cdx.remote;dur=57.592390, LoadShardBlock;dur=234.420698, PetaboxLoader3.datanode;dur=107.412349, PetaboxLoader3.resolve;dur=67.300173
x-app-server: wwwb-app212
x-ts: 302
x-tr: 324
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app212; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Thu, 07 Aug 2025 14:31:22 GMT
content-type: text/html;charset=utf-8
x-archive-orig-date: Sat, 02 Oct 2010 04:58:29 GMT
x-archive-orig-server: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.8
x-archive-orig-x-powered-by: PHP/5.2.8
x-archive-orig-cache-control: no-cache, must-revalidate, max-age=0
x-archive-orig-expires: 0
x-archive-orig-pragma: no-cache
x-archive-orig-connection: close
x-archive-orig-transfer-encoding: chunked
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Sat, 02 Oct 2010 04:58:30 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Sun, 29 Mar 2009 03:56:17 GMT", ; rel="prev memento"; datetime="Mon, 02 Aug 2010 15:29:34 GMT", ; rel="memento"; datetime="Sat, 02 Oct 2010 04:58:30 GMT", ; rel="next memento"; datetime="Sun, 03 Oct 2010 08:51:36 GMT", ; rel="last memento"; datetime="Mon, 04 Apr 2011 05:01:06 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_18_20101002042328_crawl100-c/52_18_20101002045802_crawl100.arc.gz
server-timing: captures_list;dur=0.558437, exclusion.robots;dur=0.022935, exclusion.robots.policy;dur=0.011766, esindex;dur=0.012790, cdx.remote;dur=53.552625, LoadShardBlock;dur=288.280865, PetaboxLoader3.datanode;dur=148.891125, PetaboxLoader3.resolve;dur=436.895132, load_resource;dur=365.419100
x-app-server: wwwb-app212
x-ts: 200
x-tr: 782
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
Michael Morrison - Viewing Profile
O'Reilly Forums > Viewing Profile

Profile
Personal Photo
Rating
Options
Options
Personal Statement
Michael Morrison doesn't have a personal statement currently.
Personal Info
Michael Morrison
Active Member
Age Unknown years old
![]()
Nashville, TN
Birthday Unknown
Interests
nerdy tinkering, skateboarding, hockey, pond building, landscaping, architecture/construction
Statistics
Joined: 16-October 07
Profile Views: 2,363*
Last Seen: 19th September 2010 - 09:40 PM
Local Time: Oct 1 2010, 11:58 PM
114 posts (0 per day)
Contact Information
![]() ![]() ![]() ![]() ![]() * Profile views updated each hour
![]() |
Topics
Posts
Gallery
Comments
Friends
My Content
19 Jan 2009
There is a small error in the Exercise Solution code on page 544 in regard to the sort order of the Risky Jobs script. If you look at the second case statement (case 3:), and then the third link generated below it, you'll see that the answer says 3. This is wrong. This link should be generating an ascending sort on date (oldest first), which means it should be 5, not 3. Check out the shaded section of code on page 545 to see what these values mean. Here's the full generate_sort_links() function with the correction:
function generate_sort_links($user_search, $sort) { $sort_links = ''; switch ($sort) { case 1: $sort_links .= '<td><a href = "' . $_SERVER['PHP_SELF'] . '?usersearch=' . $user_search . '&sort=2">Job Title</a></td><td>Description</td>'; $sort_links .= '<td><a href = "' . $_SERVER['PHP_SELF'] . '?usersearch=' . $user_search . '&sort=3">State</a></td>'; $sort_links .= '<td><a href = "' . $_SERVER['PHP_SELF'] . '?usersearch=' . $user_search . '&sort=5">Date Posted</a></td>'; break; case 3: $sort_links .= '<td><a href = "' . $_SERVER['PHP_SELF'] . '?usersearch=' . $user_search . '&sort=1">Job Title</a></td><td>Description</td>'; $sort_links .= '<td><a href = "' . $_SERVER['PHP_SELF'] . '?usersearch=' . $user_search . '&sort=4">State</a></td>'; $sort_links .= '<td><a href = "' . $_SERVER['PHP_SELF'] . '?usersearch=' . $user_search . '&sort=5">Date Posted</a></td>'; break; case 5: $sort_links .= '<td><a href = "' . $_SERVER['PHP_SELF'] . '?usersearch=' . $user_search . '&sort=1">Job Title</a></td><td>Description</td>'; $sort_links .= '<td><a href = "' . $_SERVER['PHP_SELF'] . '?usersearch=' . $user_search . '&sort=3">State</a></td>'; $sort_links .= '<td><a href = "' . $_SERVER['PHP_SELF'] . '?usersearch=' . $user_search . '&sort=6">Date Posted</a></td>'; break; default: $sort_links .= '<td><a href = "' . $_SERVER['PHP_SELF'] . '?usersearch=' . $user_search . '&sort=1">Job Title</a></td><td>Description</td>'; $sort_links .= '<td><a href = "' . $_SERVER['PHP_SELF'] . '?usersearch=' . $user_search . '&sort=3">State</a></td>'; $sort_links .= '<td><a href = "' . $_SERVER['PHP_SELF'] . '?usersearch=' . $user_search . '&sort=5">Date Posted</a></td>'; } return $sort_links; } Apologies for this error - hope it didn't trip up too many of you.
12 Jan 2009
Enduring proof that none of us is immune to unforeseen problems, even when you wrote the book on it! So I obviously have my own web server for building and testing the example code in the book. And recently I needed to test something out in the Aliens Abducted Me example. So I navigate to the app in my browser just to make sure all is well before I start tinkering with the code, and surprise, the YouTube feed is broken!
Now keep in mind I haven't touched the code on the server, so I did nothing to cause it to now fail. The problem is that my server is actually on a shared host, and is potentially subject to the hosting company making configuration changes without me necessarily knowing about it. And for some reason they decided to tighten up some of the PHP security settings. The end result is that the simplexml_load_file() function won't work - I get this warning: Warning: simplexml_load_file() [function.simplexml-load-file]: URL file-access is disabled in the server configuration in .../ch12/final/aliens/youtube.php on line 21 If you're getting this warning instead of seeing YouTube videos at the bottom of Aliens Abducted Me, don't despair. The same problem just bit me and there is a work-around. The best fix is to ask your web hosting company or web server admin to change a PHP configuration setting to allow the simplexml_load_file() function to work. If they're willing, ask them to change the allow_url_fopen setting in the php.ini file to ON. But there's a good chance they won't be so helpful, in which case you need to go to option 2, as I did. Option 2 is to sidestep simplexml_load_file() entirely, and use a different approach to loading XML data. The approach involves using the Client URL library, also known as cURL, which is built into PHP. cURL is extremely flexible, allowing you to communicate with all kinds of different servers using lots of different protocols. In our case, we just want to use cURL to load a file from a URL, and then we can pull it into an XML object. Here's a reusable PHP function that uses cURL to load any kind of data from a URL: function load_file_from_url($url) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_REFERER, 'http://www.headfirstlabs.com/'); $str = curl_exec($curl); curl_close($curl); return $str; } Change the URL in the line with the Head First Labs URL to your own - this just lets the server know who generated the request (some servers, like Google News, require you to provide this). Now we need one more function to actually load an XML file from a URL into an XML object in PHP: function load_xml_from_url($url) { return simplexml_load_string(load_file_from_url($url)); } Stick those two functions in your PHP code, or into a reusable script that you pull in with require_once, and you're ready to roll. Then just replace the call to simplexml_load_file() to load_xml_from_url(): $xml = load_xml_from_url(YOUTUBE_URL); That's it! Now, just to show the flexibility of reusable functions, there's a chance you may want to load in other kinds of data using the same approach. As an example, you might find a data source that provides data in the JavaScript Object Notation (JSON) format, such as Google News. This function takes care of loading data from a URL into a JSON object: function load_json_from_url($url) { return json_decode(load_file_from_url($url)); } It reuses our general load_file_from_url() function to keep from duplicating the cURL loading code. To see this function in action with JSON data, check out this post.
6 Jan 2009
Just in case anyone is confused, we had some issues at the printer with a few of the screen shots in the book where windows are overlapping. It's nothing that detracts from the learning, but it did result in some strange looking screen shots in places.
So we put together a PDF of the affected pages without the print problem as a reference. Feel free to print them out or otherwise use them to see the affected screen shots in all their original glory. We apologize for this problem, and are working to make sure it doesn't happen again. Thanks! https://www.headfirstlabs.com/books/hfphp/h...cted_images.pdf
8 Feb 2008
Just wanted to point out that we have hosted versions of all of the Head First JavaScript examples that allow you to try out the script code on a real web server:
iRock Duncan's Donuts Stick Figure Adventure Bannerocity Mandango YouCube -mm
10 Dec 2007
If you just picked up a copy of Head First JavaScript and want to get started quickly, you might be wondering what development tools you need. Unlike most programming languages, JavaScript requires very little in the way of development tools - all you need is a text editor and a web browser. You edit HTML files (containing JavaScript code) with a text editor, and then test them out in a web browser. That's it!
Windows users can use a text editor as simple as Notepad, while Mac users can rely on TextEdit. In TextEdit, make sure you check the "Ignore rich text commands" checkbox when you open a file for editing. If you don't, TextEdit will try to view the Web page, as opposed to showing the code for the page. You're also free to use a fancier text editor or Web development tool if you happen to have one. As far as browsers go, the book reveals that Firefox (https://en.www.mozilla.com/en/firefox/) is currently the frontrunner for JavaScript development because of its excellent debugging capabilities. Feel free to start out with any modern web browser that supports JavaScript, but know that eventually it will be helpful to test out your scripts in multiple browsers. -mm |
Last Visitors
Comments
![]() ![]() Love the HF PHP/MySQL book. Any chance we could get you to look at the Edit Profile script from the Mismatch site and figure out why it returns the error message when you save it without browsing for a picture when one is already present? 20 May 2010 - 18:13 Friends
There are no friends to display.
![]() |
![]() |
Lo-Fi Version | Time is now: 1st October 2010 - 08:58 PM |