Saturday, October 08, 2011

Installing Tomcat 6 on Redhat Linux Enterprise or CentOS

http://wiki.openbluedragon.org/wiki/index.php/Apache_Tomcat_on_CentOS/RedHat

From: 

Install Tomcat

With CentOS/RedHat you could install Tomcat from the YUM repositories, but they only hold the older 5.5.x version. Of course, if you want to have Version 5.5.x installed then you only have to issue a;
yum install tomcat*
But I do recommend that you install Tomcat 6.0.18 (the current version of this writing), since it features better memory handling and some other improvements. The official Tomcat page is your friend in this regard http://tomcat.apache.org/. Luckily, installing Tomcat is straight forward.
  1. Download Tomcat 6.0.18
    1. Browse to http://tomcat.apache.org/download-60.cgi and download the Binary Distribution or click on the direct link here http://apache.mirror.testserver.li/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz. Wget is your friend.
  2. I recommend to install Tomcat in the "/opt" directory. Thus copy the downloaded file into "/opt".
  3. Extract it with
tar xzvf apache-tomcat-6.0.18.tar.gz
  1. For better handling I always create a symbolic link for "tomcat" with
ln -s /opt/apache-tomcat-6.0.18 tomcat
  1. Test Tomcat
    1. Start Tomcat with:
/opt/tomcat/bin/startup.sh
    1. Hit http://localhost:8080. If all is fine you should see the Tomcat homepage.
All should be fine, right? Ok, move on.

Deploy (Install) OpenBD

  1. go into the tomcat folder
    1. cd /opt/tomcat/
  2. download the openbd.war file (be sure to check the OpenBD download site for the latest war file link)
    1. wget http://openbd.viviotech.net/downloader.cfm/id/64/file/openbd.war
  3. once the file has downloaded move it to the tomcat webapps folder where it will automatically deploy
    1. mv /opt/tomcat/openbd.war /opt/tomcat/webapps
  4. once the war file is in webapps Tomcat will pick it up and create an openbd folder
  5. go to the administrator
    1. http://localhost:8080/openbd/bluedragon/administrator
      1. the default bluedragon administrator password is admin

Configure Tomcat to run on startup

Now, that Tomcat and OpenDB runs nicely you might want to have it automatically started when you reboot your system. For that we can use the following script and "chkconfig" command line.
  1. Create a "tomcat" file in "/etc/init.d"
vi /etc/init.d/tomcat
  1. Copy the below startup script
#!/bin/bash
#
# Init file for SixSigns Tomcat server
#
# chkconfig: 2345 55 25
# description: SixSigns Tomcat server
#

# Source function library.
. /etc/init.d/functions

RUN_AS_USER=tomcat # Adjust run user here
CATALINA_HOME=/opt/tomcat

start() {
        echo "Starting Razuna Tomcat: "
        if [ "x$USER" != "x$RUN_AS_USER" ]; then
          su - $RUN_AS_USER -c "$CATALINA_HOME/bin/startup.sh"
        else
          $CATALINA_HOME/bin/startup.sh
        fi
        echo "done."
}
stop() {
        echo "Shutting down Razuna Tomcat: "
        if [ "x$USER" != "x$RUN_AS_USER" ]; then
          su - $RUN_AS_USER -c "$CATALINA_HOME/bin/shutdown.sh"
        else
          $CATALINA_HOME/bin/shutdown.sh
        fi
        echo "done."
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        sleep 10
        #echo "Hard killing any remaining threads.."
        #kill -9 `cat $CATALINA_HOME/work/catalina.pid`
        start
        ;;
  *)
        echo "Usage: $0 {start|stop|restart}"
esac

