Saturday, June 30, 2007

The fall of MS fan

For most of life, I have been a Microsoft user. I wasn't a MS' fan. But I didn't find it not so bad working on Window, and it was fair enough for me, although it is not perfect.

I had great passion to try the Vista out, the long delayed version, 6 years or sthg. We all read abt it for many years, and how much it will be sthg fascinating and a new..bla..bla..bla
When I tried it on my PC, i was expecting sthg that could dazzle me.

finally, I got Vista business. I was totally wrong, I regret the day i installed Vista.

well, it is beautiful, the 3-D desktop switcher looks nice.
I faced many problems with Drivers. the problem is not that they r not verified by Vista. the problem that from time to time, I had to redefine the drivers.
my network card kept to be disconnected. I couldn't stay online for couple of hours. the stupid thing that when it disconnects, i have to press by myself "diagnose and repair" then should press "get a new IP" to ask the Vista to get another IP. What is this stupidity!!! didn't I define that already in the connection properties!! the answer to that question is the "ALLOW" :))
If u run sthg on vista, and precipitate away from ur PC, don't expect it is working.

u should wait because u will have to answer "Continue with getting a new IP?", "continue with opening this executable file"..etc I really hate this stupid thg in vista. i don't think i have to press 3 clickes just to run exe file..

The gadgets are terrible, I have never turned them on. they are not innovative and poor.

fighting to have a network connection really annoyed me.
this Vista eats the processor and the Memory. it slows down ur PC. without any tasks running ur RAM usage can be 512 MB. to use a PC now, u have to add $X to buy extra RAM for the Vista and $Y extra to more powerful processor, don't forget that u will pay for the Vista too :)
Vista price is too high. despite the license price is the almost the same since many old versions of windows, it is too high comparing with HW costs these days. Windows license can exceed 20% of ur costs!!!!

the only thg that may keep windows alive is that majority of mobile tools need windows to sync, and some softwares are not still available for MACs.

anyway, I didn't like the Vista thg.
Not friendly, no performance, no stability...nothing.

Thursday, June 28, 2007

Improve your Company using Workflow System

Work flow,
Business Process Management,
Business Process Modeling,
Work Procedures

All these related words can come together to build an understandable vision of the workflow system.

The Business Process is a group of logically related tasks that come together to form a methodology to implement work procedures.
So companies try to automate these procedures using a workflow system to gain its benefits.

You can find more about workflow here.

So why do we need workflow system?
Some of the benefits we can get by using workflow can be briefed by the following

  • Improved efficiency - automation of many business processes results in the elimination of many unnecessary steps
  • Better process control - improved management of business processes achieved through standardizing working methods and the availability of audit trails
  • Improved customer service – consistency in the processes leads to greater predictability in levels of response to customers
  • Flexibility – software control over processes enables their re-design in line with changing business needs
  • Business process improvement - focus on business processes leads to their streamlining and simplification

How to implement a workflow system for our company?

Well, Thanks god we didn't have to pay for a license to build a system using Microsoft workflow foundation.

We have JBPM (Java Business process management) which is a flexible, extensible workflow management system build on Java and it is an Open source project.

A lot of open source projects are developed like (Open Business Engine The Open for Business Workflow Engine OpenWFE WfMOpen XFlow Micro-Flow JFlower YAWL Zebra Apache Agila Antflow Beexee Dalma Swish etc...)

I believe that RunaWFE is one of the best.

RUNA WFE is an environment for JBoss jBPM workflow engine.
It is a cross-platform end user solution for business process development and execution.

Together RUNA WFE and JBoss jBPM provide an easy to use business process management system.

RUNA WFE provides:

  • an end user GUI to define business processes without any coding: draw flowcharts, define roles and variables, lay out forms
  • an end user GUI to load and execute processes
  • an administrative interface to create and remove users/groups and grant rights
  • a possibility of writing automatic "bots" that can participate in business processes
  • a possibility to code new GUI elements, variable types, organizational structure functions etc. that extend existing RUNA WFE components and will be available to end users through the GUI

Then How to integrate our workflow system with other software?

Integrating RunaWFE with MySQL Database:

Simply, do the following steps:

  1. Add The File mysqldb-ds.xml to your jboss deploy folder "server\default\deploy".
  1. In server\default\conf\hibernate.cfg.xml Change

connection.datasource = java:/MYSQLDS
Dialect = net.sf.hibernate.dialect.MySQLDialect

  1. Important Note : Don't forget to add "com.mysql.jdbc.Driver" to your library This is done by adding "mysql-connector-java-3.1.14.jar" to the lib Folder.

Integrating RunaWFE with LDAP:

Unfortunately integrating RunaWFE with LDAP can be done to a certain level,

In any workflow system you have to define your users, their groups and also their permissions and Roles.

So you can authenticate through LDAP but you still has to add your ldap users in your workflow system so you can define their groups and Roles.

