Search / Replace with SED without escaping slashes
1. Juni 2016
Kommentare deaktiviert für Search / Replace with SED without escaping slashes By webpirat
As you might know, you can use any delimiter to use the search/replace feature of sed to avoid extreme escaping of slashes.
~/ sed -r -e 's@http://google.com/@http://example.com/@g' < input.file > output.file
bash, console, delimiter, file, input, Linux, output, replace, search, sed, Shell
agavi output type overwrite in action
um den output type einer agavi action auch nach dem routing zu ändern, kann man innerhalb der action den output type überschreiben.
/** * assume that 'html' is the standard GET output for this action * when this action is called via POST you want to change the output type to 'json' * because on error or success you want to show small messages per json instead full html */ public function executeRead(AgaviRequestDataHolder $rd) { return 'Input'; } public function executeWrite(AgaviRequestDataHolder $rd) { $this->getContainer()->setOutputType($this->getContext()->getController()->getOutputType('json')); try { // do POST stuff } catch(Exception $e) { $this->setAttribute('message', $e->getMessage()); return 'Error'; } return 'Success'; }
action, agavi, container, output, overwrite, set output type, type
Agavi routing specials
Um bestimmte Agavi output_types bei speziellen routings zu bedienen kann man die routing.xml wie folgt anpassen.
<!-- cut out leading slash --> <route name="slasher" pattern="^/" stop="false" imply="true" cut="true" /> <!-- match ajax calls with special http header --> <route pattern="XMLHttpRequest" source="_SERVER[HTTP_X_REQUESTED_WITH]" stop="false" output_type="ajax" /> <!-- match json calls with special http header --> <route pattern="application/json" source="_SERVER[HTTP_ACCEPT]" stop="false" output_type="json" /> <!-- cut out special pointer --> <route name="portal" pattern="^({portal:[a-zA-Z]{3}}/)?" stop="false" imply="true" cut="true"> <callbacks> <callback class="RoutingCallback" /> </callbacks> </route>
agavi, ajax, header, http, http_accept, http_x_requested_with, json, output, routing, specials, types
Neueste Beiträge
Kategorien
- Agavi
- Android
- ANT
- Apache
- Bildbearbeitung
- CMS Systeme
- Codeigniter
- CSS
- Debugging
- Deployment
- Doctrine ORM
- Flash
- Frameworks
- GIT
- Javascript
- Kanban
- Kohana
- Layout & Styles
- Lightroom
- Lighttpd
- Linux
- Management & Prozesse
- MySQL
- Nginx
- OffTopic
- Photographie
- Photoshop
- PHP
- PhpMyAdmin
- PHPUnit
- Postfix
- Propel ORM
- Ruby On Rails
- Scrum
- Server
- Shell
- Sicherheit
- SOAP
- Social Media
- Sonata
- SVN
- Symfony2
- Versionierung
- VIM
- Wordpress
- XDebug
- XML
- XT Commerce
- Zend