Paul M. Jones

Don't listen to the crowd, they say "jump."

Solar 1.0.0-alpha4 Released

So much for the "last alpha release" of the Solar Framework for PHP 5. ;-) The alpha4 release corrects a dozen small bugs so that users don't have to wait for the beta in about 7 weeks.

(Cross-posted from the Solar blog.)

The change notes are as follows:

  • Solar_Cli_MakeVendor

    • [FIX] Mismatched ol/ul tags are now matched properly as ul. Thanks, Jon Elofson, for the report.

    • [FIX] Add closing </p> tag in browse template. Thanks, Jon Elofson, for the report.

    • [FIX] In _list and _item templates, use the model locales, not the app locales, when labeling columns. Thanks, Jon Elofson, for the report.

    • [FIX] In method _makeLinks(), skip links that already exists. Thanks,Dmytro Konstantinov, for the report and original patch.

    • [FIX] Correct the target for the tests symlink.

  • Solar_Form_Load_Model

    • [FIX] In method _fixOptions(), use $filter, not $v.
  • Solar_Sql_Adapter_Sqlite

    • [FIX] In method _fetchIndexInfo(), quote the index name as an entity, not as a prepared-statement bound value.
  • Solar_Sql_Model

    • [FIX] In _fixFetchParams(), use $_fetch_cols by default (not $_table_cols).
  • Solar_Sql_Model_Params_Fetch

    • [FIX] Method limit() now properly accepts load parameters. Thanks, Jeff Surgeson for the report that led to this fix.

    • [FIX] Methods where() and having() now honor empty values properly for conditions. Thanks, Anthony Gentile, for the report leading to this fix.

  • Solar_Sql_Model_Related

    • [FIX] In method _fetchIntoArrayAll(), when a collated result is empty, use fetchEmpty() for its value, not a hard-coded null. Thanks, Anthony Gentile, for the report that led to this fix.
  • Solar_View_Helper_Form

    • [FIX] In method addElements(), use correct needle/haystack args for in_array(). Thanks, Jon Elofson, for the report.

Before Ayn Rand, there was Isabel Paterson

Paterson grew up in poverty on the Western frontier. She had only two years of formal schooling. But she learned from her own experience, as well as her encyclopedic knowledge of history, that economic success results from individual initiative, not federal management. As an author, she also knew what makes a plausible story and could see that there could not possibly be a happy ending to the government’s efforts to fix everything that was broken in the 1930s.

Both Roosevelt and his hapless predecessor, Herbert Hoover, tried to inspire confidence by keeping unsuccessful enterprises afloat at the expense of successful ones. Strangely, prudent investors declined to be stimulated, no matter how fervently they were exhorted to trust the government’s programs. For Paterson, that result was tediously predictable. She told readers she was “tired of being told that ‘credit depends on confidence.’ Fudge. Credit depends on real assets, sound money and a clean record. … When any one asks us to have confidence we are glad to inform him that the request of itself would shatter any remaining confidence in our mind.”

Then there was the issue of government planning. To Paterson, the notion that federal experts can plan to ensure the people’s welfare was a ridiculous projection of childish fantasies--“a mother’s boy economic program with a kind maternal government taking care of everybody out of an inexhaustible income drawn from mysterious sources.” Perfect planning requires perfect foresight--and who possesses that?

via The American Conservative -- Finding Atlas.


Let's Try Hawley-Smoot Again!

Because it worked so well last time.

To wit, what does it mean for the world economy if America now has its first protectionist President since Herbert Hoover?

The smell of trade war is suddenly in the air. Mr. Obama slapped a 35% tariff on Chinese tires Friday night, and China responded on the weekend by threatening to retaliate against U.S. chickens and auto parts. That followed French President Nicolas Sarkozy's demand on Thursday that Europe impose a carbon tariff on imports from countries that don't follow its cap-and-trade diktats. "We need to impose a carbon tax at [Europe's] border. I will lead that battle," he said.

[Protectionist]

Mr. Sarkozy was following U.S. Energy Secretary Steven Chu, who has endorsed a carbon tax on imports, and the U.S. House of Representatives, which passed a carbon tariff as part of its cap-and-tax bill. This in turn followed the "Buy American" provisions of the stimulus, which has incensed much of Canada; Congress's bill to ban Mexican trucks from U.S. roads in direct violation of Nafta, prompting Mexico to retaliate against U.S. farm and kitchen goods; and the must-make-cars-in-America provisions of the auto bailouts. Meanwhile, U.S. trade pacts with Colombia, Panama and South Korea languish in Congress.

Through all of this Mr. Obama has either said nothing or objected so feebly that Congress has assumed he doesn't mean it. Despite his pro-forma demurrals, Mr. Obama's actions and nonactions are telling the world that the U.S. is abandoning the global leadership on trade that Presidents of both parties have worked to maintain since the 1930s. His advisers whisper that their man is merely playing a little tactical domestic politics, but he is playing with fire, as the last 80 years of trade history should tell him.

via A Protectionist President - WSJ.com.