exit 0
  1. Save the file (case you forgot "esc + x) :-)
  2. Add the tomcat startup script to the chkconfig with:
chkconfig --add tomcat
  1. Then activate it for your run level. Since I am not running any X Server on my server I only want to run it on level 345. Do it with:
chkconfig --level 345 tomcat on
  1. You can check if Tomcat will startup on reboot with listing the startup scripts with:
chkconfig --list
You should see a;
tomcat         	0:off	1:off	2:on	3:on	4:on	5:on	6:off
  1. If you have done all well, you should now be able to bounce Tomcat with this script as well. Try it with:
/etc/init.d/tomcat restart

Thursday, October 06, 2011

Speeding up mysql restoration of data

Mysql restoration too slow? Try the following steps:

1. Open the file my.ini inside the MySQL installation directory and do the following:

(a) Search for innodb_buffer_pool_size and set it to approx 20% of your RAM. I set it to 500M.
innodb_buffer_pool_size=500M

(b) Search for innodb_flush_log_at_trx_commit and change it from 1 to 2:
innodb_flush_log_at_trx_commit=2

(c) Search for key_buffer_size and set it to approx 20% of your physical RAM.
key_buffer_size=1200M

(d) In your data.sql file you are trying to restore, if it is an innodb tables, try to modify it and add the lines:
SET FOREIGN_KEY_CHECKS=0 // At the beginning

...
SET FOREIGN_KEY_CHECKS=1 // At the end of the file

Now restart MySQL service.

Start restoring data. It will be approximately a magnitude of 50 times faster.

The Robot Two Leg Problem in Guice DI


Sunday, October 02, 2011

Maven, configuring an http proxy


Go to your user directory (ie. /home/babbas or /c/Users/babbas) then goto ".m2" directory and create a file named settings.xml. Inside that file copy the contents below:

<?xml version="1.0"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>iproxy.isu.net.sa</host>
<port>8080</port>
<username/>
<password/>
<nonProxyHosts/>
<id/>
</proxy>
</proxies>
</settings>


Installing GIT on Linux Redhat or CentOS 5

First is first:

wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh epel-release-5-4.noarch.rpm
yum install git

Next steps, configure git configuraiton:

git config --global user.name "Basil Abbas"
git config --global user.email "basil@isu.net.sa"
git config --global color.ui auto

Creating a bare repository on a remote server:

mkdir project_directory
cd project_directory
git init --bare

Cloning the bare remote repository on a development machine:

cd /home/babbas
git clone ssh://hostname/path/to/project_directory






Saturday, October 01, 2011

VIM ignoring case search

Just type:
:set ignorecase



and to return back to normal:
:set noignorecase


If you would like to search case insensitive one time only without changing the mode in vim, for example lets search for the word "earth" case insensitively:

/\cearth

The \c character tells vim that the search should be case insensitive.

Friday, September 30, 2011

Web Session Management White Paper

PDF Link:
http://www.isecpartners.com/files/web-session-management.pdf


Developing an application with secure session management requires developers to understand a few crucial subtleties of cookies — their attributes, their values, and how to keep them confidential — and to understand how real-world attackers are abusing weak session management in real applications today.

Thursday, September 29, 2011

Making VIM on windows behave like linux

The following:

1. Open the file _vimrc which you will find inside c:\Program files\vim

2. Find the line that says:

behave mswin

3. Change it to

behave xterm

4. Save and exit.

This will now allow you to select text by typing the 'vi' then using the arrows to select text.

Deleting all lines that are empty or contain spaces in vim

To delete all lines that are empty in vim:

:g/^$/d

To delete all empty lines or empty lines that contain spaces:

:g/^\s*$/d

Note that \s represents the space character in the regular expression. Or simply, you can also represent the space character with [ ]:

:g/^[ ]*$/d

Pasting code into VIM without the indentation problem

Frequently, when pasting code into vim, i get lots of indentation spaces that really frustrate me.
I discovered that this vim issue can easily be handled by typing in the command mode in vim:

:set paste

Then going to insert mode and pasting the source code.

Disable Autoindent in VIM

To disable autoindent in vim, you can do the following:


:set noautoindent | set nosmartindent | set nocindent

Or place the folowing lines in your .vimrc (linux) or _vimrc (windows):

set noautoindent
set nosmartindent
set nocindent


Sunday, September 25, 2011

Git Cheat Sheets

Goodbye Adobe Photoshop, Goodbye Paint.NET, Good Bye Greedy Pricing Schemes

I lately found this wonderful image processing application named PhotoPlus Starter Edition and I'm now no longer using either Adobe Photoshop nor Paint.NET.

From serif.com:
http://www.serif.com/FreeDownloads/

The best "git log" command to use

This is the best git log command to use:
git log --decorate --graph --oneline

You can alias this command as follows:
git config --global alias.lol "log --graph --decorate --oneline"

Now you can use it as follows:
git lol

Making two branches identical after a git merge

I had two branches, heavy_refactoring and master branch in git.
I have already merged heavy_refactoring into master, but I had some trouble since master looks different than heavy_refactoring at the end due to some changes that took place on master before the merge. These changes I dont want.

What I wanted is that the 'master' branch look exactly like heavy_refactoring.

So here are the steps:

1. Go to the master branch first.

git checkout master

2. First you do a git diff between the two branches:

git diff --summary master heavy_refactoring

This will shows us the differences that should take place for master to become heavy_refactoring. It is very important that you type 'master' before 'heavy_refactoring' to advise the git diffing to give the differences so that I can get from master to heavy_refactoring.

The --summary is a switch to tell the diff not to show the contents inside each file.

3. After running the command, a list of deleted, modified and created files show up.

4. If the diff tells you that I file is "deleted", this means it should be removed from the master branch using:

git rm file_to_remove

5. If the diff tells you that I file is "created", this means you have to copy it from the heavy_refactoring branch to the master branch using:

# Copying a file from another branch to the current branch
git checkout heavy_refactoring src/main/java/com/basil/TargetFile.java

6. If the diff tells you that I file got "modified", this means you also have to copy it from heavy_refactoring branch to the master branch. Notice that my objective here is to make master exactly like heavy_refactoring.

git checkout heavy_refactoring srcmain/java/com/basil/TargetFile2.java

At the end, I can run the git diff again and it will show me an empty result which will indicate that the two branches are exact:

git diff --summary master heavy_refactoring


Monday, September 19, 2011

Enabling SSL in Apache Tomcat 6 The Easy Way

NOTE: This article does not use the APR tomcat module but rather the default Tomcat 6 deployment.

To enable SSL for Apache Tomcat 6, perform the following:

1. Create an SSL certificate using the java supplied keytool:

$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA

NOTE: If you get the error:
keytool error: java.lang.Exception: Key pair not generated, alias <tomcat> already exists
Then most probably you have a key file already in your user directory. If you are root, this will be /root/.keystore

2. You will be requested for data that will show on your user browser's certificate, fill them all in.
Notice that the bold font is my input. No problem if you stick to the password "changeit" as it is the default password used by tomcat.

Enter keystore password: changeit
Re-enter new password: changeit
What is your first and last name: Jeremy Atkins
What is your organizational unit: OU
What is the name of your organization: NOYO
What is the name of your city or your locality: MyCity
What is the name of your state or province: Saudi Arabia
What is the two-letter country code for this unit:  uk
Is the entered data correct: yes

Enter key password for <tomcat>
        (RETURN if same as keystore password): PRESS RETURN KEY

It is important to have the keystore password and the key password the same. This is done by pressing the RETURN KEY in the last step. This is necessary since Tomcat doesn't support having different passwords in the keystore and key.

3. When you're done with the previous step, a keystore file gets created in the user directory named keystore. Since I'm the root user, I will find it in /root/.keystore.
Check that the file /root/.keystore got created.

4. Next, open the tomcat server.xml for editing:
vi ${tomcat_installation_dir}/conf/server.xml

And uncomment the following section by removing the <!-- and the --> surrounding them from top and bottom:

   <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS"
               />

5. Change the port number from 8443 to 443 which is the default SSL port known to all browsers.
Switch to 8443 while in development if needed.

   <Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS"
               />


6. Now add the following line in between to tell tomcat where to locate the keystore and specify the password you specified:

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
   maxThreads="150" scheme="https" secure="true"
   clientAuth="false" sslProtocol="TLS"
   keystoreFile="${user.home}/.keystore" keystorePass="changeit"
               />

Tomcat will automatically replace ${user.home} with the path of the home directory for the user tomcat is running under. Which in my case is "/root"

7. Restart apache tomcat using:
<tomcat_installation_dir>/bin/catalina.sh stop
<tomcat_installation_dir>/bin/catalina.sh start


Disabling WebDAV DELETE, PUT, OPTIONS in Apache Tomcat 6

It really took me more than two hours searching over the internet just to understand how to do this simple configuration of disabled the WebDAV methods in apache tomcat 6 for all applications.

Here is how to do it:

In your apache tomcat 6 installation, simply open the file <installation_directory>/conf/web.xml for editing. Note that this web.xml file acts as a global file for all web applications and is processed before the web.xml's web application file.

At the end of the global web.xml file and just before the closing tag place the following text:

<security-constraint>
<web-resource-collection>
<web-resource-name>restricted methods</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
</web-resource-collection>
<auth-constraint />
</security-constraint>

The above security-constraint simply denies the above WebDAV methods to be processed by tomcat and returns a forbidden message.

The <auth-constraint /> simply means: "For any user, deny access to PUT, DELETE, OPTIONS, and TRACE methods".

After that, restart apache tomcat 6 using:

<installation_directory>/bin/catalina.sh stop
<installation_directory>/bin/catalina.sh start

To be able to verify that these methods are now forbidden, I used some javascript jquery code:
1. Open firefox with the firebug plugin installed
2. Open a webapplication that has jquery javascript file included within it.
3. Open firebug and select the "Console" tab from firebug
4. Write the following javascript code:

$.ajax({
  type: 'DELETE',
  url: "http://212.138.70.94",
  data: {},
  error: function() {alert('ERROR');},
  success: function() {alert('SUCCESS');},
});

5. Click the Run button.
6. You should see an alert dialog with the message ERROR and a response in firebug with the following message:
"NetworkError: 403 Forbidden - http://212.138.70.94/"

7. Repeat the above for the OPTIONS, TRACE and PUT methods.

I'm sure there's a simpler way to verify it other than javascript. But I don't know how.

Monday, September 12, 2011

Creativity is Not Design

From: http://jessewilson.net/notes/creativity-is-not-design
Too often I notice designers and non-designers alike equating creativity with design. I find this assumption disturbing because it is one of the many fallacies that allow unskilled but creative pretenders to consider themselves capable design professionals when they’re nothing of the sort… Creativity is bound by no laws, rules, or strictures… Design, on the other hand, is based entirely on math, psychology, human perception, and a host of rigid rules and laws that can be broken by only a highly skilled few…

Automatic Java Class Diagram Generation Using ObjectAid

I was looking for a tool that would allow me to view my classes graphically, until I bumped into this question from stackoverflow.com:

http://stackoverflow.com/questions/1120032/what-is-your-favorite-automatic-class-diagram-generator-for-eclipse

And after trying several tools, I think ObjectAid beats'em all.

Object Aid Website:
http://www.objectaid.com/

Wednesday, July 13, 2011

A Wonderful Tool Called Briss, Crop your PDF margins for Kindle Reading

Wonderful tool that will crop the white spaces in your PDFs to make them clearly readable on your Kindle 3.
http://sourceforge.net/projects/briss/
Its freeware.

Important Information Concerning SATA 3 Support on Laptops / Notebooks

Read this question:
http://superuser.com/questions/234754/revision-3-sata-6gb-s-capable-laptops-do-they-exist

Then this link:
http://www.intel.com/products/notebook/chipsets/ec-qm67/ec-qm67-overview.htm

Then this link:
http://www.intel.com/Assets/PDF/datasheet/324645.pdf

When purchasing a laptop, check for a 6 series intel chipset.
They are supported on laptops with the QM67, QS67, HM65, UM67, and HM67 chipset.

Tuesday, May 03, 2011

Setting a default program to open files with unknown extensions or no extension on Windows 7

I always get frustrated having to select a program to open a file when most of the time this program is notepad.

I searched the internet for a way to define a default program to open files for all other files that have extensions not defined on windows. Luckily, I found this article:
http://www.fortypoundhead.com/showcontent.asp?artid=2738

To modify the registry you have to run regedit.exe and modify or add the following:

[HKEY_CLASSES_ROOT\*\shell]

[HKEY_CLASSES_ROOT\*\shell\open]
@="Open With Notepad"

[HKEY_CLASSES_ROOT\*\shell\open\command]
@="notepad.exe %1"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.]
"Application"="Notepad"

