Two monks on a pilgrimage

Two monks on a pilgrimage are walking along a road and they come across a 17 year old girl with a long kimono trying to cross a very muddy road but she’s not daring to step into the mud so the first monk picks her up and carries her across the road and puts her down on the other side of the road and the monks walk on in noble silence.

4 or 5 hours pass and they are nearing their destination and the second monk turns to the first and says “you know you shouldn’t have done that because us monks are not supposed even to touch women so you shouldn’t have picked up that girl. You’re not supposed to do that.” In response the first monk says “Oh, are you still carrying that girl? I put her down hours ago.”

The second monk was still carrying the girl, the event, in his head, and for 4 hours he was walking with this burden. This shows the human mind’s reluctance to let go of the past. It’s like carrying a useless weight around with you, and some people carry it all their lives, and they even derive some identity from that.

Release your identity and become one with the true formless nature of your self.

</wisdom>


Happy 2010-04-20

Asynchronous HTTP requests in PHP

Fire an HTTP request at a URL and move on without waiting for a response.

function http_async($method, $host, $url, $data) {
    $query = http_build_query($data);
    $request = "$method $url HTTP/1.1\r\n"
        ."HOST: $host\r\n"
        ."Content-type: application/x-www-form-urlencoded"."\r\n"
        ."Content-Length: ".strlen($query)."\r\n"
        ."Connection: Close\r\n\r\n"
        .$query;
    $fp = fsockopen($host, 80, $errno, $errstr, 5);
    fwrite($fp, $request);
    fclose($fp);
}

And don’t forget to ignore_user_abort(true); on the target url.

Meth – A global helper function

I use functions like this a lot during development. I tuck them into a prepend file so they’re only available on my local machine. My first was shout()

function shout() {
    echo "<pre>";
    foreach(func_get_args() as $var) {
        print_r($var);
    }
    echo "<\/pre>";   # (sic)
    die();
}

Great for looking at data.

But I very often found myself wanting to see the API for an object without having to look it up. So I wrote meth()

function meth($obj, $method_name = null) {
    $ref = new ReflectionClass($obj);
    echo "<pre>";
    foreach ($ref->getMethods() as $method) {
        if(!$method_name || $method_name == $method->name) {
            echo $method;
        }
    }
    echo "<\/pre>";   # (sic)
    die();
}
 
meth($this->Session, 'read');
 
# /**
#  * Used to read a session values for a key or return values for all keys.
#  *
#  * In your controller: $this->Session->read('Controller.sessKey');
#  * Calling the method without a param will return all session vars
#  *
#  * @param string $name the name of the session key you want to read
#  * @return mixed value from the session vars
#  * @access public
#  */
# Method [  public method read ] {
#   @@ C:\web\kbya\dev\src\cake\libs\controller\components\session.php 150 - 156
# 
#   - Parameters [1] {
#     Parameter #0 [  $name = NULL ]
#   }
# }

Pretty handy so far.

Oh ya, and here’s the VHost line

php_value auto_prepend_file "/home/kev/web/prepend.php"

The Anorexic Startup

The term Lean Startup has become a battle cry against the archetype of the ego-pumping dot-com executive flexing his Web 2.0 buzz words at an audience of Venture Capitalists and PR mavens. It has come to represent the antithesis of the multi-million dollar hail mary. But is this sense of the word really accurate?

The lean startup movement is essentially just a collection of interlocking disciplines, but the term `lean startup` has taken on this second meaning far from its roots in lean manufacturing and lean software development. To qualify a startup as `lean` now often implies that said startup operates with a heightened measure of scrutiny over its self-image.

The greatest truth the wisest man will ever know is that he knows nothing. That’s the heart of lean.

  1. Think of something you can’t already do.
  2. Write a test.
  3. Fulfill the test.
  4. Release the code.
  5. Engage your audience.
  6. Distill their feedback.
  7. GOTO 2.

The only difference between Agile Software Development and a Lean Startup is 5 and 6.

Agile Manufacturing iterates on the efficiency of the production system as a whole through Process Engineering.
Agile Software Development iterates on the structure of the software as a whole through Software Engineering.
Lean Startups iterate on the product offering itself through Customer Development Engineering.

It is entirely possible to practice agile software development within a non-agile organization, but it is much much harder to practice non-agile methodologies within an agile organization. The cycle times of a lean startup’s release and discovery schedule are just too short for waterfall project plans. Like trying to trim a bonzai with a riding lawn mower.

