Categorized

Redirect sub-sub-domains to dynamically configured virtual hosts on the localhost.

0

A colleague (thanks Danny) pointed me to this solution to host multiple development environments under a single sub-domain name.

Step 1. Configure a type A domain record by using a wildcard and a fixed sub-domain name like:

*.lab    A    127.0.0.1

( why didn’t I think of that x_X )

Step 2. Enable mod_vhost_alias in Apache if not already active.

Step 3. Configure a virtual host and use the wildcards from mod_vhost_alias to your liking, for example

<VirtualHost 127.0.0.1:80>
    ServerName lab.yourdomain.com
    VirtualDocumentRoot /var/my_flexible_friends/%1
</VirtualHost>

would redirect myproject.lab.yourdomain.com to 127.0.0.1 and serve pages from /var/my_flexible_friends/myproject but would also redirect jquery.lab.yourdomain.com to 127.0.0.1 and serve pages from /var/my_flexible_friends/jquery.

Just look at the mod_vhost_alias documentation for more possibilities.
Also a nice consistent setup to share in development teams.

If you happen to stumble upon apache error messages like ‘Request exceeded the limit of 10 internal redirects due to probable configuration error.’, just change your .htaccess file by added the rule RewriteBase /. This will most likely happen when you are using the windows hosts file instead of a real domain.

See also Stackoverflow Infinite Rewrite Loop

SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteBase /
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

I guess PhpStorm does not love OpenJDK

0

OpenJDK Runtime Environment (IcedTea6 1.9.10) (6b20-1.9.10-0ubuntu1~10.04.2)
OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)
WARNING: You are launching IDE using OpenJDK Java runtime

THIS IS STRICTLY UNSUPPORTED DUE TO KNOWN PERFORMANCE AND GRAPHICS PROBLEMS

NOTE: If you have both Sun JDK and OpenJDK installed
please validate either WEBIDE_JDK or JDK_HOME environment variable points to valid Sun JDK installation

Ubuntu Sun (Oracle) Java Installation Guide

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
aptitude install sun-java6-jdk
sudo update-alternatives --config java

Donating my upper lip to fight cancer (Movember Time!), please donate too!

0


Movember!

PHPDoc an Array Param (in Zend Framework)

0

I found this code snippet which shows how array based parameters should be documented with PHPDoc (in ZF projects). The topic came up because I’m always nagging about those magic functions and magic properties in ZF and how poorly they are documented. It seems we’ve been neglecting adding PHPDoc tags a bit because PHPDoc does have support to document magic methods and magic class properties:

@method Magic Properties

@property Magic Methods

/**
* $args may contain the following keys:
* - var1:
* - var2:
*
* @param array @args
* @return void
*/

Items prefixed with a ‘- ‘ will be treated as bullets by phpDocumentor.

source: zend framework community

I’m currently piloting PhpStorm because I had some issues with Zend Studio, it’s interesting to notice that a phpdoc line like:

/*
 * @return Foo[]
 */
function getList() {
   $f = array();
   $f[] = new Foo();
   ...
   return $f;
}

triggers auto-completion in PhpStorm when looping over the return value like:

$list = $this->getList();
foreach($list as $l) {
    $l->(starts auto-completion ...)
}

Zend Tool Cheat Sheet (v1.11.10)

1
Zend Framework Command Line Console Tool v1.11.10
Usage:
zf [--global-opts] action-name [--action-opts] provider-name [--provider-opts] [provider parameters ...]
Note: You may use “?” in any place of the above usage string to ask for more specific help information.
Example: “zf ? version” will list all available actions for the version provider.Providers and their actions:

Version
zf show version mode[=mini] name-included[=1]
Note: There are specialties, use zf show version.? to get specific help on them.Config
zf create config
zf show config
zf enable config
Note: There are specialties, use zf enable config.? to get specific help on them.
zf disable config
Note: There are specialties, use zf disable config.? to get specific help on them.

Phpinfo
zf show phpinfo

Manifest
zf show manifest

Profile
zf show profile

Project
zf create project path name-of-profile file-of-profile
zf show project
Note: There are specialties, use zf show project.? to get specific help on them.

Application
zf change application.class-name-prefix class-name-prefix

Model
zf create model name module

View
zf create view controller-name action-name-or-simple-name module

Controller
zf create controller name index-action-included[=1] module

Action
zf create action name controller-name[=Index] view-included[=1] module

Module
zf create module name

Form
zf enable form module
zf create form name module

Layout
zf enable layout
zf disable layout

DbAdapter
zf configure db-adapter dsn section-name[=production]

DbTable
zf create db-table name actual-table-name module force-overwrite
Note: There are specialties, use zf create db-table.? to get specific help on them.

ProjectProvider
zf create project-provider name actions

Examples (Windows):

zf create project ./
zf create module test
zf create controller Test index-action-included=1 test

Remarks:
- The Zend Tool will maintain a xml based configuration file called ‘.zfproject.xml’, do not remove!
- Zend Tool is case sensitive, thus “zf create module blog” and “zf create module Blog” are different commands, running them both will create 2 modules (in Windows it will only result in 1 module directory though!)
- The create module command did not create a module Bootstrap file
- The bootstrap file in the tests directory has a lowercase ‘b’ which probably needs to be an uppercase like ‘Bootstrap.php’
- Note: PHPUnit is required in order to generate controller test stubs.
- For a module Bootstrap to work, the application.ini needs resources.modules = ""

A simple module Bootstrap looks like:

<?php
class Yourmodulename_Bootstrap extends Zend_Application_Module_Bootstrap {
	protected function _initSomething () {
    }
}

Quick Optimization League of Legends Plug-ins

0

The images were eating away the low amount of bandwidth I own (see also the scary red bar on the usage summary) so I put low resolutions images on the LoL Plug-ins Demo page and centralized the image storage. If it becomes too popular I might need to re-locate though *EEK*

Thanks for visiting, come again!

p.s. High resolution images are still available in the code repository.
p.p.s. Clicking on advertisement banners will give me more bandwidth or just donate :)

*update* I put the images on the Amazon Simple Storage Service (Amazon S3) which should provide some stress relief, well at least it scales better!

Help me get friends!

0

Always nice to have friends which notice something like this:

And send it with this message:

Sooo lonely, i am so lonely :-)

Thanks Christoph ^_^ and FU Facebook

League of Legends jQuery-UI Plug-ins Released

2

I (finally) found time to spend a couple of nightly coding sessions to create some League of Legends jQuery Plug-ins, it’s a project that was becoming a never ending story. It is an open source project and uses a lot of cool technology like jQuery and CSS Sprites. With it you can create all the champion builds/pages you desire. I already had an awesome code contribution and I’m hoping for more  community feedback.

Enjoy!

FULL DEMO

More info and demo’s at http://ingol.nl/blog/jquery-league-of-legends-plugins/

League of Legends Forum Posts

http://eu.leagueoflegends.com/board/showthread.php?p=2045061#post2045061
http://www.leagueoflegends.com/board/showthread.php?t=705751

More to come …

- League of Legends Champions Plug-in

- Additional features on the current plug-ins to make them more awesome

- Back-end code to create / host your own champion build tool and exchange builds

Final Words

These features will probably not come early because we’re expecting another child soon, maybe with community support we could speed things up greatly, join me at my BitBucket project. If you happen to be Dutch/Belgian and would like to join a LoL Community, take a look at CowClan

Donations will be accepted to buy gifts for the baby / kids ;-)

Go to Top