Note the following, if the key does not exist, you have to create it.
Example, create the key "open" and created under it the key "command"
Also @= means the default value for the key
Application=Notepad means you have to create a string value containing Application and value Notepad
Also, the last key make sure to notice the ".", its not "FileExts" but rather "FileExts\.", a subkey inside FileExts labeled dot.

Or simply, the above could be saved into a *.reg file and executed.

After that you will get in the context menu the option to open with Notepad for any unknown file.

Monday, February 14, 2011

The Rise Of Mashups

As much as I hate the over-over-over-engineered java Portlet specification JSR-168 and JSR-268, as much as I  felt safe with the Mashup concept. Though in its early stages, I believe mashups will eventually replace Portals and Portlets forever.

To follow up on Java mashup news, keep a close eye on the following:
http://www.jackbe.com/enterprise-mashup/mashups-and-java/

Tuesday, February 01, 2011

An excellent article explaining custom tags in JSP2

This is an excellent article explaining custom tags in JSP2:
http://www.vsj.co.uk/java/display.asp?id=408

The custom tag development has been simplified and the complicated java API is no longer needed to develop a custom tag. A *.tag file is created instead.

JSP custom tags are an advantage in the JSP language that does not exist in other web technologies I'm aware of (ie. PHP).

Saturday, January 01, 2011

Ten Ideas for Making Sys Admins Life Easier

http://queue.acm.org/detail.cfm?id=1921361

A message from administrators to application vendors:
1. DO have a "silent install" option.
2. DON'T make the administrative interface a GUI.
3. DO create an API so that the system can be remotely administered.
4. DO have a configuration file that is an ASCII file, not a binary blob.
5. DO include a clearly defined method to restore all user data, a single user's data, and individual items
6. DO instrument the system so that we can monitor more than just, "Is it up or down?"
7. DO tell us about security issues.
8. DO use the built-in system logging mechanism 
9. DON'T scribble all over the disk.
10. DO publish documentation electronically on your Web site.

Three Common Application Problems Developers Should Watch Out For


In summary:
- ORMs can really be dangerous on your application if you don't understand whats happening internally.
- Very few developers (a fringe of a fringe) really understand threading and can write multithreaded applications.
- Memory leaks take place in java by not closing and freeing resources and could become a real performance problem if not tracked correctly.

Finding Free Use Fonts

Don't look any further: http://www.fontsquirrel.com

Wonderful site with many free for use fonts.

Wednesday, December 01, 2010

Denying A Program To Connect To A Network

Imagine that one day you download a free password manager on your windows machine, and use it to store all your passwords for online banking accounts, emails, etc.

Knowing that this same executable is capable of connecting to the internet and doing different things like connecting to a server and checking for updates...

Imagine that one day the guy developing the tool inserted some malicious code to forward password information in your password manager.

Paranoid thinking? But can we blame paranoids, I mean the world is full of negative surprises that only paranoids were able to predict.

Better than blaming, is protecting yourself without losing the privilege of the software you want to use. On windows 7, here's how:

1. Go to the Control Panel.
2. Click on the Windows Firewall icon.
3. Make sure that your windows firewall is turned on by clicking on Turn Windows Firewall on or off
4. When this is done, go back to the Windows Firewall and click on "Advanced Settings".
5. Click on "Outbound Rules"
6. On the right, click on "New Rule..."
7. Make sure Program is selected in the radio buttons and click Next.
8. Enter the path of the program exe then click Next.
9. Make sure "Should be Blocked" is selected then click Next.
10. Enter a display name for this rule.
11. Click Finish.
12. Open the desktop tool you want to protect against and select "Check for updates.." in your tool if available. The tool should crash or tell you that it is unable to connect to the internet. No connection available.

