All News Features Tips & Tricks Table of Contents
Search:

Setting up Your Web Browser

Posted by Petr Pisl on Oct 01 2008, 09:00:00 AM CEST

This tip explains how to set up different web browsers to view a project or a page. Other web browser configurations are helpful if you want to view a page in Firefox, Internet Explorer, Opera, Safari or any other browser than the default system one. It can also help you when you need to test your applications with different versions of a browser.

After installation or when running the IDE with a fresh userdir, NetBeans uses the default system browser. When you invoke Run or Debug on a PHP project that uses Local Web Site or Remote Web Site Run Configuration, a browser is launched and the project URL is displayed in the browser. Run and Debug Single File actions work in a similar way for individual PHP or HTML files. 

You can change or add a new browser configuration in the Option dialog.

In the Web Browser combobox you can select from predefined configurations. When you press the Edit... button, you can change the existing configurations or you can simply add a new one.

Category: Tips & Tricks | Permalink | Comments [2]

Introduction to Ajax for PHP Web Applications

Posted by Petr Pisl on Sep 25 2008, 10:34:32 AM CEST

There was recently published new tutorial Introduction to Ajax for PHP Web Applications on NetBeans site. The tutorial provides an introduction to Ajax and demonstrates some of the features in the NetBeans IDE that allow you to program faster and more efficiently when working with Ajax-related technologies. In the example application, you can create an entry field with autocomplete feature.

Category: Tips & Tricks | Permalink | Comments [0]

Using Zend Framework with NetBeans IDE

Posted by Jeffrey Rubinoff on Sep 23 2008, 05:20:22 PM CEST

My personal experience in setting up Zend Framework to work with NetBeans IDE.

[Read More]
Category: Tips & Tricks | Permalink | Comments [7]

Create a WordPress Theme with NetBeans PHP IDE

Posted by Petr Pisl on Sep 17 2008, 02:09:45 PM CEST

Toni Epple has written a nice tutorial about customizing a WordPress theme. You can read it here.

It is nice to know that the result of our work is useful and helpful, even if we haven't fully finished the first version of PHP support yet.

Category: Tips & Tricks | Permalink | Comments [2]

Displaying Documentation Window Next to Completion Window

Posted by Petr Pisl on Sep 12 2008, 09:04:28 AM CEST

Do you use a wide screen? Or have you noticed that the documentation window hides the text in the editor at the moment when you want to see one or two lines above the caret? A few days ago I was discussing with the editor guys, why NetBeans displays the documentation window above the code completion window. As a result there is issue #144362, which was resolved at the beginning of this month.

[Read More]
Category: Tips & Tricks | Permalink | Comments [9]

--userdir

Posted by Petr Pisl on Sep 02 2008, 01:53:09 PM CEST

I work with development builds and I run multiple NetBeans instances at the same time. I have always one instance running where I develop and a second one for testing purposes. Also I change the NetBeans build almost daily. Fortunately there is the  --userdir switch.

This switch has one parameter and this is a path to the folder where NetBeans stores all settings, including information about opened projects.  Basically it's something like a workspace. If I need to work on PHP suppport, I start NetBeans with this command

./netbeans.sh --userdir /space/netbeans/userdirs/php

If I need to fix something in Java Web Support I use

./netbeans.sh --userdir /space/netbeans/userdirs/javaweb

and for testing php build

./netbeans.sh --userdir /space/netbeans/userdirs/phptest

Because  I use development builds, sometimes the userdir can be damaged and I have to delete it and start NetBeans with a clean userdir, but this is not a big issue. Sure, I can lose all my settings, but I have to be aware that I work with the latest builds and this can happen. On the other hand, I have to delete the userdir very rarely.

I don't use installers, I always download NetBeans as a zip file. These are available on nightly build download page, where OS Independent Zip item in has to be selected in the Platform combobox. There are also really fresh builds publicly available on the continual building machine. The PHP builds are available here. There are available only as zip files. The zip file can be unzipped anywhere on your machine. Then just execute the netbeans.sh or netbeans.exe, which is located in the bin folder, with the --userdir switch.

Category: Tips & Tricks | Permalink | Comments [7]

