Feed aggregator

PHPMaster.com: Extract Objects from an Access Database with PHP, Part 2

PHPDeveloper.org - Mon, 03/06/2013 - 17:37

PHPMaster.com has posted the second part of their series covering connecting PHP to a legacy Access database. In part one they introduced you to working with the data and how to extract the object. In this new part they look at specific file types and how to pull out their data.

In this second part we'll learn how to extract Acrobat PDF documents and take a brief look at a selection of image formats. The only similarity that PDF, GIF, PNG, etc., have when stored in an Access database is that they are all wrapped in an OLE container consisting of a variable length header and trailer. As we shall see, the trailer can be ignored as it was with the package discussed in Part 1. The header is more useful, but doesn't contain all the information we need.

They get into the details of the headers for each type of object and include screenshots of what they look like in a hex viewer. The code for the complete class is included in the post, making it easy to drop in and get started with your transition from database object to external file.

Link: http://phpmaster.com/extract-ole-objects-from-an-access-database-using-php-2

Community News: Peers Conference 2013

PHPDeveloper.org - Mon, 03/06/2013 - 16:01

There's a conference coming up at the end of this month (tickets still available) that focuses on "people, not plugins and solutions, not software" - the Peers Conference.

Peers is a tech conference for web designers, PHP developers and web business owners. Love ExpressionEngine? Curious about Craft? Learning all about Laravel? Whether you're a pixel-pusher, an artisan or a maker, Peers is for you.

At Peers conference, you'll hear from a variety of voices. We've engaged some of the top people within our community to come and share their wisdom. Because running a business and keeping up with the latest trends is daunting. Who better to help than your peers?

The event is being held in Chicago on June 26th through the 28th and has lots of great speakers and sessions planned for this year. You can still get the Early Bird price of $299 USD that includes admittance into the conference, event attendance and meals.

Link: http://peersconf.com

Community News: Packagist Latest Releases for 06.03.2013

PHPDeveloper.org - Mon, 03/06/2013 - 15:02
Recent releases from the Packagist:

Community News: Packagist Latest Releases for 06.02.2013

PHPDeveloper.org - Sun, 02/06/2013 - 15:00
Recent releases from the Packagist:

Drupal Hackday - Writing DRUSH extentions

Planet-PHP - Sun, 02/06/2013 - 02:51

Today Patrick Jezek and I sat together to get a grip on one of the major problems we have when using Drupal in a continuous integration environment - module updates involving major updates on configuration settings and database content.

Problem description

Imagine a usual Drupal installation already deployed on a live server. Imagine further that there is a demand to update at least one module of this installation without human interaction, any downtime, and data loss. The default work flow when updating configuration information would either demand human interaction and/or the complete deinstallation and reinstallation of the module which, when the hook_uninstall() correctly implemented, will cause data loss. A third option is to write a script to setup the new module after the installation process is done but this would challenge the deployment system to support some kind of a post_deployment process.

What was the goal?

The goal of this hackday was to propose a solution which enables a development team to continuously deploy and maintain a Drupal installation without being forced to uninstall modules to do a major update. Further more there should be some kind of a mechanism making it possible to update modules without human interaction when deploying the modifications.

Solution proposal

One of the most beneficial Drupal extensions is the Drupal shell (short: drush). It provides an extensive variety of commands to maintain Drupal (e.g. managing modules, users, and basic drupal configuration). The nice thing about drush it can be handled by any shell script just calling the specific commands and processing their outcome. Extending drush was therefore the most natural thing we could think about when we were confronted by this task.

So we came up with a drush extension providing a new Drupal hook hook_vm_update().

Custom hook_vm_update

Located in the *.install files the hook_vm_update() will be invoked by the drush extension. Further does the extension detect the existence of the custom hook and indicates this on the command line.

$drush vm-update  "myCustomModule, myOtherModule"

Updating myCustomModule ... no »vm_update« hook available        [warning]
Nothing to update for module »myOtherModule«                     [warning]
Custom scripts