Capiche. You're done.

Monday, November 29, 2010

The Google Chrome Dictionary Plugin

I always have trouble finding and installing the google chrome dictionary plugin, therefore, I'm posting this link as a reminder:

https://chrome.google.com/extensions/detail/mgijmajocgfcbeboacabfgobmjgjcoja?hl=en-US

The Exercise Every Developer Needs

Exercises for tendonitis and carpal tunnel:
http://www.youtube.com/watch?v=hUyMNyrOHJQ

Before its too late.

Tuesday, November 09, 2010

wxWidgets versus Qt?

Both are good frameworks for writing a C++ desktop application. By the way, Qt is used in Google Earth and the Skype application.

For a wonderful comparison between wxWidgets and Qt, read the following:


My final conclusion, Qt wins.

Wednesday, November 03, 2010

Sticky Notes Utility and More...

I've been used to using ATNotes, which is a sticky notes utility that was very light weight but had some frustrations. I'm telling you, writing your todo's on a sticky note on screen is an excellent way to keep your mind fresh and at the same time keeping all your TODOs as a reminder.

However, some frustrations with ATNotes bothered me, so I've started looking for alternatives. Usually I do this be searching on google for "ATNotes alternativeto" (without double quotes), which displays the alternetiveto.net site.

Luckily, I found a wonderful alternative which is named Stickies. I've installed it and found it great, simple, lightweight and doesn't interfere with your system or registry.

If you still need more alternatives you can check the list on http://alternativeto.net/software/atnotes/.

More interestingly, I found that the company that made this utility also made some interesting utilities which I name a few here:

1. Stickies (The already mentioned sticky note utility).
2. ZBar (multiple task bars for multiple screens)
3. Bart (A wonderful simple backup utility).
4. Caffeine ( A utility that simulates a key press every one minute to avoid your PC from stand by or screen saving).

Sunday, October 03, 2010

Where to find good images for your website?

A good friend of mine named Maximos, originally Rami the 17th gave me this link which is excellente:


Don't look any further.

Tuesday, September 28, 2010

Wednesday, August 25, 2010

Catching up with Nuxeo: Switching from Python to Java

I recently read this article on infoq.com. Summarizing the findings in this post, here's the story.

Nuxeo - an ERP company - took the decision on 2006 to port their core products from Python to Java. Infoq recently got hold of their CEO to discuss how the conversion went and also discussed the merits of static very dynamic typed languages since Nuxeo now tried both.

Summary of reasons to convert to Java
1. The availability of components and frameworks in Java like Hibernate, Lucene and Eclipse makes it much easier to build applications. Although they admint Python is great, it wasn't suitable for the platform they were envisioning to build.
2. The range and depth of the Java libraries was one of the main drivers for switching to Java. The Nuxeo product is using 100 libraries in total, including jBPM, OpenSocial, OAuth for widget inclusion, Apache Shindig, Apache Chemistry for CMIS, JXA-RS, JPA, JDBC, JTA, JSF, Seam and RichFaces.
3. Build system facilities based on Maven, Hudson, JUnit. Supporting Jetty, Tomcat, JBoss and bare OSGi.
4. Market Reasons. The market for java applications is huge. All companies know Java. Most already have java applications running. A lot of companies require Java for their IT. All system integrators have extensive java knowledge.
5. Community Reasons. The community is again, huge. The Java Apache community is tremendous. There are big annual conventions around Java (JavaOne, ApacheCon, Devoxx, Jazoon, etc.) and hundreds of small ones.
6. Specification Reasons. Many technologies in the Java world are based on published specifications that have many implementations and reference implementations promoting clean specs.
7. High availability of tooling for Java. The VM itself, debugging tools, IDEs, monitoring, performance benches, etc.

The results of the new Nuxea java based platform
1. Performance scales of about 10 to 100 times more.
2. In terms of features, its around 4 times the scope of what had been.
3. In terms of developer compatibility and ease-of-use, its about the same, but with alot more tooling experience.
4. Doubling or even tripling the capabilities of the old platform.

How customers reacted?
1. 80% were okay with the change.
2. For those organizations that didn't want to move, the community stepped forward to ensure their ongoing support (the open source advantage).

Merits of Python versus Java (Merits of Dynamic versus Static typing)
Merits of Python and Java is a subset of the merits of Dynamic versus Statically typed languages. Lets see what both sides have to say.

Advocates of Dynamyic types languages argue that they are faster to code in, since the languages are inherently more expressive.

Advocates of Static typed languages argue that time saved in development using Dynamic languages is time lost in testing. This is because the lack of type information makes testing harder. In addition, dynamic languages are generally slower than statically typed languages and thus tend to be more expensive to scale.

Nuxeo Opinion on Static and Dynamic Languages
In Nuxeo's case, they tried both dynamic and static languages to write their large scale product that consists of thousands of classes and hundreds of thousands of lines of code. Nuxeo's CEO says: Without a doubt, statically typed languages are better for such applications and yield many benefits giving you:

1. An IDE with proper autocompletion
2. An IDE that knows all the uses of a given method or field in all of your classes thus vastly improving search and refactoring.
3. Many compile time checks.
4. Tools that find patterns and bugs in your code.
5. Tools that extract documentation based on the actual types in your code. This is because a statically typed language will explicitly indicate the type of an argument passed to a function. This is rarely a hindrance and always good documentation. Dynamism on the other hand doesn't bring you anything except for less typing of the argument types.


What about the advantages of dynamic languages?
IMHO, dynamically typed languages are useful only for tiny applications or fast written scripts that perform different tasks.

Another interesting thought that comes up when debating dynamism versus static languages, is an analogous subject that has sparked myriads of debates in the United States when Obama's administration applied a new set of regulations on businesses (which in some people's opinions is freedom limiting).

I've spotted this interesting analogy from comments placed by the infoq.com visitors on the same article discussing the new regulated economy.

Chat Abbreviations and IMHO

Nowadays, people are using chat abbreviations very frequently to save time and typing along with emoticons.

What surprised me recently is a very popular abbreviation used widely on the internet that I never read or used before. Its "IMHO", from the letters used and the "O" at the end, I first thought that it is an international organization of some type. But when I looked it up, I discovered that what IMHO really stands for is:

"IMHO = In My Humble Opinion"

So you can now safely add IMHO to your set of chat abbreviations including LOL, BRB, NP, BR.

Wednesday, July 14, 2010

How BP Handles a Coffee Spill

Simulating how BP handled it's oil spill on a smaller scale scenario ... a coffee spill.

http://www.youtube.com/watch?v=2AAa0gd7ClM&feature=fvhr

