..streetsmartin' IT..

..a dose of zero-day know-hows ..

5/03/2010

Using PHPXref

PHPXref is a PHP cross referencing documentation generator designed to make it easier for developers to browse a PHP application's codebase. With features such as mouse-over information and hot-jumping among classes and functions and extraction of phpdoc style documentation, it really does simplify a job of a developer in getting to know a new application.

It requires Perl to be installed since it uses a perl-based script to parse the source directory to generate a documentation. You may download the right version of Perl for your platform here.

Using PHPXref to generate a cross referencing documentation of any application is easy, assuming you already have Perl installed, just follow these 5 simple steps.

Step 1.) Download PHPXref from http://phpxref.sourceforge.net/#download (choose the version suited for your platform).

wget http://prdownloads.sourceforge.net/phpxref/phpxref-0.7.tar.gz?download

Step 2.) Uncompress the downloaded phpxref archive

tar xvpf phpxref-0.7.tar.gz

Step 3.) Navigate to the extracted folder and edit the file named phpxref.cfg. Edit the values for the SOURCE, OUTPUT and PROJECT as needed.


(NOTE: You may need to create the directory for the OUTPUT if it doesn't exist yet to prevent runtime errors during generation as the phpxref script will not create it for you.)

Step 4.) Run the phpxref generation script by invoking the following command:

./phpxref.pl



Step 5.) Once generated, you may now browse the generated documentation in HTML format. If you have set the OUTPUT to point within your Document Root as with our example above, you may browse it using http://localhost/phpxref_sugarcrm or directly in its location since the generated doc is static.



You may automate this process to keep the cross referencing documentation up to date by regularly running phpxref.pl via cron.

5/02/2010

Quick Install Memcached and Memcache for PHP on Fedora

Memcached is a high-performance, distributed memory object caching system. In web applications implementation, it is intended to alleviate database load by caching the most requested data for faster retrieval and lessen DB hits.

Installing Memcached on Fedora and adding it as a PHP module is fairly simple using the console.

Step 1: Install Memcached

yum install memcached

Step 2: Install Memcache PECL module for PHP

yum install php-pecl-memcache

Step 3: Restart Apache

service httpd restart

Step 4: Run the Memcached Daemon

service memcached start

Once finished, you should be able to access memcache-related functions and utilities. You can check the memcache entry in the phpinfo() page which verifies that it has been successfully installed as PHP module.



For more information on how to use the Memcache Class provided by the Memcache PECL module, visit the following link: http://www.php.net/manual/en/book.memcache.php


2010 reset!

Its been awhile since I updated this blog, and there are a few broken links here and there which I will be fixing soon (Sorry). I'll probably add a few more tutorials within the month as soon as I find the time.

I am currently playing around Sphinx and will be posting quick start tutorials about it soon. I also wrote a simple quick-slapped hash-type agnostic reset-password implementation which I will be reviewing for posting (for newbies).

Check back again later. :) //Out

10/07/2009

How to use 3G Phone/Modem to connect to the Internet on Fedora 11 (Linux)

Its been awhile since I attempted to connect to the internet via 3g using my phone (SGH-i550). The last time I did was several months ago with the help of wvdial. Now that there is a power outage in our area; and I forgot to install wvdial; and I just upgraded to Fedora 11, now is the perfect time to test the new features of the updated NetworkManager into action.

The following are the set of simple steps I have taken to connect to the internet using SGH-i550 via 3g on Fedora 11. I would assume that these steps will also work with other brands/models and most 3g modems around.

  1. Connect 3g phone/modem to the computer

  2. Right-Click on the NetworkManager Applet and select "Edit Connections"



  3. Select "Mobile Broadband" tab





  4. Select the 3g Device from the drop down list and click "Forward"





  5. Select the Country and click "Forward"





  6. Select a Provider and click "Forward"





  7. Select a Plan and click "Forward"





  8. Confirm the details and click "Apply"





  9. Leave the preset defaults and click "Apply"





  10. Close the Connection Settings Dialogue





  11. Right-Click on the NetworkManager Applet again and select the newly created connection





  12. The NetworkManager Applet will change its icon indicating a successful connection has been established





  13. And you are done.

10/03/2009

Web Developer tools for Opera 10 (switching from Firefox)

Just yesterday I decided to completely ditch Firefox and use Opera 10 as my default browser. The chronic issue of memory leaks and excessive CPU usage in Firefox appears to have gotten worse in their latest release and I just couldn't bear with it anymore.

As a recourse I decided to finally switch to Opera 10. I have been using it for awhile and noticed the vast difference in resource usage versus Firefox.

Below is a list of tools and widgets I found useful for web developers using Opera 10.

  • Dragonfly - is Opera's developer tool that is installed by default in Opera 10. It can be accessed via Tools -> Advanced -> Developer Tools. It offers functionalities such as DOM Inspector, CSS/Javascript Error Console, Javascript Console, Network Monitoring and more, it is pretty much like Firefox's Firebug.
  • phpManual - is an Opera Widget which provides the PHP manual. This widget is handy when looking up certain functions without having to search it up on php.net's website, the result just appears inline the widget.
  • CSS Help - provides an expandable CSS 2.1 mini-documentation.
  • Javascript Cheatsheet - as its name implies, provides an easy to browse Javascript Cheatseet.
  • Site Validator - This widget submits the current page to the W3C Markup Validation Service and returns the number of errors found and a link to the actual results. 

There are quite a number of other useful widgets for web developers in Opera's Widget home page. Dragonfly was the one which sold me entirely. I am still looking forward using Firefox again in the near future when the memory leak and high cpu usage issues are addressed.