Selenium API for PHP: PHP WebDriver.
Author Archives: Jay Jay
PHPUnit Manual
I should really read the PHPUnit Manual…
PHP Gettext
TODO: learn how to integrate Gettext in my PHP apps.
PHP spl_autoload_register
Today I used spl_autoload_register again.
This time to load default concrete classes. For example in my framework I have a class called SlibUser:
class SlibUser extends SlibRecord {
public static function Load( $id ) {
$args = array( 'id' => $id );
$data = db()->get_row( 'select * from /*prefix*/user where id = :id', $args );
if ( $data ) { return new User( $data ); }
return null;
}
}
As you can see SlibUser creates a new User. That User can be provisioned by a user of my framework, but if they don’t specify a particular User definition I give them a default implementation with spl_autoload_register, e.g.:
<?php
function load_slib_mock( $class = false ) {
//var_dump( $class );
static $classes;
static $files;
if ( ! $files ) { $files = array(); }
if ( ! $classes ) {
$classes = array(
// URL
'Uri',
'UriPath',
'UriPathBuilder',
'UriQuery',
'UriQueryBuilder',
'UriQueryNode',
// framework:
'Auth',
'Column',
'FrontController',
'Option',
'OptionGroup',
'ResourceManager',
'Schema',
'Settings',
'Table',
'Variable',
// database:
'Database',
'DatabaseUpgrader',
// ORM:
'Browser',
'GeoipLocation',
'HttpAccept',
'HttpAcceptEncoding',
'HttpAcceptLanguage',
'HttpMethod',
'HttpUserAgent',
'Partition',
'Request',
'Role',
'Session',
'SessionSettings',
'User',
'UserPartition',
'UserSettings'
);
}
if ( ! in_array( $class, $classes ) ) { return false; }
$path = "/var/tmp/slib-$class.php";
if ( ! file_exists( $path ) ) {
$content = "<?php class $class extends Slib$class {}";
$file = fopen( $path, 'w' );
if ( ! $file ) { throw new IOException( "Cannot write '$file'." ); }
fwrite( $file, $content );
fclose( $file );
}
require_once( $path );
return true;
}
// autoload handler:
spl_autoload_register( 'load_slib_mock', true, true );
Videos I watched recently
- AngularJS — Superheroic JavaScript MVW Framework
- Miško Hevery and Brad Green – Keynote – NG-Conf 2014
- AngularJS Fundamentals In 60-ish Minutes
- Introduction to Angular.js in 50 Examples (part 1)
- Larry Page: Where’s Google going next?
- How BIG Is Google?
- Edward Snowden: Here’s how we take back the Internet
- Dan Wahlin – AngularJS in 20ish Minutes – NG-Conf 2014
- Igor Minar – Angular === Community (Keynote) – NG-Conf 2014
- Programming is terrible—Lessons learned from a life wasted. EMF2012
- “The World in 2030” by Dr. Michio Kaku
- Angular Team Panel
- Google I/O 2009 – The Myth of the Genius Programmer
- Noam Chomsky: The Singularity is Science Fiction!
- Sharon DiOrio – Filters Beyond OrderBy and LimitTo – NG-Conf 2014
- Lukas Rubbelke & Matias Niemela – Awesome Interfaces with AngularJS Animations – NG-Conf 2014
- Vojta Jina – Dependency Injection – NG-Conf
- Burke Holland – Angular Directives that Scale – NG-Conf 2014
- Julie Ralph End to End Angular Testing with Protractor
- Writing a Massive Angular App at Google NG Conf
- Dave Smith – Deep Dive into Custom Directives – NG-Conf 2014
- Tom Valletta and Gabe Dayley – Angular Weapon Defense – NG-Conf 2014
- Ben Teese – Rich Data Models & Angular – NG-Conf 2014
- Karl Seamon – Angular Performance – NG-Conf
- John Papa – Progressive Saving – NG-Conf
- Silvano Luciani – PhotoHunt – NG-Conf 2014
- Christian Lilley – Going Postal with Angular in Promises – NG-Conf
- Jason Aden – Using ngModelController to Make Sexy Custom Components – NG-Conf 2014
- Anant Narayanan – Building Realtime Apps With Firebase and Angular – NG-Conf 2014
- Daniel Zen – Using AngularJS to create iPhone & Android applications with PhoneGap – NG-Conf 2014
- Ari Lerner – Robotics powering interfaces with AngularJS to the Arduino – NG-Conf 2014
- Sean Hess – How to use Typescript on your Angular Application and Be Happy – NC-Conf 2014
- Brian Ford – Zones – NG-Conf 2014
- Richard Stallman: We’re heading for a total disaster
- Jeff Cross – Rapid Prototyping with Angular & Deployd – NGConf
- Thomas Burleson Angular and RequireJS
Sublime Text
Thinking about evaluating Sublime Text.
The Most Powerful Objects in the Universe
Today I watched this video: The Most Powerful Objects in the Universe. Awesome stuff.
Debugging PHPUnit Tests in NetBeans with XDebug
Today I read Debugging PHPUnit Tests in NetBeans with XDebug and got PHPUnit tests running in the NetBeans debugger.
AngularJS and CURL and pcntl_fork, oh my!
Reading about angularjs. And the curl library. And pcntl_fork.
Processing archives
I’m de-duplicating my archives. I processed 3.6 million files and then crashed:
Symlinks: 30,836 Directories: 513,860 Files: 3,665,000 Hardlinks: 2,241,681 Duplicates: 55,309
Time to start again. Duplicates that have already been processed will show up as unduplicated files on this next iteration… my script is here.
And now we’re finished:
Symlinks: 31,926 Directories: 2,071,219 Files: 11,682,777 Hardlinks: 8,034,685 Duplicates: 669,452 Rate: 3555.44 files/second