Installing Zend Debugger on linux (ubuntu server)

January 4th, 2010

The documentation of Aptana 2.0 is poor at the moment, i did not find any docs on the new PDT PHP extension. Maybe someone has the same troubles getting php debugging to work – here is how i got it finally running:

I use the following system setup for local php development, testing and debugging:

OS:
Windows 7 (64-bit)

IDE:
Aptana Studio 2.0.2 with pdt extension

Server:
LAMP (ubuntu server 9, 32-bit) in a virtual machine (VMware server 2), PHP 5.2.10

To get a working debug configuration for php, the following steps are necessary:

  • install the aptana PHP Debugger Binaries (PDT) via the plugin manager (my studio start page – plugins – featured plugins)
  • install Zend Debugger on the server (i followed the tutorial found here) – make sure, that the IP of your development machine is added to the allowed hosts section of the zend debugger.
  • add a new php server configuration in Aptana Studio
    Preferences – PHP- PHP Servers: simply add a new entry by giving a name and the http – address (e.g. http://ubuntulocal/)
  • add a new debug configuration for your project
    click on the arrow next to the “bug” – symbol (debug configurations), setup a new configuration, choose “Zend Debugger” as Server Debugger and your configured server as “PHP Server”. In the “File” section, choose the path to the starting script of your app and check the right http-address in the “URL” section (”Auto Generate” is checked by default, in my case, this would result in a wrong url – just enter the right one manually). Finally make sure that ” Open in Browser” is active in the “Advanced” tab.

After saving the configuration your debug session should start by pressing the “Debug” button – the execution of the script should break at an automatically added breakpoint at the first line (you can change this behaviour in the debug configuration) and Aptana switches to the “Debug” view, where you can proceed with debugging.

admin Programming , , , , ,

Typo3 (4.2.8), utf-8 encoding and caching

August 31st, 2009

Recently, a weird problem occured in my current typo3 – project. The caching was configured properly (out of the box configuration) and all caching tables were written as they should – but with a very confusing behaviour: the whole page was generated completely new by typo3 on each page request, which caused high server load. The error was not caused by an overriden no_cache-value or one of the other usual suspects (USER_INT, config – directives). After spending days trying to find a fix for the problem, i finally found a solution:

The problem was the configuration of the typo3 – installation, which is set to use utf-8 in the database backend and frontend output. All databse tables were correctly set to utf-8 and the rendering of special chars worked liked a charm – but there seemed to be a missmatch in rendering the page content and generating the cache content. Because of this missmatch, the pages were correctly saved in the table page_cache, but the entry was renewed on every page request. To solve this problem, you have to set the value of the [setDBinit] directive as followed when using utf-8 (either in the typo3 install tool or via localconf.php):


[setDBinit]
SET character_set_client = utf8
SET character_set_results = utf8
SET character_set_connection = utf8


Normally, the value SET NAMES = utf8 should do the trick, but that didn’t work for me. After setting this value and clearing up the whole system cache, your pages should be served from the cache.

For a complete tutorial how to configure typo3 to use utf-8 consistently, take a look at
http://www.typo3-media.com/blog/article/utf8-and-typo3-updated.html
(this tutorial still uses the “SET NAMES” directive, be sure to change it….)

admin Programming , , ,

typo3 – enable admin panel in preview mode for non-admin users / groups

June 18th, 2009

Typo3 offers a nice feature to edit content elements of a page directly in the preview mode – but this functionality is only available for admins per default. In my projects, it’s important for all users to have this feature. As so many tasks in typo3, it is not very obvious how to enable it – so here is a (very short) tutorial, how it works to add it for backend-groups.

First step – default template

In the default template (which is typically the site’s root), you have to enable the admin panel, which is done by the following command in the typoscript- setup:

config.admPanel = 1

Second step – enable and configure the panel for the usergroup

Switch to the user admin, select a user, who is a member of the group to which you want to add the feature, select the assigned group and press the “edit” symbol. The configuration dialogue for the user group pops up – now select the “options” tab and enter the following typoscript:

admPanel {
enable.all = 1
enable.edit = 1
module.edit.forceNoPopup = 0
module.edit.forceDisplayFieldIcons = 1
module.edit.displayIcons = 1
module.edit.forceDisplayIcons = 1
enable.cache = 1
enable.preview = 1
enable.publish = 1
enable.tsdebug = 1
enable.info = 1
hide = 0
}

This is just an example setting, please refer to the typoscript reference for a complete list of options. After saving, you can switch to an user who is a member of the group, select a page in preview mode – voila  – now you should see a panel where you can move, edit, hide and delete content elements.
If you do not use groups, you can simply set the above typoscript to a single user – but using groups always makes sense.

I hope this saves some time for someone who runs into a similar issue. Thankyou, Rüdiger!

admin Programming , ,

Zend MVC Framework – forms with dojo / dijit decorators tutorial

May 28th, 2009

I started developing my first application with the Zend Framework using the MVC approach – following the tutorial (http://framework.zend.com/docs/quickstart) is a good entry point, but as soon as you need some “advanced” features, it gets a little tricky.
In my application i will use the integrated Dojo-library, which offers powerful form elements and ajax features – but the integration of Dojo into my applicaion took me a lot of research in the docs – so here is my way to get it work (based on ZF 1.8.1):

Directory structure & Bootstrap

Copy the directory externals/dojo (which comes with the ZF package) to your public directory – in my case, this was /public/js/dojo

Now we need to add an entry to the Bootstrap.php to register the Dojo-ViewHelpers to our application:

protected function _initViewHelpers() {
$this->bootstrap('view');
$view = $this->getResource('view');
$view->addHelperPath(dirname(__FILE__) . '/views/helpers', 'MRV_View_Helper');
$view->addHelperPath('Zend/Dojo/View/Helper', 'Zend_Dojo_View_Helper');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer() ;
$viewRenderer->setView($view) ;
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
}

Register dojo in the layout / view

The dojo – javscript sources must be available in our views – the best way to achieve this is to load them in the main layout – file – in my case layouts/scripts/layout.phtml

<?php
if ($this->dojo()->isEnabled()) {
$this->dojo()->setLocalPath($this->baseUrl().'/js/dojo/dojo/dojo.js')
->addStyleSheetModule('dijit.themes.tundra');
echo $this->dojo();
}
?>

Important: Don’t forget to add the base class name of the dijit theme to your DOM – otherwise, the styles will not be loaded correctly:


<body class=”tundra”>

Use Dijit widgets in your form

To add widgets to our form, the procedure is mainly the same like adding an Zend_Form to the application – the main difference is to derive the class from Zend_Dojo_Form instead of Zend_Form:

class MRV_Form_UserLogin extends Zend_Dojo_Form
{
public function init()
{
$password = $this->addElement('PasswordTextBox', 'password', array(
'filters'    => array('StringTrim'),
'regExp'         => '^[A-Za-z0-9]{3,}$',
'required'   => true,
'label'      => 'Password:',
'invalidMessage' => 'Invalid password; ' .
'must be at least 3 alphanumeric characters',
));
}
}

This example adds a dijit pasword text box with nice javascript validation to our form. Starting your application, you should see the form with the dijit element. For a detailed description of available dijit form decorators, visit the zend framework documentation

admin Programming, Uncategorized , , , ,

dotnetnuke custom module development

April 10th, 2009

Recently, i started working on a project using the ASP.NET based portal framework dotnetnuke. My part is mainly the development of custom modules. Although the framework’s architecture makes it easy to extend the functionality, the available documentation is far from being complete. Finding necessary hints and tipps in discussion boards and blogs, i’ll try to do my part offering useful tipps for developers.

Accessing current portal settings (C#)
if you plan to use elements of the current active skin of the portal in the views of your module, you need an instance of the current portal settings.

PortalSettings settings = (PortalSettings) HttpContext.Current.Items["PortalSettings"];

So if you want acces to your skin path, this is the way you go:

String path = settings.ActiveTab.SkinPath;

Accessing the portal’s active culture
You may need the current active culture (language settings) in your module. Dotnetnuke uses built-in .NET localization, but it’s not so obvious
how to get the current setting – you have to fetch it from the current thread:

CultureInfo culture = Thread.CurrentThread.CurrentUICulture;

e.g. the following will return “en-US” for standard english culture

Thread.CurrentThread.CurrentUICulture.Name

Using API for sending e-mails
DotNetNuke.Services.Mail.Mail.SendMail

A simple example using the default settings configured in the portal backend:
DotNetNuke.Services.Mail.Mail.SendMail(FromAddress, SendToAddress, "", "my subject", "this is the mailbody", "", "", "", "", "", "");

The official documentation for module development can be found here!

admin Programming , , ,

elp.co.at – everything new

March 6th, 2009

I decided to setup a new site based on wordpress – and hopefully, it will be maintained with more effort than the old one. I migrated some of the most interesting articles of my old site (mostly legacy stuff) to this blog – it may be useful to somebody.

elmar

admin Uncategorized

Internet Explorer 6 Death March

March 6th, 2009

The Internet Explorer 6 is a “no-go” for web-programmers (especially the html / css – geeks) – poor implementation of W3C – Standards and horrible javascript support causes heavy troubles on modern web-frontends. But now there is something going on: Finn.no, Norway ’s largest classifieds-site, is displaying a tip on their homepage to all IE6 users, encouraging them to upgrade their browser. Not only so, but they have initiated a campaign, prompting several of the most visited Norwegian sites to follow suit. Dave Auayan started the “Internet Explorer 6 Death March”, which should be supported by every web-professional – maybe one day there will be no necessity to do any “cross-browser-scripting”.

admin Legacy, Web 2.0

Mandrake 9.2 and Apache Open Proxy Bug

March 6th, 2009

the standard apache config of this linux version can cause serious trouble

The problem:
Linux Mandrake 9.2 uses  apache 2.0.47 by default - but take a careful look at your apache config files, because the server is set up by default with an open proxy port – so your box could be “hijacked” by spammers, who use your machine as their own proxy server.

More info about mod_proxy: http://httpd.apache.org/docs-2.0/mod/mod_proxy.html

I became attentive to the hijacking of my system, because the network performance was suddenly very poor, and the http – log of apache showed thousands of lines of “GET” and “CONNECT” requests to foreign domains (mostly porn sites) – this resulted in a massive overload on the server.

Check the open proxy server
To check if your box does really act as an open proxy server, just connect via telnet and try a “GET” request to another adress.

 telnet www.yourserver.com 80
 GET http://www.google.com

If the request returns the source code of www.google.com, your server acts as an open proxy!
Solution:
In Mandrake 9.2, the proxy – configrations can be found in  /etc/httpd/conf.d/30_mod_proxy.conf – please check your settings with the following settings, and your server will lock out the bad guys.

--------------------------------------

LoadModule proxy_module  modules/mod_proxy.so
# LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so

#
# Proxy Server directives. Uncomment the following lines to
# enable the proxy server:
#
ProxyRequests Off
#

   Order deny,allow
   Deny from all
   Allow from 127.0.0.1

#
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
#
ProxyVia Off
# End of proxy directives.
---------------------------------------

If your server has already been hijacked and its adress shows up in spammer lists, the requests will not stop immediatly, this will take a few days (up to two weeks)

In my case, everything worked fine after 4 days.

The problem:
Linux Mandrake 9.2 uses  apache 2.0.47 by default - but take a careful look at your apache config files, because the server is set up by default with an open proxy port – so your box could be “hijacked” by spammers, who use your machine as their own proxy server.

More info about mod_proxy: http://httpd.apache.org/docs-2.0/mod/mod_proxy.html

I became attentive to the hijacking of my system, because the network performance was suddenly very poor, and the http – log of apache showed thousands of lines of “GET” and “CONNECT” requests to foreign domains (mostly porn sites) – this resulted in a massive overload on the server.

Check the open proxy server
To check if your box does really act as an open proxy server, just connect via telnet and try a “GET” request to another adress.

 telnet www.yourserver.com 80
 GET http://www.google.com

If the request returns the source code of www.google.com, your server acts as an open proxy!

Solution:

In Mandrake 9.2, the proxy – configrations can be found in  /etc/httpd/conf.d/30_mod_proxy.conf – please check your settings with the following settings, and your server will lock out the bad guys.

--------------------------------------

LoadModule proxy_module  modules/mod_proxy.so
# LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so

#
# Proxy Server directives. Uncomment the following lines to
# enable the proxy server:
#
ProxyRequests Off
#

   Order deny,allow
   Deny from all
   Allow from 127.0.0.1

#
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
#
ProxyVia Off
# End of proxy directives.
---------------------------------------

If your server has already been hijacked and its adress shows up in spammer lists, the requests will not stop immediatly, this will take a few days (up to two weeks)

In my case, everything worked fine after 4 days.

admin Legacy , ,

Fujitsu Siemens Pocket Loox 720 Wlan Configuration

March 6th, 2009

It was really hard for me to get the built-in WLAN work properly on the Fujitsu Siemens Pocket Loox 720 – in my case, the pre-installed “E2C” application blocked all Windows Mobile Wlan Functions – if anyone has similar problems, here is how solved the problem:

  • The Pocket Loox 720 has a preinstalled Software named “E2C” – this tool should handle all connections on an easy-to-handle interface – the problem is – this software is just a trial version, so you just can setup one wlan / modem / IRDA / bluetooth connection.
  • If you need access to different WLANs (like i do), you must not have a WLAN connection configured in the E2C program, because this will block the Windows Mobile 2003 built-in WLAN functions. I desparately tried to connect to my company WLAN for a few hours until i figured this out.
  • Conclusion:
    If you can’t connect to a WLAN with “Settings” -> “Connections” -> “Network Connections” always check first, if there is a WLAN connection set up in E2C – if so, just delete the setup in E2C and your wireless connection will work fine.

admin Hardware, Legacy , ,

upload large files on IIS 6 (Windows 2003 Server) via ASP

March 6th, 2009

If you use a http – upload script that uses byte – streaming on IIS, there is a problem with large fileuploads.

IIS 6 on Windows 2003 Server prevents the upload of files larger than 200 Kb by default – if you use a http-upload via ASP based on byte-streaming (like “Pure ASPUpload”), you will recieve a 403 error response from the server if you try to upload files larger than 200 Kb.

For IIS6.0 users, the AspMaxRequestEntityAllowed property specifies the maximum number of bytes allowed in the entity body of an ASP request. If a Content-Length header is present and specifies an amount of data greater than the value of AspMaxRequestEntityAllowed, IIS returns a 403 error response.

This property is related in function to MaxRequestEntityAllowed, but is specific to ASP request. Whereas you might set the MaxRequestEntityAllowed property to 1 MB at the general World Wide Web Publishing Service (WWW Service) level, you may choose to set AspMaxRequestEntityAllowed to a lower value, if you know that your specific ASP applications handle a smaller amount of data.
Solution

Open your metabase.XML which is located in c:\Windows\System32\Inetsrv find the line “AspMaxRequestEntityAllowed” and change it to a higher value (default value is set to 204800 – 200 Kb).

Be sure to first stop IIS service, edit metabase.XML, save the changes and restart IIS.

admin Programming ,