So what we will do now is to authenticate using our LDAP and also import our LDAP users into RunaWFE to manage their groups, Permissions and Roles.

Fortunately RunaWFE helps us in doing both the importing and the authentication.

To Add LDAP Authentication To RunaWFE Do the Following:

  1. Add the LDAPPasswordLoginModule to src\af\logic\ru\runa\af\authentication
public boolean login() throws LoginException {  

SERVER_URL= LDAPImporterResources.getServerURL();

if (callbackHandler == null)

throw new LoginException("No CallbackHandler provided.");

Callback[] callbacks = new Callback[2];

callbacks[0] = new NameCallback("actor name: ");

callbacks[1] = new PasswordCallback("password: ", false);

ExecutorDAO executorDAO = null;

try {


String actorName = ((NameCallback) callbacks[0]).getName();

if (actorName == null)

throw new LoginException("No actor name was provided.");

char[] tmpPasswordChars = ((PasswordCallback) callbacks[1]).getPassword();

if ((tmpPasswordChars == null) || (tmpPasswordChars.length == 0))

throw new LoginException("No password was provided.");

String password = new String(tmpPasswordChars);



env.put(Context.PROVIDER_URL, SERVER_URL);

env.put(Context.SECURITY_AUTHENTICATION, "simple");

env.put(Context.SECURITY_PRINCIPAL, "uid="+ actorName +

",ou=people,"+ LDAPImporterResources.getDC());

env.put(Context.SECURITY_CREDENTIALS, password);

DirContext ctx = new InitialDirContext(env);


executorDAO = DAOFactory.getInstance().createExecutorDAO();

actor = executorDAO.getActorCaseInsensitive(actorName);

succeeded = true;

return succeeded;

} catch (IOException e) {

throw new LoginException(e.toString());

} catch (UnsupportedCallbackException e) {

throw new LoginException(e.getMessage());

} catch (NamingException e) {

throw new LoginException(e.getMessage());

} catch (InternalApplicationException e) {

throw new LoginException(e.getMessage());

} catch (ExecutorOutOfDateException e) {

throw new LoginException(e.getMessage());

} catch (RuntimeException e) {

throw new LoginException(e.getMessage());

} finally {

try {

DAOHelper.close(executorDAO, true);

} catch (InternalApplicationException e) {

throw new LoginException(e.getMessage());




  1. Modify the LDAP importer Configuration File in server/conf to point to your LDAP server.
  2. Change in server/conf to the LDAPPasswordLoginModule.

  1. You have to modify some constant variable in class LDAPImporter to accommodate with your LDAP settings.
private static final String OBJECT_CLASS_ATTR_USER_VALUE = "user";
private static final String DISPLAY_NAME = "name";
  1. Run the LDAP importer Tool which will import your users to the ldap users group in the Executors list of Runa.
  2. If you changed the Administrator login password don't forget to change it in the LDAPimporter script.

Finally to create your own processes you can use the Graphical Process Designer which helps design your processes in a very simple way.

Enjoy your Automated Workflow System and your process improvement.

Java vs. C++ - Part One

These are only some of the differences between Java and C++ that I found so far that drew my attention and I think are worth mentioning.

Compiling source codeWhen we compile a source file a .class file is generated in java byte-codes ( machine independent = portability ) that is not translated into machine language instructions until in the run time when interpreted by the Java Virtual Machine
( machine dependent ).
A source file is compiled and linked to produce an .exe file in machine language that is ready to be executed when the file is loaded into memory and run by the operating system.
Function definitions All function definitions and variable declarations are inside Classes even main(). Nothing is allowed to be outside a class except imports and package names.Function definitions are outside class definitions. They have prototypes whose place decides function scope
Including classesImporting a package.* just directs the compiler to the location of classes used in the code so that only these classes are included not the whole package. while in C++ I think that including a header file means that all classes in that header file will be compiled and linked to the source file.
Ending class definitionsClass definitions end with } without a semicolon.Class definitions end with };
Creating objectsAll objects must be created with new, so they are all dynamically allocated in the heap.
Only primitive data types can be allocated on the stack.
Objects can also be created and allocated without new so they are put on the stack in the scope of their declaration.
Declaring a reference:Declaring a reference to an object without using new to allocate the object only reserves space for the reference and no object is created in memory until new is used and the resulting object is given to the reference to point to it.Declaring an object without initializing it makes the compiler call the default constructor for the object's class and memory is allocated for the object in the stack.
Calling static methodsClassName.methodName( args.. );ClassName::functionName( args.. );
or ObjectName.functionName( args..);
Wrapper classesJava has wrapper classes for primitive data types that contains static methods for handling them
e.g. String string = Integer.toString( intVariable );
C++ doesn't normally have them in its standard libraries
Array declaration and memory allocation:An array is considered an object that has to be allocated by new.
   int c[];

declares the array reference

   c = new int[ 12 ];

allocates the array and automatically initialize its elements to zero for numeric primitive types, false for boolean, null for references ( non-primitive types)

   int c[] = new int[ 12 ];
// in one step

you can never specify the number of elements in the [] in a declaration unlike C++.

For multiple array declarations:

   double a[], b[];        

a = new double[ 100 ];
b = new double[ 27 ];


double a[] = new double[ 100 ],
b[] = new double[ 27 ];
double[] a, b;

a = new double[ 100 ];
b = new double[ 27 ];


double[] a = new double[ 100 ],
b = new double[ 27 ];

Elements of an array of a primitive data type contain values of that data type.
While elements of an array of a non-primitive data type contian "references" to objects of that data type.

( they have the value null by default )

Allocating and initializing arrays in declarations:

   int n[] = { 32, 27, 64, 18, 95,
14, 90, 70, 60, 37 };
// initializer list

Array size is determined by the number of elements in the list. Here new operator is provided by the compiler and the array object is also dynamically allocated.

When a Java program is executed. the Java interpreter checks array element subscripts to be sure they are valid. If there is an invalid subscript, Java generates an exception: ArrayIndexOutOfBoundsException.

   int c[ 12 ];

declares and allocated memory for 12 int elements without initializing them also memory is not dynamically allocated but instead it is preserved from the start and is allocated in the stack I presume.
For multiple array declaration:

   double a[ 100 ],
b[ 27 ];

Elements of an array of any data type contain values or objects of that data type.
Objects for which an array can be declared must have a default constructor to be called for every element when the array is declared.

initializing arrays in declarations:

   int n[ 10 ] = { 0 };

initialize elements of array n to 0

   int n[] = { 1, 2, 3, 4, 5 };

array size determined by the number of elements in the list

No checking for array bounds is done by the compiler so the programmer must be very carful not to exceed the array length

Multiple subscripted arrays

Doesn't directly support multiple-subscripted arrays but allows the programmer to specify single-subscripted arrays whose elements are also single-subscripted arrays, achieving the same effect.
i.e. arrays of arrays:

   int b[][] = { { 1, 2 },
{ 3, 4, 5 } };

b[ 0 ] is a reference to an array of 2 elements
b[ 1 ] is a reference to an array of 3 elements

   int b[][];
b = new int[ 3 ][ 3 ];

3 by 3 array allocated

   int b[][];
b = new int[ 2 ][];

allocates rows

   b[ 0 ] = new int[ 5 ];

allocates columns for row 0

   b[ 1 ] = new int[ 3 ];

allocates columns for row 1

Directly supports multiple-subscripted arrays and their elements are placed consecutively in memory row after row and the elements are actually located by pointer arithmetic.

   int b[][] = { { 1, 2 },
{ 3, 4, 5 } };

causes an error in C++ "error: declaration of 'b' as multidimensional array must have bounds for all dimensions except the first."

   int b[][ 3 ] = { { 1, 2 },
{ 3, 4, 5 } };

declares and preserves memory for a 2 by 3 multidimensional array b and initializes missing element in the list b[ 0 ][ 2 ] by 0.

Passing arguments

Java does not allow the programmer to decide whether to pass an argument call-by-value or call-by-reference:
Primitive data type variables are always passed call-by-value.
Objects are not passed to methods; references to objects are passed
(call-by-value just like pointers in C++ are) so the method can manipulate the object directly.

You can pass primitive data types or objects either call-by-value or call-by-reference ( using pointers or references to them ).


When returning information from a method via a return statement:

Primitive data type variables are always returned by value (a copy is returned).
Objects are always returned by reference - a reference to the object is returned.

Objects and primitive data type variables can be returned by value or by reference

Constant variables

Constant variables ( read only variables ) are declared using final.

They are declared using const.

Tuesday, June 19, 2007

Erlang Vs Object Oriented

I think that in the future the functional programming community will be at peak. currently I think that the functional communities are too small to beat the Java community.

the functional is easier to any person. any one can write a functional code. Erlang for example has a light VM that can make profit of multiprocessors availability. this doesn't depend on certain compiler that enables parallelism in Java or C.
if you don't care about performance, think about parallelism as simpler way to structure software in a domain where there is a lot of natural concurrency.

I read a paper "Structured Programming Using Processes" in which the author tried to prove that the Erlang was capable to support a personal accounting software application. Maybe you can take a look to it later.

also, I like to point to Yaws, Yaws is a HTTP high performance 1.1 webserver particularly well suited for dynamic-content webapplications. I ma really amazed by its performance.

well, but why Erlang is not widely used till now?
Well the world likes Java. the type safe language. Security in distributed Erlang is “all or nothing,” so when a node is authenticated to another, it can perform any operation.
process isolation is not complete, a process can flood another process with messages, or it can steal all the CPU cycles by entering into an infinite loop.