Thursday, April 30, 2009

SAS Operator for Not-Equal

For many programmers, Pascal is the first programming language learnt. In Pascal, the operator <> means not equal.
SAS also has such a <> operator. But, this <> operator does NOT mean not-equal, it means MAX. It simply return the maximum of the 2 values under comparsion.
Actually, the offical not-equal operator in SAS are :
  1. ne
  2. ^=
  3. ¬=
  4. ~=
This is the link for SAS version-8 operators for your reference.
Frankly speaking, this quite odd usage of the <> operator in SAS will easily make some beginners fall into the trap of assuming <> to stand for not-equal. In SAS version-8, you can change the warning level to let the interpreter to issue a warning message when it sees a <> operator to alert the programmer that it is a MAX operator.
Since in real life the usage of getting the maximum using the <> operator is quite rare, my previous working experience is to use a pre-compiler alike construct to scan all SAS program to forbid using the <> operator. This can avoid falling into the trap of mistakenly using it to mean not-equal for everyone in the department. Actually, in SAS, there is a max() function which perform SIMILAR processing as the <> operator.

Substring in SAS

In many programming languages, there is a substr() function which will extract a portion of a string. SAS also has such a function. But, in SAS the substr() function is a little bit complicated.

In SAS version-8, if you put the substr() function on the left of the = sign, the substr() is actually a procedure to substitute string. It will replace a portion of the argument string with values at the right of the = sign. This link shows the version-8 syntax and here is the version-9 syntax.

If, however, the substr() function is put at the right of the = sign, the behavior of the substr() function is the normal sub-string function as expected by many ones. It will return a portion of the argument string. This link is the version-8 syntax and here is the version-9 syntax.

In SAS version-8, there is another function called kstrstrb(). Its function is to extract a substring in terms of byte. The DBCS version of this function is called ksubstr(). SAS version-9 also has these two functions.

In short, putting the substr() function on the LHS or RHS of the = sign will have very different behaviours. Putting it on the LHS will alter the argument string, just like passing parameter by reference. Putting it on the RHS is a function call with parameters passed by value and the argument string will NOT be altered.

By the way, when writing SAS macro, there are %substr() and %qsubstr() macro functions doing similar substring extraction processing.




Tuesday, April 14, 2009

Blackberry Signature Keys and Sign .cod File

This web page Install RIM Blackberry Signature Keys and Sign .cod File tells the necessary steps for handling the signature keys after receiving them.

I follow the steps to 'install' the 3 csi files as emailed from Blackberry. After this 'installation' the RBB, RRT and RCR keys are 'registered' with RIM.

Afterward, double-click the cod file. A window will be displayed to ask for signing the application using the RBB, RRT and RCR keys.

After signed, the .cod file is updated.

Throughout the whole process, there is nothing to do with Eclipse.




Thursday, April 9, 2009

My First Day Experience with Google Chrome 1.0.154.53

After installing Google Chrome 1.0.154.53, the first web page loaded is "Google Chrome: The application failed to initialize properly (0xc0000005)"

To solve this error, use Firefox to google search. This URL in techblissonline.com really helps. It told me to add a --no-sandbox option to open the application.

This is my first day experience with Google Chrome. The moral of this story is : there must be at least two browsers in your computer. In case one browser has error, you can use another one to search the internet for solution !


What is a Job ?

In this article, I am not talking about the job command in unix. I am talking about batch job.

A job can be defined as the smallest unit of work in a job scheduler. Following is some attributes of a job:
#Attributes Description
1.Executing Member Name In unix, this is the name of the job script to be executed.
In mainframe, this is the member name of the JCL.
2.Resident Directory In unix, this is the directory which stores the job script to be executed.
3.Job Owner This is the user-id to execute the job member.
4.Machine name Some scheduler acts as an central job dispatching agent. This field tells the scheduler which machine the job is to be executed.
5.some job ordering information This specify when the job is order to the machine waiting for execution. For example :
  • every 5 minute everyday
  • every 5 minute every business day
  • every 4 hour from 07:00 to 19:00 (both inclusive) everyday
  • at 01:01 daily
  • at 01:02 every business day
  • at 02:21 every Monday
  • at 02:22 every Monday and Thursday
  • at 03:31 every 1st of the month
  • at 03:32 on the last day of every month
  • at 03:33 on the last business day of every month
  • at 04:41 on March 31st of every year
  • at 04:42 on December 31st of every year
6.incoming condition A job is going to be executed only when this incoming condition(s) is satisfied. The incoming condition(s) is actually the outgoing condition(s) of the preceding job(s). Of course, some incoming condition can be an alarm time, e.g. at 0:00 every day.
7.outgoing condition When the job is executed successfully, it will give out this outgoing condition(s) to the scheduler. This outgoing condition(s) is actually the incoming condition(s) of succeeding job(s).
Of course, there are some more attributes. Different scheduler software will have its own set of attributes. The above is some common ones.

These attributes altogether will form a job record. All the job records will be stored in a job database. At regular time, the job scheduler will then scan the database to extract those job records to order (or give birth) jobs in the job agent machine (e.g. a PC) to wait for execution. When the incoming condition(s) of a job is satisfied, the job script member will then put into the unix machine to run.

It is very important to understand that a job is NOT a script nor a JCL. A job is much more than a script or a JCL. For example, a job has incoming condition(s) and outgoing condition(s). A script or JCL will not have this condition information.

Also, in the OO terminology a job is a class declaration, NOT an object. When the job is order out, an object of that job is created. In order words, job ordering is one way to NEW a job object.

When job object is newly born, its status is waiting for execution. When incoming condition is fulfilled, a script in a unix machine will be executed. If the script is executed successfully, the job object will change status to successfully run. Then, it will generate out condition(s) to the job scheduler. When to clean-up these job objects (i.e. garbage collection in Java terminology) ? The job scheduler will do it in regular base.

Each job object will have its own sysout information to store those messages issued by the printf or echo command in the job script. This is similar to the case that each object will have its own variables and methods in the OO terminoloty.

The job scheduler take full control of all job objects.


Duplicate Open Current Folder in a New Window

Sometimes after I opened a folder in Win7, I would like to duplicate open the same folder again in another explorer window. Then, I can ope...