Obama Gets One Right

Credit where credit is due, folks.

Well I’d like to take this moment to congratulate the President for making a decision to put the safety of our nation first, instead of internationalism. Just as when he ordered the engagement of the Somali pirate kidnappers in April, Mr. Obama has again sent our special operations teams into action to protect our nation. Earlier today the best of the best, our US Navy SEALs, successfully concluded operation Celestial Balance; an operation tasked to capture/kill Saleh Ali Nabhan. Ten days ago President Obama signed off on the operation to take Nabhan, who was involved in many attacks on us and our allies since 1998 as well as residing on the FBI’s most wanted list since 2006.

via Congratulations Mr. President on a job well done. « POWIP.



Solar 1.0.0alpha3 Released

The alpha3 version of the Solar Framework for PHP5 has been released; you can get it from the usual locations. Of note, this will be the last alpha release of Solar; I expect to have a beta released within the next 8 weeks or so.

This entry is cross-posted from the Solar blog.

I can't believe that almost a whole year has passed since alpha2 was released. In that time we have made some significant changes to how some major Solar components work. You can read the class-by-class change notes if you like, but after a year, they are quite extensive. To point out the highlights, I'll give a broad overview in this post.

Before I do that, I would like to thank one person in particular who made this release what it is: Jeff Moore of Mashery. Jeff has done more on this release than any other contributor, making huge strides in the Model and other packages through his code, reporting, revisions, and (admittedly) nagging of me to make things better. Thank you, Jeff, for everything you have done to make this release possible.

There are lots of others who contributed in important ways, most of whom are noted in the change log with their specific achievements:

  • Jon Elofson
  • Anthony Gentile
  • Robert Gonzalez
  • Tomasz Holeksa
  • Antti Holvikari
  • Ray Kolbe
  • Kalkin
  • Dmytro Konstantinov
  • Clay Loveless
  • Rodrigo Moraes
  • Nicholas Sloan
  • Jeff Surgeson
  • Richard Thomas
  • Matthew Turland
  • Robert Treat
  • Kevin Wagner

Thanks, guys, for all your effort and attention. The project is better for your having been involved. :-)

Model Changes

Nothing has been lost. Solar models still:

  • recognize has-one, belongs-to, and has-many relationships;
  • allow eager- and lazy-fetching of related records;
  • support SingleTableInheritance;
  • save only the changed data, not the whole record;
  • perform data filtering at save() time; and
  • generate automatic form hints from the table columns.

However, much has been added, including performance enhancements across the board. Below are only a few of the highlights; for a full rundown, please review the change notes.

Less-Active Table, More-Active Record

Previously, the table-based Solar_Sql_Model class retained a lot of TableModule-like behavior from its predecessors (Solar_Sql_Table, Solar_Sql_Entity, PEAR DB_Table, etc). When combined with the Solar_Sql_Model_Record logic for inserts and updates, it became difficult to track which parts were doing what.

To remedy this, the Model class has had most of the manipulation logic stripped out of its insert/update/etc methods, and all of that special logic has been placed in the Record class. That makes the Model more like a TableDataGateway, in that it will insert and update the data you give it without attempt to massage it; as a corollary, the Record becomes more like an ActiveRecord implementation.

Many-to-Many

We have added "has-many-through" relationship descriptors. This means that models now recognize many-to-many relationships through an explicit association model.

Saving Related Records

When you save a record, it now wires up all the related record IDs for you, setting all the necessary primary key information automatically. In partcular, saving a "has-many-through" will wire up not only the related records on the foreign side of the association table, but also the related records on the association table itself.

For the "has" relationships, it then saves each of the related records and collections for you:

  • has-one records are saved as they are;
  • has-many collections are saved as they are; and
  • has-many-through collections are checked for additions and
    removals against the association table, and are saved or deleted
    as necessary; this includes saving the records on the foreign side
    of the association table

Note that automatic saving of related records does not occur on "belongs-to" relationships. You still have to save those on your own; they are necessarily precursors to the existence of the current record or collection.

Eager Fetching

Eager fetching performance has been improved in many common cases. We now have dual strategies for relating back to native record sets (using a "WHERE ... IN (...)" clause for smaller sets, or using an "INNER JOIN (SELECT ...)" strategy for larger sets). As before, eager fetching avoids the 1+N pitfall, generating only one additional query per relationship (not one per record in the native result set).

Additionally, it is now possible to chain eager fetches. That is, eager-fetched records can themselves eager-fetch their own related records, all with a single call to the Model fetch*() method.

XML-Struct Columns

Solar models support automatic application of serialize() and unserialize() to columns in the $_serialize_cols model property. We now add to this the ability to serialize and unserialize basic XML-formatted data as well, through the use of the new Solar_Struct_Xml class. (N.b.: XML structs do not support attributes.)

Among other things, this means that you can store simplified XML data in a column, and database engines capable of searching it, can search it. You can manipulate that data as XML data in PHP as well via the XML-struct mechanisms.

Non-Model Changes