In order to keep track of previous installed module versions we wrote two scripts. One does write down the currently installed version into a text file. The other one invokes drush to for modules which got changed since last deployment.

Further ideas Add version information to hook_vm_update

Currently the update hook will always be called when the drush command is invoked and the previous installed version is smaller then the just installed one. Having only one hook implies that this hook knows which steps needed to upgrade from one version to another (including steps in between). What about a naming convention for hooks combined with version number and a logic to call them in chronological order, up to the target version (like Drupal core updates use schema update hooks).

Since the hook should not invoke actions potentially dangerous or harmful in terms of data loss et. al. this should not be much of a problem. But since we can already imagine situations where it is useful to either step through past updates or make the hook decide whether it an update is to be invoked or not one of the next steps for this drush extension will be to provide version information for an update.

Persist version information into the database

The versions.json file resists on the file system and could be potentially overwritten by a new installed package. An alternative could store the version information into the database (e.g. by using the Drupal configuration with variable_set() ?).

Final thoughts

We had some fun working on a solution for this given problem. We had the chance to look deeper into drush. We learned yet some php functionality we never used before. Unfortunately the weather was not nice and we could not fire up the grate for lunch.

Last but not least thanks L//p for this opportunity!

Categories: Open Source, PHP Community

Community News: Packagist Latest Releases for 06.01.2013

PHPDeveloper.org - Sat, 01/06/2013 - 15:00
Recent releases from the Packagist:

Rasmus Larsson: Building a template engine in PHP

PHPDeveloper.org - Fri, 31/05/2013 - 18:11

Rasmus Larsson has a recent post to his site showing how to build a basic templating engine in PHP that uses the "__toString" to help render the result.

Possibly the most common sign of bad code is tight coupling, especially between logic and presentation. It might seem like a good idea to print out the HTML while the data is being generated, but it more often than not leads to a big incoherent mess of tangled code. [...] While PHP makes it unnecessarily easy to write shitty code it also provides a lot of ways to avoid it. I'll use this post to show you how ridiculously easy it is to create a template engine in PHP in three easy steps.

He includes the sample code for a "Template" class and shows the combination of exporting variables and output buffering to return the resulting template populated with values. The "__toString" method makes it so that you can just echo out the object and get the results.

Link: http://www.rasmuslarsson.se/2013/05/a-template-engine-in-php

Storyplayer Slides From PHP London Talk

Planet-PHP - Fri, 31/05/2013 - 11:18

Storyplayer is DataSift’s test tool for functional and non-functional testing of software and services, built to test at the firehose scale. It sits nicely between PHPUnit for unit testing by developers, and Behat for acceptance testing by product managers.

Earlier this month, I spoke to a packed audience at the PHP London user group meetup about Storyplayer, a test tool that we’ve open-sourced here at DataSift.

Here are the slides from that talk, for everyone who hasn’t yet seen them via Twitter:

<script async class="speakerdeck-embed" data-id="bfdba98095f10130d49d4a0bed3063c9" data-ratio="1.2994923857868" src="//speakerdeck.com/assets/embed.js">

If you can’t see the embedded slides in this blog post, they’re available over on SpeakerDeck.

Right now, I’m focused on completing the online documentation (which is very much a work in progress), and preparing v1.1.0 with further improvements.

Categories: Open Source, PHP Community

Consuming RabbitMQ messages with PHP

Planet-PHP - Fri, 31/05/2013 - 02:36
Once you’ve created a RabbitMQ producer, it’s fairly easy to create a consumer. In fact, the only difference is in exactly what commands you’re using. The connection, envelope, channel and queue declarations are the same. While in RabbitMQ you publish to the exchange, you actually do consume a specific queue. As a result, the commands [...]
Categories: Open Source, PHP Community

Publishing messages to RabbitMQ with PHP

