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
    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 PostgreSQL Firebird Interbase Oracle Sqlite and a call for help for charset setting support in PEAR MDB2 Extracting META information from PostgreSQL INFORMATION SCHEMA PHP Database PostgreSQL INFORMATION SCHEMA 8 May 2006 Extracting META information from a PostgreSQL database using the

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

  • Lorenzo Alberton - Articles - Read-only db access to prevent SQL injection attacks
    t seen many if any open source projects leveraging this fact for improving the security of the application For instance we don t need a connection with WRITE rights for a search form or a select menu Why can t we use a read only db connection for those tasks And a read write one only when we really need it I agree that writing an application using the same connection all over is easier but using two connections one with R W rights and one with R O rights depending on the function where we use it isn t terribly difficult Writing a singleton function returning a db connection with R W or R O permissions depending on the specific need of the current task is as easy as this example using PEAR MDB2 function getConnection with write rights false DSN of user having read write grant static rw dsn phptype rw username rw password hostspec database DSN of user having read only grant static ro dsn phptype ro username ro password hostspec database if with write rights return MDB2 singleton rw dsn return MDB2 singleton ro dsn where rw username rw password are the login details for an user having full rights on the db while the user identified by ro username ro password has a read only GRANT Having a fine grained approach i e restricting WRITE access only to a given subset of db tables would be even better but not always feasible Reference MySQL GRANT Syntax PostgreSQL GRANT Syntax Interbase Firebird GRANT Syntax Oracle GRANT Syntax Conclusion While this method doesn t excuse you from escaping any data you pass to the database and or using prepared statements where available you could avoid the SQL injection attacks using a read only connection where you don

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

  • Lorenzo Alberton - Articles - PHP 5.3 SPL goodies: GlobIterator, SplFileObject and CSV files
    I upgraded to PHP 5 3 dev and had some fun with the latest SPL additions I had a lot of files in one dir and had to work on those matching a certain pattern The classical glob problem I saw in the PHP 5 3 NEWS file that GlobIterator was added to SPL and tried it Even if it s not documented yet its usage is really simple you can use it as any other DirectoryIterator php search all the txt files starting with a dir some dir a txt files new GlobIterator dir foreach files as file echo file getPathname That s it file is a DirectoryIterator object which extends SplFileInfo so all the relative methods like getATime getSize isFile etc are available SplFileObject and CSV files I also tried SplFileObject as a CSV iterator parser instead of the old fgetcsv and again working with it is very simple php file new SplFileObject path to file csv delimiter enclosure n file setCsvControl delimiter enclosure while file valid data file fgetcsv data is an array with the values of each field of the current line file next The SPL family is getting every day more useful and convenient Follow

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

  • Lorenzo Alberton - Articles - PEAR::Pager Tutorials - Use Pager with Smarty. Use Pager_Wrapper with AJAX
    array assume you have an instantiated Smarty object into the smarty variable assign the paged data and the links to template variables smarty assign items data smarty assign pager links pager links smarty assign page numbers array current pager getCurrentPageID total pager numPages smarty display page tpl And here s the template if page numbers total 1 page page numbers current page numbers total br pager links if ul foreach item row from items li row li foreach ul As you can see there s nothing difficult about it Plain and clear Pager Wrapper and AJAX The second example shows how to use Pager Wrapper to paginate database results and HTML AJAX to display them The html file is identical to the one I ve already shown in the Pager AJAX tutorial html body h1 PEAR Pager example with AJAX h1 script type text javascript src server php client all script div id target I m the target div script type text javascript HTML AJAX replace target testdata php script body html The testdata php file is a simple php script where you fetch the data from the database with the help of Pager Wrapper The output of this script will replace the contents of the target div in the first html file We also print the current datetime to prove the data is fresh and built at the time of each call i e every time you click on a navigation link php copy the Pager Wrapper file where you can include it require once Pager Wrapper php require once MDB2 php skipped the db connection code let s just suppose we have a valid db connection in db pager params array mode Sliding append false don t append the GET parameters to the url path fileName javascript HTML

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

  • Lorenzo Alberton - Articles - PEAR::Pager Tutorials - Article Pagination and Navigation
    INTO paragraphs article id paragraph id title content VALUES 1 2 Sample data Second paragraph here INSERT INTO paragraphs article id paragraph id title content VALUES 1 3 Showtime Third paragraph here INSERT INTO paragraphs article id paragraph id title content VALUES 1 4 Alternate navigation Fourth paragraph here INSERT INTO paragraphs article id paragraph id title content VALUES 1 5 Article summary Fifth paragraph here INSERT INTO paragraphs article id paragraph id title content VALUES 1 6 Printer friendly version Sixth paragraph here Second Article INSERT INTO articles id title abstract submission date author id VALUES 2 PEAR Pager tutorials New series of tutorials about PEAR Pager CURRENT TIMESTAMP 1 INSERT INTO paragraphs article id paragraph id title content VALUES 2 1 Articles index 1 How to efficiently paginate database results 2 Create pretty links with Pager and mod rewrite 3 Navigation with Pager and AJAX or simple Javascript 4 Article pagination Showtime Now that we re done with the database structure we can display the articles in our site one paragraph per page For this task we re going to use the PEAR MDB2 DBAL and the handy Pager Wrapper we ve already seen in a previous tutorial php copy the Pager Wrapper file where you can include it require once Pager Wrapper php require once MDB2 php article id 1 if you fetch this parameter via GET POST remember to validate it skipped the db connection code let s just suppose we have a valid db connection in db pager options array mode Sliding perPage 1 we want only ONE paragraph per page delta 3 query SELECT articles title AS article title articles submission date articles abstract paragraphs title AS paragraph title paragraphs content FROM paragraphs LEFT JOIN articles ON articles id paragraphs article id WHERE articles id int article id ORDER BY paragraphs paragraph id paged data Pager Wrapper MDB2 db query pager options show the results echo h1 paged data data 0 article title h1 echo p i paged data data 0 submission date i p if paged data page numbers current 1 also show the abstract on the first page echo p paged data data 0 abstract p echo h2 paged data data 0 paragraph title h2 echo p paged data data 0 content p show the links echo paged data links Since we told Pager to split the items the paragraphs in our case into groups of one it will return only one paragraph and we can navigate through the other paragraphs with the links built by Pager This is the output of the script Alternate navigation If you don t like normal links for the navigation and prefer a select menu instead you have to add a call to getPageSelectBox in the Pager Wrapper MDB2 function before returning the paged data array since it s not included in the default version function Pager Wrapper MDB2 db query pager options array disabled false fetchMode MDB2 FETCHMODE ASSOC Pager Wrapper MDB2 body omitted Add

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

  • Lorenzo Alberton - Articles
    2006 PEAR Pager can generate javascript links and AJAX calls Read how in this new Pager tutorial examples are included PEAR Pager Tutorials Create pretty links with Pager and mod rewrite PHP PEAR mod rewrite Tutorial 19 September 2006 How to tell PEAR Pager about your links format and use it to generate mod rewrite compatible links PEAR Pager Tutorials Paginate database results PHP PEAR Database Tutorial 8 September 2006

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

  • Lorenzo Alberton - Articles - HowTo: Install Firebird/Interbase with PHP on Windows. A step-by-step tutorial.
    instsvc i s a C firebird bin instsvc start Configure PHP Copy C firebird bin fbclient dll to your C windows system32 directory and rename the file to gds32 dll Copy php interbase dll from your php ext directory to the C windows system32 directory Copy libeay32 dll and ssleay32 dll from your php directory to the C windows system32 directory Edit your php ini un comment the line extension php interbase dll you have to remove the semicolon from that line Restart your webserver Apache Install some Firebird SQL Tools You can manage your databases with some tools EMS SQL Manager for InterBase Firebird the free version is more than enough for a start FlameRobin another GUI tool open source ibWebAdmin web frontend for the Firebird and InterBase database servers written in PHP NB the default admin username password pair for Firebird is SYSDBA masterkey Follow lorenzoalberton Related articles PHP PDO Firebird status Firebird 2 cheat sheet 9 responses to HowTo Install Firebird Interbase with PHP on Windows A step by step tutorial moncler jackets 02 November 2010 07 55 web frontend for the Firebird and InterBase database servers written in PHP NB the default admin username password pair for Firebird is SYSDBA masterkey Denis 28 December 2010 09 32 Thank you Your article helped me to quickly set up php and firebird Par mums 03 January 2011 20 08 Thanks it was helpful wordpress premium themes 15 May 2011 16 09 Your article helped me to quickly set up php and firebird reisen malta 24 May 2011 23 58 Nice this helped me with my Windows System Patty 31 May 2011 10 15 Thanks a LOT obeng 16 August 2011 18 07 Thanks Muhammad Nadat 05 September 2011 12 08 im trying to create a php application to

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

  • Lorenzo Alberton - Articles - DataSift and Data Delivery: PUSH
    was to part from the conventional way of running Map Reduce jobs and to stream the results directly to the customers as soon as the incoming messages matched a filter instead of sending them to the Reducers and back to HDFS Again we were able to greatly improve responsiveness and the user experience by putting less load on the cluster nice side effect and by offering data as a stream just like the real time streams we already deliver Improving delivery The final piece of the puzzle was to improve the delivery itself Not everyone wants to be connected 24 7 to a socket and the WebSockets protocol might be problematic in corporate networks where firewalls and proxies usually strip some HTTP headers hindering a proper communication Also given how fast we now scan our Twitter archive the output channel might see huge volumes of traffic since we deliver hours worth of tweets in the space of a few seconds and not everyone can sustain such a high incoming throughput Even the network itself might be clogged up especially in trans continental links a problem known as long fat network Thanks to an epic analysis of one of our awesome DevOps we solved the latter problem by dynamically tuning TCP settings depending on the network latency and throughput and by creating adaptive stream buffers when the outgoing stream is high volume we batch messages within half a second to have a bigger TCP packet and maximise the payload while keeping the latency very small When the volume of outgoing message decreases we skip the batching cutting the latency to zero We also invested in serious networking gear to improve communication within our cluster and the internal services and in dedicated transatlantic links to kill latency and connectivity problems between the

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



  •