Monday Mar 24, 2008

AMP developement on the Mac

If you want to do any AMP development on your Mac and have Leopard you'll be pleasantly surprised by the out of the box experience.

First of all you the system comes bundled with Apache 2.0 and PHP 5.2.5. To configure the stack is quite simple:

  • "Turn on" Apache - go to System Preferences | Sharing | Web Sharing and check this option
  • Test the installation the web server installation
  • Find the main configuration file of the Apache web server /private/etc/apache2/httpd.conf
  • Enable PHP - edit httpd.conf (remember to use sudo) and uncomment this line:
    • #LoadModule php5_module        libexec/apache2/
  • Test again by creating some file in the document root: /Library/WebServer/Documents and add the following code snippet
    • <?php phpinfo(); ?>
    • bring up the browser again and invoke the test file ( - you should see a table that gives you the details of the php version that you are running

Share your technology expertise with others

Blogs are all about sharing, opinion and participation in the new social media dynamic, where the news are made by random folks, and not only the journalism graduates.
The NetBeans blogging contest is just that - an attempt to get folks to evaluate the latest support for JavaScript and the Spring framework, that comes in the NetBeans 6.1 beta. If you are adventurous, try the NetBeans 6.1 nightly build, where you can get a preview of the new design for RESTful web services support and PHP. It is still work in progress, but worth while for the folks looking for the bleeding edge.

Monday Feb 25, 2008

Embedding charts in web applications using NetBeans

You'll be surprised how easy is to build a web application that charts data using the jMaki framework and NetBeans 6. So let's assume that you want to plot the % of revenue an organization receives every month of an year. A pie chart would likely be your best bet:

So how does one build such a chart? These few steps should get you started:

  • First of all you'll need to get install the jMaki plugin from the NetBeans update center (Tools | Plugins | Available Plugins | jMaki Ajax support)
  • Next get the corresponding charting library - a project and install it in NetBeans (Tools | Palette | Add jMaki Library)
  • Create a new web project and select the jMaki framework in the project wizards dialog
  • Drag and drop the "Google Pie"component from the palette (look for a section called - jmaki-charting-widget ...) after the <body> tag in the index.jsp default page of the project
  • Deploy the application and customize as needed

If you are not a Java guy and want to achieve the same results in a PHP project and application use the following code snippet to build the chart.

  addWidget( array(
                         "name" =>"jmaki.charting.plotkit.pie",
                   xAxis : {
                   title : 'Months',
                   labels : [{ label : 'January'},
                             { label : 'February'},
                             { label : 'March'},
                             { label : 'April'},
                             { label : 'May'},
                             { label : 'June'},
                             { label : 'July'},
                             { label : 'August'},
                             { label : 'September'},
                             { label : 'October'},
                             { label : 'November'},
                             { label : 'December'}
                             data : [
                  {label : 'Set 1', values : [25, 45, 25, 45, 50, 25, 35, 25, 25, 20, 35, 45] },


Thursday Nov 01, 2007

PHP coming soon on a NetBeans installation near you

Alexei and the team have been working on a PHP plugin for NetBeans 6. I am hoping they'll be able to release it on the NetBeans 6 update center in early December. The bits will be young, beta quality at best, however I am experimenting with PHP support in NetBeans and I like what I see so far.

The first thing one may do is make sure to get a runtime stack that supports the deployment of PHP applications. Given that many of these apps will have a database backend, this calls for something like MySQL. You'll also need a matching web server, and apache comes to mind :-). Here are few easy steps to get started:


  1. SSH Server (for remote access): sudo apt-get install ssh
  2. Database Server: sudo apt-get install mysql-server
  3. Apache HTTP Server: sudo apt-get install apache2
  4. PHP for Apache HTTP Server: sudo apt-get install php5
  5. MYSQL for Apache HTTP Server: sudo apt-get install libapache2-mod-auth-mysql
    sudo apt-get install php5-mysql

Once you install the PHP plugin in NetBeans, use the  "Services" tab to configure the document root for Apache web server installation. On my Ubuntu installation the document root is /var/www/apache2-default. You will likely have to change the permission for the document root, since NetBeans is usually install in user mode and apache required sudo.

To test everything, just create a new PHP Project in the IDE and add the following line of code: phpInfo(); in the default file. Next deploy you page and in your browser look for something like: http://localhost/apache2-default/index.php 




« July 2016