For this reason, taking a company lean requires the cooperation of everyone involved. The smaller the organization, the easier it is to keep everyone in flow. You probably won’t see anyone throwing around the term Lean Enterprise any time soon.

But does this necessarily mean that a Lean Startup’s small size leaves it afflicted with a neurosis of diminished optimism?

I would say that it does not.

I would say that a Lean Startup is a startup with a realistic understanding of the current and potential viability of its product, achieved through an unyielding acceptance of uncertainty.

CakePHP session error : User-Agent must be consistent

I noticed some erratic behavior with CakePHP sessions and finally tracked down the error. I have FireBug installed with an extension called FirePHP. When FireBug is enabled, I noticed that my User-Agent tends to vary.

Sometimes my browser’s user agent reads :

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 FirePHP/0.4

Sometimes it reads :

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8

Whenever the User-Agent changes, CakePHP resets the session. This means that I can’t view 3-4 pages on the site before being logged out.

This is the firebug extension that caused the problem.
https://addons.mozilla.org/en-US/firefox/addon/6149

Here’s a link to an error report on FirePHP’s forums
http://n2.nabble.com/FirePHP-and-CakePHP-Session-Reset-tp4671294ef842658.html

This is a great add-on called HTTPFox I used to track down this error.
https://addons.mozilla.org/en-US/firefox/addon/6647

php memcache vs memcached

The newer memcached PHP extension was created recently by some guys at Digg.
It has some new features and performance enhancements.

Here’s a comparison
http://code.google.com/p/memcached/wiki/PHPClientComparison

But, the interface is not identical.

We’re going with memcache over memcached for it’s guaranteed backward compatibility.
The newer memcached has some additional features that I’m not really interested in.

If I had to worry about supporting over 10,000 daily uniques, it might be a different story.

Network Solutions Wildcard SSL Certificate

If you’re thinking of buying a Wildcard SSL Certificate from Network Solutions, beware it will not be valid for the base domain.

Your $400 SSL Certificate will cover

https://www.example.com
https://abc.example.com
https://whatever.example.com

But it will not cover

https://example.com

If you want SSL on example.com, you will have to buy ANOTHER SSL Certificate ($150).
I couldn’t find this fact mentioned anywhere on the Network Solutions website.
I had to call their 800 number to get an answer.

Note that some registrars do cover the base domain with their Wildcard SSL Certificates (like GoDaddy).

Not all SSL Certificates are created equal.

Multiple Arguments

In real life, I’m not a fan of arguments.
But sometimes in code, arguments can be a good thing.

function addFailure($id) {
	$query = "insert into billing_history (id, auth_success) values($id, 0)";
	mysql_query($query) or die(mysql_error());
}
function addSuccess($id) {
	$query = "insert into billing_history (id, auth_success) values($id, 1)";
	mysql_query($query) or die(mysql_error());
}

Sometimes 1 function with 2 arguments is better than 2 functions with 1 argument.

function billing_history_create($id, $success) {
	$query = "insert into billing_history (id, auth_success) values($id, $success)";
	mysql_query($query) or die(mysql_error());
}

KB927917

You get an error in IE6/7/8

Message: HTML Parsing Error: Unable to modify the parent container element 
before the child element is closed (KB927917)

Your javascript is attempting to append something to the body element before the body element is closed.

You need to enclose your javascript in an on-load event handler.

$(document).ready(function(){/* Your JS */});

What if the IRS had an API?

GET /people/123456789/year/2009/balance HTTP/1.1
Host           ssl.irs.gov
Accept         application/json
Secret-Api-Key f24b35a8f2e1dda6ca5a5166a5530b96
 
-
HTTP/1.1 200 OK
 
{"ssn":123456789, "balance":"12345.00"}
 
-
POST /people/123456789/year/2009/payments
Host           ssl.irs.gov
Accept         application/json
Secret-Api-Key f24b35a8f2e1dda6ca5a5166a5530b96
 
amount=12345.00&card[number]=1234567890123456&card[exp]=0112&card[name]=kev%20burns
 
-
HTTP/1.1 201 Created
Location: /people/123456789/year/2009/payments/1
 
{"ssn":123456789, "amount":"12345.00", "created_at":1265432844}
 
