Sunday, May 31, 2009

"The directory or file cannot be created (0x52)" error while installing S60 5th Edition SDK


While installing some of the newer SDK from Forum Nokia I'm getting greeted by the following error:



Nice, after looking at that bloated folder it's clearly that my FAT32 partition can't cope with the multitude of files that Nokia chose to dump there.

A quick look at FN reveals that others have the same problem (see here) and a suggestion for a fix, by deleting the resources for languages other than English.

So I went ahead an wrote the following script that does the trick:



import fnmatch
import os
import time

path = 'C:\\S60\\devices\\S60_5th_Edition_SDK_v1.0\\epoc32\\release\\winscw\\udeb\\z\\resource'

while True:

try:
for file in os.listdir(path):
if (fnmatch.fnmatch(file, '*.r0[023456789]') or
fnmatch.fnmatch(file, '*.r[123456789][0123456789]') or
fnmatch.fnmatch(file, '*.r[123456789][0123456789][0123456789]')):
print file
os.remove(path + '\\' + file)

except IOError as (errno, strerror):
print "I/O error({0}): {1}".format(errno, strerror)
except WindowsError as (errno, strerror):
print "Windows error({0}): {1}".format(errno, strerror)
except:
print "Unexpected error:", sys.exc_info()[0]
raise

time.sleep(10)



Update the path variable with your installation path and run this script after you hit the first error and chose retry. When you're done with the install kill the script.

Monday, May 25, 2009

missing WRT widget components when packaging with Aptana Studio

I've been using the Aptana Studio Community Edition and its plugin for creating S60 WRT widgets. It has a few good features that increase productivity, like a decent editor with code formatting, integrated contextual help, packaging and deploying functioning.

One annoying issue I found was that after adding new components to the widget, e.g. new .js, .png files, they are not picked up for packaging, unless you do a project refresh (right-click on the project in the project pane on the left side of the screen and chose "Refresh").

Failing to do this may result in wasting time debugging the unexpected behavior. One such step in debugging could be renaming the .wgz package to .zip and exploring that zip's content to check for the newly added components. If they are missing, surely a refresh is needed.

Friday, May 15, 2009

Unneeded white space in textarea

I noticed an annoying behavior of textarea elements that have white space between the opening and closing tags. That space shows up as the initial value of that element in the browser. 

I've been using an edit control built on top of a textarea for a recent project and I noticed that upon clicking on the control to get focus, the caret cursor would not land in the top let corner of the control, instead it would have a few characters of left padding. 

That's because my Komodo Edit IDE was formatting the code by putting the end tag on a different line and would add sufficient white space for a balanced indentation. That was causing the padding to appear. 

The workaround is to keep the textarea element with a truly empty value like this:
<textarea></textarea>

Wednesday, May 13, 2009

How to install GlassFish on CentOS and other Redhat derivatives

First you need to have Java installed, I prefer OpenJDK, which is available from EPEL , a community-run project which makes Fedora packages available to users of Red Hat Enterprise Linux 5, CentOS 5, and other RHEL 5 derivatives. First install the package that enables the EPEL repository:

su -c "rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-2.noarch.rpm"


Then fetch the packages needed:

su -c "yum install java-1.6.0-openjdk"

su -c "yum install java-1.6.0-openjdk-devel"


Set the JAVA_HOME environment variable to point to the location of the JDK installation. To find that location you can do a which java and repeated  ls -l to follow the links to the concrete location.

Do the installation, e.g.:

java -Xmx256m -jar glassfish-installer-v2.1-b60e-linux.jar


Add the as-install/bin/ directory to the PATH environment variable.

To connect to the admin console, open a web browser to on http://hostname:4848

For login, the default admin user name is admin and the password is adminadmin






  

Tuesday, May 12, 2009

How to enable access logging in GlassFish

For debugging, monitoring and audit purposes it's sometimes useful to analyze access logs. 

By default Sun's GlassFish server has such logging disabled. It can be enabled by editing the domain.xml file (e.g. domains/domain1/config/domain.xml) and changing the accessLoggingEnabled attribute of the http-service element to true.

Following the restart of GlassFish the logs are available under the logs/access folder, (e.g. domains/domain1/logs/access/).

Driving Recorder at 5000 downloads

Following the posting of my Driving Recorder application on GetJar at the beginning of the year I just went through the milestone of passing the 5000th download. 

So far the feedback from these people trying the app has been mute. The popularity seem to be holding steady, but the lack of feedback, and purchases :), makes me think that either their reporting system is broken or those numbers are mostly the result of site duplication robots.

How to install VMWare tools on CentOS 5.0

VMWare tools are needed for a smooth integration between the guest and host OS. I'm currently using VMWare Fusion for Mac, and I needed CentOS for a project. Here are the steps I went through:

In CentOS do yum install gcc kernel-devel

Compare the version of OS, reported by the uname -r with that of kernel headers, reported by rpm -q kernel-devel. If there's a mismatch, update the headers with yum -y upgrade kernel kernel-devel and reboot.

In WMware Fusion go to the Virtual Machine menu -> Install VMware Tools. 

In CentOS do a mount /dev/cdrom /mnt. Now you should have a gzipped tar with the tools in /mnt. Extract them into the /tmp folder with tar -C /tmp -zxvf /mnt/VMwareTools*.tar.gz

cd /tmp/vmware-tools-distrib
./vmware-install.pl and follow the prompts.



How to hide the .php extension in your URLs

Sometime you could implement web components that expose public REST-ful interfaces implemented in PHP. In those cases it may be useful to expose end points that are technology-agnostic. 

So, for example, instead of http://example.com/handler.php?param1=val1&param2=val2 you'd have http://example.com/handler?param1=val1&param2=val. Thus, you could later on decide to switch the underlying technology to something like servlets and reuse the old format for the URLs.

An easy way to accomplish this is using Apache's ability to do URL rewriting. Simply edit the .htaccess file in the root folder of your web directory and place the following directives:

RewriteEngine on 
RewriteRule handler handler.php

How to install MySQL on CentOS and other RedHat derivatives

One simple solution is to rely on yum and do:

sudo yum install mysql-server.i386


To ensure that the daemon starts automatically at boot-up you can do:

sudo chkconfig mysqld on

Where is httpd.conf located on Ubuntu ?

/etc/apache2