My first WordPress plugin in NetBeans

Posted by Petr Pisl on Aug 17 2008, 02:37:34 PM CEST

When I read Jan's tutorial how to configure WordPress in NetBeans I started to think, how it can be difficult to write a plugin for WordPress and whether NetBeans can help me in this. This entry is tutorial how to write simple plugin for WordPress.

What the plugin will do? The plugin will look through content of displayed entries to replace NetBeans with link to NetBeans.org site. It's simple and it should take only few minutes.

[Read More]
Category: Tips & Tricks | Permalink | Comments [11]

Configuring a NetBeans PHP Project for WordPress

Posted by honza on Aug 06 2008, 11:33:52 AM CEST

I've been experimenting with WordPress a little bit lately while setting up a blog on my personal web server. The installation was completely smooth, but I was interested in some of the WP internals and also wanted to get a better understanding of what it takes to develop WordPress extensions. So, I set up a NetBeans PHP project for my experiments.

I thought other folks might be interested in this, or perhaps, would like to see how to set up a project in NetBeans for their existing PHP applications in general. Therefore, I wrote this brief tutorial and published it in NetBeans wiki. In the future, I'd like to write another tutorial about developing a real WordPress plugin.

 Comments welcome.

Category: Tips & Tricks | Permalink | Comments [18]

How to manage templates in NetBeans II

Posted by Petr Pisl on Jul 30 2008, 09:00:18 AM CEST

My last entry "How to manage templates in NetBeans I" introduces to the file templates in NetBeans. This is probably more interesting part, which describes how to change the content of a new file during creating from a template. 

[Read More]
Category: Tips & Tricks | Permalink | Comments [0]

How to manage templates in NetBeans I

Posted by Petr Pisl on Jul 29 2008, 11:57:46 AM CEST

NetBeans contains many predefined templates for creating new files, but these templates don't have to fit your needs and you want to change or create new templates. I will try to explain it from PHP point of view, but this is generic NetBeans future, no PHP specific. Originally I have prepared one blog entry about this, but then I realized that this is too long. There is the first part, which describes "static" templates.

[Read More]
Category: Tips & Tricks | Permalink | Comments [2]

Custom code folding in PHP editor improved

Posted by Petr Pisl on Jul 24 2008, 11:59:15 AM CEST

Last week I wrote article about code folding in PHP editor. Yesterday I have improved a little the custom fold. Now it allows to define, whether the fold will be by default collapsed and also the description of the fold.

From the picture should be clear that the custom fold is defined via element <editor-fold>, which can have two optional attributes. The attribute defaultstate with the value collapsed, says that the fold is collapsed when the file is opened. If you don't use this attribute, then the fold will not be collapsed after opening file by default. The second attribute is desc, where you can define a description of the fold. This description is displayed, when the fold is collapsed.

Because writing the open element can take time, you can create a code template for this.

  • Go to the Tools -> Options and in Editor category select Code Templates tab.
  • Select PHP in  Language combobox.
  • Press New button and enter an abbreviation for the code template. I have choosen cusf.
  • In the Expanded Text tex area write:

    <editor-fold defaultstate="collapsed" desc="${cursor}">

  • Close the Option dialog

The exresion ${cursor} marks the position, where cursor in editor is placed after expanding the code template.

Now when you write cusf and press TAB, then the text cusf is replaced with the defined template.

Category: Tips & Tricks | Permalink | Comments [10]

Code Folding in PHP editor

Posted by Petr Pisl on Jul 18 2008, 09:34:56 PM CEST

What is code folding? I have looked for a definition and I have found this at wikipedia:

Code folding is a feature of some text editors, source code editors and IDEs that allows the user to selectively hide and display sections of a currently-edited file as a part of routine edit operations. This allows the user to manage large regions of potentially complicated text within one window, while still viewing only those subsections of the text that are specifically relevant during a particular editing session.

The PHP editor, like other editors in NetBeans, provides this functionality. By default no fold is collapsed. The setting you can specify in general editor options (Tools -> Options -> Editor).  On the picture below you can see which folds are supported in PHP and how they are mapped in editor options.