-
GET /people/123456789/year/2009/balance HTTP/1.1
Host           ssl.irs.gov
Accept         application/json
Secret-Api-Key f24b35a8f2e1dda6ca5a5166a5530b96
 
-
HTTP/1.1 200 OK
 
{"ssn":123456789, "balance":"0.00"}

Coupling vs. Cost vs. Time

In response to Subbu’s Coupling Vs. Cost

coupling-cost-time

It’s a wave, isn’t it? The sweet spot is somewhere between 0,1,0 and 1,0,1 depending on the project.

Bad future.

launch

Launch Launch Mass Effect 2 or Launch Mass Effect 2 Launcher?

Sometimes life makes you laugh.

2010-01-28 irc.freenode.net #startups
[23:06] <votz> rfrtfgghuyjhrt
[23:06] <votz> try to type your name with your chin
[23:06] <votz> its win
[23:06] <Daeken> heh
[23:07] <KevBurnsJr> i9e3v burdfn zxsjnrf
[23:07] <votz> haha

Tablet == Folding Desk

Show me a lecture hall with one of these embedded into every fold-away desk.

CakePHP and Doctrine

“As far as cakePHP goes, Cake is pretty reliant on the database and the cake native modeling, so if you were to use Doctrine instead of native modeling, you would lose all the magic helpers/features that you get in Cake.” — jwage

Damnit.

recordMyDesktop audio lag ubuntu

You are recording a screencast and the audio plays too quickly; finishing before the video, out of sync.

You need to switch your device from hw:0,0 to plughw:0,0

If you’re running from command line:

recordmydesktop -device plughw:0,0

If you’re running from gtk-recordmydesktop:

Advanced -> Sound -> Device change DEFAULT to plughw:0,0

We have the technology

Just ordered a new computer at NewEgg. Should be in the mail come Monday. Hoping to piece it together by next weekend.

1 x COOLER MASTER Storm Scout SGC-2000-KKN1-GP Black Steel / Plastic ATX Mid Tower Computer Case

1 x ASUS P6T LGA 1366 Intel X58 ATX Intel Motherboard

2 x SAPPHIRE 100286L Radeon HD 4860 1GB 256-bit GDDR5 PCI Express 2.0 x16 HDCP Ready CrossFireX Support Video Card

(thats right, 2 of ‘em)

1 x OCZ Gold 6GB (3 x 2GB) 240-Pin DDR3 SDRAM DDR3 1600 (PC3 12800) Low Voltage Desktop Memory Model OCZ3G1600LV6GK

1 x COOLER MASTER Silent Pro 600 RS-600-AMBA-D3 600W ATX12V V2.3 SLI Certified CrossFire Ready 80 PLUS Certified Modular Active

1 x Intel Core i7-920 Bloomfield 2.66GHz LGA 1366 130W Quad-Core Processor Model BX80601920

1 x COOLER MASTER Intel Core i7 compatible V8 RR-UV8-XBU1-GP 120mm Rifle CPU Cooler

1 x OCZ Vertex Series OCZSSD2-1VTX120G 2.5″ 120GB SATA II MLC Internal Solid State Drive (SSD)

1 x Seagate Barracuda LP ST31500541AS 1.5TB 5900 RPM SATA 3.0Gb/s 3.5″ Hard Drive -Bare Drive

1 x Microsoft Windows 7 Home Premium 64-bit 1-Pack for System Builders – OEM
1 x LG DVD Burner – Bulk Black SATA Model GH24NS50 – OEM

I’m really excited about the 120Gb SSD
Also really excited about the dual 1Gb GDDR5 graphics cards.
and also really excited about the 6Gb of triple channel DDR3.

I’m totally not excited about Windows 7, but I must do it for the 64-bit RAM capacity and SSD Performance enhancements.

This shit’s going to SCREAM.

I feel like I’m taking crazy pills

I wish PHP frameworks were more than just tightly coupled collections of libraries. So much of the code in Zend overlaps with similar functionality in CakePHP, Yii, Symfony, and others. Glad to see Zend ceasing work on Zend_Db in favor of Doctrine.

The PHP Application Framework landscape needs more consolidation, less overlapping functionality and less coupling. The frameworks I write tend to capture the 80% of developer interaction (bootstrap, router, base controller, view renderer) with very little code and steal the remaining 20% from other open source projects.

Wishing libraries like CakePHP’s Validation library were more portable. Wishing libraries like CakePHP’s Validation library were created without the crutch of a framework. Better to write a solid library and let others create adapters.

