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 ;)

Tuesday, March 27, 2007

The Riddle In The Middle

Whats next in this sequence:

1,2,3,4,5,6,7,...

No its not 8. Its 9.

See, the function that created this sequence is:

f(n) = n + floor(n/8)

Wisdom Of The Day:

"When something looks so easy,
suspicion would be the best first thing to do."


Any extra wisdoms you can think of?

Saturday, March 24, 2007

Advanced For Loops

There are some skills in our career that we have reached proficient enough to an extent that we think there's nothing extra to learn.

One good example is the for loop, I mean, I dont think there is anything left I need to learn about a for loop.

Well, I was wrong, daaaaaaaaaaaaaaaamn wrong, here's one extra piece of information that'll leave you scratching your head the rest of the day.

for (int i = 0; i < arrCustomers.length(); i++)
{
println(arrCustomers[i]);
}

Becomes:

for (int i = 0, len = arrCustomers.length(); i < len; i++)
{
println(arrCustomers[i]);
}

Now the code above saves your interpreter/compiler from calling the method length() each and every iteration.

Meaning, a wonderful optimization with approximately zero extra code.

Whether you like it or not:
"You ain't a for loop expert as much you thought you were!"

Wednesday, March 21, 2007

You've got a bug (Dont take it personal)

Developers have always, are always and will always be in a state of offense when being accused of committing a bug.

Whether they (we) like it or not, the statement:

"You've got a bug."

is an emotionally disturbing phrase for (we) the developers.

The word 'bug' by itself is so phonetically provoking. First of all, its composed from one sylable that pops out all of a sudden. "BUG", "BUg!", "bUG', "BuG", its like microwave popcorn.

It even sounds like you're cursing someone. And sometimes, it sounds like you're accusing someone of having weazels in his hair (قمل).

I try my best to avoid using the literal form of the word 'bug' by replacing it with more friendly alternatives like the words 'defect', 'malfunction', 'problem', 'leak', these words have proved to be more DES (Developer Ear Safe) words.

If you're a quality person, a customer, a manager or any person involved in auditing developer's output, then here are some alternative sentences I've collected through my career to help you out with dealing with such cases:

"The system is acting a bit wierd when I press this button."

"There's a small problem, I dont think you have uploaded the latest code."

"I found this problem, you know what, it looks like a third-party library is going nuts."

"I found this problem, are you sure no one touched the code you wrote?"

"I'm sure you haven't finished yet, I remember you told me you still have work to do in this module, I think this is why all these bugs are showing up."


Also make sure not to use the word 'you'. But always use the passive tense, and talk about it as if its a 'system' problem and not a developer's problem. Not "You've got a bug", but rather, "A strange problem is showing up here.".

Last advice, stay away from discussing this bug with the public; before the bug is fixed, while being fixed and after getting fixed. Dont discuss other people's problems if you dont like people discussing yours.

Monday, March 19, 2007

Extreme Programming

In Martial Arts, the most extreme methodology is named KungFu.

In software, they call it "Extreme Programming".

Some principals taught in Extreme Programming:

"A team is much more flexible if everyone knows enough about every part of the system to work on it. "

"You must realize that the design you envisioned was a good guide post, but is now obsolete."

"Never try to guess what the system's bottle neck will be. Measure it!"

"If only one person on your team can work in a given area and that person leaves or you just have numerous things waiting to be done in that section you will find your project's progress reduced to a crawl."

"Simple design always takes less time to finish than a complex one."

"So always do the simplest thing that could possibly work."

"If you find something that is complex replace it with something simple."

"Beware though, keeping a design simple is hard work."

"Refactor mercilessly to keep the design simple as you go and to avoid needless clutter and complexity."

"We continue to use and reuse code that is no longer maintainable because it still works in some way and we are afraid to modify it. But is it really cost effective to do so? Extreme Programming (XP) takes the stance that it is not."

"Working overtime sucks the spirit and motivation out of a team."

"Make it work, make it right, then make it fast."

For more visit:
http://www.extremeprogramming.org

Good Link

http://www.devlisting.com/

Sunday, March 18, 2007

I still find Javascript the hardest

With all the languages I write code in, I still find the most difficult language to write code through is Javascript.

When it comes to writing javascript, I start having some headaches, here's why:

1. I start imagining the different constructs I'll use to check for browser versions.
2. I need to check for different user settings.
3. The debugger on Internet Explorer SUCKS!
4. The language itself is neither Object Oriented, nor friendly, its a strange language where an object becomes an array with a strange form of instantiation, strange syntax.
5. Whenever I think of growing myself in this language, I start getting the feeling that its not worth it. I will only need it for small webapplication tweaking functionalities along with AJAX calls, so there's really no need in investing my mind brain cells in it.

The only thing that made my life easier lately is a very good javascript debugger by the name of FireBug which comes as an add-on for FireFox.

Other than that, I feel that this is the reason why there are very very very few excellent javascript developers around. And guess what, the demand is growing.

Wednesday, March 14, 2007

Profession(al)?

Having a profession is something, becoming a professional is another. The mental distance between those two is similar to the distance between Irbid and Manhattan.

When building up your profession, there are two parallel lines that you need to maintain and balance:

Step #1: Practice it yourself.
Keep practicing your profession the right way, work smart, enhance your techniques every work cycle.

Step #2: Observe other professional work.

Look at what other good people have done. Understand different methodologies, patterns, techniques and practices. Read, research, find better ways to do the same work.

This bicyclic process is necessary to grow you fast enough.
Dropping line #2 will get you a bit lost and isolated, often resulting in slow progress in your career. Dropping line #1 will simply make you loose your craft.

