Low End Mac Reader Specials
TypeStyler For Mac OS X is Now Shipping! Download The Free Fully Functional 60 Day Tryout at www.typestyler.com
Don't install Parallels to play poker online! Poker Mac will show you how
to download and install a native Mac poker application such as Full
Tilt Poker Mac.
Laptop Hardware Provided by TechRestore - Overnight Mac & iPod Repairs.
Compare products like desktop computers, apple laptops, apple macs, and LCD Monitors side by side! All the information and reviews to make the best purchasing decision for new mobile phones, sat nav systems, or MP3 players. The Ciao online shopping community makes searching products easy for you.
Low End Mac's Online Tech Journal
More Link Automation and PHP Frustration
Website Automation with PHP and MySQL, Part 15
Dan Knight - 2002.07.31
Back in the Apple II+ era, my boss bought an Apple II+ system - and I discovered that I really enjoyed BASIC programming. AppleSoft BASIC was related to the Microsoft BASIC used by Commodore, CP/M machines, and most of the others.
The challenge was learning how BASIC worked by modifying programs, learning how the various dialects worked by converting them to AppleSoft BASIC (and later Commodore BASIC when I bought a VIC-20, GW-BASIC on my Zenith DOS machine, as well as Turbo BASIC and Quick BASIC).
Then I got a Mac, and I stopped programming - unless you count defining relationships between fields in Excel, FileMaker, and ClarisWorks programming. I never did get the hang of HyperCard and still don't understand AppleScript.
I don't pretend to understand PHP. I'm learning slowly, and I'm much less dependent on Brian and Steve for assistance, but when I need a fresh set of eyes to find a programming bug, one of them usually comes through.
I'm learning enough PHP to do what I want to do. And I've discovered that PHP isn't terribly well documented. A lot of the sample code I download from PHP.net doesn't work without some modification, and some of the information is simply wrong. That's frustrating.
Reading Email
My big programming project for the summer was going to be writing an email list management program that could handle dozens of lists while using a single subscription database. Anyone who runs a few busy lists probably knows the frustration of receiving "take me off your list" emails from subscribers who don't tell you which list.
That's one thing my program will address.
But instead of making progress, I've been stuck for almost a week trying to use the imap_open function. This is supposed to let me open a mailbox, then read and display the headers. Using the example on the PHP.net site (modified for my test address and password), I get error messages no matter what I do.
This is very frustrating, because I need to have this figured out before I can go anywhere with the project. And the imap_open function could also form the basis for creating a personal program to remove spam from my mailboxes.
More Low End Mac Automation
That may be frustrating, but this morning I began another aspect of automating things on Low End Mac.
When we publish new editorial content, we include a list of recent links at the end of the article. For some content, this is a generic "recent content" list, but for regular columns, we usually link to the 3 or 4 most recent articles in that series followed by other recent links on the site.
This morning I began automating that using pretty much the same techniques discussed in part 12. The big difference is a new section that displays the three most recent articles in that column (such as Mac Scope - our sample) and then recent links excluding those from that column.
I'm not going to post all the code, but here are the relevant parts:
- $get_links = mysql_query("SELECT * FROM links WHERE timestamp <= $rightnow and columnname = 'Mac Scope' ORDER BY timestamp DESC LIMIT 3");
- while ($array = mysql_fetch_array($get_links))
- {
- echo "<li><a href=\"$array[path]$array[html]\">$array[linktext]</a>, ";
- $shortdate = $array[pubdate];
- $shortdate = substr ($shortdate, -5);
- $shortdate = strtr ($shortdate, '-', '.');
- echo "$shortdate.
- $array[description]</li>";
- }
- echo "<li>More in the <a href=/musings/index.shtml>Mac Scope index</a>.</li>";
The first line finds the three most recent Mac Scope columns and sorts them in descending order by date. The subroutine displays the column title, link, date, and description. Since Mac Scope is always written by Stephen Van Esch, there's no need to display the author's name or the column title (Mac Scope) here.
The rest of the code is almost unchanged from what we came up with in part 12. The only real difference is excluding Mac Scope columns:
$get_links = mysql_query("SELECT * FROM links WHERE pubdate = '$latestdate[pubdate]' and timestamp <= $rightnow and columnname != 'Mac Scope' ORDER BY rank DESC");
The != is PHP's way of saying "not equal," which some languages write as <> and your math teacher probably taught you as an equal sign with a slash through it.
Once I had the script working properly, all I had to do was change the calls that had been made to a manually updated include file and instead call my PHP script. It works beautifully.
What Next?
For now, I'm pretty happy with how things are working. It'll take some time to get all of the sections updated with these new scripts, but there's no big hurry - nor is it a tedious job.
I'd eventually like to work on a submission system where writers could turn in articles online, maybe even writing some PHP to analyze content and take a stab at picking the best words to use in META tags. But there's no hurry.
The next big project will be Email List Automation Using PHP and
MySQL. Assuming I can solve the imap_open problem.
Recent Online Tech Journal Columns
- Optimized Software Builds Bring Out the Best in Your Mac, 06.30. Applications compiled for your Mac's CPU can load more quickly and run faster than ones compiled for universal use.
- Low End Mac's Safe Sleep FAQ, 06.15. What is Safe Sleep mode? Which Macs support it? How can you enable or disable it? And more.
- The Original Macintosh, 01.12. An in-depth look at the original Macintosh and how it shaped future Macs.
- The Innovative Lisa, 01.08. Apple's Lisa and how it paved the way for the Macintosh.
- More in the Online Tech Journal index.
Links for the Day
- Mac of the Day: Mac mini Core Solo, Feb. 2006 - The only Mac to use a Core Solo CPU, this model ran at 1.5 GHz, has integrated graphics, and includes a Combo drive
- Group of the Day: SuperMacs is for those using Umax SuperMac clones.
- November 24 in LEM history: 98: Microsoft's heavy hand - 00: Looking at the iMac - 04: The best Mac for the holidays - Picking the right replacement for a dead mouse - Better battery for 15" AlBook
- Support Low End Mac
Recent Content on Low End Mac
- Google Calendar with iPhone or iTouch Is Great for Scheduling, John Hatchett, Recycled Computing, 11.24. Web-based Google Calendar allows access and updates from any computing platform, including Mac, Windows, Linux, and iPhone OS.
- Why Spaces is My Favorite Leopard (and Snow Leopard) Feature, Charles W. Moore, Miscellaneous Ramblings, 11.23. Spaces, a feature introduced with OS X 10.5, is like having several monitors on your Mac without the cost and space of using multiple displays.
- i5 iMac Benchmarked, Mac mini 'Shouldn't Be Overlooked', Twitter Client for Classic Mac OS, and More, Mac News Review, 11.20. Also why Apple leaves the low end to others, 10.6.2 fixes video playback problem in 27" iMac, 3D Leopard and Snow Leopard performance, and more.
- Apple's Tablet an End Run Beyond Netbooks, Frank Fox, Stop the Noiz, 11.20. Whatever Apple has planned will leverage existing technologies while going beyond what its competitors can offer.
- Apple #4 in Reliability, Apple Tablet a Gadget for All?, HP's i7 Notebook Outdoes Mac Rivals, and More, The 'Book Review, 11.20. Also Flash 10.1 improves video on Hackintosh netbooks, thin-and-light notebooks impress, Windows XP finally on the way out, and more.
- NASA Chemical Sensor for iPhone, Smartphone Death Match, iPhone Earrings, and More, Ian R Campbell, 11.20. Also mobile phone dangers, new apps, GPS solution for iPod touch, new iPod and iPhone cases, and more.
- More links in our archive.
Recent Deals
- Best G4 iMac Deals, 11.24. Used 15" 700 MHz CD-RW, $150; 800 MHz Combo, $229; 1 GHz, $289; 17" 1.25 GHz, $200; 20" 1.25 GHz, $509.
- Best MacBook Air Deals, 11.24. Used from $899; refurb from $1,099; new 1.6 GHz/120 HD, $1,150 after rebate; 1.8/64 SSD, $1,150 a/r; 1.86/128 SSD, $1,350 a/r; 2.13/128 SSD, $1,694 a/r.
- Best PowerBook G3 Deals, 11.24. Used 233 MHz WallStreet, $75; 266 MHz, $160; 400 MHz Lombard, $199; 400 MHz Pismo, $289; 500 MHz, $350.
- Best 12" PowerBook G4 Deals, 11.23. Used 867 MHz SuperDrive, $348; 1 GHz Combo, $379; SD, $519; 1.33 GHz, $529; 1.5 GHz Combo, $549; SuperDrive, $609.
- Best Mac Pro Deals, 11.23. Used 2.66 GHz 4-core, $1,300; 3.0 4-core. $1,919; refurb 2.66 4-core Nehalem, $2,149; 2.93, $2,549; 2.93 8-core, $4,999; new 2.26 8-core, $2,290.
- Best Time Capsule and AirPort Deals, 11.23. Used 802.11g AirPort Extreme, $49; 500 GB Time Capsule, $150; new, $190; 1 TB dual-band, $280; 2 TB, $469; 802.11n AirPort Extreme, $170.
- Best eMac Deals, 11.18. Used 1 GHz Combo, $100; SuperDrive, $269; 1.25 GHz Combo, $119; SD, $319; 1.42 GHz Combo, $289; SD, $498.
- Best Mac OS X 10.6 and Mac Box Set Deals, 11.18. "Snow Leopard", single user, $25; 5 users, $45; Mac Box Set, single user, $139; 5 users, $180; Server, $414. Shipping included.
- Best Xserve Deals, 11.18. Used 1 GHz dual G4, $649; 2.3 dual G5, $795; 3.0 4-core Xeon, $1,899; refurb 2.26 4-core, $2,499; new, $2,888; refurb 8-core, $2,999; new, $3,449; more.
- More deals in our archive.
About LEM | Support | Usage | Privacy | Contacts
Navigation
Used Mac Dealers
Apple History
Video Cards
Email Lists
Favorite Sites
MacSurfer
MacMinute
MacInTouch
MyAppleMenu
InfoMac
Macs Only!
The Mac Observer
Accelerate Your Mac
RetroMacCast
PB Central
MacWindows
The Vintage Mac
Museum
DealMac
DealsOnTheWeb
Mac2Sell
ramseeker
Mac Driver Museum
JAG's House
System
6 Heaven
System 7 Today
the pickle's Low-End
Mac FAQ
Abandonware
Petition
Mac vs. PC Info
Affiliates
The Apple
Store
Mac
Connection
B&H
MacMall
TechRestore
ExperCom
Crucial
Memory
batteries.com
Advertise
MacMinute
MacInTouch
MyAppleMenu
InfoMac
Macs Only!
The Mac Observer
Accelerate Your Mac
RetroMacCast
PB Central
MacWindows
The Vintage Mac
Museum
DealMac
DealsOnTheWeb
Mac2Sell
ramseeker
Mac Driver Museum
JAG's House
System 6 Heaven
System 7 Today
the pickle's Low-End
Mac FAQ
Abandonware
Petition
Mac vs. PC Info
Mac Connection
B&H
MacMall
TechRestore
ExperCom
Crucial Memory
batteries.com
