archive-info.com » INFO » A » ALBERTON.INFO

Total: 92

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Lorenzo Alberton - Articles
    released PHP PEAR Database 3 May 2007 A new stable release of MDB2 is out Enjoy PEAR MDB2 2 4 0 released PHP PEAR Database 14 March 2007 A new stable release of MDB2 is out Enjoy PEAR Pager Tutorials Use Pager with Smarty Use Pager Wrapper with AJAX PHP PEAR Database Tutorial 8 March 2007 Since I keep getting emails asking for help with PEAR Pager here s a couple of new examples about the most requested features 1 how to use Pager with a template engine like Smarty 2 how to use Pager Wrapper to paginate database results and display them using AJAX An update on my PEAR packages PHP PEAR 1 February 2007 An update about some of the PEAR packages I maintain M DB QueryTool Mail Queue MDB2 Translation2 Get involved in PEAR PHP PEAR 15 November 2006 An overview of the many ways to get involved in PEAR and a few concrete suggestions PEAR Pager Tutorials Article Pagination and Navigation PHP PEAR Database Tutorial 16 October 2006 How to navigate through the paragraphs of a long article with PEAR Pager PEAR Pager Tutorials Navigation with Pager and AJAX or simple Javascript PHP PEAR JavaScript AJAX

    Original URL path: http://www.alberton.info/articles/filter/tag/PEAR/page/2 (2016-04-24)
    Open archived version from archive


  • Lorenzo Alberton - Articles
    links PEAR Pager Tutorials Paginate database results PHP PEAR Database Tutorial 8 September 2006 Paginate database results with PEAR Pager in an efficient way PEAR Pager Tutorials PHP PEAR Database Tutorial 8 September 2006 New series of tutorials on PEAR Pager PHP PDO Firebird status PHP PEAR Database Firebird SQL Windows PDO 11 April 2006 A quick roundup of the PHP PDO Firebird driver Test of its current status what

    Original URL path: http://www.alberton.info/articles/filter/tag/PEAR/page/3 (2016-04-24)
    Open archived version from archive

  • Lorenzo Alberton - Articles - Profiling PHP Applications with XHProf
    one level up or down This is rarely a problem since you can drill down or up at any level Clicking on a function name in fact will show details about the current function the parent caller and the children called As a rule of thumb when we re ready to optimise our application we should start sorting the data by CPU exclusive and look at the top of the list The functions at the top are the most expensive ones so that s where we should focus our efforts and start optimising refactoring If there s nothing obviously wrong we drill down and see if there s something more evident at an inner level After every change we run the profiler again to see the progress or lack thereof Once we are happy we sort by Memory Usage or Wall time and start again Here s a quick summary if you want to print a step by step worksheet as a reference Profile Sort by CPU Memory usage time exclusive and function calls Start from the top of the list Analyse refactor and or optimise Measure improvement Start over Again and again and again Profiling can be an extremely tedious process because it requires a lot of patience and a lot of time staring at numbers in a table how exciting eh Hopefully the results of this process are exciting improvements are often dramatic since rewriting the slowest parts of the code and not those we think are slow has a considerable effect on the overall page load and ultimately on the user s experience The advantage of using good tools is that they help maintaining discipline and focus and thus in building experience Diffs and Aggregate Reports XHProf has a nice feature to get the differences between two different runs clearly marked in red and green colours This way it is easy to instantly see the improvements after every change To view the report use a URL of the form http xhprof ui address index php run1 XXX run2 YYY source myapp Where XXX and YYY are run ids and the namespace is myapp Also it s possible to aggregate the results of different runs to normalise the reports To do so separate the run IDs with a comma in the URL http xhprof ui address index php run XXX YYY ZZZ source myapp The Path to Scalability Measure the Baseline As in every journey you must know where you are and where you want to go If you need your application to scale you must know what your targets are users sec memory usage page generation time as well as your constraints of your application framework server resources Before even starting coding your application it s a good idea to measure the baseline of your framework if you use one For instance here s a summary of an empty Zend Framework v 1 x project NB the same considerations apply to any framework I do NOT intend to single out ZF as a bad framework This tells you that unless you optimise the framework itself or cache the full page you can t use less than 2 5MB of memory or have less than 1500 function calls per page load This is your starting point Profiling the framework itself is not just an exercise in style but is an eye opener on how it works and how in efficient the various components are so any time you decide to use one you know what to expect There are many examples of common programming practice where you might be surprised to see the impact these choices have here are some examples If you have a config ini setting called error logging level and use Zend Config to read its value you need to use config error logging level Every arrow operator means two function calls So that s 6 function calls just to read the value of a config setting If you read that value often or in a loop consider saving it into a variable Every time you use a view helper there s a lot of stuff going on behind the scenes here s the call stack it s actually much worse but you get the idea When you call partial to render a template the current view object is cloned and all the non private variables are unset This is done through expensive reflection and an awful lot of substr calls Use render instead if you can or a view helper if the template is really small and called many times Every time you render a template or use a model class ZF scans the include path to find the correct file to load even if you already requested that file before You ll be surprised to know how many stat calls are made in a single page execution thousands Luckily with XHProf or even with strace dtrace in this case it s easy to see whenever a file is read from disk so you can optimise the include path order and possibly use APC to avoid scanning the include path twice for the same file Every time you use Zend Json encode instead of json encode unless you have a very specific reason to do so you should hit yourself with a stick perhaps not literally Profiling the call and seeing what happens is left as an exercise to the reader As I said I don t intend to bash Zend Framework I m sure the others are no worse better What is important though is to be aware of the cost of each component of your framework so you can make a conscious decision on which building blocks to use in your application Identify Bottlenecks It is likely that your application will access external resources a database a web service or data on disk These are usually the most expensive operations you should try to minimise If you don t see them at

    Original URL path: http://www.alberton.info/profiling_with_xhprof.html (2016-04-24)
    Open archived version from archive

  • Lorenzo Alberton - Articles
    hosting accounts using mod rewrite and an htaccess file Book review TYPO3 Extension Development by Dmitry Dulepov PHP PEAR TYPO3 Book Review 8 January 2009 A review of the book TYPO3 Extension Development by Dmitry Dulepov Packt Publishing Database identifiers quoting and case sensitivity PHP PEAR PostgreSQL Oracle 3 December 2008 Exploring database delimited identifiers and case sensitivity the effect of quoting table and field names in the various DBMS Zend Framework testing emulating HTTP calls PHP PEAR Zend Framework Tutorial Testing 29 October 2008 How to test HTTP calls using Zend Framework using Dependency Injection and a stub HTTP Client Updated articles to extract META informations from databases PHP Database PostgreSQL Firebird SQL Oracle SQL Server INFORMATION SCHEMA 9 September 2008 By popular request I ve updated my articles explaining how to retrieve meta data from your DBMS Firebird SQL PostgreSQL Oracle SQL Server Have fun PEAR Translation2 tutorials backend usage PHP PEAR Tutorial 18 May 2008 This second Translation2 tutorial shows how to add update and remove languages and translations PEAR Translation2 tutorials frontend usage PHP PEAR Tutorial 13 May 2008 This first Translation2 tutorial shows how to deal with translated strings how to fetch them one by

    Original URL path: http://www.alberton.info/articles/filter/tag/PHP/page/2 (2016-04-24)
    Open archived version from archive

  • Lorenzo Alberton - Articles
    Book review PHP Oracle Web Development by Yuli Vasiliev PHP PEAR Database Oracle Book Review 17 November 2007 Review of the book PHP Oracle Web Development by Yuli Vasiliev Packt Publishing Book contents highlights and impressions A sample chapter is included PEAR MDB2 2 5 0a1 released PHP PEAR Database 28 October 2007 A new alpha release of MDB2 is out Please test the new FOREIGN KEY support and report any issue you may experience before a stable release Enjoy PEAR MDB2 FOREIGN KEY support is complete PHP PEAR Database 15 August 2007 I ve finally committed the last pieces of code to implement full FOREIGN KEY support in the MDB2 Manager and Reverse modules Please fetch the CVS version of the package and test it Catching up July 2007 PHP PEAR Database 22 July 2007 Zürich PEAR updates and MDB2 Oracle development PEAR MDB2 updates FOREIGN KEY support PHP PEAR Database 17 June 2007 Some updates on recent MDB2 developement FOREIGN KEY support in the Manager and Reverse modules etc Also updated SQL technical articles on INFORMATION SCHEMA for Firebird PostgreSQL SQL Server and Oracle Extracting META information from Oracle INFORMATION SCHEMA PHP Database Oracle INFORMATION SCHEMA 17 June

    Original URL path: http://www.alberton.info/articles/filter/tag/PHP/page/3 (2016-04-24)
    Open archived version from archive

  • Lorenzo Alberton - Articles
    Tutorials Use Pager with Smarty Use Pager Wrapper with AJAX PHP PEAR Database Tutorial 8 March 2007 Since I keep getting emails asking for help with PEAR Pager here s a couple of new examples about the most requested features 1 how to use Pager with a template engine like Smarty 2 how to use Pager Wrapper to paginate database results and display them using AJAX An update on my PEAR packages PHP PEAR 1 February 2007 An update about some of the PEAR packages I maintain M DB QueryTool Mail Queue MDB2 Translation2 Get involved in PEAR PHP PEAR 15 November 2006 An overview of the many ways to get involved in PEAR and a few concrete suggestions Firebird 2 cheat sheet PHP Database Firebird SQL Cheat Sheet 6 November 2006 Cheat sheet for the upcoming Firebird 2 A handy reference of the FB2 datatypes an useful query reference and a list of the PHP Firebird Interbase functions PostgreSQL cheat sheet PHP Database PostgreSQL Cheat Sheet 6 November 2006 Cheat sheet for PostgreSQL 8 A handy reference of the PostgreSQL datatypes an useful query reference with an eye on the INFORMATION SCHEMA tables and a list of the internal PostgreSQL functions PEAR Pager Tutorials Article Pagination and Navigation PHP PEAR Database Tutorial 16 October 2006 How to navigate through the paragraphs of a long article with PEAR Pager PEAR Pager Tutorials Navigation with Pager and AJAX or simple Javascript PHP PEAR JavaScript AJAX Tutorial 3 October 2006 PEAR Pager can generate javascript links and AJAX calls Read how in this new Pager tutorial examples are included DBMS and charsets a summary and a call for help PHP PEAR Database MySQL PostgreSQL Firebird SQL Oracle SQLite Charset 28 September 2006 Some clarification about charset settings for the various DBMS MySQL

    Original URL path: http://www.alberton.info/articles/filter/tag/PHP/page/4 (2016-04-24)
    Open archived version from archive

  • Lorenzo Alberton - Articles
    Tutorial 8 September 2006 Paginate database results with PEAR Pager in an efficient way PEAR Pager Tutorials PHP PEAR Database Tutorial 8 September 2006 New series of tutorials on PEAR Pager Read only db access to prevent SQL injection attacks PHP Database Security 6 June 2006 An idea for safer db applications use read only db access wherever possible Use GRANT to create an user with read only rights and use it to prevent SQL injection attacks Secure PHP installation on unix linux systems PHP Apache Linux mod rewrite Security 24 May 2006 Simple guide to a more secure PHP installation on unix linux systems Extracting META information from PostgreSQL INFORMATION SCHEMA PHP Database PostgreSQL INFORMATION SCHEMA 8 May 2006 Extracting META information from a PostgreSQL database using the INFORMATION SCHEMA views and the system catalogs pg class pg user pg view PHP PDO Firebird status PHP PEAR Database Firebird SQL Windows PDO 11 April 2006 A quick roundup of the PHP PDO Firebird driver Test of its current status what works and what doesn t HowTo Install Firebird Interbase with PHP on Windows A step by step tutorial PHP PEAR Database Firebird SQL Windows 30 March 2006 A step

    Original URL path: http://www.alberton.info/articles/filter/tag/PHP/page/5 (2016-04-24)
    Open archived version from archive

  • Lorenzo Alberton - Articles - PostgreSQL table audit
    for each changed field Create a TRIGGER for each table to monitor Now that we have defined a generic function that should work with any table with the limitation of it having a PK on one field only we can attach it to a table with a simple trigger DROP TRIGGER tg audit test1 ON test1 CREATE TRIGGER tg audit test1 AFTER INSERT OR DELETE OR UPDATE ON test1 FOR EACH ROW EXECUTE PROCEDURE log to audit table DROP TRIGGER tg audit test2 ON test2 CREATE TRIGGER tg audit test2 AFTER INSERT OR DELETE OR UPDATE ON test2 FOR EACH ROW EXECUTE PROCEDURE log to audit table Just change the trigger name and the table name no other change is needed Test the auditing procedure Now that we ve prepared everything let s see how it works by inserting a record into a monitored table INSERT INTO test1 id somename somevalue somets VALUES 1 php 5 CURRENT TIMESTAMP Let s see what happened to the audit table testdb SELECT FROM audit table ts usr tbl fld pk name pk value mod type old val new val 2007 02 19 23 18 51 468 01 postgres test1 id 1 INSERT 2007 02 19 23 18 51 468 01 postgres test1 somename id 1 INSERT php 2007 02 19 23 18 51 468 01 postgres test1 somevalue id 1 INSERT 5 2007 02 19 23 18 51 468 01 postgres test1 somets id 1 INSERT 2007 02 19 23 18 51 468 01 4 rows The function saved into the audit table the following information the timestamp of the event the user who caused the event the names of the table and field involved the name and value of the primary key of the affected record the event type INSERT UPDATE DELETE the old and new values of the field Let s insert a record in the other table testdb INSERT INTO test2 pkid testname testvalue testdate VALUES 1 php 5 21 CURRENT DATE INSERT 1 testdb SELECT FROM audit table ts usr tbl fld pk name pk value mod type old val new val 2007 02 19 23 26 17 437 01 postgres test1 id 1 INSERT 2007 02 19 23 26 17 437 01 postgres test1 somename id 1 INSERT php 2007 02 19 23 26 17 437 01 postgres test1 somevalue id 1 INSERT 5 2007 02 19 23 26 17 437 01 postgres test1 somets id 1 INSERT 2007 02 19 23 26 17 437 01 2007 02 19 23 28 09 656 01 postgres test2 pkid 1 INSERT 2007 02 19 23 28 09 656 01 postgres test2 testname pkid 1 INSERT php 2007 02 19 23 28 09 656 01 postgres test2 testvalue pkid 1 INSERT 5 21 2007 02 19 23 28 09 656 01 postgres test2 testdate pkid 1 INSERT 2007 02 19 8 rows The audit table registered the insertion with one record per field Please note that it recognized the event happened

    Original URL path: http://www.alberton.info/postgresql_table_audit.html (2016-04-24)
    Open archived version from archive



  •