The most useful tasks I ever got while working in the software industry were debugging, fixing and enhancing existing codebases.

Simply because, I get the opportunity to write code, and to understand how other code works.

Finally, I'd like to end this post with a valuable wisdom:

"Its not what you know, its how good you know it."

Tuesday, March 13, 2007

Desktop Application Development

I'm back to desktop development aaaand I love it. Desktop Applications, its a whole new world, away from the CSS, HTML tags and Buggy Javascript (Damn the IE javascript debugger, I just hate it, it always lies to me about the error's line number).

Desktop application development on the other hand is rigid, aint buggy, wonderful. I'm using MFC8 with Visual C++ 2005 Express. Voila! Smells exactly like teen spirit.

With desktop applications, the possibilities are just endless. You've got new raw material for your abstract ideas.

CYouSoon->Hala3ammi(&GoodBye);

Monday, March 12, 2007

Subliminal Programming

I remember the old days when I used to play billiards, I used to concentrate deeeeeply on the cue, the black eight, the pocket and the cueball ('7asem), trying my best to have them aligned on the correct (virtual dashed line), I then hesitate and give myself a break by sharpening the edge with a piece of chalk, again, I concentrate, think and make a shot, most oftenly, missing the pocket.

Once upon a vivid day, and after some heavy experience, and while on the table, a sudden feeling of confidence came upon me that made me shoot without thinking and made me score just by blinking. No thinking at all, just used my hidden senses to score, score, score. Yippeeee YaYoe! Something happened there, I'm not sure what it is, but I think somehow my experience managed to slip inside the subconcious part of my brain for a while.

I think this what happens with professional football players, or basket ball players, or tennis, or ping-pong, or even judo, jujitsu, guitarists, all the professional people every where, they just do it without thinking, they are experienced enough to an extent that they are able to make moves and decisions without thinking.

I wish I can become like that one day, actually, this happens to me when I'm writing HTML code, it always compiles(1) without any errors.

ref(1): HTML is the only language that compiles without errors.

Saturday, March 10, 2007

Reverse Engineering Tools That Are Not.

I've been researching for the last week for a good reverse engineering tool that would simply get handed in a large C++ codebase and would automatically walk through all the classes, functions, variables and interfaces for the purpose of generating a visualization of the live flow of code.

At the end of my research I was able to find a good reverse engineering tool called Understand for C++ and Understand for Java. This was one of the best I found. I decided to use it, was impressive, but not too impressive, it still lacked lots of stuff I needed.

Looking around, I felt a bit hopeless, until I got introduced to automated document generators.

A code documentation generator would prove as the best reverse engineering tool ever. For reverse engineering purposes, I dont think I need to go any further.

Wednesday, March 07, 2007

Being Skeptic About Necessity is the Mother of Invention

Have a quick look at the mouse to your right, do you see the two mouse buttons, tell me what else? I'm sure you see a small wheel between the two buttons, a wheel used for scrolling up and down a large page inside the window.

A question prevails: "Did anyone in the world ever need this small scrollable wheel before it was invented?"

The answer is No. No one needed it. People where living happily ever after before this wheel even showed up. They had no problem using the up and down arrow keys or even using the scroll bar to the right of the browser's window.

If this is the case, if no one needed it, then "who in the world invented it and for what reason?"

Well, trying to scratch my head a bit, I believe she or he is someone who found it a tedious task to stretch her or his arms a bit and use the arrow keys, or even worse, he or she found it hard to point the mouse cursor on the scroll bar and move it up or down while holding the left mouse button.

From the previous notes, the only reason I can find for him or her who invented the scrollable mouse wheel is, he or she were in a state of laziness... in other words... laziness was the motive.

Did anyone ever need it before it was invented? No. Can anyone nowadays buy a mouse without requesting a scroll wheel, well, I'm one of the people who cant live without it. And I've seen many others who expect it as the default.

Does this apply to other inventions, in most cases, yes, the laziness motive appears much stronger than the necessity motive, as a short conclusion I could say:

"Necessity was never the mother of invention, the real mother is Laziness."

Monday, March 05, 2007

Power Shell versus Bash

A good command prompt has always been a weakness point in MS Windows. Compared with bash scripting in Linux/Solaris/UNIX, the command prompt simply lacks a command prompt.

Microsoft aggressively striked back this time with Microsoft's new Power Shell. You can download it from the following link or read more about it here. Expect better automation tasks and large bash scripts to be so common on Windows.

Sunday, March 04, 2007

Dissecting The Wisdom

Dont trust casual reasoning doesn't mean dont use it. It just means 'dont trust it'.

In reality, I urge people to use their human logic, to use their common sense, to use their casual reasoning or to use whatever they want to call it. These activities are sourced from a powerful tool God gave to us, called the brain.

The only piece of information that you should be aware of and that wasn't mentioned in your user guide is:

"Dont trust it."

So remember this advice when it comes to making big decisions or when it comes to embracing big ideas.

Thursday, March 01, 2007

A Riddle With A Wisdom

Two large jars of exact equal size. The first jar holds pepsi, the second jar holds the same but seven-up.

Using a small empty cup you remove a full small cup of pepsi and pour it in the sevenup jar, you mix the seven-up jar well. Then you remove from the seven-up jar (which has a small amount of pepsi in it) a full small cup and pour it into the pepsi jar.

The question now is:

Is there more pepsi in the sevenup jar than seven-up in the pepsi jar, or is it that there is more sevenup in the pepsi jar than pepsi in the sevenup jar?

This riddle simply proves that casual reasoning cant be trusted.