Veikko Mäkinen

Tuesday, 2009-01-06

» Agavi Tip: Checking Validation Results

Agavi Tip: Checking Validation Results

Normally when an input validator fails you’ll just want to show the form again and let FormPopulationFilter do its magic (you do know you can it have re-populate the form and inject error messages into the form, don’t you?-). But occasionally you want to decide the next move based on what validator failed. With Agavi 1.0 getting validation incidents of a named validator is this simple:

public function handleError(AgaviRequestDataHolder $rd)
{
  $vm = $this->container->getValidationManager();
  if (count($vm->getReport()->getValidatorResult('my_special_validator')->getIncidents())) {
    return 'CriticalError';
  }
  else {
    return 'Error';
  }
  
}

Note: that AgaviValidationValidatorResult was missing from the core autoload.xml in 1.0 Beta 6. This has been fixed in the SVN If you aren’t using the bleeding edge version add the following line to your config/autoload.xml.

<autoload name="AgaviValidationValidatorResult">%core.agavi_dir%/validator/AgaviValidationValidatorResult.class.php</autoload> 

Tags

Comments (View)
Monday, 2009-01-05
Agavi Debug Tools now supports Propel query logging (both FirePHP and HTML output). Just configure Propel to use DebugPDO and AdtFilter to use AdtPropelDataSource. Nothing else required.

Agavi Debug Tools now supports Propel query logging (both FirePHP and HTML output). Just configure Propel to use DebugPDO and AdtFilter to use AdtPropelDataSource. Nothing else required.

Tags

Comments (View)
Tuesday, 2008-11-25

» Agavi 1.0.0 Beta 6

Agavi 1.0.0 Beta 6 - Even More Secure

Default: Strict Validation ALWAYS

Agavi has a very special input validation system which, by default, will not let your application use any unvalidated input data. And this doesn’t mean only POST or GET parameters in HTTP world but also cookies and headers. Remember, those too are user input and must be considered insecure.

This strict validation mode has been the default setting for production environment for quite some time already but after Agavi was blamed for somebody’s poor input validation it was made default for development environments too. It had already been discussed earlier because different defaults for different environments was sometimes confusing and caused applications to break when moved to production.

Production-ready Exception Templates

Because people seem to be too lazy to configure exception templates for production use a new set of default templates was added to Agavi 1.0.0 Beta 6.

Download Agavi: http://www.agavi.org/download

Comments (View)
Tuesday, 2008-11-18
Thanks to Harald &#8220;digitarald&#8221; Kirschner ADT&#8217;s FirePHP output is now 174% nicer. And a few bugs was fixed too. Check out ADT at http://adt.projectbin.org/.

Thanks to Harald “digitarald” Kirschner ADT’s FirePHP output is now 174% nicer. And a few bugs was fixed too. Check out ADT at http://adt.projectbin.org/.

Tags

Comments (View)
Monday, 2008-11-17

» Kübler-Ross Model

Five Steps to Agile Development

  1. Denial
  2. Anger
  3. Bargaining
  4. Depression
  5. Acceptance

Elisabeth Kübler-Ross’ Five Stages of Grief describes how people handle grief and tragedy, especially when diagnosed with a terminal illness. Apparently these also apply to agile development and user experience practice :D

Originally blogged/linked by http://agileweb.org/.

Comments (View)

» Happy Birthday to Me

28 (0x1c) years today.

Comments (View)
Sunday, 2008-11-16

» How to Enable Syntax Highlighting in Tumblr

How to Enable Syntax Highlighting in Tumblr

It’s alwasy nicer to read code snippets with a proper syntax highlighting but unfortunately Tumblr, although used by many code monkeys, doesn’t support this. It is however pretty simple to add syntax highlighting to Tumblr. All you need is a Javascript library (you have several to choose from) and a bit of Tumblr template editing. You of course also need a web host for these additional Javascript and CSS files.

Prerequisites

  • Web host for a few additional Javascript and CSS files. You cannot upload files to Tumblr.
  • Custom Tumblr template. You need to add a few lines of HTML code into your template.

SHJS - Syntax Highlighting in JavaScript

From all the alternatives Google found for me my choice was SHJS. It seemed simple enough.

1. Install SHJS

Just upload the SHJS files to your web host.

2. Edit Your Template

SHJS requires one main Javascript file plus one for each syntax you want to use. In the example only PHP syntax is loaded. You also need to load a CSS file. And the final thing to add is the onload call to body.

<head>
  ...
  <script type="text/javascript" 
    src="http://mydomain.tld/blog_resources/sh_main.js"></script>
  <script type="text/javascript" 
    src="http://mydomain.tld/blog_resources/lang/sh_php.js"></script>
  <link type="text/css" rel="stylesheet" 
    href="http://mydomain.tld/blog_resources/css/sh_nedit.css">
</head>
<body onload="sh_highlightDocument();">

3. Start Showing off Your Mad Coding Skilz

SHJS automatically parses code wrapped inside <pre>. Use special class identifiers to tell it what syntax highlighting to use. Refer to SHJS documentation for available syntaxes/class names.

<pre class="sh_php">
  $foo = new MyClass('string', array(123, 456));
</pre>

Tags

Comments (View)
Saturday, 2008-11-15

Tags

Comments (View)
Friday, 2008-11-14

Tags

Comments (View)

Tags

Comments (View)
« previous | page 2 of 3 | next »