When you collapse a fold, you can see the hidden content, if you place the mouse cursor over the fold description.

The PHP editor also supports custome folds, which are defined by user. At the line, where you want to start the fold, place comment //<editor-fold> and at line where the fold should end place //</editor-fold>. Content between these tags, will be folded. These folds can be also nested.


The functionality, which provides the custome folds, is available from today. It is available in development builds or you have to wait until NetBeans 6.5 Milestone 2 will be published.


Category: Tips & Tricks | Permalink | Comments [11]

Howto check xdebug installation

Posted by Radek Matous on Jul 15 2008, 06:19:37 AM CEST

Petr in one of his recent entries mentions how to install xdebug in Ubuntu. I would like to add a very simple test how to verify that xdebug is properly installed on any supported platform. Naturally the most straightforward test would be to use debugger in NetBeans PHP IDE. Definitely, but maybe you haven't installed NetBeans yet, so I've decided for different approach - just write a very lightweight test listening to a connection on port 9000 (default one for xdebug). Which language to choose? Not much important but why not PHP? So, here we go:

screesnhot: verification code testing proper installation of xdebug

Now if we have a code (let's choose filename like "dbgtest.php") we can use it. Two simply steps should be enough to verify that xdebug was properly installed:

  1. run the code from command line (e.g. /usr/bin/php dbgtest.php)
  2. start debug session for arbitrary file from within a browser window (e.g. http://localhost/index.php?XDEBUG_SESSION_START=mysession)
If xdebug is properly installed then script started in step 1. should print message like "connection established: Resource id #5". If no message is printed and the script is still running, then xdebug isn't installed properly or uses different port or whatever else. So, kill the running process and investigate where the problem is, but this is the other story.


Category: Tips & Tricks | Permalink | Comments [27]

How to set up NetBeans to view .htaccess in Project or Files view

Posted by Petr Pisl on Jul 10 2008, 02:26:44 PM CEST

A few days ago I run in an issue that by default NetBeans doesn't show files which starts with dot, which is exactly the case of .htaccess file. This is the tip how to do it.

Go to the Options->Miscellaneous->Files and the content of Ingnored Files Pattern field replace with:

^(CVS|SCCS|vssver.?\.scc|#.*#|%.*%|\.(cvsignore|svn|DS_Store)|_svn)$|~$|^\.(?!htaccess$)

If you have already .htaccess in the project and the file is not still displayed, then close the project and open again. There is issue #139582, which is entered against the project.


Category: Tips & Tricks | Permalink | Comments [2]

Ubuntu, PHP, NetBeans - part II

Posted by Petr Pisl on Jul 06 2008, 10:40:34 PM CEST

In my last entry I have described, how to install PHP, Apache and MySQL in Ubuntu 8.04 from Ubuntu repositories. NetBeans IDE is written in Java, so before installing NetBeans you have to install Java. This entry is about how to install Java environment in Ubuntu.

You can find a few Java environment like openJDK, Cacao or Kaffe in the default Ubuntu repositories. I have tried to run NetBeans on top of openJDK withouth a problem, I haven't try Cacao or others. I suggest to use Sun Java, because NetBeans are tested mainly with Sun Java.

You can download JRE (Java Runtime Environment) or JDK (Java Development Kit) from Sun web.  For running NetBeans, JRE is enough. NetBeans supports the latest two releases, so today Java 1.5 and Java 1.6 are supported. Java 1.6 uses native look and field and on the pictures below you can compare how NetBeans looks, if there are running on top of Sun Java 1.5 and Sun Java 1.6 .

There steps how to install Sun Java 1.6 :

  1. From Application menu choose Add/Remove... item



  2. The Add/Remove Application dialog is open. In Show combo box select All Available Applications.



  3. Write "Sun Java" in the Search box and Sun Java 6 Runtime should be displayed.



  4. Check Sun Java 6 Runtime and click on Apply Changes button. Durig the installation you will be prompted to accept the licence.

  5. You can check, whether the JRE is installed correctly. Open a terminal and write command java -version. You should see similar output as on the picture.



Category: Tips & Tricks | Permalink | Comments [5]