Subscribe via RSS

Netbeans – fast and with correct font sizes in Ubuntu

The first thing that I suggest to every fresh Ubuntu‘s user is to install the ubuntu-restricted-extras package.

sudo apt-get install ubuntu-restricted-extras

It brings to you all the codecs and plugins that you need to a great user experience. The Java Virtual Machine that comes for default is the open source OpenJDK. There is nothing wrong with it.

But, as a developer, if you want to use NetBeans like I do, it’s better to install the Sun Java package. This Java Virtual Machine is developed by Sun, that develops NetBeans also. So, NetBeans become faster on it and free of a problem with font sizes too.

To install sun-java6-jre and make it the default Java Virtual Machine of you system do as follows:

sudo add-apt-repository "deb http://archive.canonical.com/ natty partner"
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin
sudo update-alternatives --config java

Thanks to Alexandre Gaigalas for the tip and Sanjeev Mishra for the how to.

Ubuntu 11.04 Unity keyboard shortcuts

The last version of Ubuntu Linux, 11.04, has changed its defaults window manager from Gnome to Unit. Personally, I like Unit.
It brings the launcher to the screen’s left side, taking advantage of widescreen monitors. The widescreen brings us widths even more wider while maintains the height size.

Another Unit’s advantage is the variety of keyboard shortcuts. Working on Linux Desktop become faster than ever! Mostly of the shortcuts use the Super Key. For those that don’t know, it is the Windows’ logo key, between Ctrl and Alt. I solved this on the last FISL (International Free Software Forum) ;)

On http://askubuntu.com/questions/28086/unity-keyboard-mouse-shortcuts you have a list of those shortcuts and some wallpapers with them too.

You can try Ubuntu from a CD or USB stick. No install is needed. Try it if you didn’t!

CentOS, PHP 5.3 and the strtotime() error

If you were expecting that your CentOS server PHP version upgrades to 5.3 with an yum update, forget it. It has a separated package called php53. To upgrade, you need to deinstall your current php with:

# yum remove php php-*

And then install the new packages:

# yum install php53u-pear php53u php53u-cli php53u-common php53u-devel php53u-gd php53u-mbstring php53u-mcrypt php53u-mysql php53u-pdo php53u-soap php53u-xml php53u-xmlrpc php53u-bcmath php53u-pecl-apc php53u-pecl-memcache php53u-snmp

Thanks to How2CentOS.

But, if after doing that, you start receiving an PHP error like “warning: strtotime(): It is not safe to rely on the system’s timezone settings” (that happened to me) you only need to uncomment and change the value of the date.timezone at /etc/php.ini file:

; http://php.net/date.timezone
date.timezone = America/New_York

Thanks to Guillermo Garron.

PHP and proxy visits

Sometimes is important for you to know if your website visitor is accessing trough a proxy. One of my projects is an url shortner that gives analytics and, definitely, that is important.
When you realize that your visitor is using a proxy to hide himself and cheat the statistics, you can stop him from accessing your url or just ignore his visit on analysis… The last one is what I prefer.

Bruno Bertolini sent me a post called Block Tough Proxies and it helps me discovering who came from a proxy like hidemyass.com, in a very simple way:

<?php if(@fsockopen($_SERVER['REMOTE_ADDR'], 80, $errstr, $errno, 1))
die("Proxy access not allowed"); ?>

In the code above, the visitor can not see the site. You can change this behavior with a different logic after the if statement.

The post shows how to block with .htaccess too, but PHP is more effective in this case.

Design the interface before you start programming

This article’s title is part of the Getting Real book’s 9th chapter. It’s an unusual behavior for almost all developers, but it is true.

Start from the core of the page and build outward.

Did you realize that we are used to do the opposite? When we think on page appearance’s elements and leave the content part for the last, it has to fit only the space left. The important thing would not have enough space! The content is more important than the navigation/tabs, footer, colors, sidebar, logo, etc.

Design for regular, blank, and error states

Ok, you already have done the regular state of your application. But when your user open it for the first time. What is his first impression? If it is a literally blank screen, he would not understand anything and leave without give you another chance. Think on some tutorial or screenshots, but do not leave it blank.
And when some error occurs? You should not leave your user alone when he needs you more than ever. Think about it.

Draw the interface with your client or user before you start programming is the better requirements analysis practice. You will discover as soon as possible what your user really expected from your application.

How to choose your application name

Like the Getting Real book says, give your app a name that’s easy to remember:

A big mistake a lot of people make is thinking their app’s name needs to be ultradescriptive. Don’t worry about picking a name that vividly describes your tool’s purpose; That usually just leads to a generic, forgettable name. Basecamp is a better name than something like Project Management Center or ProjectExpress. Writeboard is better than CollaborEdit.

Also, don’t focus group or committee-ize the naming process too much. Pick a name that’s short, catchy, and memorable and then run with it.

And don’t sweat it if you can’t get the exact domain name you want. You can always be creative and get close with a couple of extra letters (e.g. backpackit.com or campfirenow.com).

As usual, they are right!

But I have only one reflection to do: if your application depends on search engine results to achieve success it’s important to have a domain name that countains your keywords. This is one of the good practices on SEO (Search Engine Optimization).

Good luck!