Disclaimer: If you didn't follow the news then you wont get it.

Sunday, July 11, 2010

A good Drupal alternative?

Frankly, I'm quite fedup with Drupal.

My plan is to find an alternative. And here's my research findings.


I bumped into the following excellent CMSs that I would like to try out:


1. Concrete 5 http://www.concrete5.org/ (PHP using Zend Framework)
2. BrowserCMS http://www.browsercms.org/ (Ruby on Rails)
3. Silver Stripe http://www.silverstripe.org/silverstripe-cms/ (PHP using Sapphire)
4. modx http://modxcms.com/download/ (PHP)
5. Frog CMS http://www.madebyfrog.com/ (PHP)
6. MiaCMS http://miacms.org/
7. CMS Made Simple http://www.cmsmadesimple.org/
8. TextPattern http://textpattern.com/
9. ImpressCMS http://www.impresscms.org/


Well, I think all of them are excellent. I really likes the Concrete 5 video preview though.


Also have a look at this top chart:
http://amplicate.com/rankings/475-top-ten-content-management-systems-cms/

In search for a User, Group, Role & Security Java Library

I've been longing for a Java library that would cover all the needs of authorization and authentication within an application in a sensible manner. The library shouldn't require huge EJB structures and should allow being used within a POJO context.

I've searched and found three useful libraries:
3. Spring Security http://www.acegisecurity.org/

The one that drives my curiosity the most is Apache Ki. Seems very promising.

Thursday, January 28, 2010

Jobless, need money, why not freelance from home?

You can start freelancing effectively using these websites:



One day, I'll need these websites badly.

Wednesday, June 13, 2007

A Useful Command Prompt Tip

netstat -an |find ":80"

The above command I use so frequently. It really helps me out figure if there is a webserver running on the machine (ie. listening on port 80).

Actually, this command is a combination of two commands. The first is netstat which displays a boring long table.

The second is find "XX" which ignores all strings that dont contain "XX".

The '|' is the pipe operator. Now the command simply pipes the output of 'netstat' into 'find', the result is the line that contains the string "80".

If you're from a linux background, you'll find this post a bit too obvious. Since we're used to using the 'grep' command (which is similar to 'find' on windows).

Sunday, June 03, 2007

Microsoft PowerToys

Add convenience to your life ...

Try these free tools:

1. Alt-Tab Replacement
When using Alt-Tab, this will show you a small thumbnail of the program you are switching too. Very helpful when switching to multiple instances of the same application.

2. Power Calculator
Enhanced calculator for your OS.

3. Open Command Window Here
Allows you to open the command window for any folder you are currently in.

4. Image Resizer
Resize images on the spot.

5. ClearType Tuner
This PowerToy lets you use ClearType technology to make it easier to read text on your screen, and installs in the Control Panel for easy access.

Download any or all at:
http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx

Saturday, June 02, 2007

Who Said You Cant Learn Karate From A Book?

You can learn anything from books. A good book with good illustrations and a comprehendable language style can teach you anything.

The only extra large step you need is to continually practice. If you dont, then most probably you're dropping everything you've read.

Now wait a second, I know what you're thinking... but watch out for what I said; I said 'you can learn', but I didn't say 'its the best way!'. So lets face it, someone whom read a book about Karate will definitely know more than someone who haven't read (assuming both initially start in the same state).

Here's my evaluation of the different ways to learn ordered from best to worst:

1. Let an expert teach you, practice well, see what other experts teach, read about it, apply, understand the different schools on the same subject.

2. Let an expert teach you and practice well.

3. Read a book, and practice.

4. Read a book.

5. Do nothing.

Please note that I'm writing this post without any pre-research or good analysis on the subject. Therefore, please forgive my 'hardly scratching the surface analysis' (abbreviated HSTSA) on this subject.

Tuesday, May 29, 2007

File System Storage Versus BLOB Objects

Document Management Systems nowadays are heading towards storing all documents as BLOB objects in the database. You rarely find any server side applications that deal with documents as files.

Whether its a... Document, Content, Bug, Project, Knowledge Management System, they're all implementing document storage using BLOB objects.

Why it that then?

Well...

1. The first advantage of having everything stored in the database is the ease of backups and restorations. You no longer need to backup the database then backup your document's directory, then make sure they are synchronized.

2. The second advantage is that the documents are stored the same way on all platforms and partitions. Whether its FAT32, NTFS, or any other filesystem, you can store them all in the same way.

3. The third advantage is, you have full control of versioning documents, storing interesting information like diffs, dates, users performing on them.

4. The fourth advantage is that third party applications that connect to the database need only to have the database port available. No need to provide extra ftp access to acess the documents.

Thats it. Bottom line...

If you're building some kind of server application, consider a Database File System.

Wednesday, May 23, 2007

The 3arabeezy Habit

In the old university days, whenever I met someone speaking half english half arabic, I usually felt so intimidated of such personalities. I used to think of them as people whom try their best to show off by mixing sophisticated english terminology with verbal mingled arabic pronounced english sounding words. At those days, 3arabeezy for me was a 100% Yukk.

Today, I became one of them (A 3arabeezist). I just cant stop it, I keep mixing english and arabic whenever I speak, I dont know how it came up to be, it just happened. Gradually, I started substituting english words for words that I cant find an arabic alternative for, and vice versa.

It seems that mixing two languages makes me feel smoother. Its not only in verbal languages. Its also in computer languages. You need to write Embedded C in Java code for certain functionalities, and to write PHP extensions using C in others, or even assembly in some C code, mixing languages could be an advantage.

However, mixing arabic and english proves that you are proficient in using both simultaneaously, but very weak in utilizing one at at time.

Even when trying to talk completely in English... one or more 'ya3neeez' have to slip through the conversation. And when I talk in complete Arabic, one or more 'simply', 'basically', 'soon enough', 'I think' have to slip in between.

In funny cases, I'm also starting to use the plural form of arabic words in english form... examples are 'Raheeebz', 'Raw3az', '7abaaaybax' and 'Jee3aanz'.

Lets jump to the lessons learned of this post. I guess there's one really serious lesson to mention. 3arabeezy aint that bad, but could make you look REALLY bad in first impressions. So here's my advice:

1. When introduced to new people, dont use 3arabeezy whatsoever. Stick to one language. Talk professionaly. Dont mix. It will only leave an impression of either a show-off or an improficient talker.

2. In public speech, dont use 3arabeezy unless the audience are people you've worked with before.

3. When dreaming, feel free to use 3arabeezy. Totally acceptable.

4. Sometimes you need to use 3arabeezy when talking to people who know neither arabic or english. This raises the chances that there could be an arabic or english word that sound something similar to their native language.