Planet-PHP - Wed, 29/05/2013 - 14:31
Now that we understand the basics behind RabbitMQ, it’s time for us to start working with it. The first step in working with RabbitMQ is to begin sending messages to the exchange so that they can be queued. In RabbitMQ parlance, the “producer” is responsible for “publishing” the messages to the exchange. Connecting to RabbitMQ [...]
Categories: Open Source, PHP Community

10 Steps to properly do PHP Bug Tracking and Fixing as Fast as possible

Planet-PHP - Wed, 29/05/2013 - 14:18
By Manuel Lemos
No matter how hard you try to test your PHP applications before putting them in production, you will always ship code to your server that has bugs.

Some of those bugs will be very serious and need to be fixed before they cause greater damages to your application data that may be too hard to recover.

Read this article to learn about a several good practices that you can apply to track bugs in production code, so you can fix them before it is too late.
Categories: Open Source, PHP Community

Queuing with RabbitMQ and PHP

Planet-PHP - Tue, 28/05/2013 - 13:00
There are many times that you want to write background processes and queue up the tasks so that they can be handled in sequential order. There are any number of queues available for software developers, and one that I’ve really taken a liking to is RabbitMQ. Besides the fact that the queue is designed to [...]
Categories: Open Source, PHP Community

Universal Database Tools - DtSQL 2.5.1 is released (FREE)

Postgresql.org - Mon, 27/05/2013 - 02:00
Universal Database Tools

DtSQL is a FREE universal database query and editor tools for developers and database administrators to Query, Edit, Browse, and Manage Database objects such as tables, views, indexes, procedures, functions, triggers, contraints and sequences. It can access most databases and can be used on all major operating systems.

  • Supported databases : Cache, DB2, Derby, Firebird, FrontBase, H2, HSQLDB, Informix, Ingres, JDatastore, MaxDB, Mckoi, Mimer, MySQL, Oracle, PointBase, PostgreSQL, Solid, SQLite, SQL Server, SQL Anywhere, Sybase (ASE).
  • Support Operation Systems : Windows, Linux and Mac OS. Database Browser Tools : browse schemas, tables, columns, primary and foreign keys, constraints, views, indexes, triggers, stored procedures, functions, sequences, and so on.
  • Database Tools : create, alter, view and drop database tables, views, indexes, constraints, stored procedures, functions, triggers, sequences, and so on.
  • Database Management Tools : edit database table data including binary/BLOB and CLOB data types. Filter, sort and search query result. Insert, duplicate, update, and delete database table data. Find and replace database data, preview generated SQL. Redo or undo last table data change before update is commit.
  • SQL Tools : tools to edit, format and execute SQL scripts.

    SQL Builder : help tools to build database select, insert, update, delete SQL scripts.

  • Import Data : tools to import data from various formats such as CSV files, Excel files, and fixed-width files. Parse import data according to integer, date, time, timestamp, and boolean pattern.
  • Export Data : tools to export database data (single table/multiple tables/query result) in various formats such as CSV files, Excel files, XML, HTML, SQL insert statements and fixed width files. Format export data according to applied integer, date, time, timestamp, and boolean pattern. Built in database

FREE to use.

Home: http://www.dtsql.com

Categories: PHP Community

My contribution to Mentoring in the PHP Community

Planet-PHP - Sun, 26/05/2013 - 03:38

After the awesome mentorship summit at php[tek] 2013 a little over a week ago, I decided that as part of my contributions to mentoring in the community I would put out a call:

Anyone and everyone who would like to speak at a conference, I want to review and critique your talk submissions.

As part of this, I’d like to offer an opportunity for to you bounce ideas for talks off me, to work with you on tightening up your title/abstract, and if I have time, to review slides and/or do a google hangout run through prior to you speaking.

To make this process as easy and efficient as possible:

  • If you want to bounce ideas off me, you can find me on #phpmentoring on Freenode IRC, or ping me via Twitter for IM details.
  • For proposal review, please put them in a gist and we can work from there — just ping me on Twitter beforehand, and then once I get back to you I’ll ask for the gist link.
  • For slide review, ask on Twitter/IRC — and don’t be upset if I say no. This is a much more time consuming thing.
  • For hangouts, do one of the first two things and if it’s something I’d like to see, I’ll probably suggest it

