klenwell information services : SpecialCocktailNapkin

Revision [2718]

This is an old revision of SpecialCocktailNapkin made by KlenwellAdmin on 2014-03-13 08:19:44.

online cocktail napkin

links and notes for later organization

Wikka Handler Refactor

    public function process_request($request) {
        $route = $this->route_request($request);
        $response = $this->run_wikka_handler($route['page'], $route['handler']);
        $response->set_header('Cache-Control', 'no-cache');
        $response->set_header('ETag', md5($content));
        $response->set_header('Content-Length:', strlen($content));
        return $response;
    private function run_wikka_handler($page_name, $handler_name) {
        $wikka = new WikkaBlob($this->config);
        if ( $wikka->is_new_style_handler($handler_name) ) {
            $handler = $wikka->load_handler_class($handler_name);
            $response = $handler->handle();
            return $response;
        else {
            return $this->run_old_style_handler($page_name, $handler_name);
    private function run_old_style_handler($page_name, $handler_name) {
        $wikka = new WikkaBlob($this->config);
        $wikka->Run($page_name, $handler_name);
        $content = $wikka->close_buffer();
        # create response object
        $response = new WikkaResponse($content, 200);
        $response->set_header('Content-Type', 'text/html; charset=utf-8');
        # Set header for response object from headers list
        $headers = headers_sent();        
        foreach ($headers as $header) {
            list($key, $value) = explode(':', $header, 1);
            $response->set_header($key, $value);

        return $response;

Wikka Install Exception

try {
    $request = $webservice->prepare_request();
    $response = $webservice->process_request($request);
catch (WikkaInstallException $e) {
    $response = $webservice->process_installer($request);
catch (Exception $e) {
    $response = $webservice->process_error($e);

Unpublished Comment

In response to https://news.ycombinator.com/item?id=7341400:

I get this impression with a lot of libertarian social ideas, e.g. socialized health coverage or newfangled food supplements.

It seems to be one area where recapitulation theory[1] applies. Only by seeing ontogeny recapitulate phylogeny for themselves will some people -- strike that, most people -- appreciate the hoary inefficient logic behind long-established conventions and institution.

[1] http://en.wikipedia.org/wiki/Recapitulation_theory

Test Local Site on Android Chrome Attached by USB

Full instructions here:

DESKTOP: local machine where you doing your development
PHONE: Android device connection to DESKTOP by USB

1. On DESKTOP: Get network IP address
- Open terminal
- Run: ifconfig
- Copy inet addr for eth0 (e.g., inet addr:

2. On DESKTOP: Set up port forwarding for Chrome
- In address bar, enter: about:inspect
- Check checkbox for Discover USB devices
- Click Port Forwarding button
- In pop-up for Port Forwarding Settings, enter:
8080 <IP ADDRESS>:80

For example:

3. On PHONE: Go to website
- In address bar, enter:*

* Note: This can also be done in the inspect tab by using Open tab with url
field. Just enter same value there and if Chrome is open on your phone, it
will automatically load that page.

2014 Cocktail Napkin

Happy New Year!