5. Only use 3arabeezy if you feel that a certain word has a better alternative in the other language that will ease up understanding. Again, this proves weakness in the former language.

Till then, we'll meet again in a next epi-post of 'Lost in the Code Carribeans'.

Tuesday, May 15, 2007

The Long Easy Way Versus the Short Hard Way

Today I had a small discussion with a good technical friend of mine ;) The discussion started with trying to handle an SQL Query with one shot.

The SQL Query got a bit too complicated to handle and needed some extra research, reading and thinking to figure out the correct way to do it. It took two technical brains, good MySQL experience, about forty minutes of work, and at the end some testing. It resulted with a long SQL statement.

Through our work we had another solution, its a very easy solution, get the data you need through multiple SQL statements. Thus, a long but easier way to do it.

We felt so proud that we were able to tackle the short difficult path, but at the end, considering the long easy path we missed, I felt a bit unrelaxed, but as soon as that happened, I was reminded with an important wisdom (by my amigo):

"If you keep choosing the easy and long path, you'll hardly learn anything. It's the difficult short path that provides you with extra skill and power."

Now imagine the amount of skill and power you can gain by choosing the long difficult path. Hmmmm, cool as long as no fatal mistakes takes place.

There's always alternate wisdom supplements when twisting different stories around.

Monday, May 14, 2007

The 'Call Super' Antipattern

A common design problem that is usually solved using the 'Call Super' antipattern (also referred to as code-smell). Simply stated, the problem occurs when the subclass needs to share the implementation of the super classes over-ridable methods.

In such case, 'Call Super' anti-patten is usually used by calling the over-ridden methods from within the subclass's over-riding methods.

I'll show a 'Call Super' code sample, then show a much better and neater solution (proposed by Martin Fowler).

The Bad Solution (Using the 'Call Super' AntiPattern):

class Penguin {
public void intoduceYourSelf() {
System.out.println("Hi, I'm classified as a penguin.");
}
}

class EmperorPenguin Extended Penguin {
public void introduceYourSelf() {
super.introduceYourSelf();
System.out.println("My real name is Emperor Penguin");
}
}
A Better Solution
A much better solution is to have an abstract method in the super class for the extra actions the subclasses will perform. And thus, the subclass only needs to implement that abstract method:

class Penguin {
public void introduceYourSelf() {
System.out.println("Hi, I'm classified as a penguin.");
talkAboutYourselfMore();
}


abstract public talkAboutYourselfMore();
}


class EmperorPenguin extends Penguin {
public void talkAboutYourselfMore() {
System.out.println("My real name is Emperor Penguin");
}
}



Thats it. A neat alternative solution that I love to use.

Wednesday, May 09, 2007

Curiosity Never Killed The Cat...

... it was Boredom which did.

The amount of boredom I've been through in the past three days has been killing me softly.

Unfortunately, this time it's the result of practicing a boring repititive task; writing code that tests code. You just keep on writing code and checking the result, then writing another line and checking the result, then another line, and checking the result.

Trying my best to be creative with this task, I only modified the code a bit to show errors in red color and success in green color. Thats about it.

Wisdom of the day:

Ok, curiosity might have killed the cat. But boredom will kill anything!

Monday, May 07, 2007

The Best Free Utilities

Check them out at:

http://www.techsupportalert.com/best_46_free_utilities.htm

Enjoy. I liked the sticky notes utility ;)

Saturday, May 05, 2007

Swapping Two Integer Variables Without Using a Temp Variable

The first time I heard this question, I thought it was a joke of some kind. I never thought such was possible.

Turned out to be possible and even faster than the normal technique, here you go:

Let X be an integer variable.
Let Y be another integer variable.
X = X xor Y
Y = X xor Y
X = X xor Y

Wont buy it? Then try it out for yourself.

One more technique, you can use the - (minus) operator instead, but be careful not to step over the integer max and min limits. Here you go:

(eg. X = 12, Y = 7)
X = X - Y ( X is now 5)
Y = X + Y ( Y is now 12)
X = Y - X ( X is now 7)
(result: X = 7, Y = 12, Voila! Swapped)

Hmmmm. Coming to think of a practical use. The only way such would be useful is to swap two large memory binary buffers.

This swapping enhancement breaks the common myth of 'its either memory or speed, but not both'. The swapping algorithm you just saw proves better in both memory consumption and performance gain.

Wednesday, May 02, 2007

Sticky Notes No Longer Stick

Ok, we all use pieces of paper for jotting notes and todos from time to time.

Some use white paper, lined paper or 3M sticky notes. When no physical resources are available I'll usually use notepad for quick note jotting.

This usually happens when I'm jotting down a quick description of a street address of phone number.

The problem with the notepad approach is the extra steps you have to walk through to actually open notepad and save the file. Which turns out to be so inconvenient when urgency is required.

I mean you need to go to Start > All Programs > Accessories > Notepad, oooft! or even Start >Run then 'notepad' and enter. I also use the quick launch, but at the end, notepad for note taking creates an intimidating experience. Not to mention having to remember the filename you saved on the desktop.

So long for notepad, what about the paper and pen approach? Well...

First, you need them to be around your desk somewhere and you need them to be around instantly. Pen and paper are easily un-noticed on your desk until you discover that you need them (comparing them to a laptop).

Second, paper and ink are limited resource, ie. They will run out. And you'll have to purchase them again.

Third, ok, anyone can afford paper and ink, but what about the environment.

The amount of paper waste caused from temp note storage is unjustified with the alternative tools available. Consider the amount of trees wasted for the sake of disposable paper notes and todo items.

Ok, I'm sure you're thinking now. What point is this post building up to?

Well, its all about a small and cute sticky notes tool (that mimics 3M sticky notes) named "ATNotes".

You can download it for free from:
http://atnotes.free.fr/download.html

Yep. Yep. No more notepad files on your desktop, no more scattered paper, no more ink, and guess what? You're now an environment friendly person.

A Big Thanks goes to its developer & author - "Thomas Ascher".

Hope you like it.

Tuesday, May 01, 2007

The Programmers Notepad

If you're one of those people whom dislike thick fat development IDE's, and at the same time you miss many of those rich highlighting and search/replace features in your simples editors.

Then go no further...

Try "The Programmers Notepad".

1.3 MB in size, free, wonderful, and very light-weight.

I loved it from first 'site' : /
at http://www.pnotepad.org/

I think I'll let go of EditPlus. My X-Favorite Editor.

Sunday, April 29, 2007

Lazy Evaluation and Caching...

... are the most widely used techniques for improving your software's implementation performance.

Then what are they and how can I use them?

Lazy Evaluation is exactly just like a Lazy Employee; he wont do the job unless some one directly requests it from him. Infact, he'll postpone it forever until the request is made official.

