Category: open source
Installing php apd on php 5.3.10
Today I wanted to extend the phpdebugtoolbar to allow tracing for good old mysql_query commands. This can be possible by using the rename_function-method, which is provided by the apd pecl extension.
It's a pitty that this extension cannot be compiled for php >= 5.3 without any patch.
So here the step by step guide to get it up and running on a php 5.3 or later.
1. Download apd-1.0.1.tar.gz from pecl.php.net.
2. Extract the files
3. Patch the code
2
3
4
5
6
7
8
9
10
11
12
index 6707e02..8bfafb5 100644
--- a/php_apd.c
+++ b/php_apd.c
@@ -964,7 +964,7 @@ ZEND_DLEXPORT void onStatement(zend_op_array *op_array)
int apd_zend_startup(zend_extension *extension)
{
TSRMLS_FETCH();
- CG(extended_info) = 1; /* XXX: this is ridiculous */
+ CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO;
return zend_startup_module(&apd_module_entry);
}
4. Run phpize to configure the extension.
5. Run make to build the extension
6. Run sudo make install to copy the .so to the necessary location
7. Add this line to your php.ini (the folder may be different on your system)
That's it. If you receive the error message, that apd.so is not a valid extension, you must use "zend_extension=" and not "extension=" to configure the extension properly!
Call
2
3
4
5
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Advanced PHP Debugger (APD) v1.0.1, , by George Schlossnagle
with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans
and the Advanved PHP Debugger info appears.
Assertions and No-Test-Framework in PHP
When I was writing the tests for Craur, I wanted to try a new way (no phpunit this time) to write tests in php.
Since php already has a assert($assertion) method, I imagined that it might be a good start to test without an extra test framework.
A simple
raised a warning. Nice! So I made the following approach:
2
3
my_test_file.php
another_test.php
Whenever I want to launch the tests, I just go into the tests folder and launch php $file_name for all of them. If the exit code is different to 0 -> the test failed.
It's a pitty, bit assert($assertion) does not raise an exception or something like this. Great for other use cases, but in mine this was really an issue. So I wrote this small wrapper script bootstrap_for_test.php. It registers a new AssertionException class for all kind of errors and as ASSERT_CALLBACK! Now even a notice or a warning make the test fail. Great!
Now a simple test looks like this:
2
3
include('./../bootstrap_for_test.php');
assert(2 == 3);
To have the tests run at once, I wrote a little run_test.sh script. It runs every test and returns the script with an exit code different to 0, if one of the tests fails.
All integrated with Travis CI and Craur is tested!
JSB 1.3.0 released - Good bye Inline-Javascript
Today I finally finished JSB 1.3.0. The JsBehavourToolkit is a little toolkit to avoid any inline javascript, allow copy-and-paste of behaviour on html elements.
There is a native version, which works without any framework from (Firefox 3+, Safari 5+, Opera, Chrome and IE9+). The jQuery and Mootools Version works with any browser (even IE6).
New in 1.3.0 is a simple (by design!) event system. It is framework independent and works with simple channel identifier and a json-object as value.
This should be fired by a Js-Behaviour which needs to say something, instead of global variables and direct call. This enables you to use dependency injection if you keep the channel identifier the same.
You can listen to that event, too:
2
3
4
5
6
'HoneyPot::CLICKED', // identifier
function(values) { // callback
alert('The user ' + values.name + ' clicked it already ' + values.times);
}
);
It's even possible to filter for a filter-object when listening:
2
3
4
5
6
7
'HoneyPot::CLICKED', // identifier
{"name": "Bob"}, // filter everything with name = Bob
function(values) { // callback
alert('The user ' + values.name + ' clicked it already ' + values.times);
}
);
You may also use RegExp as channel identifier when calling jsb.on:
2
3
4
5
6
/^HoneyPot.*$, // identifier which starts with HoneyPot*
function(values) { // callback
alert('The user ' + values.name + ' clicked it already ' + values.times);
}
);
Have fun with this release. Sourcecode is of course MIT-Licensed and available on github. Tests for jquery, mootols and native version are shipped in the tests-folder.
Spludo 1.1.0 released
Finally a new spludo 1.1.0 release is available. This is also the start of 1.2-dev development.
The 1.1-branch will stay to support node version 0.4, 1.2 will (soon) support only 0.6 and later.
Changes from 1.0.3 to 1.1.0:
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
* generator for monit+upstart configuration
* code generation for migrations extended with shortcut fields definition
* added support for application/json paylod
* generate *ByIds method for services
* added ApiServiceController to register a service as REST service
* context.request now holds the current req instance
* added inflection.js
* added node_modules for own vendor libraries
* replaced own testing system with vows (if you want to run the tests, please install vows!)
* spludo_directory variable is now set always when calling spludo-gen
* added bootstrap_manager.whenLoaded(callback) to get notified as
soon as the app is ready.
* replaced self with that
* fixed core_dev_change_build_version on MACOSX
* added jshint instead of jslint
* added support for node_modules folder in project directory
* added Criteria for DatabaseDrivers
* added code generation for Migrations
* added SqliteDatabaseDriver
* added a Database Migration system
* added MysqlDatabaseDriver
* added code generation for Services
* added DatabaseManager and ServiceManager
* added Logging#addTracing (makes the this.trace(function_name) obsolete)
* Codegeneration loads the spludo application now (this enables the developer
to generate code against the base of the application)
* Codegeneration #validateParameter receives the validated parameters now
* TestCases are now able to call .debug+.log and so on, because the execute
method is applied to the TestSuite.
I have been using this development version for plenty small projects and the code generation, migrations and database driver stuff should really help
you get your app developed way faster!
Loads of documentation and examples can be found in the spludo user guide.
Have fun!
Facebook Client for node.js 1.3.0
Today I have an update for the Facebook Client for node.js finished.
The version 1.3.0 is a graph and rest api client for facebook. It has support for the latest stable nodejs 0.4.x.
Now it's possible to post data (for instance into your news feed):
2
3
4
5
6
7
8
"/me/feed", {
"message":"I love node.js!"
},
'POST'
)(function(result) {
console.log('The new feed post id is: ' + result.id);
});
All you need to do is to specify the method parameter (defaults to GET).
Thanks to jharlap for this addition.
Also thanks to tslater and shaisultanov. They found an issue with expires-time (which is fixed now) and requested the brand new FacebookSession#isValid method, which tells you if the session is really alive.
Source may be found at node-facebook-client@github.
The package is also available by using npm:
PhpDebugToolbar 1.3.0 (for agavi) released
Today I am pleased to announce the new version 1.3.0 of the Agavi PHP DebugToolbar for download.
New features include full propel support (thanks tim), rows+time+memory display for the database queries and some small bugfixes.
The source can be found on github now http://github.com/DracoBlue/PhpDebugToolbar, feel free to fork it and send pull request with new features!
Download for PhpDebugToolbar 1.3.0 (just 23KB) is also available here at dracoblue.net.
Short installation and configuration information can be found in the readme. Thanks to all contributors!