I hope in this way I can help a bunch of people in a fairly informal way, and we can bring a bunch of new blood to the speaking circuit.

Also: please don’t limit this to just PHP-related topics. I’m happy to give advice on many more things (that I feel qualified for), soft and hard topics.

Categories: Open Source, PHP Community

Community News: Packagist Latest Releases for 05.25.2013

PHPDeveloper.org - Sat, 25/05/2013 - 15:05
Recent releases from the Packagist:

PHP Subconference at FrOSCon 2013

Planet-PHP - Sat, 25/05/2013 - 08:59
This years FrOSCon – one of the most awesome open source software conferences – is right ahead and we are organizing a PHP project room again this year. Read more for details…
Categories: Open Source, PHP Community

XPath expert needed

Planet-PHP - Fri, 24/05/2013 - 20:27

In the PHPCR implementation using Doctrine DBAL we support search queries by converting the SQL2/QOM statements into XPath queries that we run on the XML stored in an RDBMS. Sounds insane, yes .. but it works pretty well .. obviously will not scale very well .. but it works for smaller data sets and there will be ways to improve performance later. In terms of functionality we have everything working quite well including JOIN support that was added recently.

However we are stuck with multivalue queries. What makes it particularly tricky is that we do not know which properties are multivalue and which are not as illustrated by these tests.

As you can see in the test we have a multivalue property "tags" and in the SQL2 statement we want to test if that multivalue property contains both "foo" and "bar". However inside the query engine we do not know that this property is multivalued or not.

The relevant code is in QOMWalker:: sqlXpathValueExists() and QOMWalker:: sqlXpathExtractValue(). As you can see it currently only looks at "sv:value[1]".

You can find some more information here:
https://github.com/jackalope/jackalope-doctrine-dbal/issues/88

Categories: Open Source, PHP Community

Adam Culp: PHP usage statistics

PHPDeveloper.org - Fri, 24/05/2013 - 18:41

Adam Culp has posted his own look at some of the PHP usage statistics that are out there and how they can be interpreted.

Every once in awhile I stumble across someone who is trying to find their way and decide what they will do in their career. As the organizer of a PHP user group I see many new developers passing through. Of course I always speak of how strong PHP is in the web markets, and encourage new web developers to pursue PHP as a tool in their box of goodies. Because as a web developer it would be a career limiting move to not have any knowledge of PHP. Here is why...

He shares a few different sources including w3tech's overall and PHP-specific information (PHP5 specific here) and the current results of the TIOBE index showing language popularity. For each he talks some about what the results mean (and don't mean) and how, if you're a "professional developer" you should, at the least, know PHP - the most dominant language in the web space.

Link: http://www.geekyboy.com/archives/672

Michelangelo van Dam: UA Testing with Selenium and PHPUnit

PHPDeveloper.org - Fri, 24/05/2013 - 17:18

In this new post to his site Michaelangelo van Dam looks at user acceptance testing with PHPUnit and Selenium.

Last week I spoke at php[tek] 2013 where I explained to people how to get started with Selenium IDE to record user interaction with the web interface, convert them to PHPUnit testcases and automatically execute them on multiple browsers on multiple platforms. The feedback I got was awesome, you're all a great crowd! But on twitter I also received a bunch of questions regarding how to set up multiple platforms and why I used Windows in my presentation to deploy to. So today I deceided it was time to write a full article on this subject.

He introduces Selenium and what kinds of things it can be used to test. He also defines "user acceptance testing" and talks about why they're an important part of the testing ecosystem. He then walks you through the process of getting the testing environment set up, creating a few tests and how to convert them over to PHPUnit tests (using a built-in tool). Screencasts show you each step of the way. He includes a little tweaking you'll need to do to to the test code to get it working with your own Selenium server

Link: http://www.dragonbe.com/2013/05/ua-testing-with-selenium-and-phpunit.html
Syndicate content