Caching on the other hand is simply storing frequently used data in some quick array or memory for fast retreival, although the same data is stored in a database or in a file, the programmer usually chooses to cache it in its accessible form for fast retreival. This memory could be an Array, a Berkley DB file, a tmp file or any other suitable media.

Google - a well known search engine - caches search results for most frequently used queries. FileNET (a really good CMS server) renders all content objects inside one single HTML page ready for access (instead of querying it from a database everytime). The HTTP protocol itself caches different requested pages on the internet on local internet proxies and implements the HTTP headers to do so. And even does your browser cache some html pages from time to time.

Thats why you usually need to press Ctrl+F5 to force requesting to refresh the page from the server.

As a programming example, lets say you have a small class named UserAccountManager and this class contains a single method:

public static String UserAccountsManager.getUsername(int UserId);

And a single private array which is simply a HashMap mapping a UserID to the Username which is used by getUsername(int UserId).

The method is implemented simply to execute a query on the database:

"SELECT USERNAME FROM USERS WHERE ID=" + UserId

Here is a simple way to see how caching and lazy evaluation can be applied.

The program can implement caching using a private array map that maps the user id to the username string. This array is filled only once from the database when the program first loads.

The tricky part when implementing caching is knowing when to re-generate the cache, or more accurately, how to identify that the original data store has changed or not? If changed, then the cache needs to be regenerated or else your program is using out-of-date data.
Any calls to getUsername will simply access the array instead of accessing the database. This is whats Caching all about.

Now, lazy evaluation simply changes the implementation so that the array AINT FILLED AT ALL until someone actually calls the getUsername() method.

The advantage here is that you dont waste memory or connect to the database until someone actually calls the function. (ps. It might need not be called at all).

After all this explanation, there is a very annoying advice that you have to stick to:

"Never implement optimization techniques such as caching or lazy evaluation until a bottle neck is identified in the system using benchmarking and testing procedures that shows that need. This simply means, avoid Premature Optimization as much as you can."

Friday, April 27, 2007

SQL Statement Shortcuts

What always bothered me when writing SQL SELECT Statements is handling long table names, and having to reference a field by its table's name to avoid ambiguous errors.

Take this for example, three tables: infobase, infobase_labels, and infobase_users. And let's imagine that those three tables each have a field named 'ID'.

So a simple select statement will go like that:

SELECT infobase.ID, infobase.NAME AS INFO_NAME, infobase_labels.NAME AS LABEL_NAME, PHONE FROM infobase_labels, infobase_users, infobase WHERE infobase_labels.ID=infobase.LABEL_ID and infobase_users.ID=infobase.USER_ID AND infobase.ID=5;

Okay, 238 characters of unreadable sql code.

Whats next? Okay, till here you have two options:
1. Live with it.
2. Find a simpler way.

I have been using option 1 for the last 7 years. Until, option two showed up ...

... the usage of name aliasing for table names to make a query simpler, now this I love, simple alias each table with a 2 letter name, and use it instead of the table name:

SELECT _IB.ID, _IB.NAME AS INFO_NAME, _IBL.NAME AS LABEL_NAME, PHONE FROM infobase_labels AS _IBL, infobase_users AS _IBU, infobase AS _IB WHERE _IBL.ID=_IB.LABEL_ID and _IBU.ID=_IB.USER_ID AND _IB.ID=5;

Okay, this makes them 205 characters long.

For me the latter is much more readable, shorted and easier to write.

Tidying the SQL statement a bit:
SELECT
_IB.ID,
_IB.NAME AS INFO_NAME,
_IBL.NAME AS LABEL_NAME,
PHONE
FROM
infobase_labels AS _IBL,
infobase_users AS _IBU,
infobase AS _IB
WHERE
_IBL.ID=_IB.LABEL_ID
AND _IBU.ID=_IB.USER_ID
AND _IB.ID=5;

Okay thats it for today. Quite a long post, but I like it ; )

Sunday, April 22, 2007

Master the Techniques Before Chasing the Goals

Miyagi told Daniel Son while holding the chop sticks:

"You have to catch fly first."

And this applies to any career. Ok, Miyagi was a bit over-reacting here, I mean, if it was not for the 'beginners luck' of Daniel Son, I dont think this movie would have ever ended.

The lesson here is that a career person SHOULD master the techniques of her or his profession. Know it well, do it right, know when to use a technique, know when to drop it, know the pros and cons of different techniques, but most importantly, Master it!

That could be the boring part for some, to master the technique, to know the details, to understand the bits and pieces.

A professional football player knows that mastering a 'pass' weighs much more than scoring a goal. Mediocre players - on the other hand - only care about scoring, this arises from a mentality of greed ... "Need to score, makes me feel good.".

Most low quality environments overlook developing good techniques, and favor jumping directly to goals. Ok, fair enough, the time and budget constraints of 'the start' could force such conditions. But, this symptom easily grows to a disorder when this methodology becomes a continuous habit.

Wisdom of today's post:

"Master the techniques, and make them the solid path to your goals."

Tuesday, April 17, 2007

Toggle The Toggler

We all use them, different places in our code, toggling variables.
And there are many ways to achieve the same results.


My first toggle looked like that. This toggles between 1 and -1.
a *= -1;

It then evolved to:
a = a XOR 1; // or a = a ^ 1 in Java

I also started using the modulus operator:
a = (a + 1) % 2;

Then I liked the modulus operator so much, that I started using it to toggle between three, four or N values:
a = (a + 1) % 4;

Sunday, April 15, 2007

Teach Yourself Programming in Ten Years

Very nice article discussing the programmers' learning curve:
http://norvig.com/21-days.html

This article is so popular it has been translated to many different languages including chinese, arabic, german, french, polish, japanese, korean, russian, spanish and turkish.

ref: Khaled J. Simtix Software.

Friday, April 13, 2007

Book Quote

"Some people play tennis all their lives, but never get better. Those people are not willing to take a fresh look at what they do or to consider changing it. Good players recognize that getting better often means making an investment in new approaches. For a while, they may get worse, as they wrestle with new and unfamiliar techniques, but eventually they surpass their old plateau."

-Fisher, Ury and Patton
In Getting To Yes

Wednesday, April 11, 2007

Getting Organized

I've seen different people do different stuff when it comes to getting organized.

Whether its organizng your images, favorites, invoices, note taking, meetings, budgeting.

Frankly, what works with some turns up to be impractical for others, and vice versa.

1. Some use the browser's favorites toolbar; others see it as non-sense.
2. Some use small notepad files to collect different websites, todo items, readings, passwords.
Others use excel sheets for the same task.
3. Some people even use stange but effective tools. An example is a tool that applies different colors to the different folders on a machine. Even others use tools that automate your environment through pre-configured shortcut keys and mouse clicks.
4. Some use information tools - called outliners - for collecting important pieces of information. Others see it as overly organized.
5. Some use outlook calendar for different reminders, others use their mobile, or even pen and paper.

