Once again I am working diligently on managing my bibliography and related resources. That means... time to create some new tools.
Today, I released the source code for an RIS parser and writer. The project, LibRIS is hosted on GitHub.
RIS (Research Information Systems) is a file format for exchanging information about reference sources. Journal articles, art works, books... metadata for these can all be expressed in RIS format. And most common citation formats need no more information than that found within an RIS record.
I released an "early access release" today. The format is basic enough that the reader/writer should already be relatively stable. I am using it in a new version of the fabled Lantern package, which is being written on Fortissimo.
Showing posts with label php. Show all posts
Showing posts with label php. Show all posts
Saturday, February 6, 2010
Monday, January 4, 2010
Pilaster PHP Library in GitHub
Over the holiday break, I decided to dust off the Pilaster document database and bring it up to some acceptable level of stability.
As it stands now, Pilaster is a document database that provides similar capabilities to that of MongoDB. It is nowhere near as performant as MongoDB -- then again, it's written in pure PHP and does not require a separate application.
I figured it would be useful for smaller system or for applications running on hosted platforms.
In the backend, it uses Lucene (or, rather Zend's port of Lucene) to provide a high(-ish) performance datastore. You can search it using either name/value arrays or search strings. Yes, search strings are the database's query language. Weird... I know.
To test it out (and contribute, if you'd like), take a look at the Git repository here:
http://github.com/technosophos/Pilaster
If you want to start with a build of it, you can download 2.0-alpha1 (or whatever today's latest version is) by going here:
http://github.com/technosophos/Pilaster/downloads
Versions
When I initially developed Pilaster, it was basically a form of the Sinciput and Rhizome projects. It worked, but it was very tied to the way those systems used data. That was Pilaster 1.x.
As I took a fresh look at Pilaster in December, I realized that I could make it much more generic -- in short, I could make it work with native data structures! With minimal refactoring, I changed the entire Pilaster data model.
I decided that would be Pilaster 2.x.
Pilaster is not quite stable. The unit tests for the main public API all pass. However, the low-level driver is not complete. Import and export still need to be added. I am also uncertain as to how stable the Zend index really is. Your testing can help me discover what works and what doesn't.
As it stands now, Pilaster is a document database that provides similar capabilities to that of MongoDB. It is nowhere near as performant as MongoDB -- then again, it's written in pure PHP and does not require a separate application.
I figured it would be useful for smaller system or for applications running on hosted platforms.
In the backend, it uses Lucene (or, rather Zend's port of Lucene) to provide a high(-ish) performance datastore. You can search it using either name/value arrays or search strings. Yes, search strings are the database's query language. Weird... I know.
To test it out (and contribute, if you'd like), take a look at the Git repository here:
http://github.com/technosophos/Pilaster
If you want to start with a build of it, you can download 2.0-alpha1 (or whatever today's latest version is) by going here:
http://github.com/technosophos/Pilaster/downloads
Versions
When I initially developed Pilaster, it was basically a form of the Sinciput and Rhizome projects. It worked, but it was very tied to the way those systems used data. That was Pilaster 1.x.
As I took a fresh look at Pilaster in December, I realized that I could make it much more generic -- in short, I could make it work with native data structures! With minimal refactoring, I changed the entire Pilaster data model.
I decided that would be Pilaster 2.x.
Pilaster is not quite stable. The unit tests for the main public API all pass. However, the low-level driver is not complete. Import and export still need to be added. I am also uncertain as to how stable the Zend index really is. Your testing can help me discover what works and what doesn't.
Saturday, January 24, 2009
QueryPath: It's like jQuery PHP.
I have just posted "my winter project." Its name is QueryPath, and it's something like jQuery PHP (or is that PHP jQuery?).
While writing the Drupal 6, JavaScript, and jQuery book, I started looking for something like jQuery in the PHP world. I found several projects that implemented small subsets of the jQuery API, but nothing approaching the complexity I had in mind.
So I went back a step, and started looking for a good CSS 3 Selector implementation. I didn't find one of those, either. At best, I found some simple regex-style tools that supported a small portion of the CSS 3 Selector standard.
There was nothing else to do but start coding.
First I wrote a recursive descent parser for CSS 3, including support for XML namespaces and other ill-defined yuckiness.
Then I wrote an event-based API similar to SAX2 -- only for CSS 3 Selectors. And I wrote an implementation of the API.
From there, I began constructing a PHP equivalent of jQuery. Not all of the jQuery API is relevant in PHP. After all, an event model glue layer is not of general interest in a single-threaded PHP app. But HTML/XML traversing and manipulating certainly are. So I borrowed as much of the jQuery API as seemed appropriate.
While I used the same function names (except for empty, which is a PHP reserved word), and tried to follow as closely as possible in parameters and return values, the internals are almost completely different. Why not? After all, JavaScript and PHP are very different languages.
The coding process was interesting. I'm too busy to write something like this in one go. So I spread it out... in 15-30 minute increments. In fact, I developed most of QueryPath while riding Chicagoland trains to and from work. Even with this bizarre and disjointed development path, I eventually finished. QueryPath's main library has 58 public methods, almost all of which are from jQuery's API (though I added some, like an XPath query and tools to use PHP delta and callback functions).
But I wasn't happy. I wanted some cool extensions (plugins), too. It didn't take me long to figure out the obvious: QueryPath needed a database layer. Using PHP's PDO library, I constructed a simple database library, QPDB, that allowed various ways of merging SQL results into XML/HTML. Take a query and turn it into a table or a list. Or get get more detailed -- you can put database results (in whole or in part) wherever you want! There's even a simple template language (I like to call it HTML) that you can use to format results in sophisticated ways.
I am so happy with the library that I have released it under LGPL or MIT License (your choice). You can head over to QueryPath.org (or skip straight to the downloads and docs at http://fedorahosted.org/querypath) to try it out for yourself.)
N.B. A huge thanks to the Fedora Hosted folks for (a) inviting me to host there, (b) providing an unbelievable array of VCS and bug tracking tools, and (c) being more than congenial all along.
Thursday, September 11, 2008
Slashdot review of Learning Drupal 6
I just found out that Slashdot posted a review of Learning Drupal 6 Module Development. The reviewer gave it a 9/10 -- with his detracting points being a few typos in the text, and some stylistic differences with the Packt writing guidelines. Needless to say, I'm thrilled to get such a positive review on a site like Slashdot.
Monday, June 2, 2008
Article on Themes and Modules in Drupal 6
Packt has published a new article of mine (extracted from the Learning Drupal 6 Module Development book.) The article, entitled Theming Modules in Drupal 6, discusses how module developers can build modules that take advantage of the robust theme system in Drupal.
From the article's introduction:
The Philosophy Quotes module that we will create in this article will use Drupal's theme system and a simple database query to theme the content of a custom content type.
The goal of the article is to create a module that uses the theme engine to render content. That way, the module will always produce attractively marked-up content. But when a theme designer needs to change the module's look and feel, this can be done using a template... and the module code itself doesn't need to be touched.
From the article's introduction:
The Philosophy Quotes module that we will create in this article will use Drupal's theme system and a simple database query to theme the content of a custom content type.
The goal of the article is to create a module that uses the theme engine to render content. That way, the module will always produce attractively marked-up content. But when a theme designer needs to change the module's look and feel, this can be done using a template... and the module code itself doesn't need to be touched.
Friday, April 4, 2008
PHP, Unicode, and Securing Your Code
I ran across a pair of interesting articles this morning.
The first focuses on securely handling string data (in PHP). There is a lot of focus on the "context" of a string as being the grounds for determining when and what encoding should be done. Good idea... but the conclusion is rather banal. Safe string theory for the web.
The second, which is linked from the first, is a basic intro to Unicode. It contains useful information that too few people seem to understand. Man, I wish I'd found this four years ago....
The first focuses on securely handling string data (in PHP). There is a lot of focus on the "context" of a string as being the grounds for determining when and what encoding should be done. Good idea... but the conclusion is rather banal. Safe string theory for the web.
The second, which is linked from the first, is a basic intro to Unicode. It contains useful information that too few people seem to understand. Man, I wish I'd found this four years ago....
Friday, February 22, 2008
Learning Drupal 6 Module Development
Packt has now set up the official information page for my Drupal book.This book has a very hands-on practical feeling to it. Each chapter walks through the creation of a module, theme, or installation profile. The goal is to produce modules that actually do something.
The modules cover a range of development tasks, from the fun (jQuery, AJAX/JSON, and XML feeds) to the practical (providing administrators with a special email notification system). More attention has been devoted to some of the new or updated Drupal 6 subsystems, like the Menu API, Forms API, mail subsystem, triggers and actions, sub-themes, and new Javascript.
One chapter covers theming, and one chapter covers building a custom installation profile (that is, an installer for a highly customized version of Drupal).
I'm actually done writing the book (ahead of schedule, I might add). Now, it will go through reviewing and printing before hitting the shelves. My editor tells me that it will probably ship in June. But apparently they are optimistic -- they but the book up for pre-order already.
This has been by far the most fun book I've written, and I think I will stick to this sort of format for future books (at least the development ones).
And if you are coming to DrupalCon Boston, look me up.
Friday, February 1, 2008
JS Library of PHP Functions
Sometimes the most painful thing about Javascript programming is the lack of utility functions. I end up writing an awful lot of boilerplate.
jQuery -- my favorite Javascript library of all time -- goes a long way toward simplifying DOM-related tasks.
But why can't Javascript be more like PHP? Why can't it have a decent set of string and array manipulation functions?
It does now.... in the form of the php.js library. I haven't gotten to do any real testing of this library, but I read through the source code and am happy to see the beginnings of a library that might just encroach upon jQuery's top spot.
jQuery -- my favorite Javascript library of all time -- goes a long way toward simplifying DOM-related tasks.
But why can't Javascript be more like PHP? Why can't it have a decent set of string and array manipulation functions?
It does now.... in the form of the php.js library. I haven't gotten to do any real testing of this library, but I read through the source code and am happy to see the beginnings of a library that might just encroach upon jQuery's top spot.
Thursday, August 9, 2007
Old Sinciput Revision
I (Matt Butcher) released an alpha-quality revision to the original Sinciput 1.0 PHP code base. This new version, 1.5 alpha 1, is transitioning from PHP 4 to PHP 5. The primary change has been from the old DOM XML package to the new DOM package. No major changes have been done to the rest of the project.
Other than making a PHP5 version available (mainly for my own purposes), no new development is happening on the PHP version. The Java version alone is under active development.
Other than making a PHP5 version available (mainly for my own purposes), no new development is happening on the PHP version. The Java version alone is under active development.
Subscribe to:
Posts (Atom)