Monthly Archives: December 2013

Subversion and commands

This subversion tutorial describes the common subversion commands to maintain your repository.Subversion tutorial and commands

Setup a new repository on your diskstation (see this article for instructions to install Subversion onto your DiskStation):

  1. Goto your DiskStation box with the SVN server and create the repository:
    /opt/bin/svnadmin create myrepo
  2. Edit the passwd file in /volume1/svn/myrepo/conf/passwd; add a line below [users]:
    myrepousr=myrepopwd
  3. Edit the svnserve.conf and add the line
    anon-access=none
  4. Uncomment the line
    passwd-db=passwd

Now to add an existing folder to this new repository execute the command below:
svn import localdir svn://diskstation.local/myrepo

The local directory localdir is now under source control. Add some files to the local directory and execute the status command:

svn status
?       newfile

The files you just added are shown starting with a question mark. You can add the new files to your repository with the add command:

svn add newfile
A      newfile

The file is now added to source control but it is not committed yet; lets do that now with the command commit command:

svn commit

Your default (terminal) editor will open and you are allowed to type a comment for this new revision; go ahead and type your comment (or leave it empty). After you type your comment press Ctrl-X; if you typed a comment pres Y and press enter; otherwise press c.

Subversion responds with the message below; your newfile is added:

Adding newfile
Transmitting file data .
Committed revision 119.

Delete a file from your repository with the delete command:

svn delete newfile
D        newfile

Commit the delete action with the commit command:

svn commit
Deleting newfile

If you ever run into the warning message “Directory ‘current/dir’ is out of date update local files” you have to update your local copy of the repository; execute the command below:

svn update

Add all new files to the SVN repo:

svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add
Share

NetBeans installation

netbeansDownload NetBeans at here. This script will install the Java JRE and NetBeans in one go.

After installation start up the NetBeans IDE. If you are running under gnome the fontsize is a bit big.

You can change this by adding

–laf javax.swing.plaf.metal.MetalLookAndFeel –fontsize 14

to your desktop shortcut. Th desktop shortcut is located at ~/.local/share/applications/. Change the line that starts with Exec to:

/bin/sh "/home/berend/netbeans-7.4/bin/netbeans" --laf javax.swing.plaf.metal.MetalLookAndFeel --fontsize 12

Now it is time to install the PHP plugin. Go to Tools -> Options; order by name and search for the PHP plugin. Select it and press install. Accept the dependencies and the license and press install. Choose restart the IDE now and press Finish.

Install also the PHPUnit plugin to help you create Unit testing classes.

Share

phpStorm 7 / XDebug environment configuration

The phpStorm 7 IDE is an excellent tool to write your PHP code in. This post describes the step to take to debug your PHP website with phpStorm 7 and XDebug. This post only describes the installation of XDebug and the use of phpStorm 7. You can also find posts about installing Apache and Mysql on this blog.

Configure phpStorm 7 / XDebug environmentFirst of all download a copy of phpStorm 7 and unpack it to a directory of your choice. PhpStorm 7 depends on java so you should also install java onto your system.

Next thing to do is configure XDebug and Apache to work together. First step is to determine the active php.ini . This can easily be done by creating a PHP script with a call to phpinfo();.

Copy the contents of this page (not the page source) and paste it into the textbox found at http://xdebug.org/wizard.php.

Download the XDebug archive at http://xdebug.org/files/xdebug-2.2.3.tgz. Unzip the archive with

tar -xzvf xdebug-2.2.3.tgz

Goto the directory created by the unzip command:

cd to xdebug-2.2.3

Run the phpize command (prepare PHP extension for compiling); the output should be something like:

$>phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525

When you see something like the text above you know you’re good to go.

Execute ./configure to configure the make script

./configure

When configure runs ok execute the make command:

make

After the make command has finished you have a compiled xdebug.so  module in the modules directory.

Copy the xdebug.so  module to /usr/lib/php5/[Zend Extension value from phpinfo(); call]

Now in the output of the phpinfo()  call search for the value Loaded Configuration File. The second column shows the active php.ini . Edit this file and add the lines below (uncomment any [zend] section if it exists):

[XDebug]
zend_extension="/usr/lib/php5/20100525/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/tmp>"

Change the location of zend_extension as needed!

Restart your apache server:
sudo service apache2 restart

Rerun your phpinfo() script and paste it again into the textbox at http://xdebug.org/wizard.php

Check for a line that says something like “You’re already running the latest Xdebug version “, If it is there you have configured PHP to use the XDebug extension.

Now it is time to startup phpStorm 7 and create our first PHP project. Start your copy of phpStorm 7.

Select “Create New Project” (choose “Empty project for now; be sure that the location is in or below the DocumentRoot of your apache site) and follow the steps below:

  1. Add a new file index.php  and add a call tophpinfo()  to it (right click the project title on the left; select New -> PHP File).
  2. Select Run -> Edit configurations
  3. Select the + sign at the top left and select “Php Web Application”
  4. Name it for example “WebAppDebugConfig”
  5. Press the “…” after “Server” to add a server.
  6. Press the + sign at the top left.
  7. Change the servername to the name of your development host (both Name and Host) and press Ok
  8. Select the Server Name in the “Run/Debug Configurations” to make the error go away
  9. Fill out your start URL; /index.php 
  10. Press Ok

 

Share