Best general tips when adopting an organizing procedure is:

1. Make sure the maintenance cost is to the minimum when organizing an item. You dont want to spend an hour trying to figure out where to place your favorite site.
2. Make sure there is some temp storage for your information items that need to be organized. Since sometimes you're too lazy to organize even when you have the infrastructure.
3. Make sure that retrieval of the organized item is to the minimum (example, should be easily located, easily searchable by different fields, dates, text).
4. Make sure that it is available from different places.
5. Take time investigating organization tools at downloads.net, and tucows.com, see what fits your case, use what you find practical, make your life easier.

You never know, a fifteen minute deep thought of how to efficiently organize yourself, or even a small research in finding the right practical tool is your way for a much efficient and easier life.

The main hurdle that lets people postpone organizing themselves is their false feeling of 'I can manage' my reminders, my todos, my schedules, my information, and my budget. Trust me on this one, when it comes to organizing yourself, your brain alone is very limited.

Sunday, April 08, 2007

Big Downloads Cause Big Frustrations

These days, I'm downloading different IDE's, database binaries and (non microsoft) service updates from the net. The minimum download size is about 40 MB and the maximum was the new release of JDeveloper which is currently still being downloaded. Its about 508 MB in size.

This is the third time I try to download this 508 piece with a failed connection frustration.

Until... I found this wonderful free tool. Its a download manager named 'free download manager' that can be downloaded from http://www.freedownloadmanager.org/download.htm.

Enjoy downloading. No more connection disruptions. No more frustrations.

ref: Thanks Quazy (IT support team)

Tuesday, April 03, 2007

Bad Software Methodologies

Ok, this time its from the software industry...

Here are some very well known anti-pattern methodologies in software:

/* 1. Copy and Paste Programming: */
Copying (and modifying) existing code rather than creating generic solutions

/* 2. Golden Hammer */
Assuming that a favorite solution is universally applicable

/* 3. Tester Driven Development */
Software projects where new requirements are specified in bug reports

/* 4. Improbability factor */
Assuming that it is improbable that a known error becomes effective

/* 5. Defactoring */
The process of removing functionality and replacing it with documentation

/* 6. Premature Optimization */
Optimization on the basis of insufficient information

/* 7. Programming by permutation */
Trying to approach a solution by successively modifying the code to see if it works

/* 8. Reinventing the square wheel */
Creating a poor solution when a good one exists

/* 9. Reinventing the wheel */
Failing to adopt an existing, adequate solution

/* 10. Silver Bullet */
Assuming that a favorite technical solution can solve a larger process or problem

Ref: Copied and pasted from wikipedia

Patterns Plus Anti-Patterns

In every engineering science lies the notion of good (design) patterns.

This comes out as a result of repeating good ideas and/or methodologies that work. Once being repeated in different places, a pattern is spotted in which it gets popular between the engineering community and can be safely reused, it even acts as guidelines to beginners.

"Another important concept - but not as popular - is the concept of anti-patterns."

Good Patterns and Antipatterns complete each other. Anti-Patterns are simply the bad patterns that have been spotted being practiced repeatedly and should be avoided.

Its important to note that patterns and anti-patterns do not apply only to software engineering, but rather can be applied to any science. You can even apply it in your own kitchen (strong assumption: you have a kitchen).

I'll discuss here some anti-patterns spotted in the managerial world that have been popular and should be avoided:

1. Fruitless Hoop: The manager who requires endless (often meaningless) data before making a decision.
2. Golden Child: When special responsibility, opportunity, recognition, or reward is given to a team member based on personal relationships or contrary to the person’s actual performance.
3. Leader Not Manager: Being a great leader doesn’t necessarily mean being a great manager.
4. Manager Not Leader: The manager who is proficient at their administrative and managerial duties, but lacks leadership ability
5. Management Meeting Mania: The manager whose only function in the organization is to schedule useless meetings
6. All You Have is a Hammer: One-dimensional management where the same technique is used on all subordinates.

These will do for today. For more you can search google or checkout wikipedia. Keywords Anti-Patterns and Managerial. You can also check amazon.com for good books on the anti-patterns subject.

Sunday, April 01, 2007

Swing/AWT

Fortunately, I've found lots of books and online material that teach you Java swing/awt programming for desktop environments.

Unfortunately, very few (approximately none) discuss structuring your application code.

I've seen "Learning Java" over discuss the 'Adapter' design pattern when it comes to separating UI actions from application functionality. But still, I'm looking for patterns that will make code scale, techniques that will handle complex user interfaces using simple class relations without cross-referencing different variables, classes and elements along the code.

Till I meet such a tutorial or reference, I think I'll be treating Swing the MFC way.
Lucky me , I've done MFC ;)

In Search For A Convenient Java IDE

With all the years of VI programming on linux as my ultimate IDE. Being introduced to some civilized java IDE's exposed me to a cultural shock.

With all the impressing stuff, I'm still trying to find the best out there. Trying to find the best by comparison then by elimination. First of all, they all look great. The Java IDE's sum up to the following:

1. Eclipse
2. NetBeans
3. JBuilder (by Borland)
4. JDeveloper (by Oracle)
5. Intellij IDEA

The best link I found that does a fair comparison is this one:
http://www.mojavelinux.com/wiki/doku.php?id=javaidecomparison

I'm trying them out one by one. Please note that my evaluation will be based on the best IDE for creating desktop applications.

I've just tried JDeveloper today and I think its the best. Eclipse, NetBeans and Intellij IDEA I've tried a bit. But the one that provides the best convenience I believe is JDeveloper, specially when it comes to creating GUI Desktop applications.

The problem with Eclipse is that it doesn't support Swing/AWT ui elements, but rather have to be purchased from thirdparty commercials (most notably MyEclipse).

Netbeans is good. But the layout facilities provided are so cumbersome. To that, NetBeans lacks alot of features, and its intellisense makes me mad from time to time. When I'm in the middle of typing a function name, and go back by pressing delete, intellisense dissapears. This doesn't happen with JDeveloper.

Intellij IDEA. I have to be frank here, I didnt give it a full try. Its commercial for $500 and looks great. Also lots of features, a big community, and lots of plugins, the only problem is that I didnt give it a full try since the GUI layouts it provided were a bit like NetBeans. I'm sure there is an option that makes it like JDeveloper. But I didn't find it fast enough.

The only one left to try is JBuilder from Borland. I dont think I will get there. I'm so happy about JDeveloper I dont think I'll ever go anywhere else ;)