Arch-Class

The Solar arch-class has fewer static methods in it; collections of related methods have been grouped into their own classes (e.g., [Solar_Config][]).

Construction

The Solar_Base class, from which all other Solar classes extend, now has a more pluggable construction and configuration process. Hooks include:

  • _preConfig() to set up the object before configuration
  • _postConfig() to modify the object after configuration
  • _postConstruct() to complete object construction

This means that you never need to override a Solar constructor; instead, place your construction logic in the applicable hook method.

Page Controllers

The Solar_Controller_Page class now comes with a default layout and views, along with added error handling methods, making it more useful as a base page controller class in its own right. (Previously, one had to extend Solar_App_Base, or create a base app of one's own, to get these basic defaults.)

One thing has been removed: recognition of page-level view helpers. In theory, these seemed like they might be useful. However, in practice, they were rarely if ever needed. Vendor-level helpers are now the first place the views will look.

Lazy Sessions

The Solar_Session class now supports "lazy" sessions. Previously, it would start a sesssion automatically at instantiation time. Now, it starts a session only when ...

  1. A PHP session cookie already exists, or
  2. You call one of the set*() methods to store a value

This means that the session object can be available at any time, but won't invoke any session-based overhead until it is actually needed.

Make-Vendor and Model-Based Apps

The make-vendor command now generates a special page controller called {Vendor}_Controller_Model, which houses all the code for a minimal BREAD-S (browse, read, edit, add, delete, and search) application based on a model.

Previously, make-app would generate the BREAD code fresh in each new class, but when you build mutiple model-based apps, you would end up with a lot of code duplication. The new approach removes that duplication entirely. This means that make-app --model-name will now create app classes that extend from {Vendor}_Controller_Model.

Compound Selects

Solar_Sql_Adapter and Solar_Sql_Select now support UNION and UNION ALL query construction, with the related LIMIT and ORDER components of those kinds of queries.

Forms

The Solar_View_Helper_Form view helper for forms now supports different kinds of decoration: as definition list, as a table, or as "plain" (no surrounding markup). The helper itself has been significantly refactored so that the internal logic is easier to follow, and support logic has been extracted into separate classes when possible.

Much More

There is a lot more to be had. Take a look at the Getting Started documentation, then spend some time with these blog entries from Solar users:


Forty Percent!

Big news (for me anyway): my employer, OmniTI, is allowing me to spend a minimum of 40% of my paid work time on the Solar Framework for PHP 5 (plus additional time as duty allows). The project remains open-source under New BSD license.

The agreement has been in place for several weeks now, and has allowed me to put a lot more effort into the project lately (as a review the SVN logs will reveal) while keeping a paycheck. At the same time, OmniTI gets to show its support for one of the many the open-source communities it has been able to build its business on. Thanks, Theo and Ciprian, for this generous allowance. I appreciate it, and so does everyone who uses Solar; I think it's a big win-win all around.


US Life Expectancy: Best In World?

Apparently "yes", when you control for car crashes and homicides.

One big reason our life expectancy lags is that Americans have an unusual tendency to perish in homicides or accidents. We are 12 times more likely than the Japanese to be murdered and nearly twice as likely to be killed in auto wrecks.

In their 2006 book, The Business of Health, economists Robert L. Ohsfeldt and John E. Schneider set out to determine where the U.S. would rank in life span among developed nations if homicides and accidents are factored out. Their answer? First place.

via The Agitator » Blog Archive » Life Expectancy.

Not sure what this says about US rates of homicide and auto fatalities, but I'm pretty sure it says that the "Americans spend more on health care but don't live as long" trope is misleading at best.



Let insurance companies compete across U.S.

Right now, the U.S. does not have a national market for health insurance. It has 50 separate state markets. Erecting walls around each state means less competition and higher prices for consumers. There's not even one market for the Chicago area. If you live in South Holland or Calumet City, your insurance options could be completely different from your Indiana neighbors in Hammond or Merrillville. What sense does that make?

The easiest way to see how insurance competition benefits consumers is to look at auto insurance. That's a huge, nationwide market and companies compete intensively for a share of it. Some stress their low prices, others customer service, whatever gives them an edge in the marketplace. Geico and Progressive have been especially aggressive in touting cost savings. State Farm and Allstate certainly compete on price, but they stress service after an accident. That's why Allstate says "you're in good hands," and State Farm says it will be there "like a good neighbor." Other companies, like SafeAuto, focus on drivers who want only minimum coverage to meet state license requirements. In short, auto insurance companies compete vigorously to provide what different consumers want, and they tell them so in national advertisements. Life insurance companies do the same thing. There are even companies that specialize in comparing policies for customers. Competition drives down excess profits and means better, cheaper options for consumers.

Ever see an ad touting health insurance? They are rare because the markets are small and companies don't need to compete aggressively on price or service. Introducing such competition would be good for consumers, wouldn't require another Washington bureaucracy and could be done quickly.

via Let insurance companies compete across U.S. -- chicagotribune.com. (All emphasis mine.)