The PHP Application Framework of my dreams would come bundled with 0 unnecessary libraries and would play nice with all libraries created/appropriated by others.

Waxing lackadaisical

Usually my posts emerge naturally as a more or less cohesive synthesis of thoughts found nagging away at the back of my mind. I go to the place I find myself when my mind has slack enough to focus on something other than the present and let its gaze fall where it may. In the noise and confusion of the last few weeks, this usual buffer is so awash with uncertainty that when the inspiration comes to synthesize I find a marked lack of focus in my mind’s lackadaisical stare.

Pity. I have come to despise it. It is not easy to convey to someone that you feel no shame in your behavior without appearing to be a coward denying his own emotion. Yet they express their pity, empathizing with that which you are not. So how does one react? The politics of our culture would advocate a politely feigned heartfelt thank you. However, this reaction is an out-of-hand dismissal of the true intent of the expression; an attempt at empathy. When we can truly empathize with one another, we feel we are part of the same whole. When we feign empathy, we distance ourselves from one another.

It is easy to appear genuine to a child. The emotions of human beings become more complex as we mature. A newborn knows only hunger and sleep. It is not until much later that we are taught disingenuity and deceit. In fact we are indoctrinated with disingenuity from a young age. We are not taught to feel sorry, we are taught to say we feel sorry. Despite our feelings. We are taught to infantilize ourselves and those under our care. Homogeneity heralded as a virtuous and admirable trait.

If we are self-conscious, we choose how we express ourselves. We train ourselves over time to channel our emotions through laughter, silence or hatred. We choose to what degree we reveal these channels to those around us. We strive to do so with honesty and integrity, always staying true to the self.

Faced with misplaced pity do we shut down and mutter a feigned heart-felt thanks? Do we channel our discomfort through anger? Or do we recognize the attempt at empathy for what it is and belch a hearty laugh and a quip genuine response?

My first response to a new type of difficult situation is usually silence. I’ve learned from opening my mouth that I can’t assume anything about another person.

Next time I find myself in silence I will do my best to flip the interaction from disingenuous and sterile to something real and meaningful.

Breaking, mending and replacing these unhealthy cycles that ail us is what shamanism is all about.

Friction feedback loop

Your organization is highly focused on time-to-market. Burn rate is high and revenue is low. Proposals to spend time optimizing development processes are entertained on principle and swiftly discarded out-of-hand; every ounce of developer attention must be devoted directly to product development.

Yet developers are spending increasingly large portions of their time on tasks not directly related to product development. Hand-copying file revisions across release branches, rewriting functionality and interfaces to match violently flagellating specs, while still turning out heaps of code optimized for schedule rather than maintainability and reuse.

Heaps of hacky code makes for heaps of bugs. Specs change again and bugs continue to roll in. The workload continues to increase as time ticks away, the project’s air supply growing heavy and toxic. Management caves to pressure, granting a milestone slip and the team has a momentary breath of fresh air. The loop continues, only now behind schedule.

Development progress slips into the red as each day more bugs are reported than fixed. The release date approaches on the long crunch toward release. Eyes go bloodshot as nerves begin to fray. Weekend and vacation work become the norm. Then the big day.

Release! To a cheerful management with plenty of rewards and good-on-yas with cherries on top and glimpses of grand rewrites in the sky. Just another speed bump. Back to the grindstone as customers do their own QA, reporting blazing hot ultra-mega-high priority bugs with varying degrees of rage, elation and flippancy.

Your product is cool.
Your product is hot.
Your product sucks.
Your product is moot.
Your product is a dream come true.

But does your product make money?

If not, you’d better cancel that second honeymoon and gear up for what can only be described as war. Man Vs. Machine, developers hack through twisted wrecks of code leaning heavy on what-were-supposed-to-be-temporary structures that ought to be condemned. Days bleed into weeks and all semblance of a unified product direction is drowned by the cries of screaming souls.

What if we could do this better?

Do we need to release a fully-configurable decision making platform in order to start generating revenue for our organization? Is there something that we could create today and ship tomorrow that would generate more revenue from our customers than the 2 days it cost us to produce? What kind of feedback would we get from customers? Bug reports or feature requests? What would a grand rewrite cost at this stage? A day? How about a spec change? Hours? Could we turn that into minutes?

What can we do to front-load this most critical aspect of any software development project?

« Previous PageNext Page »